mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
sys/net: add a new ether_vlanid_t type
ether_vlanid_t is a type to represent a VLAN ID, for example inside a
.1q tag. since this is specific to Ethernet, put it in net/ethernet.h.
change bridge to use the new type instead of uint{16,32}_t.
Reviewed by: adrian, kp
Differential Revision: https://reviews.freebsd.org/D49836
(cherry picked from commit 96f830456fd449c4cb5a7df8a2f6c3c96993b43e)
This commit is contained in:
parent
f28c22e803
commit
dd9c2758f2
3 changed files with 22 additions and 13 deletions
|
|
@ -81,6 +81,11 @@ struct ether_addr {
|
|||
(((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.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -263,7 +263,7 @@ struct bridge_rtnode {
|
|||
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;
|
||||
};
|
||||
|
|
@ -340,21 +340,21 @@ static void bridge_broadcast(struct bridge_softc *, struct ifnet *,
|
|||
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 *,
|
||||
|
|
@ -2212,7 +2212,7 @@ bridge_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *sa,
|
|||
struct ether_header *eh;
|
||||
struct ifnet *bifp, *dst_if;
|
||||
struct bridge_softc *sc;
|
||||
uint16_t vlan;
|
||||
ether_vlanid_t vlan;
|
||||
|
||||
NET_EPOCH_ASSERT();
|
||||
|
||||
|
|
@ -2543,7 +2543,7 @@ bridge_input(struct ifnet *ifp, struct mbuf *m)
|
|||
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 @@ bridge_span(struct bridge_softc *sc, struct mbuf *m)
|
|||
* 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 @@ bridge_rtupdate(struct bridge_softc *sc, const uint8_t *dst, uint16_t vlan,
|
|||
* 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 @@ bridge_rtflush(struct bridge_softc *sc, int full)
|
|||
* 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 @@ bridge_rtnode_addr_cmp(const uint8_t *a, const uint8_t *b)
|
|||
* 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;
|
||||
|
|
|
|||
|
|
@ -185,7 +185,7 @@ struct ifbareq {
|
|||
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 */
|
||||
|
|
|
|||
Loading…
Reference in a new issue