On Fri, Feb 21, 2014 at 3:59 PM, Kevyn-Alexandre Paré <[email protected]> wrote: >> Here is my current "best idea": >> >> http://busybox.net/~vda/no_ifup.txt > > thx for the link I'm also searching/learning something similar... > > When you are saying: > > "Treat appearance and disappearance of network interfaces > and links as asynchronous events. Whenever an interface > or link goes up or down, reconfigure network-related settings." > > With busybox how do you do this? with mdev events?
It's device- and program-specific. For example, ethernet controlled by udhcpc: when udhcpc gets the lease, it runs its -s SCRIPT. The act of running that script *is* a notification that something has changed. According to no_ifup.txt "ideology", the script should trigger network reconfiguration. examples/var_service/* files demonstrate it. The examples/var_service/fw/run file is a script which is the network reconfiguration thing. In examples/var_service/dhcp_if/run you see how udhcpc is run: udhcpc -vv -s "$pwd/dhcp_handler" In examples/var_service/dhcp_if/dhcp_handler you see how the "fw" service gets restarted every time lease is obtained or lost. You see how before doing that, dhcp_handler saves network data (IP/router/etc) so that "fw" can get at it. examples/var_service/ifplugd_if is another variation of the same: it's a tool which detects changes in network topology - in this case, link disappearing because cable was unplugged - and acting on it. (In this case, though, it proved better to stop/start udhcpc rather than kicking fw - udhcpc will do that for us, but it also will get IP first). Questions? _______________________________________________ busybox mailing list [email protected] http://lists.busybox.net/mailman/listinfo/busybox
