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>
This commit is contained in:
stephen hemminger
2010-04-27 07:13:11 +00:00
committed by David S. Miller
parent 7180f7751d
commit dcdca2c49b

View File

@@ -1042,21 +1042,21 @@ static int br_ip6_multicast_mld2_report(struct net_bridge *br,
static void br_multicast_add_router(struct net_bridge *br, static void br_multicast_add_router(struct net_bridge *br,
struct net_bridge_port *port) struct net_bridge_port *port)
{ {
struct hlist_node *p; struct net_bridge_port *p;
struct hlist_node **h; struct hlist_node *n, *last = NULL;
for (h = &br->router_list.first; hlist_for_each_entry(p, n, &br->router_list, rlist) {
(p = *h) && if ((unsigned long) port >= (unsigned long) p) {
(unsigned long)container_of(p, struct net_bridge_port, rlist) > hlist_add_before_rcu(n, &port->rlist);
(unsigned long)port; return;
h = &p->next) }
; last = n;
}
port->rlist.pprev = h; if (last)
port->rlist.next = p; hlist_add_after_rcu(last, &port->rlist);
rcu_assign_pointer(*h, &port->rlist); else
if (p) hlist_add_head_rcu(&port->rlist, &br->router_list);
p->pprev = &port->rlist.next;
} }
static void br_multicast_mark_router(struct net_bridge *br, static void br_multicast_mark_router(struct net_bridge *br,