From owner-p4-projects@FreeBSD.ORG Sat Jan 31 21:40:56 2004 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 7751816A4D0; Sat, 31 Jan 2004 21:40:56 -0800 (PST) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3A82516A4CE for ; Sat, 31 Jan 2004 21:40:56 -0800 (PST) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id C91D143D2D for ; Sat, 31 Jan 2004 21:40:54 -0800 (PST) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.10/8.12.10) with ESMTP id i115es0B063592 for ; Sat, 31 Jan 2004 21:40:54 -0800 (PST) (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.10/8.12.10/Submit) id i115esoM063589 for perforce@freebsd.org; Sat, 31 Jan 2004 21:40:54 -0800 (PST) (envelope-from sam@freebsd.org) Date: Sat, 31 Jan 2004 21:40:54 -0800 (PST) Message-Id: <200402010540.i115esoM063589@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to sam@freebsd.org using -f From: Sam Leffler To: Perforce Change Reviews Subject: PERFORCE change 46293 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Feb 2004 05:40:56 -0000 http://perforce.freebsd.org/chv.cgi?CH=46293 Change 46293 by sam@sam_ebb on 2004/01/31 21:40:15 add privacy vlan mechanism Affected files ... .. //depot/projects/netperf+sockets/sys/net80211/ieee80211.c#9 edit .. //depot/projects/netperf+sockets/sys/net80211/ieee80211_input.c#12 edit .. //depot/projects/netperf+sockets/sys/net80211/ieee80211_ioctl.h#8 edit .. //depot/projects/netperf+sockets/sys/net80211/ieee80211_node.h#7 edit .. //depot/projects/netperf+sockets/sys/net80211/ieee80211_output.c#11 edit Differences ... ==== //depot/projects/netperf+sockets/sys/net80211/ieee80211.c#9 (text+ko) ==== @@ -101,6 +101,14 @@ struct ieee80211_channel *c; int i; + /* + * Mark interface as having hardware VLAN support. + * This is a bit of a cheat; we don't actually + * send/recv VLAN encapsulated frames; we use + * vlans only for privacy. + */ + ifp->if_capabilities |= IFCAP_VLAN_MTU; + ifp->if_capenable |= IFCAP_VLAN_HWTAGGING; ether_ifattach(ifp, ic->ic_myaddr); #if NBPFILTER > 0 bpfattach2(ifp, DLT_IEEE802_11, ==== //depot/projects/netperf+sockets/sys/net80211/ieee80211_input.c#12 (text+ko) ==== @@ -56,6 +56,7 @@ #include #include #include +#include #include @@ -385,8 +386,13 @@ ifp->if_obytes += len; } } - if (m != NULL) + if (m != NULL) { + if (ni->ni_vlan != 0) { + /* attach vlan tag */ + VLAN_INPUT_TAG(ifp, m, ni->ni_vlan,); + } (*ifp->if_input)(ifp, m); + } return; case IEEE80211_FC0_TYPE_MGT: ==== //depot/projects/netperf+sockets/sys/net80211/ieee80211_ioctl.h#8 (text+ko) ==== @@ -65,6 +65,9 @@ u_int32_t ns_tx_mcast; /* tx multi/broadcast frames */ u_int64_t ns_tx_bytes; /* tx data count (bytes) */ + u_int32_t ns_tx_novlantag; /* tx discard 'cuz no tag */ + u_int32_t ns_tx_vlanmismatch; /* tx discard 'cuz bad tag */ + /* MIB-related state */ u_int32_t ns_mib_assoc; /* [re]associations */ u_int32_t ns_mib_assoc_fail; /* [re]association failures */ ==== //depot/projects/netperf+sockets/sys/net80211/ieee80211_node.h#7 (text+ko) ==== @@ -77,6 +77,7 @@ #define IEEE80211_NODE_PWR_MGT 0x0010 /* power save mode enabled */ u_int16_t ni_associd; /* assoc response */ u_int16_t ni_txpower; /* current transmit power */ + u_int16_t ni_vlan; /* vlan tag */ u_int32_t *ni_challenge; /* shared-key challenge */ u_int16_t ni_txseq; /* seq to be transmitted */ u_int16_t ni_rxseq; /* seq previous received */ ==== //depot/projects/netperf+sockets/sys/net80211/ieee80211_output.c#11 (text+ko) ==== @@ -57,6 +57,7 @@ #include #include #include +#include #include @@ -199,6 +200,23 @@ ni = ic->ic_bss; ni->ni_inact = 0; + /* + * If node has a vlan tag then all traffic + * to it must have a matching tag. + */ + if (ni->ni_vlan != 0) { + struct m_tag *mtag = VLAN_OUTPUT_TAG(ic->ic_ifp, m); + if (!mtag) { + ni->ni_stats.ns_tx_novlantag++; + goto bad; + } + if (VLAN_TAG_VALUE(mtag) != ni->ni_vlan) { + ni->ni_stats.ns_tx_vlanmismatch++; + goto bad; + } + } + + m_adj(m, sizeof(struct ether_header) - sizeof(struct llc)); llc = mtod(m, struct llc *); llc->llc_dsap = llc->llc_ssap = LLC_SNAP_LSAP;