6in4: add support for he.net updatekey
authorSteven Barth <cyrus@openwrt.org>
Thu, 20 Feb 2014 21:36:15 +0000 (21:36 +0000)
committerSteven Barth <cyrus@openwrt.org>
Thu, 20 Feb 2014 21:36:15 +0000 (21:36 +0000)
SVN-Revision: 39646

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

index 992c5fc67b709fe27b6a0a40d00a6d4737543889..ea211e92ef7a8d7f307f16e35865ac551e2e9c61 100644 (file)
@@ -8,7 +8,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=6in4
-PKG_VERSION:=14
+PKG_VERSION:=15
 PKG_RELEASE:=1
 
 include $(INCLUDE_DIR)/package.mk
index c4e547f6de802434a50c7320b1e207e70a641bfd..6e53de1e45e6926e5d4d0315002d92318a916c51 100755 (executable)
@@ -14,8 +14,8 @@ proto_6in4_setup() {
        local iface="$2"
        local link="6in4-$cfg"
 
-       local mtu ttl ipaddr peeraddr ip6addr ip6prefix tunnelid username password sourcerouting
-       json_get_vars mtu ttl ipaddr peeraddr ip6addr ip6prefix tunnelid username password sourcerouting
+       local mtu ttl ipaddr peeraddr ip6addr ip6prefix tunnelid username password updatekey sourcerouting
+       json_get_vars mtu ttl ipaddr peeraddr ip6addr ip6prefix tunnelid username password updatekey sourcerouting
 
        [ -z "$peeraddr" ] && {
                proto_notify_error "$cfg" "MISSING_ADDRESS"
@@ -62,11 +62,13 @@ proto_6in4_setup() {
 
        proto_send_update "$cfg"
 
-       [ -n "$tunnelid" -a -n "$username" -a -n "$password" ] && {
+       [ -n "$tunnelid" -a -n "$username" -a \( -n "$password" -o -n "$updatekey" \) ] && {
                [ "${#password}" == 32 -a -z "${password//[a-fA-F0-9]/}" ] || {
                        password="$(echo -n "$password" | md5sum)"; password="${password%% *}"
                }
 
+               [ -n "$updatekey" ] && password="$updatekey"
+
                local url="http://ipv4.tunnelbroker.net/ipv4_end.php?ip=AUTO&apikey=$username&pass=$password&tid=$tunnelid"
                local try=0
                local max=3
@@ -95,6 +97,7 @@ proto_6in4_init_config() {
        proto_config_add_string "tunnelid"
        proto_config_add_string "username"
        proto_config_add_string "password"
+       proto_config_add_string "updatekey"
        proto_config_add_int "mtu"
        proto_config_add_int "ttl"
        proto_config_add_boolean "sourcerouting"