diff --git a/sys/net/ethernet.h b/sys/net/ethernet.h --- a/sys/net/ethernet.h +++ b/sys/net/ethernet.h @@ -80,6 +80,11 @@ (((addr)[0] | (addr)[1] | (addr)[2] | \ (addr)[3] | (addr)[4] | (addr)[5]) == 0x00) +/* + * This is the type of the VLAN ID inside the tag, not the tag itself. + */ +typedef uint16_t ether_vlanid_t; + /* * 802.1q Virtual LAN header. */ diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c --- a/sys/net/if_bridge.c +++ b/sys/net/if_bridge.c @@ -266,7 +266,7 @@ unsigned long brt_expire; /* expiration time */ uint8_t brt_flags; /* address flags */ uint8_t brt_addr[ETHER_ADDR_LEN]; - uint16_t brt_vlan; /* vlan id */ + ether_vlanid_t brt_vlan; /* vlan id */ struct vnet *brt_vnet; struct epoch_context brt_epoch_ctx; }; @@ -344,21 +344,21 @@ static void bridge_span(struct bridge_softc *, struct mbuf *); static int bridge_rtupdate(struct bridge_softc *, const uint8_t *, - uint16_t, struct bridge_iflist *, int, uint8_t); + ether_vlanid_t, struct bridge_iflist *, int, uint8_t); static struct ifnet *bridge_rtlookup(struct bridge_softc *, const uint8_t *, - uint16_t); + ether_vlanid_t); static void bridge_rttrim(struct bridge_softc *); static void bridge_rtage(struct bridge_softc *); static void bridge_rtflush(struct bridge_softc *, int); static int bridge_rtdaddr(struct bridge_softc *, const uint8_t *, - uint16_t); + ether_vlanid_t); static void bridge_rtable_init(struct bridge_softc *); static void bridge_rtable_fini(struct bridge_softc *); static int bridge_rtnode_addr_cmp(const uint8_t *, const uint8_t *); static struct bridge_rtnode *bridge_rtnode_lookup(struct bridge_softc *, - const uint8_t *, uint16_t); + const uint8_t *, ether_vlanid_t); static int bridge_rtnode_insert(struct bridge_softc *, struct bridge_rtnode *); static void bridge_rtnode_destroy(struct bridge_softc *, @@ -2220,7 +2220,7 @@ struct bridge_iflist *sbif; struct ifnet *bifp, *dst_if; struct bridge_softc *sc; - uint16_t vlan; + ether_vlanid_t vlan; NET_EPOCH_ASSERT(); @@ -2552,7 +2552,7 @@ struct ifnet *bifp; struct ether_header *eh; struct mbuf *mc, *mc2; - uint16_t vlan; + ether_vlanid_t vlan; int error; NET_EPOCH_ASSERT(); @@ -2916,8 +2916,9 @@ * Add a bridge routing entry. */ static int -bridge_rtupdate(struct bridge_softc *sc, const uint8_t *dst, uint16_t vlan, - struct bridge_iflist *bif, int setflags, uint8_t flags) +bridge_rtupdate(struct bridge_softc *sc, const uint8_t *dst, + ether_vlanid_t vlan, struct bridge_iflist *bif, + int setflags, uint8_t flags) { struct bridge_rtnode *brt; struct bridge_iflist *obif; @@ -3024,7 +3025,8 @@ * Lookup the destination interface for an address. */ static struct ifnet * -bridge_rtlookup(struct bridge_softc *sc, const uint8_t *addr, uint16_t vlan) +bridge_rtlookup(struct bridge_softc *sc, const uint8_t *addr, + ether_vlanid_t vlan) { struct bridge_rtnode *brt; @@ -3135,7 +3137,8 @@ * Remove an address from the table. */ static int -bridge_rtdaddr(struct bridge_softc *sc, const uint8_t *addr, uint16_t vlan) +bridge_rtdaddr(struct bridge_softc *sc, const uint8_t *addr, + ether_vlanid_t vlan) { struct bridge_rtnode *brt; int found = 0; @@ -3264,7 +3267,8 @@ * vlan id or if zero then just return the first match. */ static struct bridge_rtnode * -bridge_rtnode_lookup(struct bridge_softc *sc, const uint8_t *addr, uint16_t vlan) +bridge_rtnode_lookup(struct bridge_softc *sc, const uint8_t *addr, + ether_vlanid_t vlan) { struct bridge_rtnode *brt; uint32_t hash; diff --git a/sys/net/if_bridgevar.h b/sys/net/if_bridgevar.h --- a/sys/net/if_bridgevar.h +++ b/sys/net/if_bridgevar.h @@ -188,7 +188,7 @@ unsigned long ifba_expire; /* address expire time */ uint8_t ifba_flags; /* address flags */ uint8_t ifba_dst[ETHER_ADDR_LEN];/* destination address */ - uint16_t ifba_vlan; /* vlan id */ + ether_vlanid_t ifba_vlan; /* vlan id */ }; #define IFBAF_TYPEMASK 0x03 /* address type mask */