summaryrefslogtreecommitdiffstats
path: root/net/sched
diff options
context:
space:
mode:
authorNikolay Aleksandrov <nikolay@cumulusnetworks.com>2019-06-27 10:10:44 +0200
committerDavid S. Miller <davem@davemloft.net>2019-06-29 20:15:12 +0200
commit9e10edd7dcd37ddf55d30d1f8f85ae9306306879 (patch)
treed256f67e52bd43038335a6824157e6d898595267 /net/sched
parenthinic: add vlan offload support (diff)
downloadlinux-9e10edd7dcd37ddf55d30d1f8f85ae9306306879.tar.xz
linux-9e10edd7dcd37ddf55d30d1f8f85ae9306306879.zip
net: sched: em_ipt: match only on ip/ipv6 traffic
Restrict matching only to ip/ipv6 traffic and make sure we can use the headers, otherwise matches will be attempted on any protocol which can be unexpected by the xt matches. Currently policy supports only ipv4/6. Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched')
-rw-r--r--net/sched/em_ipt.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/net/sched/em_ipt.c b/net/sched/em_ipt.c
index 243fd22f2248..64dbafe4e94c 100644
--- a/net/sched/em_ipt.c
+++ b/net/sched/em_ipt.c
@@ -185,6 +185,19 @@ static int em_ipt_match(struct sk_buff *skb, struct tcf_ematch *em,
struct nf_hook_state state;
int ret;
+ switch (tc_skb_protocol(skb)) {
+ case htons(ETH_P_IP):
+ if (!pskb_network_may_pull(skb, sizeof(struct iphdr)))
+ return 0;
+ break;
+ case htons(ETH_P_IPV6):
+ if (!pskb_network_may_pull(skb, sizeof(struct ipv6hdr)))
+ return 0;
+ break;
+ default:
+ return 0;
+ }
+
rcu_read_lock();
if (skb->skb_iif)