Extract out the various local definitions of ETHER_IS_BROADCAST() and
turn them into a shared definition. Set M_MCAST/M_BCAST appropriately upon packet reception in net80211, just before they are delivered up to the ethernet stack. Submitted by: rstone
This commit is contained in:
parent
1b334c8bc1
commit
eb81dc79e9
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=303811
@ -71,6 +71,9 @@ struct ether_addr {
|
||||
} __packed;
|
||||
|
||||
#define ETHER_IS_MULTICAST(addr) (*(addr) & 0x01) /* is address mcast/bcast? */
|
||||
#define ETHER_IS_BROADCAST(addr) \
|
||||
(((addr)[0] & (addr)[1] & (addr)[2] & \
|
||||
(addr)[3] & (addr)[4] & (addr)[5]) == 0xff)
|
||||
|
||||
/*
|
||||
* 802.1q Virtual LAN header.
|
||||
|
@ -115,8 +115,6 @@ static void ether_reassign(struct ifnet *, struct vnet *, char *);
|
||||
#endif
|
||||
static int ether_requestencap(struct ifnet *, struct if_encap_req *);
|
||||
|
||||
#define ETHER_IS_BROADCAST(addr) \
|
||||
(bcmp(etherbroadcastaddr, (addr), ETHER_ADDR_LEN) == 0)
|
||||
|
||||
#define senderr(e) do { error = (e); goto bad;} while (0)
|
||||
|
||||
|
@ -166,14 +166,6 @@ SYSCTL_INT(_net_link_gif, OID_AUTO, parallel_tunnels,
|
||||
CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(parallel_tunnels), 0,
|
||||
"Allow parallel tunnels?");
|
||||
|
||||
/* copy from src/sys/net/if_ethersubr.c */
|
||||
static const u_char etherbroadcastaddr[ETHER_ADDR_LEN] =
|
||||
{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
|
||||
#ifndef ETHER_IS_BROADCAST
|
||||
#define ETHER_IS_BROADCAST(addr) \
|
||||
(bcmp(etherbroadcastaddr, (addr), ETHER_ADDR_LEN) == 0)
|
||||
#endif
|
||||
|
||||
static int
|
||||
gif_clone_create(struct if_clone *ifc, int unit, caddr_t params)
|
||||
{
|
||||
|
@ -283,7 +283,10 @@ ieee80211_deliver_data(struct ieee80211vap *vap,
|
||||
IEEE80211_NODE_STAT(ni, rx_data);
|
||||
IEEE80211_NODE_STAT_ADD(ni, rx_bytes, m->m_pkthdr.len);
|
||||
if (ETHER_IS_MULTICAST(eh->ether_dhost)) {
|
||||
m->m_flags |= M_MCAST; /* XXX M_BCAST? */
|
||||
if (ETHER_IS_BROADCAST(eh->ether_dhost))
|
||||
m->m_flags |= M_BCAST;
|
||||
else
|
||||
m->m_flags |= M_MCAST;
|
||||
IEEE80211_NODE_STAT(ni, rx_mcast);
|
||||
} else
|
||||
IEEE80211_NODE_STAT(ni, rx_ucast);
|
||||
|
Loading…
Reference in New Issue
Block a user