Closed jfrogg closed 4 years ago
I would go with a hotplug script. Keep in mind that there are different hotplug directories in /etc/hotplug.d
.
See https://openwrt.org/docs/guide-user/base-system/hotplug
Hotplug does not work here, at least for me, that is what I started from. As noted earlier, the last hotpug event happens much earlier than the Internet connection is established and IP address assigned to ztxxxxxxxx device. In other words, the 'ifup' below does not mean that the IP address is assigned:
hotplug (iface): action='ifup' interface='ZT0'
ok, then I do not know what to do. Maybe ZT supports some kind of notifications...
It looks like the notification mechanism is available internally, see example in 5.1.4 Handling events
ZTS_EVENT_NETIF_UP --- network=a09acf023be465c1, mac=73b7abcfc207, mtu=10000
ZTS_EVENT_ADDR_NEW_IP4 --- addr=11.7.7.184 (on network=a09acf023be465c1)
ZTS_EVENT_ADDR_NEW_IP6 --- addr=fda0:9acf:233:e4b0:7099:9309:4c9b:c3c7 (on network=a09acf023be465c1)
ZTS_EVENT_NODE_ONLINE, node=c4c7ba3cf
ZTS_EVENT_NETWORK_READY_IP4 --- network=a09acf023be465c1
ZTS_EVENT_NETWORK_READY_IP6 --- network=a09acf023be465c1
Don't know how to use this though.
I do not think we find a solution here. Maybe open a ticket at github.com/zerotier?
Is it possible programmatically detect the IP address assignment to ZeroTier device? I was thinking about something similar to checking IFUPDATE_ADDRESSES variable available in iface hotplug script. Currently the last ZeroTier event I can catch happens before the Internet connection is established which means that there is no IP on ztxxxxxxxx yet:
Obviously one can run zerotier-cli (or
ip -4 a show dev ...
) in a loop and wait for IP address to pop up, however that does not look nice.