Weird bug in DDNS script

I'm using PPPOE to dial up and using cloudflare, ddns basically doesn't work for me.

cat /etc/config/ddns 

config ddns 'global'
        option ddns_dateformat '%F %R'
        option ddns_loglines '250'
        option ddns_rundir '/var/run/ddns'
        option ddns_logdir '/var/log/ddns'
        option use_curl '1'

config service 'myddns_ipv4'
        option enabled '1'
        option use_ipv6 '0'
        option service_name 'cloudflare.com-v4'
        option lookup_host 't.test.xyz'
        option domain 't@test.xyz'
        option username 'test@test.com'
        option password '544545454545454545454545'
        option use_https '1'
        option cacert '/etc/ssl/certs'
        option ip_source 'interface'
        option ip_interface 'pppoe-wan'
        option interface 'pppoe-wan'
        option use_syslog '2'
        option retry_unit 'seconds'
        option check_interval '5'
        option check_unit 'minutes'
        option force_interval '1'
        option force_unit 'days'
        option retry_count '0'
cat /etc/hotplug.d/iface/95-ddns 
#!/bin/sh

# there are other ACTIONs like ifupdate we don't need
case "$ACTION" in
        ifup)                                   # OpenWrt is giving a network not phys. Interface
                /etc/init.d/ddns enabled && /usr/lib/ddns/dynamic_dns_updater.sh -n "$INTERFACE" -- start
                ;;
        ifdown)
                /usr/lib/ddns/dynamic_dns_updater.sh -n "$INTERFACE" -- stop
                ;;
esac

The method recommended by Mr. Stragies was used.

cat /etc/hotplug.d/iface/98-test 
#!/bin/sh

# there are other ACTIONs like ifupdate we don't need
case "$ACTION" in
        ifup)                                   # OpenWrt is giving a network not phys. Interface
                /usr/bin/env > /tmp/envs_${INTERFACE}_${DEVICE}_${ACTION}.log 
                ;;
        ifdown)
                /usr/bin/env > /tmp/envs_${INTERFACE}_${DEVICE}_${ACTION}.log
                ;;
esac

Then I went to plug and unplug the network cable.

ls /tmp | grep "envs"
envs_lan_br-lan_ifup.log
envs_loopback_lo_ifup.log
envs_wan_6_pppoe-wan_ifup.log
envs_wan_pppoe-wan_ifup.log

When I encountered this bug a year ago, I solved my problem by modifying the plug-in script and changing the variable INTERFACE to pppoe-wan.

But now it seems I should modify the DDNS hotplug script to something like the following.

cat /etc/hotplug.d/iface/95-ddns 

#!/bin/sh

# there are other ACTIONs like ifupdate we don't need
case "$ACTION" in
        ifup)                                   # OpenWrt is giving a network not phys. Interface
                /etc/init.d/ddns enabled && /usr/lib/ddns/dynamic_dns_updater.sh -n "$DEVICE" -- start
                ;;
        ifdown)
                /usr/lib/ddns/dynamic_dns_updater.sh -n "$DEVICE" -- stop
                ;;
esac

At least now the ddns script works for me.

PS: Why is this bug not found? Could it be that cloudflare.com-v4 is deprecated?

1 Like

The fault is not resolved, but the following configuration seems to work.

        option ip_source 'network'
        option ip_network 'wan'

At least now I don't have to modify the hotplug script.