aboutsummaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
authorThomas Graf <tgraf@suug.ch>2007-03-27 16:56:52 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-04-26 01:28:18 -0400
commit73417f617a93cf30342c3ea41abc38927bd467aa (patch)
tree6093005afdca1825197758d851ca5f275d62356f /net/core
parentbe776281aee54626a474ba06f91926b98bdd180d (diff)
[NET] fib_rules: Flush route cache after rule modifications
The results of FIB rules lookups are cached in the routing cache except for IPv6 as no such cache exists. So far, it was the responsibility of the user to flush the cache after modifying any rules. This lead to many false bug reports due to misunderstanding of this concept. This patch automatically flushes the route cache after inserting or deleting a rule. Thanks to Muli Ben-Yehuda <muli@il.ibm.com> for catching a bug in the previous patch. Signed-off-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/fib_rules.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c
index 5824b2644f26..cb2dae19531b 100644
--- a/net/core/fib_rules.c
+++ b/net/core/fib_rules.c
@@ -44,6 +44,12 @@ static void rules_ops_put(struct fib_rules_ops *ops)
44 module_put(ops->owner); 44 module_put(ops->owner);
45} 45}
46 46
47static void flush_route_cache(struct fib_rules_ops *ops)
48{
49 if (ops->flush_cache)
50 ops->flush_cache();
51}
52
47int fib_rules_register(struct fib_rules_ops *ops) 53int fib_rules_register(struct fib_rules_ops *ops)
48{ 54{
49 int err = -EEXIST; 55 int err = -EEXIST;
@@ -314,6 +320,7 @@ static int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
314 list_add_rcu(&rule->list, ops->rules_list); 320 list_add_rcu(&rule->list, ops->rules_list);
315 321
316 notify_rule_change(RTM_NEWRULE, rule, ops, nlh, NETLINK_CB(skb).pid); 322 notify_rule_change(RTM_NEWRULE, rule, ops, nlh, NETLINK_CB(skb).pid);
323 flush_route_cache(ops);
317 rules_ops_put(ops); 324 rules_ops_put(ops);
318 return 0; 325 return 0;
319 326
@@ -404,6 +411,7 @@ static int fib_nl_delrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
404 notify_rule_change(RTM_DELRULE, rule, ops, nlh, 411 notify_rule_change(RTM_DELRULE, rule, ops, nlh,
405 NETLINK_CB(skb).pid); 412 NETLINK_CB(skb).pid);
406 fib_rule_put(rule); 413 fib_rule_put(rule);
414 flush_route_cache(ops);
407 rules_ops_put(ops); 415 rules_ops_put(ops);
408 return 0; 416 return 0;
409 } 417 }