[OpenWrt-Devel] ddns-scripts "sleep 10" before updating?
Catalin Patulea
cat at vv.carleton.ca
Tue Jan 13 00:53:45 EST 2015
Hi Christian, curious about something else..
In dynamic_dns_updater.sh there's a "sleep 10":
# we need time here because hotplug.d is fired by netifd
# but IP addresses are not set by DHCP/DHCPv6 etc.
write_log 7 "Waiting 10 seconds for interfaces to fully come up"
sleep 10 &
PID_SLEEP=$!
wait $PID_SLEEP # enable trap-handler
PID_SLEEP=0
https://github.com/openwrt/packages/blob/master/net/ddns-scripts/files/usr/lib/ddns/dynamic_dns_updater.sh#L218
But on my system (trunk r43888) it seems when ifup event comes,
address is already set:
Tue Jan 13 00:46:59 2015 kern.info kernel: [ 2621.360000] eth1: link
up (1000Mbps/Full duplex)
Tue Jan 13 00:46:59 2015 daemon.notice netifd: Network device 'eth1' link is up
Tue Jan 13 00:46:59 2015 daemon.notice netifd: Interface 'wan' has
link connectivity
Tue Jan 13 00:46:59 2015 daemon.notice netifd: Interface 'wan' is setting up now
Tue Jan 13 00:46:59 2015 daemon.notice netifd: wan (9426): udhcpc
(v1.22.1) started
Tue Jan 13 00:46:59 2015 daemon.notice netifd: wan (9426): Sending discover...
Tue Jan 13 00:46:59 2015 daemon.notice netifd: wan (9426): Sending
select for 198.48.205.121...
Tue Jan 13 00:46:59 2015 daemon.notice netifd: wan (9426): Lease of
198.48.205.121 obtained, lease time 69146
Tue Jan 13 00:46:59 2015 daemon.notice netifd: Interface 'wan6' is
setting up now
Tue Jan 13 00:46:59 2015 daemon.notice netifd: Interface 'wan' is now up
Tue Jan 13 00:47:00 2015 user.notice root: hotplug iface: DEVICE=eth1
ACTION=ifup
Tue Jan 13 00:47:00 2015 user.notice root: 3: eth1:
<BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc tbf state UP group
default qlen 1000
Tue Jan 13 00:47:00 2015 user.notice root: link/ether
10:6f:3f:e7:00:b6 brd ff:ff:ff:ff:ff:ff
Tue Jan 13 00:47:00 2015 user.notice root: inet 198.48.205.121/27
brd 198.48.205.127 scope global eth1
Tue Jan 13 00:47:00 2015 user.notice root: valid_lft forever
preferred_lft forever
Tue Jan 13 00:47:00 2015 user.notice root: inet6
fe80::126f:3fff:fee7:b6/64 scope link
Tue Jan 13 00:47:00 2015 user.notice root: valid_lft forever
preferred_lft forever
I added those last few lines using a debug script in
/etc/hotplug.d/iface to see what the state of the interface was.
It would be cool not to sleep I think, so the update happens as soon
as the interface gets an address.
Looking at netifd/DESIGN it says:
Interfaces
----------
[...]
state:
IFS_SETUP:
The interface is currently being configured by the protocol handler
IFS_UP:
The interface is fully configured
and the scripts in /etc/hotplug.d/iface are called only for IFS_UP, so
I think this behaviour is reliable.
In what case did you see the need for a "sleep 10"?
Catalin
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list