@Travis-Elliott let me know how the C implementation works out. A generic solution could be useful for a lot of users! For monitoring network status and taking action based on changes, I recommend looking into the openwrt hotplug system: https://openwrt.org/docs/guide-user/base-system/hotplug Specifically the iface and net parts.