3 YADDNS_CONF=/tmp/yaddns.conf
4 YADDNS_PID=/var/run/yaddns.pid
16 SECTIONS="$SECTIONS $2"
20 for section in $SECTIONS; do
21 config_get enabled $section enabled
22 if [ "$enabled" = "1" ]; then
23 if [ -z "$header_filled" ]; then
24 config_get ip_source $section ip_source
25 #if ip source is not defined, assume we want to get ip from wan
26 if [ "$ip_source" != "interface" ] && [ "$ip_source" != "web" ]; then
29 if [ "$ip_source" = "interface" ]; then
30 config_get ip_interface $section ip_interface
32 if [ "$ip_source" = "network" ]; then
33 if [ -z "$ip_network" ]; then
37 config_load /var/state/network
38 config_get ip_interface $ip_network ifname
40 if [ "$ip_source" = "web" ]; then
41 config_get ip_url $section ip_url
42 config_get check_interval $section check_interval
43 config_get check_unit $section check_unit
44 if [ -z "$check_interval" ]; then
47 if [ -z "$check_unit" ]; then
50 if [ -z "$ip_url" ]; then
51 ip_url="http://checkip.dyndns.org/"
55 check_interval_seconds=$(($check_interval*60*60*24))
58 check_interval_seconds=$(($check_interval*60*60))
61 check_interval_seconds=$(($check_interval*60))
64 check_interval_seconds=$check_interval
68 check_interval_seconds=$(($check_interval*60*60))
71 myip_host="`echo $ip_url | sed 's%.*//\([^:/]*\).*%\1%'`"
72 myip_port="`echo $ip_url | sed -n 's%.*//[^:]*:\([0-9]\+\).*%\1%; t m; b; :m p'`"
73 if [ -z "$myip_port" ]; then
76 myip_path="`echo $ip_url | sed 's%.*//[^/]*\(.*\)%\1%'`"
77 if [ -z "$myip_path" ]; then
80 echo mode = \"indirect\" >> $YADDNS_CONF
81 echo myip_host = \"$myip_host\" >> $YADDNS_CONF
82 echo myip_path = \"$myip_path\" >> $YADDNS_CONF
83 echo myip_port = \"$myip_port\" >> $YADDNS_CONF
84 echo myip_upint = \"$check_interval_seconds\" >> $YADDNS_CONF
86 echo mode = \"direct\" >> $YADDNS_CONF
87 echo wanifname = \"$ip_interface\" >> $YADDNS_CONF
92 config_get service_name $section service_name
93 config_get domain $section domain
94 config_get username $section username
95 config_get password $section password
96 echo account \{ >> $YADDNS_CONF
97 echo -e '\tname = '\"$section\" >> $YADDNS_CONF
98 echo -e '\tservice = '\"$service_name\" >> $YADDNS_CONF
99 echo -e '\tusername = '\"$username\" >> $YADDNS_CONF
100 echo -e '\tpassword = '\"$password\" >> $YADDNS_CONF
101 echo -e '\thostname = '\"$domain\" >> $YADDNS_CONF
102 echo \} >> $YADDNS_CONF
107 if [ "$INTERFACE" = "wan" ] && [ "$ACTION" = "ifup" ]
111 if [ -z "$pid" ]; then
112 yaddns -f $YADDNS_CONF -p $YADDNS_PID -D