diff options
author | stephen hemminger <shemminger@vyatta.com> | 2010-04-27 03:13:11 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-04-27 15:53:24 -0400 |
commit | dcdca2c49bb6328bbc7cd8d73434c308b5dd0df2 (patch) | |
tree | a9cbb45b1cd4cffae2279f18989c5a40887a1b72 /net | |
parent | 7180f7751d5a1b6f1ef40285b5e928970cdd5306 (diff) |
bridge: multicast router list manipulation
I prefer that the hlist be only accessed through the hlist macro
objects. Explicit twiddling of links (especially with RCU) exposes
the code to future bugs.
Compile tested only.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/bridge/br_multicast.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c index 2048ef0f9be5..fcba313f1894 100644 --- a/net/bridge/br_multicast.c +++ b/net/bridge/br_multicast.c | |||
@@ -1042,21 +1042,21 @@ static int br_ip6_multicast_mld2_report(struct net_bridge *br, | |||
1042 | static void br_multicast_add_router(struct net_bridge *br, | 1042 | static void br_multicast_add_router(struct net_bridge *br, |
1043 | struct net_bridge_port *port) | 1043 | struct net_bridge_port *port) |
1044 | { | 1044 | { |
1045 | struct hlist_node *p; | 1045 | struct net_bridge_port *p; |
1046 | struct hlist_node **h; | 1046 | struct hlist_node *n, *last = NULL; |
1047 | 1047 | ||
1048 | for (h = &br->router_list.first; | 1048 | hlist_for_each_entry(p, n, &br->router_list, rlist) { |
1049 | (p = *h) && | 1049 | if ((unsigned long) port >= (unsigned long) p) { |
1050 | (unsigned long)container_of(p, struct net_bridge_port, rlist) > | 1050 | hlist_add_before_rcu(n, &port->rlist); |
1051 | (unsigned long)port; | 1051 | return; |
1052 | h = &p->next) | 1052 | } |
1053 | ; | 1053 | last = n; |
1054 | 1054 | } | |
1055 | port->rlist.pprev = h; | 1055 | |
1056 | port->rlist.next = p; | 1056 | if (last) |
1057 | rcu_assign_pointer(*h, &port->rlist); | 1057 | hlist_add_after_rcu(last, &port->rlist); |
1058 | if (p) | 1058 | else |
1059 | p->pprev = &port->rlist.next; | 1059 | hlist_add_head_rcu(&port->rlist, &br->router_list); |
1060 | } | 1060 | } |
1061 | 1061 | ||
1062 | static void br_multicast_mark_router(struct net_bridge *br, | 1062 | static void br_multicast_mark_router(struct net_bridge *br, |