On Sat, Nov 13, 2021 at 11:59:59PM +0000, Klemens Nanni wrote: > Practically all interfaces pull itself up when IPs get assigned, but > vport(4) does not.
Yes, I do (or don't do) this very deliberately when I get the chance. > This broke IPv4 networking for me on a router I switched from bridge(4) > to veb(4) because hostname.vport0 only contained the equivalent of > > descr LAN > inet 192.0.2.1 > inet6 2001:db8::1 > > e.g. the explicit "up" was missing. > > dhcpd(8) only considers UP interfaces to listen on during start; > being the only interface it could potentially listen on, dhcpd thus > ignored vport0 and failed to start. > > `ifconfig vport0 up && rcctl restart dhcpd' fixed this. > Adding "up" to thostname.vport0 also fixed it. > > Nonetheless, vport should UP itself as the rest does. My counter argument is that no interface should implicitly bring itself up when an address is configured because it has been a road block to figuring out how to lock the ioctl paths better, and it confuses error handling. If address config works, but the interface fails to come up, the address remains configured but we report an error. But it looks like configuring an address failed? Wat. I've suggested previously that netstart should handle bringing an interface up. look for "netstart: implicit up and explicit down for hostname.if conf files" on tech@. I didn't hanve the energy to push it forward though. dhcpd should cope with an interface being down too. It should be about whetherthe addresses are right more than if the interface is up or not. > > OK? > > Index: net/if_veb.c > =================================================================== > RCS file: /cvs/src/sys/net/if_veb.c,v > retrieving revision 1.21 > diff -u -p -r1.21 if_veb.c > --- net/if_veb.c 8 Nov 2021 04:15:46 -0000 1.21 > +++ net/if_veb.c 13 Nov 2021 23:47:58 -0000 > @@ -2122,6 +2122,10 @@ vport_ioctl(struct ifnet *ifp, u_long cm > return (ENXIO); > > switch (cmd) { > + case SIOCSIFADDR: > + ifp->if_flags |= IFF_UP; > + /* FALLTHROUGH */ > + > case SIOCSIFFLAGS: > if (ISSET(ifp->if_flags, IFF_UP)) { > if (!ISSET(ifp->if_flags, IFF_RUNNING)) >