On 07/06/19(Fri) 20:55, Eygene Ryabinkin wrote: > Good day. > > With the hints from Martin Pieuchot had found out that the current > handling of IFT_ETHER for bridge(4) /and nowadays, after de-introduction > of IFT_MPLSTUNNEL/mpw(4) type interfaces, only IFT_ETHER ones can > be attached to the bridge(4)/
Can't gif(4) interfaces be attached as well? > - isn't uniform across both ADD ioctls, > - has some redundant "if (ifs->if_type == IFT_ETHER)" statements > both in ioctl and bridge forwarding code paths. > > Can the attached patch be reviewed and considered for inclusion > into the main code? > > Thanks! > -- > rea > From c5dc1bf7b8875788af3c325e618b08e1ff3d90a9 Mon Sep 17 00:00:00 2001 > From: Eygene Ryabinkin <[email protected]> > Date: Fri, 7 Jun 2019 20:23:58 +0300 > Subject: [PATCH 2/2] bridge(4): simplify interface handling logics > > - uniformly check for IFT_ETHER in both add-type ioctls: > only Ethernet interfaces can nowadays be bridge(4) members > > - move promiscious mode handling out of IFT_ETHER checks: > prior code structure was due to the IFT_MPLSTUNNEL interface > types that need no promiscious mode, but now they are gone > > - don't check for IFT_ETHER in the run-time packet handling: > this is now completely redundant. > > Signed-off-by: Eygene Ryabinkin <[email protected]> > --- > sys/net/if_bridge.c | 15 ++++++--------- > 1 file changed, 6 insertions(+), 9 deletions(-) > > diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c > index d64bdc05abb..496ed8a3b97 100644 > --- a/sys/net/if_bridge.c > +++ b/sys/net/if_bridge.c > @@ -304,19 +304,18 @@ bridge_ioctl(struct ifnet *ifp, u_long cmd, caddr_t > data) > break; > } > > - if (ifs->if_type == IFT_ETHER) { > - error = ifpromisc(ifs, 1); > - if (error != 0) > - break; > - } else { > + if (ifs->if_type != IFT_ETHER) { > error = EINVAL; > break; > } > > + error = ifpromisc(ifs, 1); > + if (error != 0) > + break; > + > bif = malloc(sizeof(*bif), M_DEVBUF, M_NOWAIT|M_ZERO); > if (bif == NULL) { > - if (ifs->if_type == IFT_ETHER) > - ifpromisc(ifs, 0); > + ifpromisc(ifs, 0); > error = ENOMEM; > break; > } > @@ -1201,8 +1200,6 @@ bridge_process(struct ifnet *ifp, struct mbuf *m) > */ > bif0 = bif; > SMR_SLIST_FOREACH_LOCKED(bif, &sc->sc_iflist, bif_next) { > - if (bif->ifp->if_type != IFT_ETHER) > - continue; > if (bridge_ourether(bif->ifp, eh->ether_dhost)) { > if (bif0->bif_flags & IFBIF_LEARNING) > bridge_rtupdate(sc, > -- > 2.21.0 >
