Triggering action on connection change using hooks
Reto Schneider
Sun May 05 12:28:05 2019
Hi,
I would like to get my embedded device to check for updates whenever its
connectivity got changed (and the interface is up). For example, after
the user has plugged in the Ethernet cable or the WLAN came up and an IP
address and default gateway got assigned.
Looking at $reason in dhcpcd-run-hook it seems to me that BOUND and
BOUND6 is what I want to use for DHCP/DHCPv6 networks. However, only for
IPv4 networks I can be (quite) sure that DHCP gets used. Not for IPv6 ones.
It seems to me that I also have to trigger on ROUTERADVERT. However, my
hook gets called every time my device receives a router advertisement
and I do not know how to figure out if actually anything of relevance
has changed regarding the networking topology.
CARRIER together with a big-ish delay before starting the update would
likely work, but is quite hackish.
Is it possible to do achieve my obviously non-DHCP related goal using
dhcpcd? If so, how?
Kind regards,
Reto
The information in this email may be confidential and/or legally privileged. It has been sent for the sole use of the intended recipient(s). If you are not an intended recipient, you are strictly prohibited from reading, disclosing, distributing, copying or using this email or any of its contents, in any way whatsoever. If you have received this email in error, please contact the sender by reply email and destroy all copies of the original message. Please also be advised that emails are not a secure form for communication, and may contain errors.
Archive administrator: postmaster@marples.name