diff options
author | David S. Miller <davem@davemloft.net> | 2012-06-29 04:32:45 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-06-29 04:36:36 -0400 |
commit | 7a9bc9b81a5bc6e44ebc80ef781332e4385083f2 (patch) | |
tree | 1342c672823d47bfb112fee63951af9f6a3eb590 /net/core | |
parent | b8c8430726e5bd552e01dacc5a44f3f83f7446ca (diff) |
ipv4: Elide fib_validate_source() completely when possible.
If rpfilter is off (or the SKB has an IPSEC path) and there are not
tclassid users, we don't have to do anything at all when
fib_validate_source() is invoked besides setting the itag to zero.
We monitor tclassid uses with a counter (modified only under RTNL and
marked __read_mostly) and we protect the fib_validate_source() real
work with a test against this counter and whether rpfilter is to be
done.
Having a way to know whether we need no tclassid processing or not
also opens the door for future optimized rpfilter algorithms that do
not perform full FIB lookups.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/fib_rules.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c index 72cceb79d0d4..ab7db83236c9 100644 --- a/net/core/fib_rules.c +++ b/net/core/fib_rules.c | |||
@@ -151,6 +151,8 @@ static void fib_rules_cleanup_ops(struct fib_rules_ops *ops) | |||
151 | 151 | ||
152 | list_for_each_entry_safe(rule, tmp, &ops->rules_list, list) { | 152 | list_for_each_entry_safe(rule, tmp, &ops->rules_list, list) { |
153 | list_del_rcu(&rule->list); | 153 | list_del_rcu(&rule->list); |
154 | if (ops->delete) | ||
155 | ops->delete(rule); | ||
154 | fib_rule_put(rule); | 156 | fib_rule_put(rule); |
155 | } | 157 | } |
156 | } | 158 | } |
@@ -499,6 +501,8 @@ static int fib_nl_delrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg) | |||
499 | 501 | ||
500 | notify_rule_change(RTM_DELRULE, rule, ops, nlh, | 502 | notify_rule_change(RTM_DELRULE, rule, ops, nlh, |
501 | NETLINK_CB(skb).pid); | 503 | NETLINK_CB(skb).pid); |
504 | if (ops->delete) | ||
505 | ops->delete(rule); | ||
502 | fib_rule_put(rule); | 506 | fib_rule_put(rule); |
503 | flush_route_cache(ops); | 507 | flush_route_cache(ops); |
504 | rules_ops_put(ops); | 508 | rules_ops_put(ops); |