Skip to content

Commit 960d97f

Browse files
simonwunderlichdavem330
authored andcommitted
cfg80211: add MPLS and 802.21 classification
MPLS labels may contain traffic control information, which should be evaluated and used by the wireless subsystem if present. Also check for IEEE 802.21 which is always network control traffic. Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de> Signed-off-by: Mathias Kretschmer <mathias.kretschmer@fokus.fraunhofer.de> Acked-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent f3baa39 commit 960d97f

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

‎net/wireless/util.c‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include <net/ip.h>
1212
#include <net/dsfield.h>
1313
#include <linux/if_vlan.h>
14+
#include <linux/mpls.h>
1415
#include "core.h"
1516
#include "rdev-ops.h"
1617

@@ -717,6 +718,21 @@ unsigned int cfg80211_classify8021d(struct sk_buff *skb,
717718
case htons(ETH_P_IPV6):
718719
dscp = ipv6_get_dsfield(ipv6_hdr(skb)) & 0xfc;
719720
break;
721+
case htons(ETH_P_MPLS_UC):
722+
case htons(ETH_P_MPLS_MC): {
723+
struct mpls_label mpls_tmp, *mpls;
724+
725+
mpls = skb_header_pointer(skb, sizeof(struct ethhdr),
726+
sizeof(*mpls), &mpls_tmp);
727+
if (!mpls)
728+
return 0;
729+
730+
return (ntohl(mpls->entry) & MPLS_LS_TC_MASK)
731+
>> MPLS_LS_TC_SHIFT;
732+
}
733+
case htons(ETH_P_80221):
734+
/* 802.21 is always network control traffic */
735+
return 7;
720736
default:
721737
return 0;
722738
}

0 commit comments

Comments
 (0)