However, we have a deadline and it turns out that the link state info can be gotten with the swlib library which exists only as part of the swconfig utility. It's a bit ugly that we can only detect link state changes by polling but real ethernet drivers actually just poll in-kernel for these changes anyway. I've copied the swlib source into the notdhcp repository. Unfortunately that utility uses libnl and libnl-gen so now notdhcp has library dependencies (which needs to be added to the sudowrt-packages makefile and to the packages list).
Writing notdhcp has been much more of a rabbit hole than expected. But! We want to be able to query switch port link status for purposes of the GUI anyway and now we know that this is currently impossible (short of allowing the running of arbitrary commands from the gui). I think once we've gotten all this working I'll go back and move the switch status polling code over to a fork of netifd and then make notdhcp use ubus to listen for the link state changes.
Now the skylights are no longer black and that's my queue to call it a night. I'll try to get this working before Tuesday.
--
marc/juul