I’m hosting my domain myself on a dedicated root server, and I wanted my Internet router to automatically update a hostname in my own domain (in a designated dynamic zone) with my current public IP. With OpenWRT this was easily accomplished. I used these instructions as a starting point.
When trying to check whether everything was set up correctly I always got some strange error from the following command:
# ACTION=update INTERFACE=wan /sbin/hotplug-call iface
It turned out that the following statement
config_get ipaddr wan ipaddr
did not return the currently assigned IP address in my case, but just an empty response, so I got the following error message:
could not read rdata syntax error
(For testing I hooked a spare router with a fresh OpenWRT install with the WAN port into my LAN, and configured the WAN interface to receive its IP address via DHCP from out of the LAN. In “production” the WAN interface receives its IP via PPPoE.)
Some friendly guy in the OpenWRT forum suggested I try the following instead:
. /lib/functions/network.sh network_get_ipaddr ipaddr wan
And indeed this worked well.