summaryrefslogtreecommitdiffstats
path: root/net/ipv4/fib_rules.c
diff options
context:
space:
mode:
authorRoopa Prabhu <roopa@cumulusnetworks.com>2018-03-01 04:41:06 +0100
committerDavid S. Miller <davem@davemloft.net>2018-03-01 04:44:43 +0100
commit4a2d73a4fb36ed4d73967bd3892cfab014a52ab2 (patch)
tree9da660749eda73451633049203d8a53a63422f72 /net/ipv4/fib_rules.c
parentnet: fib_rules: support for match on ip_proto, sport and dport (diff)
downloadlinux-4a2d73a4fb36ed4d73967bd3892cfab014a52ab2.tar.xz
linux-4a2d73a4fb36ed4d73967bd3892cfab014a52ab2.zip
ipv4: fib_rules: support match on sport, dport and ip proto
support to match on src port, dst port and ip protocol. Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com> Acked-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/fib_rules.c')
-rw-r--r--net/ipv4/fib_rules.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/net/ipv4/fib_rules.c b/net/ipv4/fib_rules.c
index 35d646a62ad4..16083b82954b 100644
--- a/net/ipv4/fib_rules.c
+++ b/net/ipv4/fib_rules.c
@@ -182,6 +182,17 @@ static int fib4_rule_match(struct fib_rule *rule, struct flowi *fl, int flags)
if (r->tos && (r->tos != fl4->flowi4_tos))
return 0;
+ if (rule->ip_proto && (rule->ip_proto != fl4->flowi4_proto))
+ return 0;
+
+ if (fib_rule_port_range_set(&rule->sport_range) &&
+ !fib_rule_port_inrange(&rule->sport_range, fl4->fl4_sport))
+ return 0;
+
+ if (fib_rule_port_range_set(&rule->dport_range) &&
+ !fib_rule_port_inrange(&rule->dport_range, fl4->fl4_dport))
+ return 0;
+
return 1;
}