diff options
author | Denis V. Lunev <den@openvz.org> | 2007-09-16 18:44:27 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-10 19:51:22 -0400 |
commit | 76c72d4f44ec5fb7f88eda8a0d3aa30922c891d1 (patch) | |
tree | 0c773487ff11d098a70fddbc631f153260614bdb /net/core | |
parent | 056925ab3145713e5e83cf8e05ae6fb2f4ace41e (diff) |
[IPV4/IPV6/DECNET]: Small cleanup for fib rules.
This patch slightly cleanups FIB rules framework. rules_list as a pointer
on struct fib_rules_ops is useless. It is always assigned with a static
per/subsystem list in IPv4, IPv6 and DecNet.
Signed-off-by: Denis V. Lunev <den@openvz.org>
Acked-by: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/fib_rules.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c index 1ba71baf87ef..13de6f53f098 100644 --- a/net/core/fib_rules.c +++ b/net/core/fib_rules.c | |||
@@ -84,7 +84,7 @@ static void cleanup_ops(struct fib_rules_ops *ops) | |||
84 | { | 84 | { |
85 | struct fib_rule *rule, *tmp; | 85 | struct fib_rule *rule, *tmp; |
86 | 86 | ||
87 | list_for_each_entry_safe(rule, tmp, ops->rules_list, list) { | 87 | list_for_each_entry_safe(rule, tmp, &ops->rules_list, list) { |
88 | list_del_rcu(&rule->list); | 88 | list_del_rcu(&rule->list); |
89 | fib_rule_put(rule); | 89 | fib_rule_put(rule); |
90 | } | 90 | } |
@@ -139,7 +139,7 @@ int fib_rules_lookup(struct fib_rules_ops *ops, struct flowi *fl, | |||
139 | 139 | ||
140 | rcu_read_lock(); | 140 | rcu_read_lock(); |
141 | 141 | ||
142 | list_for_each_entry_rcu(rule, ops->rules_list, list) { | 142 | list_for_each_entry_rcu(rule, &ops->rules_list, list) { |
143 | jumped: | 143 | jumped: |
144 | if (!fib_rule_match(rule, ops, fl, flags)) | 144 | if (!fib_rule_match(rule, ops, fl, flags)) |
145 | continue; | 145 | continue; |
@@ -271,7 +271,7 @@ static int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg) | |||
271 | if (rule->target <= rule->pref) | 271 | if (rule->target <= rule->pref) |
272 | goto errout_free; | 272 | goto errout_free; |
273 | 273 | ||
274 | list_for_each_entry(r, ops->rules_list, list) { | 274 | list_for_each_entry(r, &ops->rules_list, list) { |
275 | if (r->pref == rule->target) { | 275 | if (r->pref == rule->target) { |
276 | rule->ctarget = r; | 276 | rule->ctarget = r; |
277 | break; | 277 | break; |
@@ -287,7 +287,7 @@ static int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg) | |||
287 | if (err < 0) | 287 | if (err < 0) |
288 | goto errout_free; | 288 | goto errout_free; |
289 | 289 | ||
290 | list_for_each_entry(r, ops->rules_list, list) { | 290 | list_for_each_entry(r, &ops->rules_list, list) { |
291 | if (r->pref > rule->pref) | 291 | if (r->pref > rule->pref) |
292 | break; | 292 | break; |
293 | last = r; | 293 | last = r; |
@@ -300,7 +300,7 @@ static int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg) | |||
300 | * There are unresolved goto rules in the list, check if | 300 | * There are unresolved goto rules in the list, check if |
301 | * any of them are pointing to this new rule. | 301 | * any of them are pointing to this new rule. |
302 | */ | 302 | */ |
303 | list_for_each_entry(r, ops->rules_list, list) { | 303 | list_for_each_entry(r, &ops->rules_list, list) { |
304 | if (r->action == FR_ACT_GOTO && | 304 | if (r->action == FR_ACT_GOTO && |
305 | r->target == rule->pref) { | 305 | r->target == rule->pref) { |
306 | BUG_ON(r->ctarget != NULL); | 306 | BUG_ON(r->ctarget != NULL); |
@@ -320,7 +320,7 @@ static int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg) | |||
320 | if (last) | 320 | if (last) |
321 | list_add_rcu(&rule->list, &last->list); | 321 | list_add_rcu(&rule->list, &last->list); |
322 | else | 322 | else |
323 | list_add_rcu(&rule->list, ops->rules_list); | 323 | list_add_rcu(&rule->list, &ops->rules_list); |
324 | 324 | ||
325 | notify_rule_change(RTM_NEWRULE, rule, ops, nlh, NETLINK_CB(skb).pid); | 325 | notify_rule_change(RTM_NEWRULE, rule, ops, nlh, NETLINK_CB(skb).pid); |
326 | flush_route_cache(ops); | 326 | flush_route_cache(ops); |
@@ -359,7 +359,7 @@ static int fib_nl_delrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg) | |||
359 | if (err < 0) | 359 | if (err < 0) |
360 | goto errout; | 360 | goto errout; |
361 | 361 | ||
362 | list_for_each_entry(rule, ops->rules_list, list) { | 362 | list_for_each_entry(rule, &ops->rules_list, list) { |
363 | if (frh->action && (frh->action != rule->action)) | 363 | if (frh->action && (frh->action != rule->action)) |
364 | continue; | 364 | continue; |
365 | 365 | ||
@@ -402,7 +402,7 @@ static int fib_nl_delrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg) | |||
402 | * actually been added. | 402 | * actually been added. |
403 | */ | 403 | */ |
404 | if (ops->nr_goto_rules > 0) { | 404 | if (ops->nr_goto_rules > 0) { |
405 | list_for_each_entry(tmp, ops->rules_list, list) { | 405 | list_for_each_entry(tmp, &ops->rules_list, list) { |
406 | if (tmp->ctarget == rule) { | 406 | if (tmp->ctarget == rule) { |
407 | rcu_assign_pointer(tmp->ctarget, NULL); | 407 | rcu_assign_pointer(tmp->ctarget, NULL); |
408 | ops->unresolved_rules++; | 408 | ops->unresolved_rules++; |
@@ -498,7 +498,7 @@ static int dump_rules(struct sk_buff *skb, struct netlink_callback *cb, | |||
498 | int idx = 0; | 498 | int idx = 0; |
499 | struct fib_rule *rule; | 499 | struct fib_rule *rule; |
500 | 500 | ||
501 | list_for_each_entry(rule, ops->rules_list, list) { | 501 | list_for_each_entry(rule, &ops->rules_list, list) { |
502 | if (idx < cb->args[1]) | 502 | if (idx < cb->args[1]) |
503 | goto skip; | 503 | goto skip; |
504 | 504 | ||
@@ -608,12 +608,12 @@ static int fib_rules_event(struct notifier_block *this, unsigned long event, | |||
608 | switch (event) { | 608 | switch (event) { |
609 | case NETDEV_REGISTER: | 609 | case NETDEV_REGISTER: |
610 | list_for_each_entry(ops, &rules_ops, list) | 610 | list_for_each_entry(ops, &rules_ops, list) |
611 | attach_rules(ops->rules_list, dev); | 611 | attach_rules(&ops->rules_list, dev); |
612 | break; | 612 | break; |
613 | 613 | ||
614 | case NETDEV_UNREGISTER: | 614 | case NETDEV_UNREGISTER: |
615 | list_for_each_entry(ops, &rules_ops, list) | 615 | list_for_each_entry(ops, &rules_ops, list) |
616 | detach_rules(ops->rules_list, dev); | 616 | detach_rules(&ops->rules_list, dev); |
617 | break; | 617 | break; |
618 | } | 618 | } |
619 | 619 | ||