Skip to content

Commit 4a2d73a

Browse files
roopa-prabhudavem330
authored andcommitted
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 <[email protected]> Acked-by: Nikolay Aleksandrov <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent bfff486 commit 4a2d73a

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

net/ipv4/fib_rules.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,17 @@ static int fib4_rule_match(struct fib_rule *rule, struct flowi *fl, int flags)
182182
if (r->tos && (r->tos != fl4->flowi4_tos))
183183
return 0;
184184

185+
if (rule->ip_proto && (rule->ip_proto != fl4->flowi4_proto))
186+
return 0;
187+
188+
if (fib_rule_port_range_set(&rule->sport_range) &&
189+
!fib_rule_port_inrange(&rule->sport_range, fl4->fl4_sport))
190+
return 0;
191+
192+
if (fib_rule_port_range_set(&rule->dport_range) &&
193+
!fib_rule_port_inrange(&rule->dport_range, fl4->fl4_dport))
194+
return 0;
195+
185196
return 1;
186197
}
187198

0 commit comments

Comments
 (0)