Thread (21 messages) flat view 21 messages, 4 authors, 2018-02-26
STALE3125d

[PATCH net-next 3/5] ipv6: fib6_rules: support for match on sport, dport and ip proto

From: Roopa Prabhu <hidden>
Date: 2018-02-25 05:44:52
Subsystem: networking [general], networking [ipv4/ipv6], the rest · Maintainers: "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, David Ahern, Ido Schimmel, Linus Torvalds

From: Roopa Prabhu <redacted>

support to match on src port, dst port and ip protocol.

Signed-off-by: Roopa Prabhu <redacted>
---
 net/ipv6/fib6_rules.c | 9 +++++++++
 1 file changed, 9 insertions(+)
diff --git a/net/ipv6/fib6_rules.c b/net/ipv6/fib6_rules.c
index 95a2c9e..678d664 100644
--- a/net/ipv6/fib6_rules.c
+++ b/net/ipv6/fib6_rules.c
@@ -223,6 +223,15 @@ static int fib6_rule_match(struct fib_rule *rule, struct flowi *fl, int flags)
 	if (r->tclass && r->tclass != ip6_tclass(fl6->flowlabel))
 		return 0;
 
+	if (rule->ip_proto && (rule->ip_proto != fl6->flowi4_proto))
+		return 0;
+
+	if (!fib_rule_port_inrange(&rule->sport_range, fl6->fl4_sport))
+		return 0;
+
+	if (!fib_rule_port_inrange(&rule->dport_range, fl6->fl4_dport))
+		return 0;
+
 	return 1;
 }
 
-- 
2.1.4
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help