3 if [ "$ACTION" = ifup
]; then
13 config_get proto
"$cfg" proto
14 [ "$proto" = 6in4
] ||
return 0
17 config_get wandev
"$cfg" wan_device
"$(find_6in4_wanif)"
18 [ "$wandev" = "$DEVICE" ] ||
return 0
20 local wanip
=$
(find_6in4_wanip
"$wandev")
24 config_get tunnelid
"$cfg" tunnelid
27 config_get username
"$cfg" username
30 config_get password
"$cfg" password
32 [ -n "$tunnelid" ] && [ -n "$username" ] && [ -n "$password" ] && {
33 [ "${#password}" == 32 -a -z "${password//[a-f0-9]/}" ] ||
{
34 password
="$(echo -n "$password" | md5sum)"; password
="${password%% *}"
36 uci_set_state network
"$cfg" ipaddr
"$wanip"
39 local url
="http://ipv4.tunnelbroker.net/ipv4_end.php?ipv4b=AUTO&user_id=$username&pass=$password&tunnel_id=$tunnelid"
43 while [ $
((++try
)) -le $max ]; do
44 wget
-qO/dev
/null
"$url" 2>/dev
/null
&& {
45 logger
-t 6in4-update
"Updated tunnel #$tunnelid endpoint to $wanip"
49 logger
-t 6in4-update
"Try $try/$max failed, retrying"
58 config_foreach update_tunnel interface