summaryrefslogtreecommitdiffstats
path: root/sys/net80211
diff options
context:
space:
mode:
authorsam <sam@FreeBSD.org>2009-06-07 22:06:15 +0000
committersam <sam@FreeBSD.org>2009-06-07 22:06:15 +0000
commitf3f59b2ee06917292b96f078892316f83fd2e7b5 (patch)
tree03d3dedeb086206f6db454ab48a3c0ea94938474 /sys/net80211
parent892cecbd65521a79d008c6f8fb2ff5aa190191d8 (diff)
downloadFreeBSD-src-f3f59b2ee06917292b96f078892316f83fd2e7b5.zip
FreeBSD-src-f3f59b2ee06917292b96f078892316f83fd2e7b5.tar.gz
teach ieee80211_classify about ipv6 packets
Reviewed by: bz, rrs
Diffstat (limited to 'sys/net80211')
-rw-r--r--sys/net80211/ieee80211_output.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/sys/net80211/ieee80211_output.c b/sys/net80211/ieee80211_output.c
index 6da1796..3700c63 100644
--- a/sys/net80211/ieee80211_output.c
+++ b/sys/net80211/ieee80211_output.c
@@ -28,6 +28,7 @@
__FBSDID("$FreeBSD$");
#include "opt_inet.h"
+#include "opt_inet6.h"
#include "opt_wlan.h"
#include <sys/param.h>
@@ -61,6 +62,9 @@ __FBSDID("$FreeBSD$");
#include <netinet/in_systm.h>
#include <netinet/ip.h>
#endif
+#ifdef INET6
+#include <netinet/ip6.h>
+#endif
#include <security/mac/mac_framework.h>
@@ -730,13 +734,13 @@ ieee80211_classify(struct ieee80211_node *ni, struct mbuf *m)
v_wme_ac = TID_TO_WME_AC(EVL_PRIOFTAG(ni->ni_vlan));
}
+ /* XXX m_copydata may be too slow for fast path */
#ifdef INET
if (eh->ether_type == htons(ETHERTYPE_IP)) {
uint8_t tos;
/*
* IP frame, map the DSCP bits from the TOS field.
*/
- /* XXX m_copydata may be too slow for fast path */
/* NB: ip header may not be in first mbuf */
m_copydata(m, sizeof(struct ether_header) +
offsetof(struct ip, ip_tos), sizeof(tos), &tos);
@@ -744,7 +748,25 @@ ieee80211_classify(struct ieee80211_node *ni, struct mbuf *m)
d_wme_ac = TID_TO_WME_AC(tos);
} else {
#endif /* INET */
+#ifdef INET6
+ if (eh->ether_type == htons(ETHERTYPE_IPV6)) {
+ uint32_t flow;
+ uint8_t tos;
+ /*
+ * IPv6 frame, map the DSCP bits from the TOS field.
+ */
+ m_copydata(m, sizeof(struct ether_header) +
+ offsetof(struct ip6_hdr, ip6_flow), sizeof(flow),
+ (caddr_t) &flow);
+ tos = (uint8_t)(ntohl(flow) >> 20);
+ tos >>= 5; /* NB: ECN + low 3 bits of DSCP */
+ d_wme_ac = TID_TO_WME_AC(tos);
+ } else {
+#endif /* INET6 */
d_wme_ac = WME_AC_BE;
+#ifdef INET6
+ }
+#endif
#ifdef INET
}
#endif
OpenPOWER on IntegriCloud