lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1590611130-19146-2-git-send-email-jbaron@akamai.com>
Date:   Wed, 27 May 2020 16:25:29 -0400
From:   Jason Baron <jbaron@...mai.com>
To:     davem@...emloft.net
Cc:     netdev@...r.kernel.org, jhs@...atatu.com, xiyou.wangcong@...il.com,
        jiri@...nulli.us
Subject: [net-next 1/2] net: sched: cls-flower: include ports in 1rst fragment

cls-flower does not include the ports in the 1rst ipv4/6
fragments. Thus, if fragments are to be allowed, then port based
rules have no choice but to allow all fragments destined to all
ports. Let's include ports in the 1rst fragment. Thus, fragmented
packets can be allowed/blocked by adding a rule which
allows/blocks specific ports and allows all non-first ip fragments
(via setting ip_flags to frag/nofirstfrag).


Cc: Jamal Hadi Salim <jhs@...atatu.com>
Cc: Cong Wang <xiyou.wangcong@...il.com>
Cc: Jiri Pirko <jiri@...nulli.us>
Signed-off-by: Jason Baron <jbaron@...mai.com>
---
 net/core/flow_dissector.c | 4 +++-
 net/sched/cls_flower.c    | 3 ++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
index 0aeb335..bfd554e 100644
--- a/net/core/flow_dissector.c
+++ b/net/core/flow_dissector.c
@@ -1446,7 +1446,9 @@ bool __skb_flow_dissect(const struct net *net,
 		break;
 	}
 
-	if (!(key_control->flags & FLOW_DIS_IS_FRAGMENT))
+	if (!(key_control->flags & FLOW_DIS_IS_FRAGMENT) ||
+	    ((key_control->flags & FLOW_DIS_FIRST_FRAG) &&
+	     (FLOW_DISSECTOR_F_PARSE_1ST_FRAG & flags)))
 		__skb_flow_dissect_ports(skb, flow_dissector, target_container,
 					 data, nhoff, ip_proto, hlen);
 
diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c
index 96f5999..e16227a 100644
--- a/net/sched/cls_flower.c
+++ b/net/sched/cls_flower.c
@@ -317,7 +317,8 @@ static int fl_classify(struct sk_buff *skb, const struct tcf_proto *tp,
 		skb_flow_dissect_ct(skb, &mask->dissector, &skb_key,
 				    fl_ct_info_to_flower_map,
 				    ARRAY_SIZE(fl_ct_info_to_flower_map));
-		skb_flow_dissect(skb, &mask->dissector, &skb_key, 0);
+		skb_flow_dissect(skb, &mask->dissector, &skb_key,
+				 FLOW_DISSECTOR_F_PARSE_1ST_FRAG);
 
 		fl_set_masked_key(&skb_mkey, &skb_key, mask);
 
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ