From f3f59b2ee06917292b96f078892316f83fd2e7b5 Mon Sep 17 00:00:00 2001 From: sam Date: Sun, 7 Jun 2009 22:06:15 +0000 Subject: teach ieee80211_classify about ipv6 packets Reviewed by: bz, rrs --- sys/net80211/ieee80211_output.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'sys/net80211') 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 @@ -61,6 +62,9 @@ __FBSDID("$FreeBSD$"); #include #include #endif +#ifdef INET6 +#include +#endif #include @@ -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 -- cgit v1.1