Re: wrong default route on system with ethernet and wifi

"Thomas Seeling" ([email protected] via lfs-support Mailing List) <[email protected]> Tue, 14 Oct 2025 17:47:44 +0200
Newsgroups gmane.linux.lfs.support
Organization Kleintierpraxis Berstadt
Message-ID <[email protected]>
Hallo dear list,
> On 10/8/25 6:39 AM, Thomas Seeling ([email protected] via 
> lfs-support Mailing List) wrote:
>> Hallo dear list,
>>
>> This too was fine, until I reached wpa_supplicant. The build was 
>> good, everything worked, until I pulled the ethernet cable.
>> For testing I disabled the wifi interface with ifdown, then tried to 
>> restart wifi only.
>> This failed because the default route was still set to the ethernet 
>> connection and `ifup` refused to switch it to wifi.
>>
>> In the `ifup` script this is done by checking the result of `ip route 
>> | grep default`.
>> Imho this check should include that the interface is up and only if 
>> *both* conditions are true, the refusal is sound.
>> In any other case, i.e. either no default route or interface not up, 
>> it should accept the *new* default route.
> That's a tricky situation.  If you have eth0 up and then do 'ifup 
> wifi0' do you expect the default route to change?
>
> I'll note that the ifdown and ifup scripts were created in 2011 and 
> haven't been significantly changed since 2012.  I'm sure the scripts 
> are not perfect, but this is the first time this sort of issue has 
> come up.
>
> If you want the scripts to change, we'd be happy to review any 
> specific changes you might suggest.
>
>   -- Bruce 

it gets even trickier, as  I noticed when I investigated some more.
It doesn't help to check for "UP", the interface *is* UP, but it is 
flagged as "NO-CARRIER".
So there's even one more situation to handle - when the cable is 
plugged, the interface may not be UP or it has no carrier.
I'm trying to find a suitable script solution in the next days.

On a sidenote I noticed that the startup script (I'm a fan of sysV) 
checks /sys/class/net/$interface for the "stop" action, but not for "start".
Since I like it symmetrical, I'd suggest to add it there too.

Stay healthy,
Thomas
-- 
"Do you wanna be a legend or a passing footprint on the sands of time?"

-- 
http://lists.linuxfromscratch.org/sympa/info/lfs-support
Unsubscribe: See the above information page