After a very brief look, NCD looks very cool. I'm curious about the first complete example. Is it possible to implement a delay of a few seconds before the IP address is reset when the link is lost?
I've never seen why that would be useful. Switches and Ethernet cards aren't that unreliable in my experience, and I've plugged cables into a different switch in less than a few seconds :) I think if you really needed that, the nicest way would be to add it as a feature to net.backend.waitlink(). See source [1] of this command, and source of sleep() [2] to see how to use a timer. It may also be possible to hack it up without C-coding using blocker(), spawn(), sleep() and maybe other control commands.
I've had a situation where an Ethernet connection would occasionally drop link for a very small fraction of a second, which unnecessarily shut down the interface and reset all TCP connections. Maybe a few second delay is too long, but 500ms seems reasonable. Also, maybe I wouldn't want to keep the old address blindly, but trigger a DCHP request if the link is dropped and restored before the timeout.
Also, thanks for the pointers into the source code. It looks like I would want to make the change around line 67 of net_backend_waitlink.c. I highly doubt I'll actually get around to doing it though :).
So you really need this, would that mean you may be able to use my language for something? If so, just say, and I can add this little feature, but I wouldn't like spending time for nothing :)
I haven't seen this problem recently, so don't worry about it. I appreciate the offer, though. Maybe some day I'll look into adding the feature for my embedded Linux systems, if I ever add Ethernet disconnection detection.
[1] http://code.google.com/p/badvpn/source/browse/trunk/ncd/modu... [2] http://code.google.com/p/badvpn/source/browse/trunk/ncd/modu...