svn commit: r303811 - in head/sys: net net80211
Adrian Chadd
adrian at FreeBSD.org
Sun Aug 7 03:48:34 UTC 2016
Author: adrian
Date: Sun Aug 7 03:48:33 2016
New Revision: 303811
URL: https://svnweb.freebsd.org/changeset/base/303811
Log:
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
Modified:
head/sys/net/ethernet.h
head/sys/net/if_ethersubr.c
head/sys/net/if_gif.c
head/sys/net80211/ieee80211_input.c
Modified: head/sys/net/ethernet.h
==============================================================================
--- head/sys/net/ethernet.h Sun Aug 7 01:32:37 2016 (r303810)
+++ head/sys/net/ethernet.h Sun Aug 7 03:48:33 2016 (r303811)
@@ -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.
Modified: head/sys/net/if_ethersubr.c
==============================================================================
--- head/sys/net/if_ethersubr.c Sun Aug 7 01:32:37 2016 (r303810)
+++ head/sys/net/if_ethersubr.c Sun Aug 7 03:48:33 2016 (r303811)
@@ -115,8 +115,6 @@ static void ether_reassign(struct ifnet
#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)
Modified: head/sys/net/if_gif.c
==============================================================================
--- head/sys/net/if_gif.c Sun Aug 7 01:32:37 2016 (r303810)
+++ head/sys/net/if_gif.c Sun Aug 7 03:48:33 2016 (r303811)
@@ -166,14 +166,6 @@ SYSCTL_INT(_net_link_gif, OID_AUTO, para
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)
{
Modified: head/sys/net80211/ieee80211_input.c
==============================================================================
--- head/sys/net80211/ieee80211_input.c Sun Aug 7 01:32:37 2016 (r303810)
+++ head/sys/net80211/ieee80211_input.c Sun Aug 7 03:48:33 2016 (r303811)
@@ -283,7 +283,10 @@ ieee80211_deliver_data(struct ieee80211v
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);
More information about the svn-src-head
mailing list