On Tue, Nov 02, 2021 at 11:30:11AM -0600, Theo de Raadt wrote:
> Klemens Nanni <[email protected]> wrote:
> 
> > At least bwfm(4) does not support WEP:
> > 
> >     # ifconfig bwfm0 nwkey 12345          
> >     ifconfig: SIOCS80211NWKEY: Operation not supported by device
> >     # echo $?
> >     0
> > 
> > ifconfig(8) must return non-zero in this case.
> > 
> > This is relevant for an upcoming installer fix, but also worth itself.
> > 
> > OK?
> > 
> > Index: ifconfig.c
> > ===================================================================
> > RCS file: /cvs/src/sbin/ifconfig/ifconfig.c,v
> > retrieving revision 1.445
> > diff -u -p -r1.445 ifconfig.c
> > --- ifconfig.c      6 Oct 2021 06:14:08 -0000       1.445
> > +++ ifconfig.c      2 Nov 2021 17:20:01 -0000
> > @@ -2033,7 +2033,7 @@ setifnwkey(const char *val, int d)
> >     }
> >  
> >     if (ioctl(sock, SIOCS80211NWKEY, (caddr_t)&nwkey) == -1)
> > -           warn("SIOCS80211NWKEY");
> > +           err("SIOCS80211NWKEY");
> >  }
> 
> 
> If you do this, then a multi-parameter ifconfig will fail, without
> trying other operations.

I'm happy to fail early instead of humping along best-effort.

Which multiple parameters would you do in one ifconfig invocation?
Maybe WEP, then autoconf/address setup?  I'd assume they somewhat depend
on each other or are logically grouped (in hostname.if).

> That might be desireable.  Or it might not be.

Better fail hard and early.  If a long `ifconfig ...' command "worked"
now while it didn't, I'm happy to show users now that it never worked.

Reply via email to