AA: 6in4: backport r39646 and r40876 (#15054, #16617)
authorjow <jow@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Thu, 29 May 2014 09:42:25 +0000 (09:42 +0000)
committerjow <jow@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Thu, 29 May 2014 09:42:25 +0000 (09:42 +0000)
git-svn-id: svn://svn.openwrt.org/openwrt/branches/attitude_adjustment@40877 3c298f89-4303-0410-b956-a3cf2f4a3e73

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

index 7090234..47f27f6 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2010-2012 OpenWrt.org
+# Copyright (C) 2010-2014 OpenWrt.org
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
@@ -8,7 +8,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=6in4
-PKG_VERSION:=14
+PKG_VERSION:=16
 PKG_RELEASE:=1
 
 include $(INCLUDE_DIR)/package.mk
index 647a2f8..165056c 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
-       json_get_vars mtu ttl ipaddr peeraddr ip6addr ip6prefix tunnelid username password
+       local mtu ttl ipaddr peeraddr ip6addr ip6prefix tunnelid username password updatekey
+       json_get_vars mtu ttl ipaddr peeraddr ip6addr ip6prefix tunnelid username password updatekey
 
        [ -z "$peeraddr" ] && {
                proto_notify_error "$cfg" "MISSING_ADDRESS"
@@ -55,12 +55,14 @@ 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%% *}"
                }
 
-               local url="http://ipv4.tunnelbroker.net/ipv4_end.php?ip=AUTO&apikey=$username&pass=$password&tid=$tunnelid"
+               [ -n "$updatekey" ] && password="$updatekey"
+
+               local url="http://ipv4.tunnelbroker.net/nic/update?username=$username&password=$password&hostname=$tunnelid"
                local try=0
                local max=3
 
@@ -88,6 +90,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"
 }