diff options
-rw-r--r-- | sys/net/if_vlan.c | 248 |
1 files changed, 124 insertions, 124 deletions
diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c index 48b7a091403..dc736c9ea94 100644 --- a/sys/net/if_vlan.c +++ b/sys/net/if_vlan.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_vlan.c,v 1.192 2019/04/27 05:14:33 dlg Exp $ */ +/* $OpenBSD: if_vlan.c,v 1.193 2019/04/27 05:28:00 dlg Exp $ */ /* * Copyright 1998 Massachusetts Institute of Technology @@ -83,22 +83,22 @@ struct vlan_mc_entry { }; struct vlan_softc { - struct arpcom ifv_ac; -#define ifv_if ifv_ac.ac_if - unsigned int ifv_ifidx0; /* parent interface */ - int ifv_rxprio; - int ifv_prio; - u_int16_t ifv_proto; /* encapsulation ethertype */ - u_int16_t ifv_tag; - u_int16_t ifv_type; /* non-standard ethertype or 0x8100 */ + struct arpcom sc_ac; +#define sc_if sc_ac.ac_if + unsigned int sc_ifidx0; /* parent interface */ + int sc_rxprio; + int sc_prio; + u_int16_t sc_proto; /* encapsulation ethertype */ + u_int16_t sc_tag; + u_int16_t sc_type; /* non-standard ethertype or 0x8100 */ LIST_HEAD(__vlan_mchead, vlan_mc_entry) - vlan_mc_listhead; - SRPL_ENTRY(vlan_softc) ifv_list; - int ifv_flags; - struct refcnt ifv_refcnt; - void *lh_cookie; - void *dh_cookie; - struct ifih *ifv_ifih; + sc_mc_listhead; + SRPL_ENTRY(vlan_softc) sc_list; + int sc_flags; + struct refcnt sc_refcnt; + void *sc_lh_cookie; + void *sc_dh_cookie; + struct ifih *sc_ifih; }; #define IFVF_PROMISC 0x01 /* the parent should be made promisc */ @@ -190,8 +190,8 @@ vlan_clone_create(struct if_clone *ifc, int unit) struct ifnet *ifp; sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK|M_ZERO); - LIST_INIT(&sc->vlan_mc_listhead); - ifp = &sc->ifv_if; + LIST_INIT(&sc->sc_mc_listhead); + ifp = &sc->sc_if; ifp->if_softc = sc; snprintf(ifp->if_xname, sizeof ifp->if_xname, "%s%d", ifc->ifc_name, unit); @@ -200,13 +200,13 @@ vlan_clone_create(struct if_clone *ifc, int unit) /* Special handling for the IEEE 802.1ad QinQ variant */ if (strcmp("svlan", ifc->ifc_name) == 0) - sc->ifv_type = ETHERTYPE_QINQ; + sc->sc_type = ETHERTYPE_QINQ; else - sc->ifv_type = ETHERTYPE_VLAN; + sc->sc_type = ETHERTYPE_VLAN; - refcnt_init(&sc->ifv_refcnt); - sc->ifv_prio = IF_HDRPRIO_PACKET; - sc->ifv_rxprio = IF_HDRPRIO_OUTER; + refcnt_init(&sc->sc_refcnt); + sc->sc_prio = IF_HDRPRIO_PACKET; + sc->sc_rxprio = IF_HDRPRIO_OUTER; ifp->if_flags = IFF_BROADCAST | IFF_MULTICAST; ifp->if_xflags = IFXF_CLONED|IFXF_MPSAFE; @@ -229,7 +229,7 @@ vlan_ref(void *null, void *v) { struct vlan_softc *sc = v; - refcnt_take(&sc->ifv_refcnt); + refcnt_take(&sc->sc_refcnt); } void @@ -237,7 +237,7 @@ vlan_unref(void *null, void *v) { struct vlan_softc *sc = v; - refcnt_rele_wake(&sc->ifv_refcnt); + refcnt_rele_wake(&sc->sc_refcnt); } int @@ -250,7 +250,7 @@ vlan_clone_destroy(struct ifnet *ifp) ether_ifdetach(ifp); if_detach(ifp); - refcnt_finalize(&sc->ifv_refcnt, "vlanrefs"); + refcnt_finalize(&sc->sc_refcnt, "vlanrefs"); vlan_multi_free(sc); free(sc, M_DEVBUF, sizeof(*sc)); @@ -260,8 +260,8 @@ vlan_clone_destroy(struct ifnet *ifp) void vlan_transmit(struct vlan_softc *sc, struct ifnet *ifp0, struct mbuf *m) { - struct ifnet *ifp = &sc->ifv_if; - int txprio = sc->ifv_prio; + struct ifnet *ifp = &sc->sc_if; + int txprio = sc->sc_prio; uint8_t prio; #if NBPFILTER > 0 @@ -281,12 +281,12 @@ vlan_transmit(struct vlan_softc *sc, struct ifnet *ifp0, struct mbuf *m) * itself, create an encapsulation header. */ if ((ifp0->if_capabilities & IFCAP_VLAN_HWTAGGING) && - (sc->ifv_type == ETHERTYPE_VLAN)) { - m->m_pkthdr.ether_vtag = sc->ifv_tag + + (sc->sc_type == ETHERTYPE_VLAN)) { + m->m_pkthdr.ether_vtag = sc->sc_tag + (prio << EVL_PRIO_BITS); m->m_flags |= M_VLANTAG; } else { - m = vlan_inject(m, sc->ifv_type, sc->ifv_tag | + m = vlan_inject(m, sc->sc_type, sc->sc_tag | (prio << EVL_PRIO_BITS)); if (m == NULL) { counters_inc(ifp->if_counters, ifc_oerrors); @@ -309,7 +309,7 @@ vlan_enqueue(struct ifnet *ifp, struct mbuf *m) return (if_enqueue_ifq(ifp, m)); sc = ifp->if_softc; - ifp0 = if_get(sc->ifv_ifidx0); + ifp0 = if_get(sc->sc_ifidx0); if (ifp0 == NULL || !ISSET(ifp0->if_flags, IFF_RUNNING)) { m_freem(m); @@ -333,7 +333,7 @@ vlan_start(struct ifqueue *ifq) struct ifnet *ifp0; struct mbuf *m; - ifp0 = if_get(sc->ifv_ifidx0); + ifp0 = if_get(sc->sc_ifidx0); if (ifp0 == NULL || !ISSET(ifp0->if_flags, IFF_RUNNING)) { ifq_purge(ifq); goto leave; @@ -407,9 +407,9 @@ vlan_input(struct ifnet *ifp0, struct mbuf *m, void *cookie) tag = EVL_VLANOFTAG(m->m_pkthdr.ether_vtag); list = &tagh[TAG_HASH(tag)]; - SRPL_FOREACH(sc, &sr, list, ifv_list) { - if (ifp0->if_index == sc->ifv_ifidx0 && tag == sc->ifv_tag && - etype == sc->ifv_type) + SRPL_FOREACH(sc, &sr, list, sc_list) { + if (ifp0->if_index == sc->sc_ifidx0 && tag == sc->sc_tag && + etype == sc->sc_type) break; } @@ -418,7 +418,7 @@ vlan_input(struct ifnet *ifp0, struct mbuf *m, void *cookie) goto drop; } - if ((sc->ifv_if.if_flags & (IFF_UP|IFF_RUNNING)) != + if ((sc->sc_if.if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING)) goto drop; @@ -435,21 +435,21 @@ vlan_input(struct ifnet *ifp0, struct mbuf *m, void *cookie) m_adj(m, EVL_ENCAPLEN); } - switch (sc->ifv_rxprio) { + switch (sc->sc_rxprio) { case IF_HDRPRIO_PACKET: break; case IF_HDRPRIO_OUTER: m->m_pkthdr.pf.prio = EVL_PRIOFTAG(m->m_pkthdr.ether_vtag); break; default: - m->m_pkthdr.pf.prio = sc->ifv_rxprio; + m->m_pkthdr.pf.prio = sc->sc_rxprio; /* IEEE 802.1p has prio 0 and 1 swapped */ if (m->m_pkthdr.pf.prio <= 1) m->m_pkthdr.pf.prio = !m->m_pkthdr.pf.prio; break; } - if_vinput(&sc->ifv_if, m); + if_vinput(&sc->sc_if, m); SRPL_LEAVE(&sr); return (1); @@ -464,18 +464,18 @@ vlan_parent_up(struct vlan_softc *sc, struct ifnet *ifp0) { int error; - if (ISSET(sc->ifv_flags, IFVF_PROMISC)) { + if (ISSET(sc->sc_flags, IFVF_PROMISC)) { error = ifpromisc(ifp0, 1); if (error != 0) return (error); } /* Register callback for physical link state changes */ - sc->lh_cookie = hook_establish(ifp0->if_linkstatehooks, 1, + sc->sc_lh_cookie = hook_establish(ifp0->if_linkstatehooks, 1, vlan_link_hook, sc); /* Register callback if parent wants to unregister */ - sc->dh_cookie = hook_establish(ifp0->if_detachhooks, 0, + sc->sc_dh_cookie = hook_establish(ifp0->if_detachhooks, 0, vlan_ifdetach, sc); vlan_multi_apply(sc, ifp0, SIOCADDMULTI); @@ -489,17 +489,17 @@ int vlan_up(struct vlan_softc *sc) { SRPL_HEAD(, vlan_softc) *tagh, *list; - struct ifnet *ifp = &sc->ifv_if; + struct ifnet *ifp = &sc->sc_if; struct ifnet *ifp0; int error = 0; u_int hardmtu; KASSERT(!ISSET(ifp->if_flags, IFF_RUNNING)); - tagh = sc->ifv_type == ETHERTYPE_QINQ ? svlan_tagh : vlan_tagh; - list = &tagh[TAG_HASH(sc->ifv_tag)]; + tagh = sc->sc_type == ETHERTYPE_QINQ ? svlan_tagh : vlan_tagh; + list = &tagh[TAG_HASH(sc->sc_tag)]; - ifp0 = if_get(sc->ifv_ifidx0); + ifp0 = if_get(sc->sc_ifidx0); if (ifp0 == NULL) return (ENXIO); @@ -527,7 +527,7 @@ vlan_up(struct vlan_softc *sc) * csum can be freely defined, we could actually do csum offload * for VLAN and QINQ packets. */ - if (sc->ifv_type != ETHERTYPE_VLAN) { + if (sc->sc_type != ETHERTYPE_VLAN) { /* * Hardware offload only works with the default VLAN * ethernet type (0x8100). @@ -546,11 +546,11 @@ vlan_up(struct vlan_softc *sc) if (error != 0) goto scrub; - error = vlan_inuse_locked(sc->ifv_type, sc->ifv_ifidx0, sc->ifv_tag); + error = vlan_inuse_locked(sc->sc_type, sc->sc_ifidx0, sc->sc_tag); if (error != 0) goto leave; - SRPL_INSERT_HEAD_LOCKED(&vlan_tagh_rc, list, sc, ifv_list); + SRPL_INSERT_HEAD_LOCKED(&vlan_tagh_rc, list, sc, sc_list); rw_exit(&vlan_tagh_lk); /* configure the parent to handle packets for this vlan */ @@ -568,7 +568,7 @@ vlan_up(struct vlan_softc *sc) remove: rw_enter(&vlan_tagh_lk, RW_WRITE); - SRPL_REMOVE_LOCKED(&vlan_tagh_rc, list, sc, vlan_softc, ifv_list); + SRPL_REMOVE_LOCKED(&vlan_tagh_rc, list, sc, vlan_softc, sc_list); leave: rw_exit(&vlan_tagh_lk); scrub: @@ -585,11 +585,11 @@ int vlan_down(struct vlan_softc *sc) { SRPL_HEAD(, vlan_softc) *tagh, *list; - struct ifnet *ifp = &sc->ifv_if; + struct ifnet *ifp = &sc->sc_if; struct ifnet *ifp0; - tagh = sc->ifv_type == ETHERTYPE_QINQ ? svlan_tagh : vlan_tagh; - list = &tagh[TAG_HASH(sc->ifv_tag)]; + tagh = sc->sc_type == ETHERTYPE_QINQ ? svlan_tagh : vlan_tagh; + list = &tagh[TAG_HASH(sc->sc_tag)]; KASSERT(ISSET(ifp->if_flags, IFF_RUNNING)); @@ -598,19 +598,19 @@ vlan_down(struct vlan_softc *sc) ifq_barrier(&ifp->if_snd); - ifp0 = if_get(sc->ifv_ifidx0); + ifp0 = if_get(sc->sc_ifidx0); if (ifp0 != NULL) { if_ih_remove(ifp0, vlan_input, NULL); - if (ISSET(sc->ifv_flags, IFVF_PROMISC)) + if (ISSET(sc->sc_flags, IFVF_PROMISC)) ifpromisc(ifp0, 0); vlan_multi_apply(sc, ifp0, SIOCDELMULTI); - hook_disestablish(ifp0->if_detachhooks, sc->dh_cookie); - hook_disestablish(ifp0->if_linkstatehooks, sc->lh_cookie); + hook_disestablish(ifp0->if_detachhooks, sc->sc_dh_cookie); + hook_disestablish(ifp0->if_linkstatehooks, sc->sc_lh_cookie); } if_put(ifp0); rw_enter_write(&vlan_tagh_lk); - SRPL_REMOVE_LOCKED(&vlan_tagh_rc, list, sc, vlan_softc, ifv_list); + SRPL_REMOVE_LOCKED(&vlan_tagh_rc, list, sc, vlan_softc, sc_list); rw_exit_write(&vlan_tagh_lk); ifp->if_capabilities = 0; @@ -624,14 +624,14 @@ void vlan_ifdetach(void *v) { struct vlan_softc *sc = v; - struct ifnet *ifp = &sc->ifv_if; + struct ifnet *ifp = &sc->sc_if; if (ISSET(ifp->if_flags, IFF_RUNNING)) { vlan_down(sc); CLR(ifp->if_flags, IFF_UP); } - sc->ifv_ifidx0 = 0; + sc->sc_ifidx0 = 0; } void @@ -643,7 +643,7 @@ vlan_link_hook(void *v) u_char link = LINK_STATE_DOWN; uint64_t baud = 0; - ifp0 = if_get(sc->ifv_ifidx0); + ifp0 = if_get(sc->sc_ifidx0); if (ifp0 != NULL) { link = ifp0->if_link_state; baud = ifp0->if_baudrate; @@ -656,13 +656,13 @@ vlan_link_hook(void *v) void vlan_link_state(struct vlan_softc *sc, u_char link, uint64_t baud) { - if (sc->ifv_if.if_link_state == link) + if (sc->sc_if.if_link_state == link) return; - sc->ifv_if.if_link_state = link; - sc->ifv_if.if_baudrate = baud; + sc->sc_if.if_link_state = link; + sc->sc_if.if_baudrate = baud; - if_link_state_change(&sc->ifv_if); + if_link_state_change(&sc->sc_if); } int @@ -700,17 +700,17 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) } tag = ifr->ifr_vnetid; - if (tag == sc->ifv_tag) + if (tag == sc->sc_tag) break; error = vlan_set_vnetid(sc, tag); break; case SIOCGVNETID: - if (sc->ifv_tag == EVL_VLID_NULL) + if (sc->sc_tag == EVL_VLID_NULL) error = EADDRNOTAVAIL; else - ifr->ifr_vnetid = (int64_t)sc->ifv_tag; + ifr->ifr_vnetid = (int64_t)sc->sc_tag; break; case SIOCDVNETID: @@ -722,7 +722,7 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) break; case SIOCGIFPARENT: - ifp0 = if_get(sc->ifv_ifidx0); + ifp0 = if_get(sc->sc_ifidx0); if (ifp0 == NULL) error = EADDRNOTAVAIL; else { @@ -768,10 +768,10 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) if (error != 0) break; - sc->ifv_prio = ifr->ifr_hdrprio; + sc->sc_prio = ifr->ifr_hdrprio; break; case SIOCGTXHPRIO: - ifr->ifr_hdrprio = sc->ifv_prio; + ifr->ifr_hdrprio = sc->sc_prio; break; case SIOCSRXHPRIO: @@ -779,14 +779,14 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) if (error != 0) break; - sc->ifv_rxprio = ifr->ifr_hdrprio; + sc->sc_rxprio = ifr->ifr_hdrprio; break; case SIOCGRXHPRIO: - ifr->ifr_hdrprio = sc->ifv_rxprio; + ifr->ifr_hdrprio = sc->sc_rxprio; break; default: - error = ether_ioctl(ifp, &sc->ifv_ac, cmd, data); + error = ether_ioctl(ifp, &sc->sc_ac, cmd, data); break; } @@ -805,23 +805,23 @@ vlan_iff(struct vlan_softc *sc) int promisc = 0; int error = 0; - if (ISSET(sc->ifv_if.if_flags, IFF_PROMISC) || - ISSET(sc->ifv_flags, IFVF_LLADDR)) + if (ISSET(sc->sc_if.if_flags, IFF_PROMISC) || + ISSET(sc->sc_flags, IFVF_LLADDR)) promisc = IFVF_PROMISC; - if (ISSET(sc->ifv_flags, IFVF_PROMISC) == promisc) + if (ISSET(sc->sc_flags, IFVF_PROMISC) == promisc) return (0); - if (ISSET(sc->ifv_if.if_flags, IFF_RUNNING)) { - ifp0 = if_get(sc->ifv_ifidx0); + if (ISSET(sc->sc_if.if_flags, IFF_RUNNING)) { + ifp0 = if_get(sc->sc_ifidx0); if (ifp0 != NULL) error = ifpromisc(ifp0, promisc); if_put(ifp0); } if (error == 0) { - CLR(sc->ifv_flags, IFVF_PROMISC); - SET(sc->ifv_flags, promisc); + CLR(sc->sc_flags, IFVF_PROMISC); + SET(sc->sc_flags, promisc); } return (error); @@ -830,7 +830,7 @@ vlan_iff(struct vlan_softc *sc) int vlan_setlladdr(struct vlan_softc *sc, struct ifreq *ifr) { - struct ifnet *ifp = &sc->ifv_if; + struct ifnet *ifp = &sc->sc_if; struct ifnet *ifp0; uint8_t lladdr[ETHER_ADDR_LEN]; int flag; @@ -839,7 +839,7 @@ vlan_setlladdr(struct vlan_softc *sc, struct ifreq *ifr) /* setting the mac addr to 00:00:00:00:00:00 means reset lladdr */ if (memcmp(lladdr, etheranyaddr, sizeof(lladdr)) == 0) { - ifp0 = if_get(sc->ifv_ifidx0); + ifp0 = if_get(sc->sc_ifidx0); if (ifp0 != NULL) memcpy(lladdr, LLADDR(ifp0->if_sadl), sizeof(lladdr)); if_put(ifp0); @@ -849,15 +849,15 @@ vlan_setlladdr(struct vlan_softc *sc, struct ifreq *ifr) flag = IFVF_LLADDR; if (memcmp(lladdr, LLADDR(ifp->if_sadl), sizeof(lladdr)) == 0 && - ISSET(sc->ifv_flags, IFVF_LLADDR) == flag) { + ISSET(sc->sc_flags, IFVF_LLADDR) == flag) { /* nop */ return (0); } /* commit */ if_setlladdr(ifp, lladdr); - CLR(sc->ifv_flags, IFVF_LLADDR); - SET(sc->ifv_flags, flag); + CLR(sc->sc_flags, IFVF_LLADDR); + SET(sc->sc_flags, flag); return (ENETRESET); } @@ -865,13 +865,13 @@ vlan_setlladdr(struct vlan_softc *sc, struct ifreq *ifr) int vlan_set_vnetid(struct vlan_softc *sc, uint16_t tag) { - struct ifnet *ifp = &sc->ifv_if; + struct ifnet *ifp = &sc->sc_if; SRPL_HEAD(, vlan_softc) *tagh, *list; u_char link = ifp->if_link_state; uint64_t baud = ifp->if_baudrate; int error; - tagh = sc->ifv_type == ETHERTYPE_QINQ ? svlan_tagh : vlan_tagh; + tagh = sc->sc_type == ETHERTYPE_QINQ ? svlan_tagh : vlan_tagh; if (ISSET(ifp->if_flags, IFF_RUNNING) && LINK_STATE_IS_UP(link)) vlan_link_state(sc, LINK_STATE_DOWN, 0); @@ -880,21 +880,21 @@ vlan_set_vnetid(struct vlan_softc *sc, uint16_t tag) if (error != 0) return (error); - error = vlan_inuse_locked(sc->ifv_type, sc->ifv_ifidx0, tag); + error = vlan_inuse_locked(sc->sc_type, sc->sc_ifidx0, tag); if (error != 0) goto unlock; if (ISSET(ifp->if_flags, IFF_RUNNING)) { - list = &tagh[TAG_HASH(sc->ifv_tag)]; + list = &tagh[TAG_HASH(sc->sc_tag)]; SRPL_REMOVE_LOCKED(&vlan_tagh_rc, list, sc, vlan_softc, - ifv_list); + sc_list); - sc->ifv_tag = tag; + sc->sc_tag = tag; - list = &tagh[TAG_HASH(sc->ifv_tag)]; - SRPL_INSERT_HEAD_LOCKED(&vlan_tagh_rc, list, sc, ifv_list); + list = &tagh[TAG_HASH(sc->sc_tag)]; + SRPL_INSERT_HEAD_LOCKED(&vlan_tagh_rc, list, sc, sc_list); } else - sc->ifv_tag = tag; + sc->sc_tag = tag; unlock: rw_exit(&vlan_tagh_lk); @@ -908,7 +908,7 @@ unlock: int vlan_set_parent(struct vlan_softc *sc, const char *parent) { - struct ifnet *ifp = &sc->ifv_if; + struct ifnet *ifp = &sc->sc_if; struct ifnet *ifp0; int error = 0; @@ -919,7 +919,7 @@ vlan_set_parent(struct vlan_softc *sc, const char *parent) if (ifp0->if_type != IFT_ETHER) return (EPROTONOSUPPORT); - if (sc->ifv_ifidx0 == ifp0->if_index) { + if (sc->sc_ifidx0 == ifp0->if_index) { /* nop */ return (0); } @@ -927,13 +927,13 @@ vlan_set_parent(struct vlan_softc *sc, const char *parent) if (ISSET(ifp->if_flags, IFF_RUNNING)) return (EBUSY); - error = vlan_inuse(sc->ifv_type, ifp0->if_index, sc->ifv_tag); + error = vlan_inuse(sc->sc_type, ifp0->if_index, sc->sc_tag); if (error != 0) return (error); /* commit */ - sc->ifv_ifidx0 = ifp0->if_index; - if (!ISSET(sc->ifv_flags, IFVF_LLADDR)) + sc->sc_ifidx0 = ifp0->if_index; + if (!ISSET(sc->sc_flags, IFVF_LLADDR)) if_setlladdr(ifp, LLADDR(ifp0->if_sadl)); return (0); @@ -942,14 +942,14 @@ vlan_set_parent(struct vlan_softc *sc, const char *parent) int vlan_del_parent(struct vlan_softc *sc) { - struct ifnet *ifp = &sc->ifv_if; + struct ifnet *ifp = &sc->sc_if; if (ISSET(ifp->if_flags, IFF_RUNNING)) return (EBUSY); /* commit */ - sc->ifv_ifidx0 = 0; - if (!ISSET(sc->ifv_flags, IFVF_LLADDR)) + sc->sc_ifidx0 = 0; + if (!ISSET(sc->sc_flags, IFVF_LLADDR)) if_setlladdr(ifp, etheranyaddr); return (0); @@ -1004,12 +1004,12 @@ vlan_get_compat(struct ifnet *ifp, struct ifreq *ifr) struct ifnet *p; memset(&vlr, 0, sizeof(vlr)); - p = if_get(sc->ifv_ifidx0); + p = if_get(sc->sc_ifidx0); if (p != NULL) memcpy(vlr.vlr_parent, p->if_xname, sizeof(vlr.vlr_parent)); if_put(p); - vlr.vlr_tag = sc->ifv_tag; + vlr.vlr_tag = sc->sc_tag; return (copyout(&vlr, ifr->ifr_data, sizeof(vlr))); } @@ -1045,10 +1045,10 @@ vlan_inuse_locked(uint16_t type, unsigned int ifidx, uint16_t tag) tagh = type == ETHERTYPE_QINQ ? svlan_tagh : vlan_tagh; list = &tagh[TAG_HASH(tag)]; - SRPL_FOREACH_LOCKED(sc, list, ifv_list) { - if (sc->ifv_tag == tag && - sc->ifv_type == type && /* wat */ - sc->ifv_ifidx0 == ifidx) + SRPL_FOREACH_LOCKED(sc, list, sc_list) { + if (sc->sc_tag == tag && + sc->sc_type == type && /* wat */ + sc->sc_ifidx0 == ifidx) return (EADDRINUSE); } @@ -1063,7 +1063,7 @@ vlan_multi_add(struct vlan_softc *sc, struct ifreq *ifr) u_int8_t addrlo[ETHER_ADDR_LEN], addrhi[ETHER_ADDR_LEN]; int error; - error = ether_addmulti(ifr, &sc->ifv_ac); + error = ether_addmulti(ifr, &sc->sc_ac); if (error != ENETRESET) return (error); @@ -1082,11 +1082,11 @@ vlan_multi_add(struct vlan_softc *sc, struct ifreq *ifr) * statement shouldn't fail. */ (void)ether_multiaddr(&ifr->ifr_addr, addrlo, addrhi); - ETHER_LOOKUP_MULTI(addrlo, addrhi, &sc->ifv_ac, mc->mc_enm); + ETHER_LOOKUP_MULTI(addrlo, addrhi, &sc->sc_ac, mc->mc_enm); memcpy(&mc->mc_addr, &ifr->ifr_addr, ifr->ifr_addr.sa_len); - LIST_INSERT_HEAD(&sc->vlan_mc_listhead, mc, mc_entries); + LIST_INSERT_HEAD(&sc->sc_mc_listhead, mc, mc_entries); - ifp0 = if_get(sc->ifv_ifidx0); + ifp0 = if_get(sc->sc_ifidx0); error = (ifp0 == NULL) ? 0 : (*ifp0->if_ioctl)(ifp0, SIOCADDMULTI, (caddr_t)ifr); if_put(ifp0); @@ -1100,7 +1100,7 @@ vlan_multi_add(struct vlan_softc *sc, struct ifreq *ifr) LIST_REMOVE(mc, mc_entries); free(mc, M_DEVBUF, sizeof(*mc)); alloc_failed: - (void)ether_delmulti(ifr, &sc->ifv_ac); + (void)ether_delmulti(ifr, &sc->sc_ac); return (error); } @@ -1120,11 +1120,11 @@ vlan_multi_del(struct vlan_softc *sc, struct ifreq *ifr) */ if ((error = ether_multiaddr(&ifr->ifr_addr, addrlo, addrhi)) != 0) return (error); - ETHER_LOOKUP_MULTI(addrlo, addrhi, &sc->ifv_ac, enm); + ETHER_LOOKUP_MULTI(addrlo, addrhi, &sc->sc_ac, enm); if (enm == NULL) return (EINVAL); - LIST_FOREACH(mc, &sc->vlan_mc_listhead, mc_entries) { + LIST_FOREACH(mc, &sc->sc_mc_listhead, mc_entries) { if (mc->mc_enm == enm) break; } @@ -1133,20 +1133,20 @@ vlan_multi_del(struct vlan_softc *sc, struct ifreq *ifr) if (mc == NULL) return (EINVAL); - error = ether_delmulti(ifr, &sc->ifv_ac); + error = ether_delmulti(ifr, &sc->sc_ac); if (error != ENETRESET) return (error); - if (!ISSET(sc->ifv_if.if_flags, IFF_RUNNING)) + if (!ISSET(sc->sc_if.if_flags, IFF_RUNNING)) goto forget; - ifp0 = if_get(sc->ifv_ifidx0); + ifp0 = if_get(sc->sc_ifidx0); error = (ifp0 == NULL) ? 0 : (*ifp0->if_ioctl)(ifp0, SIOCDELMULTI, (caddr_t)ifr); if_put(ifp0); if (error != 0) { - (void)ether_addmulti(ifr, &sc->ifv_ac); + (void)ether_addmulti(ifr, &sc->sc_ac); return (error); } @@ -1164,7 +1164,7 @@ vlan_media_get(struct vlan_softc *sc, struct ifreq *ifr) struct ifnet *ifp0; int error; - ifp0 = if_get(sc->ifv_ifidx0); + ifp0 = if_get(sc->sc_ifidx0); error = (ifp0 == NULL) ? ENOTTY : (*ifp0->if_ioctl)(ifp0, SIOCGIFMEDIA, (caddr_t)ifr); if_put(ifp0); @@ -1186,7 +1186,7 @@ vlan_multi_apply(struct vlan_softc *sc, struct ifnet *ifp0, u_long cmd) struct ifreq *ifr = &ifreq.ifreq; memcpy(ifr->ifr_name, ifp0->if_xname, IFNAMSIZ); - LIST_FOREACH(mc, &sc->vlan_mc_listhead, mc_entries) { + LIST_FOREACH(mc, &sc->sc_mc_listhead, mc_entries) { memcpy(&ifr->ifr_addr, &mc->mc_addr, mc->mc_addr.ss_len); (void)(*ifp0->if_ioctl)(ifp0, cmd, (caddr_t)ifr); @@ -1198,7 +1198,7 @@ vlan_multi_free(struct vlan_softc *sc) { struct vlan_mc_entry *mc; - while ((mc = LIST_FIRST(&sc->vlan_mc_listhead)) != NULL) { + while ((mc = LIST_FIRST(&sc->sc_mc_listhead)) != NULL) { LIST_REMOVE(mc, mc_entries); free(mc, M_DEVBUF, sizeof(*mc)); } |