local iface="$2"
local link="6rd-$cfg"
- local mtu df ttl tos ipaddr peeraddr ip6prefix ip6prefixlen ip4prefixlen tunlink sourcerouting zone
- json_get_vars mtu df ttl tos ipaddr peeraddr ip6prefix ip6prefixlen ip4prefixlen tunlink sourcerouting zone
+ local mtu df ttl tos ipaddr peeraddr ip6prefix ip6prefixlen ip4prefixlen tunlink zone
+ json_get_vars mtu df ttl tos ipaddr peeraddr ip6prefix ip6prefixlen ip4prefixlen tunlink zone
[ -z "$ip6prefix" -o -z "$peeraddr" ] && {
proto_notify_error "$cfg" "MISSING_ADDRESS"
# Determine the relay prefix.
local ip4prefixlen="${ip4prefixlen:-0}"
- local ip4prefix=$(ipcalc.sh "$ipaddr/$ip4prefixlen" | grep NETWORK)
- ip4prefix="${ip4prefix#NETWORK=}"
+ local ip4prefix
+ eval "$(ipcalc.sh "$ipaddr/$ip4prefixlen")";ip4prefix=$NETWORK
# Determine our IPv6 address.
local ip6subnet=$(6rdcalc "$ip6prefix/$ip6prefixlen" "$ipaddr/$ip4prefixlen")
proto_add_ipv6_address "$ip6addr" "$ip6prefixlen"
proto_add_ipv6_prefix "$ip6lanprefix"
- if [ "$sourcerouting" != "0" ]; then
- proto_add_ipv6_route "::" 0 "::$peeraddr" 4096 "" "::/128"
- proto_add_ipv6_route "::" 0 "::$peeraddr" 4096 "" "$ip6addr/$ip6prefixlen"
- proto_add_ipv6_route "::" 0 "::$peeraddr" 4096 "" "$ip6lanprefix"
- else
- proto_add_ipv6_route "::" 0 "::$peeraddr" 4096
- fi
+ proto_add_ipv6_route "::" 0 "::$peeraddr" 4096 "" "$ip6addr/$ip6prefixlen"
+ proto_add_ipv6_route "::" 0 "::$peeraddr" 4096 "" "$ip6lanprefix"
proto_add_tunnel
json_add_string mode sit
json_add_int ttl "${ttl:-64}"
[ -n "$tos" ] && json_add_string tos "$tos"
json_add_string local "$ipaddr"
- json_add_string 6rd-prefix "$ip6prefix/$ip6prefixlen"
- json_add_string 6rd-relay-prefix "$ip4prefix/$ip4prefixlen"
[ -n "$tunlink" ] && json_add_string link "$tunlink"
+
+ json_add_object 'data'
+ json_add_string prefix "$ip6prefix/$ip6prefixlen"
+ json_add_string relay-prefix "$ip4prefix/$ip4prefixlen"
+ json_close_object
+
proto_close_tunnel
proto_add_data
proto_config_add_string "ip6prefixlen"
proto_config_add_string "ip4prefixlen"
proto_config_add_string "tunlink"
- proto_config_add_boolean "sourcerouting"
proto_config_add_string "zone"
}