PERFORCE change 46293 for review
Sam Leffler
sam at FreeBSD.org
Sat Jan 31 21:40:56 PST 2004
http://perforce.freebsd.org/chv.cgi?CH=46293
Change 46293 by sam at 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 <net/if_arp.h>
#include <net/ethernet.h>
#include <net/if_llc.h>
+#include <net/if_vlan_var.h>
#include <net80211/ieee80211_var.h>
@@ -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 <net/if_arp.h>
#include <net/ethernet.h>
#include <net/if_llc.h>
+#include <net/if_vlan_var.h>
#include <net80211/ieee80211_var.h>
@@ -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;
More information about the p4-projects
mailing list