6in4: make local ip6addr optional
authorJo-Philipp Wich <jow@openwrt.org>
Sun, 14 Oct 2012 09:17:14 +0000 (09:17 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Sun, 14 Oct 2012 09:17:14 +0000 (09:17 +0000)
SVN-Revision: 33761

package/network/ipv6/6in4/Makefile
package/network/ipv6/6in4/files/6in4.sh

index fdab290861ec399792fabe10adc45b652698e83d..fcb0a7e75615b6fc2b4b347166254237b5b58b7d 100644 (file)
@@ -8,7 +8,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=6in4
-PKG_VERSION:=11
+PKG_VERSION:=12
 PKG_RELEASE:=1
 
 include $(INCLUDE_DIR)/package.mk
index 71bc68940c6bf0956acced3779dcaaab237294e5..651d7b97b7e20ecbae6623b3104f51ec61a50e85 100755 (executable)
@@ -17,7 +17,7 @@ proto_6in4_setup() {
        local mtu ttl ipaddr peeraddr ip6addr tunnelid username password
        json_get_vars mtu ttl ipaddr peeraddr ip6addr tunnelid username password
 
-       [ -z "$ip6addr" -o -z "$peeraddr" ] && {
+       [ -z "$peeraddr" ] && {
                proto_notify_error "$cfg" "MISSING_ADDRESS"
                proto_block_restart "$cfg"
                return
@@ -33,14 +33,16 @@ proto_6in4_setup() {
                fi
        }
 
-       local local6="${ip6addr%%/*}"
-       local mask6="${ip6addr##*/}"
-       [[ "$local6" = "$mask6" ]] && mask6=
-
        proto_init_update "$link" 1
-       proto_add_ipv6_address "$local6" "$mask6"
        proto_add_ipv6_route "::" 0
 
+       [ -n "$ip6addr" ] && {
+               local local6="${ip6addr%%/*}"
+               local mask6="${ip6addr##*/}"
+               [[ "$local6" = "$mask6" ]] && mask6=
+               proto_add_ipv6_address "$local6" "$mask6"
+       }
+
        proto_add_tunnel
        json_add_string mode sit
        json_add_int mtu "${mtu:-1280}"