aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/fib6_rules.c
diff options
context:
space:
mode:
authorRoopa Prabhu <roopa@cumulusnetworks.com>2018-02-28 22:43:22 -0500
committerDavid S. Miller <davem@davemloft.net>2018-02-28 22:44:44 -0500
commit5e5d6fed374155ba1a7a5ca5f12fbec2285d06a2 (patch)
tree92e19ce9d5e58ee33bbface8a6b5f4001c28a06c /net/ipv6/fib6_rules.c
parente37b1e978bec5334dc379d8c2423d063af207430 (diff)
ipv6: route: dissect flow in input path if fib rules need it
Dissect flow in fwd path if fib rules require it. Controlled by a flag to avoid penatly for the common case. Flag is set when fib rules with sport, dport and proto match that require flow dissect are installed. Also passes the dissected hash keys to the multipath hash function when applicable to avoid dissecting the flow again. icmp packets will continue to use inner header for hash calculations. Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com> Acked-by: Paolo Abeni <pabeni@redhat.com> Acked-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/fib6_rules.c')
-rw-r--r--net/ipv6/fib6_rules.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/net/ipv6/fib6_rules.c b/net/ipv6/fib6_rules.c
index bcd1f22ac7b1..04e5f523e50f 100644
--- a/net/ipv6/fib6_rules.c
+++ b/net/ipv6/fib6_rules.c
@@ -269,12 +269,26 @@ static int fib6_rule_configure(struct fib_rule *rule, struct sk_buff *skb,
269 rule6->dst.plen = frh->dst_len; 269 rule6->dst.plen = frh->dst_len;
270 rule6->tclass = frh->tos; 270 rule6->tclass = frh->tos;
271 271
272 if (fib_rule_requires_fldissect(rule))
273 net->ipv6.fib6_rules_require_fldissect++;
274
272 net->ipv6.fib6_has_custom_rules = true; 275 net->ipv6.fib6_has_custom_rules = true;
273 err = 0; 276 err = 0;
274errout: 277errout:
275 return err; 278 return err;
276} 279}
277 280
281static int fib6_rule_delete(struct fib_rule *rule)
282{
283 struct net *net = rule->fr_net;
284
285 if (net->ipv6.fib6_rules_require_fldissect &&
286 fib_rule_requires_fldissect(rule))
287 net->ipv6.fib6_rules_require_fldissect--;
288
289 return 0;
290}
291
278static int fib6_rule_compare(struct fib_rule *rule, struct fib_rule_hdr *frh, 292static int fib6_rule_compare(struct fib_rule *rule, struct fib_rule_hdr *frh,
279 struct nlattr **tb) 293 struct nlattr **tb)
280{ 294{
@@ -334,6 +348,7 @@ static const struct fib_rules_ops __net_initconst fib6_rules_ops_template = {
334 .match = fib6_rule_match, 348 .match = fib6_rule_match,
335 .suppress = fib6_rule_suppress, 349 .suppress = fib6_rule_suppress,
336 .configure = fib6_rule_configure, 350 .configure = fib6_rule_configure,
351 .delete = fib6_rule_delete,
337 .compare = fib6_rule_compare, 352 .compare = fib6_rule_compare,
338 .fill = fib6_rule_fill, 353 .fill = fib6_rule_fill,
339 .nlmsg_payload = fib6_rule_nlmsg_payload, 354 .nlmsg_payload = fib6_rule_nlmsg_payload,
@@ -361,6 +376,7 @@ static int __net_init fib6_rules_net_init(struct net *net)
361 goto out_fib6_rules_ops; 376 goto out_fib6_rules_ops;
362 377
363 net->ipv6.fib6_rules_ops = ops; 378 net->ipv6.fib6_rules_ops = ops;
379 net->ipv6.fib6_rules_require_fldissect = 0;
364out: 380out:
365 return err; 381 return err;
366 382