diff options
author | Steven Barth <cyrus@openwrt.org> | 2013-12-15 19:38:53 +0000 |
---|---|---|
committer | Steven Barth <cyrus@openwrt.org> | 2013-12-15 19:38:53 +0000 |
commit | e49d67f1925f1582138c7fcd998c6952aa5d0909 (patch) | |
tree | ed1d9b1c2f89b77edc9426e58d3d6d535ce56de1 | |
parent | 36197755dc955f1ff287270d58a607ce975cbce4 (diff) | |
download | mtk-20170518-e49d67f1925f1582138c7fcd998c6952aa5d0909.zip mtk-20170518-e49d67f1925f1582138c7fcd998c6952aa5d0909.tar.gz mtk-20170518-e49d67f1925f1582138c7fcd998c6952aa5d0909.tar.bz2 |
Convert DHCP->6rd and DHCPv6->DS-Lite autoconfig to dynamic interface
SVN-Revision: 39061
-rw-r--r-- | package/network/config/netifd/Makefile | 2 | ||||
-rwxr-xr-x | package/network/config/netifd/files/lib/netifd/dhcp.script | 23 | ||||
-rw-r--r-- | package/network/ipv6/6rd/Makefile | 2 | ||||
-rw-r--r-- | package/network/ipv6/6rd/files/6rd.sh | 6 | ||||
-rwxr-xr-x | package/network/ipv6/odhcp6c/files/dhcpv6.script | 19 |
5 files changed, 25 insertions, 27 deletions
diff --git a/package/network/config/netifd/Makefile b/package/network/config/netifd/Makefile index 5a110e9..1650b58 100644 --- a/package/network/config/netifd/Makefile +++ b/package/network/config/netifd/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=netifd -PKG_VERSION:=2013-12-14 +PKG_VERSION:=2013-12-14.1 PKG_RELEASE=$(PKG_SOURCE_VERSION) PKG_SOURCE_PROTO:=git diff --git a/package/network/config/netifd/files/lib/netifd/dhcp.script b/package/network/config/netifd/files/lib/netifd/dhcp.script index 50163da..77b77f5 100755 --- a/package/network/config/netifd/files/lib/netifd/dhcp.script +++ b/package/network/config/netifd/files/lib/netifd/dhcp.script @@ -44,19 +44,18 @@ setup_interface () { ip6rd="${ip6rd#* }" local ip6rdbr="${ip6rd%% *}" -uci -q batch <<-EOF >/dev/null -set network.$IFACE6RD.proto=6rd -set network.$IFACE6RD.auto=0 -set network.$IFACE6RD.peeraddr=$ip6rdbr -set network.$IFACE6RD.ip4prefixlen=$v4mask -set network.$IFACE6RD.ip6prefix=$ip6rdprefix -set network.$IFACE6RD.ip6prefixlen=$ip6rdprefixlen -commit network -EOF + json_init + json_add_string name "$IFACE6RD" + json_add_string ifname "@$INTERFACE" + json_add_string proto "6rd" + json_add_string peeraddr "$ip6rdbr" + json_add_int ip4prefixlen "$v4mask" + json_add_string ip6prefix "$ip6rdprefix" + json_add_int ip6prefixlen "$ip6rdprefixlen" + json_add_string tunlink "$INTERFACE" + json_close_object - ifdown "$IFACE6RD" - /etc/init.d/network reload - ifup "$IFACE6RD" + ubus call network add_dynamic "$(json_dump)" fi # TODO diff --git a/package/network/ipv6/6rd/Makefile b/package/network/ipv6/6rd/Makefile index c701596..5a48078 100644 --- a/package/network/ipv6/6rd/Makefile +++ b/package/network/ipv6/6rd/Makefile @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=6rd -PKG_VERSION:=4 +PKG_VERSION:=5 PKG_RELEASE:=1 include $(INCLUDE_DIR)/package.mk diff --git a/package/network/ipv6/6rd/files/6rd.sh b/package/network/ipv6/6rd/files/6rd.sh index 7d6cc3e..a3935e1 100644 --- a/package/network/ipv6/6rd/files/6rd.sh +++ b/package/network/ipv6/6rd/files/6rd.sh @@ -14,8 +14,8 @@ proto_6rd_setup() { local iface="$2" local link="6rd-$cfg" - local mtu ttl ipaddr peeraddr ip6prefix ip6prefixlen ip4prefixlen - json_get_vars mtu ttl ipaddr peeraddr ip6prefix ip6prefixlen ip4prefixlen + local mtu ttl ipaddr peeraddr ip6prefix ip6prefixlen ip4prefixlen tunlink + json_get_vars mtu ttl ipaddr peeraddr ip6prefix ip6prefixlen ip4prefixlen tunlink [ -z "$ip6prefix" -o -z "$peeraddr" ] && { proto_notify_error "$cfg" "MISSING_ADDRESS" @@ -57,6 +57,7 @@ proto_6rd_setup() { 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" proto_close_tunnel proto_send_update "$cfg" @@ -77,6 +78,7 @@ proto_6rd_init_config() { proto_config_add_string "ip6prefix" proto_config_add_string "ip6prefixlen" proto_config_add_string "ip4prefixlen" + proto_config_add_string "tunlink" } [ -n "$INCLUDE_ONLY" ] || { diff --git a/package/network/ipv6/odhcp6c/files/dhcpv6.script b/package/network/ipv6/odhcp6c/files/dhcpv6.script index 1d5f521..8bcf766 100755 --- a/package/network/ipv6/odhcp6c/files/dhcpv6.script +++ b/package/network/ipv6/odhcp6c/files/dhcpv6.script @@ -78,17 +78,14 @@ setup_interface () { proto_send_update "$INTERFACE" if [ -n "$AFTR_IP " -a -n "$IFACE_DSLITE" ]; then -uci -q batch <<-EOF >/dev/null -set network.$IFACE_DSLITE.proto=dslite -set network.$IFACE_DSLITE.auto=0 -set network.$IFACE_DSLITE.peeraddr=$AFTR_IP -set network.$IFACE_DSLITE.tunlink=$INTERFACE -commit network -EOF - - ifdown "$IFACE_DSLITE" - /etc/init.d/network reload - ifup "$IFACE_DSLITE" + json_init + json_add_string name "$IFACE_DSLITE" + json_add_string ifname "@$INTERFACE" + json_add_string proto "dslite" + json_add_string peeraddr "$AFTR_IP" + json_add_string tunlink "$INTERFACE" + json_close_object + ubus call network add_dynamic "$(json_dump)" fi # TODO: $SNTP_IP $SIP_IP $SNTP_FQDN $SIP_DOMAIN |