diff options
Diffstat (limited to 'sys/net/if_vlan.c')
-rw-r--r-- | sys/net/if_vlan.c | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c index 07a302b3832..7d3bef9a548 100644 --- a/sys/net/if_vlan.c +++ b/sys/net/if_vlan.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_vlan.c,v 1.211 2023/02/02 13:28:31 claudio Exp $ */ +/* $OpenBSD: if_vlan.c,v 1.212 2023/04/21 14:31:41 jan Exp $ */ /* * Copyright 1998 Massachusetts Institute of Technology @@ -941,6 +941,9 @@ vlan_set_parent(struct vlan_softc *sc, const char *parent) if (!ISSET(sc->sc_flags, IFVF_LLADDR)) if_setlladdr(ifp, LLADDR(ifp0->if_sadl)); + /* Inherit flags from parent interface. */ + vlan_flags_from_parent(ifp0, IFXF_TSO); + put: if_put(ifp0); return (error); @@ -962,6 +965,33 @@ vlan_del_parent(struct vlan_softc *sc) return (0); } +void +vlan_flags_from_parent(struct ifnet *ifp0, int flags) +{ + struct ifnet *ifp; + struct vlan_softc *sc; + + TAILQ_FOREACH(ifp, &ifnetlist, if_list) { + if ((sc = ifp->if_softc) == NULL) + continue; + + if (sc->sc_type != ETHERTYPE_VLAN && + sc->sc_type != ETHERTYPE_QINQ) + continue; + + /* vlan and tso only works with hw tagging */ + if (!ISSET(ifp0->if_capabilities, IFCAP_VLAN_HWTAGGING)) + CLR(flags, IFXF_TSO); + + if (sc->sc_ifidx0 == ifp0->if_index) { + if (ISSET(ifp0->if_xflags, flags)) + SET(ifp->if_xflags, flags); + else + CLR(ifp->if_xflags, flags); + } + } +} + int vlan_set_compat(struct ifnet *ifp, struct ifreq *ifr) { |