Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 25 Sep 2018 23:33:30 +0000 (UTC)
From:      Josh Paetzel <jpaetzel@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r338937 - in stable/11/sys: net net80211
Message-ID:  <201809252333.w8PNXUad050429@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jpaetzel
Date: Tue Sep 25 23:33:30 2018
New Revision: 338937
URL: https://svnweb.freebsd.org/changeset/base/338937

Log:
  MFC r303811:
  
    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:
  stable/11/sys/net/ethernet.h
  stable/11/sys/net/if_ethersubr.c
  stable/11/sys/net/if_gif.c
  stable/11/sys/net80211/ieee80211_input.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/net/ethernet.h
==============================================================================
--- stable/11/sys/net/ethernet.h	Tue Sep 25 22:21:36 2018	(r338936)
+++ stable/11/sys/net/ethernet.h	Tue Sep 25 23:33:30 2018	(r338937)
@@ -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: stable/11/sys/net/if_ethersubr.c
==============================================================================
--- stable/11/sys/net/if_ethersubr.c	Tue Sep 25 22:21:36 2018	(r338936)
+++ stable/11/sys/net/if_ethersubr.c	Tue Sep 25 23:33:30 2018	(r338937)
@@ -118,8 +118,6 @@ static	void ether_reassign(struct ifnet *, struct vnet
 #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: stable/11/sys/net/if_gif.c
==============================================================================
--- stable/11/sys/net/if_gif.c	Tue Sep 25 22:21:36 2018	(r338936)
+++ stable/11/sys/net/if_gif.c	Tue Sep 25 23:33:30 2018	(r338937)
@@ -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)
 {

Modified: stable/11/sys/net80211/ieee80211_input.c
==============================================================================
--- stable/11/sys/net80211/ieee80211_input.c	Tue Sep 25 22:21:36 2018	(r338936)
+++ stable/11/sys/net80211/ieee80211_input.c	Tue Sep 25 23:33:30 2018	(r338937)
@@ -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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201809252333.w8PNXUad050429>