From owner-svn-src-stable@freebsd.org Tue Sep 25 23:33:31 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AB766109357A; Tue, 25 Sep 2018 23:33:31 +0000 (UTC) (envelope-from jpaetzel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47E5085E80; Tue, 25 Sep 2018 23:33:31 +0000 (UTC) (envelope-from jpaetzel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3D0897554; Tue, 25 Sep 2018 23:33:31 +0000 (UTC) (envelope-from jpaetzel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w8PNXVKT050433; Tue, 25 Sep 2018 23:33:31 GMT (envelope-from jpaetzel@FreeBSD.org) Received: (from jpaetzel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w8PNXUad050429; Tue, 25 Sep 2018 23:33:30 GMT (envelope-from jpaetzel@FreeBSD.org) Message-Id: <201809252333.w8PNXUad050429@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jpaetzel set sender to jpaetzel@FreeBSD.org using -f From: Josh Paetzel Date: Tue, 25 Sep 2018 23:33:30 +0000 (UTC) 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 X-SVN-Group: stable-11 X-SVN-Commit-Author: jpaetzel X-SVN-Commit-Paths: in stable/11/sys: net net80211 X-SVN-Commit-Revision: 338937 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Sep 2018 23:33:31 -0000 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);