On Fri, Nov 11, 2022 at 07:00:27PM +0000, Florian Obser wrote:
> On 2022-11-11 16:55 UTC, Klemens Nanni <[email protected]> wrote:
> > Only /etc/hostname.athn0 contains autoconf on my X230.
> >
> > When the hardware switch turned off, netstart still waits 10 seconds:
> >
> >     $ ifconfig athn0
> >     athn0: 
> > flags=a48803<UP,BROADCAST,SIMPLEX,MULTICAST,AUTOCONF6TEMP,AUTOCONF6,AUTOCONF4>
> >  mtu 1500
> >             lladdr 04:f0:21:30:37:de
> >             index 2 priority 4 llprio 3
> >             groups: wlan
> >             media: IEEE802.11 autoselect
> >             status: no network
> >             ieee80211: nwid ""
> >
> >     # time sh /etc/netstart
> >         0m11.48s real     0m00.93s user     0m00.55s system
> >
> > For DHCP/SLAAC to kick in, the interface must be UP and RUNNING, so this
> > won't exit ealier unless I turn the switch on *and* athn0 gets an IP and
> > default route within those ten seconds, which is quite unlikely, imho.
> >
> > Make netstart wait for RUNNING interfaces only so booting in guaranteed
> > offline mode won't stall for nothing:
> >
> >     # time sh ./netstart
> >         0m00.73s real     0m00.57s user     0m00.20s system
> >
> > Feedback? Objection? OK?
> 
> I have a suspicion that netstart(8) could win the race against the
> kernel and see an interface as not yet running while it currently comes
> up, defeating the purpose.

When 'ifconfig athn0 inet autoconf' returns, UP and RUNNING should be
set immediately.

SIOCSIFXFLAGS directly sets those flags without any asynchronous logic
that would make ifconfig return early and set flags later in the kernel.

Am I missing something here?

> 
> On my laptop I'm setting a blackhole default route in one of my
> hostname.if(5) files to get past the sleeping in netstart(8).

That just sounds like a different "fix" for this naive sleep logic.

> 
> >
> > Index: netstart
> > ===================================================================
> > RCS file: /cvs/src/etc/netstart,v
> > retrieving revision 1.229
> > diff -u -p -r1.229 netstart
> > --- netstart        5 Nov 2022 12:06:05 -0000       1.229
> > +++ netstart        11 Nov 2022 16:44:44 -0000
> > @@ -292,7 +292,7 @@ ip6routes() {
> >  wait_autoconf_default() {
> >     local _count=0
> >  
> > -   if ifconfig | grep -q ': flags=.*<.*AUTOCONF.*>'; then
> > +   if ifconfig | grep -q ': flags=.*<.*RUNNING.*AUTOCONF.*>'; then
> >             while ((_count++ < 20)); do
> >                     route -n show | grep -q ^default && break
> >                     sleep .5
> >
> 
> -- 
> I'm not entirely sure you are real.
> 

Reply via email to