aboutsummaryrefslogtreecommitdiffstats
path: root/net/bridge
diff options
context:
space:
mode:
Diffstat (limited to 'net/bridge')
-rw-r--r--net/bridge/br_device.c109
-rw-r--r--net/bridge/br_fdb.c4
-rw-r--r--net/bridge/br_forward.c34
-rw-r--r--net/bridge/br_if.c29
-rw-r--r--net/bridge/br_input.c9
-rw-r--r--net/bridge/br_netfilter.c11
-rw-r--r--net/bridge/br_netlink.c9
-rw-r--r--net/bridge/br_notify.c5
-rw-r--r--net/bridge/br_private.h51
-rw-r--r--net/bridge/br_stp_bpdu.c5
-rw-r--r--net/bridge/netfilter/ebt_redirect.c3
-rw-r--r--net/bridge/netfilter/ebt_ulog.c8
-rw-r--r--net/bridge/netfilter/ebtables.c11
13 files changed, 170 insertions, 118 deletions
diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c
index b898364beaf5..6f3a9279be30 100644
--- a/net/bridge/br_device.c
+++ b/net/bridge/br_device.c
@@ -47,6 +47,10 @@ netdev_tx_t br_dev_xmit(struct sk_buff *skb, struct net_device *dev)
47 skb_pull(skb, ETH_HLEN); 47 skb_pull(skb, ETH_HLEN);
48 48
49 if (is_multicast_ether_addr(dest)) { 49 if (is_multicast_ether_addr(dest)) {
50 if (unlikely(netpoll_tx_running(dev))) {
51 br_flood_deliver(br, skb);
52 goto out;
53 }
50 if (br_multicast_rcv(br, NULL, skb)) 54 if (br_multicast_rcv(br, NULL, skb))
51 goto out; 55 goto out;
52 56
@@ -199,73 +203,81 @@ static int br_set_tx_csum(struct net_device *dev, u32 data)
199} 203}
200 204
201#ifdef CONFIG_NET_POLL_CONTROLLER 205#ifdef CONFIG_NET_POLL_CONTROLLER
202static bool br_devices_support_netpoll(struct net_bridge *br) 206static void br_poll_controller(struct net_device *br_dev)
203{ 207{
204 struct net_bridge_port *p;
205 bool ret = true;
206 int count = 0;
207 unsigned long flags;
208
209 spin_lock_irqsave(&br->lock, flags);
210 list_for_each_entry(p, &br->port_list, list) {
211 count++;
212 if ((p->dev->priv_flags & IFF_DISABLE_NETPOLL) ||
213 !p->dev->netdev_ops->ndo_poll_controller)
214 ret = false;
215 }
216 spin_unlock_irqrestore(&br->lock, flags);
217 return count != 0 && ret;
218} 208}
219 209
220static void br_poll_controller(struct net_device *br_dev) 210static void br_netpoll_cleanup(struct net_device *dev)
221{ 211{
222 struct netpoll *np = br_dev->npinfo->netpoll; 212 struct net_bridge *br = netdev_priv(dev);
213 struct net_bridge_port *p, *n;
223 214
224 if (np->real_dev != br_dev) 215 list_for_each_entry_safe(p, n, &br->port_list, list) {
225 netpoll_poll_dev(np->real_dev); 216 br_netpoll_disable(p);
217 }
226} 218}
227 219
228void br_netpoll_cleanup(struct net_device *dev) 220static int br_netpoll_setup(struct net_device *dev, struct netpoll_info *ni)
229{ 221{
230 struct net_bridge *br = netdev_priv(dev); 222 struct net_bridge *br = netdev_priv(dev);
231 struct net_bridge_port *p, *n; 223 struct net_bridge_port *p, *n;
232 const struct net_device_ops *ops; 224 int err = 0;
233 225
234 br->dev->npinfo = NULL;
235 list_for_each_entry_safe(p, n, &br->port_list, list) { 226 list_for_each_entry_safe(p, n, &br->port_list, list) {
236 if (p->dev) { 227 if (!p->dev)
237 ops = p->dev->netdev_ops; 228 continue;
238 if (ops->ndo_netpoll_cleanup) 229
239 ops->ndo_netpoll_cleanup(p->dev); 230 err = br_netpoll_enable(p);
240 else 231 if (err)
241 p->dev->npinfo = NULL; 232 goto fail;
242 }
243 } 233 }
234
235out:
236 return err;
237
238fail:
239 br_netpoll_cleanup(dev);
240 goto out;
244} 241}
245 242
246void br_netpoll_disable(struct net_bridge *br, 243int br_netpoll_enable(struct net_bridge_port *p)
247 struct net_device *dev)
248{ 244{
249 if (br_devices_support_netpoll(br)) 245 struct netpoll *np;
250 br->dev->priv_flags &= ~IFF_DISABLE_NETPOLL; 246 int err = 0;
251 if (dev->netdev_ops->ndo_netpoll_cleanup) 247
252 dev->netdev_ops->ndo_netpoll_cleanup(dev); 248 np = kzalloc(sizeof(*p->np), GFP_KERNEL);
253 else 249 err = -ENOMEM;
254 dev->npinfo = NULL; 250 if (!np)
251 goto out;
252
253 np->dev = p->dev;
254
255 err = __netpoll_setup(np);
256 if (err) {
257 kfree(np);
258 goto out;
259 }
260
261 p->np = np;
262
263out:
264 return err;
255} 265}
256 266
257void br_netpoll_enable(struct net_bridge *br, 267void br_netpoll_disable(struct net_bridge_port *p)
258 struct net_device *dev)
259{ 268{
260 if (br_devices_support_netpoll(br)) { 269 struct netpoll *np = p->np;
261 br->dev->priv_flags &= ~IFF_DISABLE_NETPOLL; 270
262 if (br->dev->npinfo) 271 if (!np)
263 dev->npinfo = br->dev->npinfo; 272 return;
264 } else if (!(br->dev->priv_flags & IFF_DISABLE_NETPOLL)) { 273
265 br->dev->priv_flags |= IFF_DISABLE_NETPOLL; 274 p->np = NULL;
266 br_info(br,"new device %s does not support netpoll (disabling)", 275
267 dev->name); 276 /* Wait for transmitting packets to finish before freeing. */
268 } 277 synchronize_rcu_bh();
278
279 __netpoll_cleanup(np);
280 kfree(np);
269} 281}
270 282
271#endif 283#endif
@@ -294,6 +306,7 @@ static const struct net_device_ops br_netdev_ops = {
294 .ndo_change_mtu = br_change_mtu, 306 .ndo_change_mtu = br_change_mtu,
295 .ndo_do_ioctl = br_dev_ioctl, 307 .ndo_do_ioctl = br_dev_ioctl,
296#ifdef CONFIG_NET_POLL_CONTROLLER 308#ifdef CONFIG_NET_POLL_CONTROLLER
309 .ndo_netpoll_setup = br_netpoll_setup,
297 .ndo_netpoll_cleanup = br_netpoll_cleanup, 310 .ndo_netpoll_cleanup = br_netpoll_cleanup,
298 .ndo_poll_controller = br_poll_controller, 311 .ndo_poll_controller = br_poll_controller,
299#endif 312#endif
diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c
index 26637439965b..6818e609b2c0 100644
--- a/net/bridge/br_fdb.c
+++ b/net/bridge/br_fdb.c
@@ -242,11 +242,11 @@ int br_fdb_test_addr(struct net_device *dev, unsigned char *addr)
242 struct net_bridge_fdb_entry *fdb; 242 struct net_bridge_fdb_entry *fdb;
243 int ret; 243 int ret;
244 244
245 if (!dev->br_port) 245 if (!br_port_exists(dev))
246 return 0; 246 return 0;
247 247
248 rcu_read_lock(); 248 rcu_read_lock();
249 fdb = __br_fdb_get(dev->br_port->br, addr); 249 fdb = __br_fdb_get(br_port_get_rcu(dev)->br, addr);
250 ret = fdb && fdb->dst->dev != dev && 250 ret = fdb && fdb->dst->dev != dev &&
251 fdb->dst->state == BR_STATE_FORWARDING; 251 fdb->dst->state == BR_STATE_FORWARDING;
252 rcu_read_unlock(); 252 rcu_read_unlock();
diff --git a/net/bridge/br_forward.c b/net/bridge/br_forward.c
index a98ef1393097..6e97711fd2c5 100644
--- a/net/bridge/br_forward.c
+++ b/net/bridge/br_forward.c
@@ -50,14 +50,7 @@ int br_dev_queue_push_xmit(struct sk_buff *skb)
50 kfree_skb(skb); 50 kfree_skb(skb);
51 else { 51 else {
52 skb_push(skb, ETH_HLEN); 52 skb_push(skb, ETH_HLEN);
53 53 dev_queue_xmit(skb);
54#ifdef CONFIG_NET_POLL_CONTROLLER
55 if (unlikely(skb->dev->priv_flags & IFF_IN_NETPOLL)) {
56 netpoll_send_skb(skb->dev->npinfo->netpoll, skb);
57 skb->dev->priv_flags &= ~IFF_IN_NETPOLL;
58 } else
59#endif
60 dev_queue_xmit(skb);
61 } 54 }
62 } 55 }
63 56
@@ -73,23 +66,20 @@ int br_forward_finish(struct sk_buff *skb)
73 66
74static void __br_deliver(const struct net_bridge_port *to, struct sk_buff *skb) 67static void __br_deliver(const struct net_bridge_port *to, struct sk_buff *skb)
75{ 68{
76#ifdef CONFIG_NET_POLL_CONTROLLER
77 struct net_bridge *br = to->br;
78 if (unlikely(br->dev->priv_flags & IFF_IN_NETPOLL)) {
79 struct netpoll *np;
80 to->dev->npinfo = skb->dev->npinfo;
81 np = skb->dev->npinfo->netpoll;
82 np->real_dev = np->dev = to->dev;
83 to->dev->priv_flags |= IFF_IN_NETPOLL;
84 }
85#endif
86 skb->dev = to->dev; 69 skb->dev = to->dev;
70
71 if (unlikely(netpoll_tx_running(to->dev))) {
72 if (packet_length(skb) > skb->dev->mtu && !skb_is_gso(skb))
73 kfree_skb(skb);
74 else {
75 skb_push(skb, ETH_HLEN);
76 br_netpoll_send_skb(to, skb);
77 }
78 return;
79 }
80
87 NF_HOOK(NFPROTO_BRIDGE, NF_BR_LOCAL_OUT, skb, NULL, skb->dev, 81 NF_HOOK(NFPROTO_BRIDGE, NF_BR_LOCAL_OUT, skb, NULL, skb->dev,
88 br_forward_finish); 82 br_forward_finish);
89#ifdef CONFIG_NET_POLL_CONTROLLER
90 if (skb->dev->npinfo)
91 skb->dev->npinfo->netpoll->dev = br->dev;
92#endif
93} 83}
94 84
95static void __br_forward(const struct net_bridge_port *to, struct sk_buff *skb) 85static void __br_forward(const struct net_bridge_port *to, struct sk_buff *skb)
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index d9242342837e..c03d2c3ff03e 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -147,15 +147,17 @@ static void del_nbp(struct net_bridge_port *p)
147 147
148 list_del_rcu(&p->list); 148 list_del_rcu(&p->list);
149 149
150 dev->priv_flags &= ~IFF_BRIDGE_PORT;
151
150 netdev_rx_handler_unregister(dev); 152 netdev_rx_handler_unregister(dev);
151 rcu_assign_pointer(dev->br_port, NULL);
152 153
153 br_multicast_del_port(p); 154 br_multicast_del_port(p);
154 155
155 kobject_uevent(&p->kobj, KOBJ_REMOVE); 156 kobject_uevent(&p->kobj, KOBJ_REMOVE);
156 kobject_del(&p->kobj); 157 kobject_del(&p->kobj);
157 158
158 br_netpoll_disable(br, dev); 159 br_netpoll_disable(p);
160
159 call_rcu(&p->rcu, destroy_nbp_rcu); 161 call_rcu(&p->rcu, destroy_nbp_rcu);
160} 162}
161 163
@@ -168,8 +170,6 @@ static void del_br(struct net_bridge *br, struct list_head *head)
168 del_nbp(p); 170 del_nbp(p);
169 } 171 }
170 172
171 br_netpoll_cleanup(br->dev);
172
173 del_timer_sync(&br->gc_timer); 173 del_timer_sync(&br->gc_timer);
174 174
175 br_sysfs_delbr(br->dev); 175 br_sysfs_delbr(br->dev);
@@ -401,7 +401,7 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)
401 return -ELOOP; 401 return -ELOOP;
402 402
403 /* Device is already being bridged */ 403 /* Device is already being bridged */
404 if (dev->br_port != NULL) 404 if (br_port_exists(dev))
405 return -EBUSY; 405 return -EBUSY;
406 406
407 /* No bridging devices that dislike that (e.g. wireless) */ 407 /* No bridging devices that dislike that (e.g. wireless) */
@@ -429,12 +429,15 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)
429 if (err) 429 if (err)
430 goto err2; 430 goto err2;
431 431
432 rcu_assign_pointer(dev->br_port, p); 432 if (br_netpoll_info(br) && ((err = br_netpoll_enable(p))))
433 goto err3;
433 434
434 err = netdev_rx_handler_register(dev, br_handle_frame); 435 err = netdev_rx_handler_register(dev, br_handle_frame, p);
435 if (err) 436 if (err)
436 goto err3; 437 goto err3;
437 438
439 dev->priv_flags |= IFF_BRIDGE_PORT;
440
438 dev_disable_lro(dev); 441 dev_disable_lro(dev);
439 442
440 list_add_rcu(&p->list, &br->port_list); 443 list_add_rcu(&p->list, &br->port_list);
@@ -454,11 +457,9 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)
454 457
455 kobject_uevent(&p->kobj, KOBJ_ADD); 458 kobject_uevent(&p->kobj, KOBJ_ADD);
456 459
457 br_netpoll_enable(br, dev);
458
459 return 0; 460 return 0;
460err3: 461err3:
461 rcu_assign_pointer(dev->br_port, NULL); 462 sysfs_remove_link(br->ifobj, p->dev->name);
462err2: 463err2:
463 br_fdb_delete_by_port(br, p, 1); 464 br_fdb_delete_by_port(br, p, 1);
464err1: 465err1:
@@ -475,9 +476,13 @@ put_back:
475/* called with RTNL */ 476/* called with RTNL */
476int br_del_if(struct net_bridge *br, struct net_device *dev) 477int br_del_if(struct net_bridge *br, struct net_device *dev)
477{ 478{
478 struct net_bridge_port *p = dev->br_port; 479 struct net_bridge_port *p;
480
481 if (!br_port_exists(dev))
482 return -EINVAL;
479 483
480 if (!p || p->br != br) 484 p = br_port_get(dev);
485 if (p->br != br)
481 return -EINVAL; 486 return -EINVAL;
482 487
483 del_nbp(p); 488 del_nbp(p);
diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c
index 99647d8f95c8..f076c9d79d5e 100644
--- a/net/bridge/br_input.c
+++ b/net/bridge/br_input.c
@@ -41,7 +41,7 @@ static int br_pass_frame_up(struct sk_buff *skb)
41int br_handle_frame_finish(struct sk_buff *skb) 41int br_handle_frame_finish(struct sk_buff *skb)
42{ 42{
43 const unsigned char *dest = eth_hdr(skb)->h_dest; 43 const unsigned char *dest = eth_hdr(skb)->h_dest;
44 struct net_bridge_port *p = rcu_dereference(skb->dev->br_port); 44 struct net_bridge_port *p = br_port_get_rcu(skb->dev);
45 struct net_bridge *br; 45 struct net_bridge *br;
46 struct net_bridge_fdb_entry *dst; 46 struct net_bridge_fdb_entry *dst;
47 struct net_bridge_mdb_entry *mdst; 47 struct net_bridge_mdb_entry *mdst;
@@ -111,10 +111,9 @@ drop:
111/* note: already called with rcu_read_lock (preempt_disabled) */ 111/* note: already called with rcu_read_lock (preempt_disabled) */
112static int br_handle_local_finish(struct sk_buff *skb) 112static int br_handle_local_finish(struct sk_buff *skb)
113{ 113{
114 struct net_bridge_port *p = rcu_dereference(skb->dev->br_port); 114 struct net_bridge_port *p = br_port_get_rcu(skb->dev);
115 115
116 if (p) 116 br_fdb_update(p->br, p, eth_hdr(skb)->h_source);
117 br_fdb_update(p->br, p, eth_hdr(skb)->h_source);
118 return 0; /* process further */ 117 return 0; /* process further */
119} 118}
120 119
@@ -151,7 +150,7 @@ struct sk_buff *br_handle_frame(struct sk_buff *skb)
151 if (!skb) 150 if (!skb)
152 return NULL; 151 return NULL;
153 152
154 p = rcu_dereference(skb->dev->br_port); 153 p = br_port_get_rcu(skb->dev);
155 154
156 if (unlikely(is_link_local(dest))) { 155 if (unlikely(is_link_local(dest))) {
157 /* Pause frames shouldn't be passed up by driver anyway */ 156 /* Pause frames shouldn't be passed up by driver anyway */
diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c
index 6bb6f7c9e6e1..84060bc48f11 100644
--- a/net/bridge/br_netfilter.c
+++ b/net/bridge/br_netfilter.c
@@ -127,16 +127,17 @@ void br_netfilter_rtable_init(struct net_bridge *br)
127 127
128static inline struct rtable *bridge_parent_rtable(const struct net_device *dev) 128static inline struct rtable *bridge_parent_rtable(const struct net_device *dev)
129{ 129{
130 struct net_bridge_port *port = rcu_dereference(dev->br_port); 130 if (!br_port_exists(dev))
131 131 return NULL;
132 return port ? &port->br->fake_rtable : NULL; 132 return &br_port_get_rcu(dev)->br->fake_rtable;
133} 133}
134 134
135static inline struct net_device *bridge_parent(const struct net_device *dev) 135static inline struct net_device *bridge_parent(const struct net_device *dev)
136{ 136{
137 struct net_bridge_port *port = rcu_dereference(dev->br_port); 137 if (!br_port_exists(dev))
138 return NULL;
138 139
139 return port ? port->br->dev : NULL; 140 return br_port_get_rcu(dev)->br->dev;
140} 141}
141 142
142static inline struct nf_bridge_info *nf_bridge_alloc(struct sk_buff *skb) 143static inline struct nf_bridge_info *nf_bridge_alloc(struct sk_buff *skb)
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index fe0a79018ab2..4a6a378c84e3 100644
--- a/net/bridge/br_netlink.c
+++ b/net/bridge/br_netlink.c
@@ -120,10 +120,11 @@ static int br_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb)
120 idx = 0; 120 idx = 0;
121 for_each_netdev(net, dev) { 121 for_each_netdev(net, dev) {
122 /* not a bridge port */ 122 /* not a bridge port */
123 if (dev->br_port == NULL || idx < cb->args[0]) 123 if (!br_port_exists(dev) || idx < cb->args[0])
124 goto skip; 124 goto skip;
125 125
126 if (br_fill_ifinfo(skb, dev->br_port, NETLINK_CB(cb->skb).pid, 126 if (br_fill_ifinfo(skb, br_port_get(dev),
127 NETLINK_CB(cb->skb).pid,
127 cb->nlh->nlmsg_seq, RTM_NEWLINK, 128 cb->nlh->nlmsg_seq, RTM_NEWLINK,
128 NLM_F_MULTI) < 0) 129 NLM_F_MULTI) < 0)
129 break; 130 break;
@@ -168,9 +169,9 @@ static int br_rtm_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
168 if (!dev) 169 if (!dev)
169 return -ENODEV; 170 return -ENODEV;
170 171
171 p = dev->br_port; 172 if (!br_port_exists(dev))
172 if (!p)
173 return -EINVAL; 173 return -EINVAL;
174 p = br_port_get(dev);
174 175
175 /* if kernel STP is running, don't allow changes */ 176 /* if kernel STP is running, don't allow changes */
176 if (p->br->stp_enabled == BR_KERNEL_STP) 177 if (p->br->stp_enabled == BR_KERNEL_STP)
diff --git a/net/bridge/br_notify.c b/net/bridge/br_notify.c
index 717e1fd6133c..404d4e14c6a7 100644
--- a/net/bridge/br_notify.c
+++ b/net/bridge/br_notify.c
@@ -32,14 +32,15 @@ struct notifier_block br_device_notifier = {
32static int br_device_event(struct notifier_block *unused, unsigned long event, void *ptr) 32static int br_device_event(struct notifier_block *unused, unsigned long event, void *ptr)
33{ 33{
34 struct net_device *dev = ptr; 34 struct net_device *dev = ptr;
35 struct net_bridge_port *p = dev->br_port; 35 struct net_bridge_port *p = br_port_get(dev);
36 struct net_bridge *br; 36 struct net_bridge *br;
37 int err; 37 int err;
38 38
39 /* not a port of a bridge */ 39 /* not a port of a bridge */
40 if (p == NULL) 40 if (!br_port_exists(dev))
41 return NOTIFY_DONE; 41 return NOTIFY_DONE;
42 42
43 p = br_port_get(dev);
43 br = p->br; 44 br = p->br;
44 45
45 switch (event) { 46 switch (event) {
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
index c83519b555bb..f6bc979b1135 100644
--- a/net/bridge/br_private.h
+++ b/net/bridge/br_private.h
@@ -15,6 +15,7 @@
15 15
16#include <linux/netdevice.h> 16#include <linux/netdevice.h>
17#include <linux/if_bridge.h> 17#include <linux/if_bridge.h>
18#include <linux/netpoll.h>
18#include <net/route.h> 19#include <net/route.h>
19 20
20#define BR_HASH_BITS 8 21#define BR_HASH_BITS 8
@@ -143,8 +144,17 @@ struct net_bridge_port
143#ifdef CONFIG_SYSFS 144#ifdef CONFIG_SYSFS
144 char sysfs_name[IFNAMSIZ]; 145 char sysfs_name[IFNAMSIZ];
145#endif 146#endif
147
148#ifdef CONFIG_NET_POLL_CONTROLLER
149 struct netpoll *np;
150#endif
146}; 151};
147 152
153#define br_port_get_rcu(dev) \
154 ((struct net_bridge_port *) rcu_dereference(dev->rx_handler_data))
155#define br_port_get(dev) ((struct net_bridge_port *) dev->rx_handler_data)
156#define br_port_exists(dev) (dev->priv_flags & IFF_BRIDGE_PORT)
157
148struct br_cpu_netstats { 158struct br_cpu_netstats {
149 unsigned long rx_packets; 159 unsigned long rx_packets;
150 unsigned long rx_bytes; 160 unsigned long rx_bytes;
@@ -273,16 +283,41 @@ extern void br_dev_setup(struct net_device *dev);
273extern netdev_tx_t br_dev_xmit(struct sk_buff *skb, 283extern netdev_tx_t br_dev_xmit(struct sk_buff *skb,
274 struct net_device *dev); 284 struct net_device *dev);
275#ifdef CONFIG_NET_POLL_CONTROLLER 285#ifdef CONFIG_NET_POLL_CONTROLLER
276extern void br_netpoll_cleanup(struct net_device *dev); 286static inline struct netpoll_info *br_netpoll_info(struct net_bridge *br)
277extern void br_netpoll_enable(struct net_bridge *br, 287{
278 struct net_device *dev); 288 return br->dev->npinfo;
279extern void br_netpoll_disable(struct net_bridge *br, 289}
280 struct net_device *dev); 290
291static inline void br_netpoll_send_skb(const struct net_bridge_port *p,
292 struct sk_buff *skb)
293{
294 struct netpoll *np = p->np;
295
296 if (np)
297 netpoll_send_skb(np, skb);
298}
299
300extern int br_netpoll_enable(struct net_bridge_port *p);
301extern void br_netpoll_disable(struct net_bridge_port *p);
281#else 302#else
282#define br_netpoll_cleanup(br) 303static inline struct netpoll_info *br_netpoll_info(struct net_bridge *br)
283#define br_netpoll_enable(br, dev) 304{
284#define br_netpoll_disable(br, dev) 305 return NULL;
306}
307
308static inline void br_netpoll_send_skb(struct net_bridge_port *p,
309 struct sk_buff *skb)
310{
311}
285 312
313static inline int br_netpoll_enable(struct net_bridge_port *p)
314{
315 return 0;
316}
317
318static inline void br_netpoll_disable(struct net_bridge_port *p)
319{
320}
286#endif 321#endif
287 322
288/* br_fdb.c */ 323/* br_fdb.c */
diff --git a/net/bridge/br_stp_bpdu.c b/net/bridge/br_stp_bpdu.c
index 217bd225a42f..70aecb48fb69 100644
--- a/net/bridge/br_stp_bpdu.c
+++ b/net/bridge/br_stp_bpdu.c
@@ -137,12 +137,13 @@ void br_stp_rcv(const struct stp_proto *proto, struct sk_buff *skb,
137 struct net_device *dev) 137 struct net_device *dev)
138{ 138{
139 const unsigned char *dest = eth_hdr(skb)->h_dest; 139 const unsigned char *dest = eth_hdr(skb)->h_dest;
140 struct net_bridge_port *p = rcu_dereference(dev->br_port); 140 struct net_bridge_port *p;
141 struct net_bridge *br; 141 struct net_bridge *br;
142 const unsigned char *buf; 142 const unsigned char *buf;
143 143
144 if (!p) 144 if (!br_port_exists(dev))
145 goto err; 145 goto err;
146 p = br_port_get_rcu(dev);
146 147
147 if (!pskb_may_pull(skb, 4)) 148 if (!pskb_may_pull(skb, 4))
148 goto err; 149 goto err;
diff --git a/net/bridge/netfilter/ebt_redirect.c b/net/bridge/netfilter/ebt_redirect.c
index 9e19166ba453..46624bb6d9be 100644
--- a/net/bridge/netfilter/ebt_redirect.c
+++ b/net/bridge/netfilter/ebt_redirect.c
@@ -24,8 +24,9 @@ ebt_redirect_tg(struct sk_buff *skb, const struct xt_action_param *par)
24 return EBT_DROP; 24 return EBT_DROP;
25 25
26 if (par->hooknum != NF_BR_BROUTING) 26 if (par->hooknum != NF_BR_BROUTING)
27 /* rcu_read_lock()ed by nf_hook_slow */
27 memcpy(eth_hdr(skb)->h_dest, 28 memcpy(eth_hdr(skb)->h_dest,
28 par->in->br_port->br->dev->dev_addr, ETH_ALEN); 29 br_port_get_rcu(par->in)->br->dev->dev_addr, ETH_ALEN);
29 else 30 else
30 memcpy(eth_hdr(skb)->h_dest, par->in->dev_addr, ETH_ALEN); 31 memcpy(eth_hdr(skb)->h_dest, par->in->dev_addr, ETH_ALEN);
31 skb->pkt_type = PACKET_HOST; 32 skb->pkt_type = PACKET_HOST;
diff --git a/net/bridge/netfilter/ebt_ulog.c b/net/bridge/netfilter/ebt_ulog.c
index ae3c7cef1484..26377e96fa1c 100644
--- a/net/bridge/netfilter/ebt_ulog.c
+++ b/net/bridge/netfilter/ebt_ulog.c
@@ -177,8 +177,9 @@ static void ebt_ulog_packet(unsigned int hooknr, const struct sk_buff *skb,
177 if (in) { 177 if (in) {
178 strcpy(pm->physindev, in->name); 178 strcpy(pm->physindev, in->name);
179 /* If in isn't a bridge, then physindev==indev */ 179 /* If in isn't a bridge, then physindev==indev */
180 if (in->br_port) 180 if (br_port_exists(in))
181 strcpy(pm->indev, in->br_port->br->dev->name); 181 /* rcu_read_lock()ed by nf_hook_slow */
182 strcpy(pm->indev, br_port_get_rcu(in)->br->dev->name);
182 else 183 else
183 strcpy(pm->indev, in->name); 184 strcpy(pm->indev, in->name);
184 } else 185 } else
@@ -187,7 +188,8 @@ static void ebt_ulog_packet(unsigned int hooknr, const struct sk_buff *skb,
187 if (out) { 188 if (out) {
188 /* If out exists, then out is a bridge port */ 189 /* If out exists, then out is a bridge port */
189 strcpy(pm->physoutdev, out->name); 190 strcpy(pm->physoutdev, out->name);
190 strcpy(pm->outdev, out->br_port->br->dev->name); 191 /* rcu_read_lock()ed by nf_hook_slow */
192 strcpy(pm->outdev, br_port_get_rcu(out)->br->dev->name);
191 } else 193 } else
192 pm->outdev[0] = pm->physoutdev[0] = '\0'; 194 pm->outdev[0] = pm->physoutdev[0] = '\0';
193 195
diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c
index 59ca00e40dec..bcc102e3be4d 100644
--- a/net/bridge/netfilter/ebtables.c
+++ b/net/bridge/netfilter/ebtables.c
@@ -140,11 +140,14 @@ ebt_basic_match(const struct ebt_entry *e, const struct ethhdr *h,
140 return 1; 140 return 1;
141 if (FWINV2(ebt_dev_check(e->out, out), EBT_IOUT)) 141 if (FWINV2(ebt_dev_check(e->out, out), EBT_IOUT))
142 return 1; 142 return 1;
143 if ((!in || !in->br_port) ? 0 : FWINV2(ebt_dev_check( 143 /* rcu_read_lock()ed by nf_hook_slow */
144 e->logical_in, in->br_port->br->dev), EBT_ILOGICALIN)) 144 if (in && br_port_exists(in) &&
145 FWINV2(ebt_dev_check(e->logical_in, br_port_get_rcu(in)->br->dev),
146 EBT_ILOGICALIN))
145 return 1; 147 return 1;
146 if ((!out || !out->br_port) ? 0 : FWINV2(ebt_dev_check( 148 if (out && br_port_exists(out) &&
147 e->logical_out, out->br_port->br->dev), EBT_ILOGICALOUT)) 149 FWINV2(ebt_dev_check(e->logical_out, br_port_get_rcu(out)->br->dev),
150 EBT_ILOGICALOUT))
148 return 1; 151 return 1;
149 152
150 if (e->bitmask & EBT_SOURCEMAC) { 153 if (e->bitmask & EBT_SOURCEMAC) {