[RFE?] allow link-local fallback in auto mode
Description of the feature
I cannot seem to get an interface to try dhcp and stay up if neither ipv4 nor ipv6 connect in auto mode:
- configuring ipv4.link-local I can get an ipv4 link-local address during dhcp attempt (setting ipv4.link-local to '3' -- took me a bit of time to find the values for this enum. Ideally I wouldn't mind if the link-local address gets removed once dhcp has been obtained, but I can live with this IP staying ; the same is true with
ipv4.method disabled
so let's ignore this part for now) - once the auto setup reaches its timeout, the connection is failed (normal because both IP types auto connection failed and may-fail only means either must succeed); all IPs are unset (also expected)
- after a bit the connection retries and link-local IPs are restored (until max retries attempt perhaps?)
I'd like to have some configuration option that tries to get DHCP/SLAAC/whatever it is auto does as currently, but just keeps the autoconfigured link-local IPs if that failed (ideally retry DHCP once in a while? I don't care about the nm connection itself so just do exactly the same without deconfiguring the link-local IPs in between? Open to ideas.)
Description of the use cases
use case 1: autoconfiguration fallback
We're making an embedded device that connects to existing networks, so the default setup pretty much has to be auto/auto, but some of our users will not be able to plug the device into their network (e.g. company security policy forbids connecting foreign devices), so we also would like things to work by connecting our device directly to a PC.
If we can get the link-local address to stay (and the PC also gets one... which I think is ok for windows, I don't want to get into the realm of things like "start a DHCP server if you couldn't get a lease in x seconds"...) then we can use mDNS to advertise the random IP and have the user just enter the advertised named in their browser.
Right now our user needs to connect to the serial console and mess with settings, but we'd like things to work without using a serial console at all, so some kind of automagic must happen.
use case 2: home network debugging (personal use case that's bugged me a few times over the years)
I sometimes have my DHCP server failing for whatever reasons; in these cases the wifi still connects but dhcp/slaac fails.
I can connect for a few seconds over the link-local address (ping ff02::1
FTW), but unless I explicitly set ipv6.method to link-local the connection can hardly be called usable.
Now I've looked into the problem that is a valid workaround (just need to set it back to auto after I'm done fixing things), but I had never bothered so this had always annoyed me
References and other resources
This is somewhat similar to #284 (closed), although I think in that case something was wrong with their router's announces, they were surprised with the removal of link-local IPs.
I've also checked the code, and there is a nm_device_sys_iface_state_is_external_or_assume()
escape hatch that might be usable here but I didn't quite figure out how to enter this if.
Thanks!