aboutsummaryrefslogtreecommitdiffstats
path: root/net/bridge
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-11 14:38:13 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-11 14:38:13 -0500
commitcb18eccff48ef3986d1072964590bce6fec705fb (patch)
tree777fb1d15e0281341e1e02c9803d989538d346f2 /net/bridge
parentc827ba4cb49a30ce581201fd0ba2be77cde412c7 (diff)
parent5ef213f6842277ee1df5659f59fac0ffc9beb411 (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6: (45 commits) [IPV4]: Restore multipath routing after rt_next changes. [XFRM] IPV6: Fix outbound RO transformation which is broken by IPsec tunnel patch. [NET]: Reorder fields of struct dst_entry [DECNET]: Convert decnet route to use the new dst_entry 'next' pointer [IPV6]: Convert ipv6 route to use the new dst_entry 'next' pointer [IPV4]: Convert ipv4 route to use the new dst_entry 'next' pointer [NET]: Introduce union in struct dst_entry to hold 'next' pointer [DECNET]: fix misannotation of linkinfo_dn [DECNET]: FRA_{DST,SRC} are le16 for decnet [UDP]: UDP can use sk_hash to speedup lookups [NET]: Fix whitespace errors. [NET] XFRM: Fix whitespace errors. [NET] X25: Fix whitespace errors. [NET] WANROUTER: Fix whitespace errors. [NET] UNIX: Fix whitespace errors. [NET] TIPC: Fix whitespace errors. [NET] SUNRPC: Fix whitespace errors. [NET] SCTP: Fix whitespace errors. [NET] SCHED: Fix whitespace errors. [NET] RXRPC: Fix whitespace errors. ...
Diffstat (limited to 'net/bridge')
-rw-r--r--net/bridge/br_device.c8
-rw-r--r--net/bridge/br_fdb.c34
-rw-r--r--net/bridge/br_forward.c4
-rw-r--r--net/bridge/br_if.c26
-rw-r--r--net/bridge/br_input.c4
-rw-r--r--net/bridge/br_ioctl.c18
-rw-r--r--net/bridge/br_netfilter.c14
-rw-r--r--net/bridge/br_notify.c10
-rw-r--r--net/bridge/br_private.h4
-rw-r--r--net/bridge/br_stp.c24
-rw-r--r--net/bridge/br_stp_bpdu.c2
-rw-r--r--net/bridge/br_stp_if.c4
-rw-r--r--net/bridge/br_stp_timer.c20
-rw-r--r--net/bridge/br_sysfs_br.c8
-rw-r--r--net/bridge/netfilter/ebt_802_3.c6
-rw-r--r--net/bridge/netfilter/ebt_among.c6
-rw-r--r--net/bridge/netfilter/ebt_arpreply.c2
-rw-r--r--net/bridge/netfilter/ebt_ip.c8
-rw-r--r--net/bridge/netfilter/ebt_log.c6
-rw-r--r--net/bridge/netfilter/ebt_mark_m.c2
-rw-r--r--net/bridge/netfilter/ebt_stp.c4
-rw-r--r--net/bridge/netfilter/ebt_ulog.c16
-rw-r--r--net/bridge/netfilter/ebt_vlan.c6
-rw-r--r--net/bridge/netfilter/ebtable_filter.c4
-rw-r--r--net/bridge/netfilter/ebtables.c16
25 files changed, 128 insertions, 128 deletions
diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c
index f8dbcee80eba..905a39c33a16 100644
--- a/net/bridge/br_device.c
+++ b/net/bridge/br_device.c
@@ -40,7 +40,7 @@ int br_dev_xmit(struct sk_buff *skb, struct net_device *dev)
40 skb->mac.raw = skb->data; 40 skb->mac.raw = skb->data;
41 skb_pull(skb, ETH_HLEN); 41 skb_pull(skb, ETH_HLEN);
42 42
43 if (dest[0] & 1) 43 if (dest[0] & 1)
44 br_flood_deliver(br, skb, 0); 44 br_flood_deliver(br, skb, 0);
45 else if ((dst = __br_fdb_get(br, dest)) != NULL) 45 else if ((dst = __br_fdb_get(br, dest)) != NULL)
46 br_deliver(dst->dst, skb); 46 br_deliver(dst->dst, skb);
@@ -178,12 +178,12 @@ void br_dev_setup(struct net_device *dev)
178 dev->change_mtu = br_change_mtu; 178 dev->change_mtu = br_change_mtu;
179 dev->destructor = free_netdev; 179 dev->destructor = free_netdev;
180 SET_MODULE_OWNER(dev); 180 SET_MODULE_OWNER(dev);
181 SET_ETHTOOL_OPS(dev, &br_ethtool_ops); 181 SET_ETHTOOL_OPS(dev, &br_ethtool_ops);
182 dev->stop = br_dev_stop; 182 dev->stop = br_dev_stop;
183 dev->tx_queue_len = 0; 183 dev->tx_queue_len = 0;
184 dev->set_mac_address = br_set_mac_address; 184 dev->set_mac_address = br_set_mac_address;
185 dev->priv_flags = IFF_EBRIDGE; 185 dev->priv_flags = IFF_EBRIDGE;
186 186
187 dev->features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA | 187 dev->features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA |
188 NETIF_F_TSO | NETIF_F_NO_CSUM | NETIF_F_GSO_ROBUST; 188 NETIF_F_TSO | NETIF_F_NO_CSUM | NETIF_F_GSO_ROBUST;
189} 189}
diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c
index 8ca448db7a0d..def2e403f932 100644
--- a/net/bridge/br_fdb.c
+++ b/net/bridge/br_fdb.c
@@ -52,7 +52,7 @@ static __inline__ unsigned long hold_time(const struct net_bridge *br)
52static __inline__ int has_expired(const struct net_bridge *br, 52static __inline__ int has_expired(const struct net_bridge *br,
53 const struct net_bridge_fdb_entry *fdb) 53 const struct net_bridge_fdb_entry *fdb)
54{ 54{
55 return !fdb->is_static 55 return !fdb->is_static
56 && time_before_eq(fdb->ageing_timer + hold_time(br), jiffies); 56 && time_before_eq(fdb->ageing_timer + hold_time(br), jiffies);
57} 57}
58 58
@@ -71,7 +71,7 @@ void br_fdb_changeaddr(struct net_bridge_port *p, const unsigned char *newaddr)
71{ 71{
72 struct net_bridge *br = p->br; 72 struct net_bridge *br = p->br;
73 int i; 73 int i;
74 74
75 spin_lock_bh(&br->hash_lock); 75 spin_lock_bh(&br->hash_lock);
76 76
77 /* Search all chains since old address/hash is unknown */ 77 /* Search all chains since old address/hash is unknown */
@@ -85,7 +85,7 @@ void br_fdb_changeaddr(struct net_bridge_port *p, const unsigned char *newaddr)
85 /* maybe another port has same hw addr? */ 85 /* maybe another port has same hw addr? */
86 struct net_bridge_port *op; 86 struct net_bridge_port *op;
87 list_for_each_entry(op, &br->port_list, list) { 87 list_for_each_entry(op, &br->port_list, list) {
88 if (op != p && 88 if (op != p &&
89 !compare_ether_addr(op->dev->dev_addr, 89 !compare_ether_addr(op->dev->dev_addr,
90 f->addr.addr)) { 90 f->addr.addr)) {
91 f->dst = op; 91 f->dst = op;
@@ -118,8 +118,8 @@ void br_fdb_cleanup(unsigned long _data)
118 struct hlist_node *h, *n; 118 struct hlist_node *h, *n;
119 119
120 hlist_for_each_entry_safe(f, h, n, &br->hash[i], hlist) { 120 hlist_for_each_entry_safe(f, h, n, &br->hash[i], hlist) {
121 if (!f->is_static && 121 if (!f->is_static &&
122 time_before_eq(f->ageing_timer + delay, jiffies)) 122 time_before_eq(f->ageing_timer + delay, jiffies))
123 fdb_delete(f); 123 fdb_delete(f);
124 } 124 }
125 } 125 }
@@ -138,11 +138,11 @@ void br_fdb_delete_by_port(struct net_bridge *br,
138 spin_lock_bh(&br->hash_lock); 138 spin_lock_bh(&br->hash_lock);
139 for (i = 0; i < BR_HASH_SIZE; i++) { 139 for (i = 0; i < BR_HASH_SIZE; i++) {
140 struct hlist_node *h, *g; 140 struct hlist_node *h, *g;
141 141
142 hlist_for_each_safe(h, g, &br->hash[i]) { 142 hlist_for_each_safe(h, g, &br->hash[i]) {
143 struct net_bridge_fdb_entry *f 143 struct net_bridge_fdb_entry *f
144 = hlist_entry(h, struct net_bridge_fdb_entry, hlist); 144 = hlist_entry(h, struct net_bridge_fdb_entry, hlist);
145 if (f->dst != p) 145 if (f->dst != p)
146 continue; 146 continue;
147 147
148 if (f->is_static && !do_all) 148 if (f->is_static && !do_all)
@@ -155,7 +155,7 @@ void br_fdb_delete_by_port(struct net_bridge *br,
155 if (f->is_local) { 155 if (f->is_local) {
156 struct net_bridge_port *op; 156 struct net_bridge_port *op;
157 list_for_each_entry(op, &br->port_list, list) { 157 list_for_each_entry(op, &br->port_list, list) {
158 if (op != p && 158 if (op != p &&
159 !compare_ether_addr(op->dev->dev_addr, 159 !compare_ether_addr(op->dev->dev_addr,
160 f->addr.addr)) { 160 f->addr.addr)) {
161 f->dst = op; 161 f->dst = op;
@@ -190,14 +190,14 @@ struct net_bridge_fdb_entry *__br_fdb_get(struct net_bridge *br,
190} 190}
191 191
192/* Interface used by ATM hook that keeps a ref count */ 192/* Interface used by ATM hook that keeps a ref count */
193struct net_bridge_fdb_entry *br_fdb_get(struct net_bridge *br, 193struct net_bridge_fdb_entry *br_fdb_get(struct net_bridge *br,
194 unsigned char *addr) 194 unsigned char *addr)
195{ 195{
196 struct net_bridge_fdb_entry *fdb; 196 struct net_bridge_fdb_entry *fdb;
197 197
198 rcu_read_lock(); 198 rcu_read_lock();
199 fdb = __br_fdb_get(br, addr); 199 fdb = __br_fdb_get(br, addr);
200 if (fdb) 200 if (fdb)
201 atomic_inc(&fdb->use_count); 201 atomic_inc(&fdb->use_count);
202 rcu_read_unlock(); 202 rcu_read_unlock();
203 return fdb; 203 return fdb;
@@ -218,7 +218,7 @@ void br_fdb_put(struct net_bridge_fdb_entry *ent)
218} 218}
219 219
220/* 220/*
221 * Fill buffer with forwarding table records in 221 * Fill buffer with forwarding table records in
222 * the API format. 222 * the API format.
223 */ 223 */
224int br_fdb_fillbuf(struct net_bridge *br, void *buf, 224int br_fdb_fillbuf(struct net_bridge *br, void *buf,
@@ -237,7 +237,7 @@ int br_fdb_fillbuf(struct net_bridge *br, void *buf,
237 if (num >= maxnum) 237 if (num >= maxnum)
238 goto out; 238 goto out;
239 239
240 if (has_expired(br, f)) 240 if (has_expired(br, f))
241 continue; 241 continue;
242 242
243 if (skip) { 243 if (skip) {
@@ -277,7 +277,7 @@ static inline struct net_bridge_fdb_entry *fdb_find(struct hlist_head *head,
277 277
278static struct net_bridge_fdb_entry *fdb_create(struct hlist_head *head, 278static struct net_bridge_fdb_entry *fdb_create(struct hlist_head *head,
279 struct net_bridge_port *source, 279 struct net_bridge_port *source,
280 const unsigned char *addr, 280 const unsigned char *addr,
281 int is_local) 281 int is_local)
282{ 282{
283 struct net_bridge_fdb_entry *fdb; 283 struct net_bridge_fdb_entry *fdb;
@@ -307,17 +307,17 @@ static int fdb_insert(struct net_bridge *br, struct net_bridge_port *source,
307 307
308 fdb = fdb_find(head, addr); 308 fdb = fdb_find(head, addr);
309 if (fdb) { 309 if (fdb) {
310 /* it is okay to have multiple ports with same 310 /* it is okay to have multiple ports with same
311 * address, just use the first one. 311 * address, just use the first one.
312 */ 312 */
313 if (fdb->is_local) 313 if (fdb->is_local)
314 return 0; 314 return 0;
315 315
316 printk(KERN_WARNING "%s adding interface with same address " 316 printk(KERN_WARNING "%s adding interface with same address "
317 "as a received packet\n", 317 "as a received packet\n",
318 source->dev->name); 318 source->dev->name);
319 fdb_delete(fdb); 319 fdb_delete(fdb);
320 } 320 }
321 321
322 if (!fdb_create(head, source, addr, 1)) 322 if (!fdb_create(head, source, addr, 1))
323 return -ENOMEM; 323 return -ENOMEM;
@@ -350,7 +350,7 @@ void br_fdb_update(struct net_bridge *br, struct net_bridge_port *source,
350 if (likely(fdb)) { 350 if (likely(fdb)) {
351 /* attempt to update an entry for a local interface */ 351 /* attempt to update an entry for a local interface */
352 if (unlikely(fdb->is_local)) { 352 if (unlikely(fdb->is_local)) {
353 if (net_ratelimit()) 353 if (net_ratelimit())
354 printk(KERN_WARNING "%s: received packet with " 354 printk(KERN_WARNING "%s: received packet with "
355 " own address as source address\n", 355 " own address as source address\n",
356 source->dev->name); 356 source->dev->name);
diff --git a/net/bridge/br_forward.c b/net/bridge/br_forward.c
index 191b861e5e53..3e45c1a1aa96 100644
--- a/net/bridge/br_forward.c
+++ b/net/bridge/br_forward.c
@@ -21,7 +21,7 @@
21#include "br_private.h" 21#include "br_private.h"
22 22
23/* Don't forward packets to originating port or forwarding diasabled */ 23/* Don't forward packets to originating port or forwarding diasabled */
24static inline int should_deliver(const struct net_bridge_port *p, 24static inline int should_deliver(const struct net_bridge_port *p,
25 const struct sk_buff *skb) 25 const struct sk_buff *skb)
26{ 26{
27 return (skb->dev != p->dev && p->state == BR_STATE_FORWARDING); 27 return (skb->dev != p->dev && p->state == BR_STATE_FORWARDING);
@@ -101,7 +101,7 @@ void br_forward(const struct net_bridge_port *to, struct sk_buff *skb)
101 101
102/* called under bridge lock */ 102/* called under bridge lock */
103static void br_flood(struct net_bridge *br, struct sk_buff *skb, int clone, 103static void br_flood(struct net_bridge *br, struct sk_buff *skb, int clone,
104 void (*__packet_hook)(const struct net_bridge_port *p, 104 void (*__packet_hook)(const struct net_bridge_port *p,
105 struct sk_buff *skb)) 105 struct sk_buff *skb))
106{ 106{
107 struct net_bridge_port *p; 107 struct net_bridge_port *p;
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index 2b7c2c7dad48..f35c1a378d0f 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -47,7 +47,7 @@ static int port_cost(struct net_device *dev)
47 set_fs(KERNEL_DS); 47 set_fs(KERNEL_DS);
48 err = dev_ethtool(&ifr); 48 err = dev_ethtool(&ifr);
49 set_fs(old_fs); 49 set_fs(old_fs);
50 50
51 if (!err) { 51 if (!err) {
52 switch(ecmd.speed) { 52 switch(ecmd.speed) {
53 case SPEED_100: 53 case SPEED_100:
@@ -191,7 +191,7 @@ static void del_br(struct net_bridge *br)
191 del_timer_sync(&br->gc_timer); 191 del_timer_sync(&br->gc_timer);
192 192
193 br_sysfs_delbr(br->dev); 193 br_sysfs_delbr(br->dev);
194 unregister_netdevice(br->dev); 194 unregister_netdevice(br->dev);
195} 195}
196 196
197static struct net_device *new_bridge_dev(const char *name) 197static struct net_device *new_bridge_dev(const char *name)
@@ -201,7 +201,7 @@ static struct net_device *new_bridge_dev(const char *name)
201 201
202 dev = alloc_netdev(sizeof(struct net_bridge), name, 202 dev = alloc_netdev(sizeof(struct net_bridge), name,
203 br_dev_setup); 203 br_dev_setup);
204 204
205 if (!dev) 205 if (!dev)
206 return NULL; 206 return NULL;
207 207
@@ -258,12 +258,12 @@ static int find_portno(struct net_bridge *br)
258} 258}
259 259
260/* called with RTNL but without bridge lock */ 260/* called with RTNL but without bridge lock */
261static struct net_bridge_port *new_nbp(struct net_bridge *br, 261static struct net_bridge_port *new_nbp(struct net_bridge *br,
262 struct net_device *dev) 262 struct net_device *dev)
263{ 263{
264 int index; 264 int index;
265 struct net_bridge_port *p; 265 struct net_bridge_port *p;
266 266
267 index = find_portno(br); 267 index = find_portno(br);
268 if (index < 0) 268 if (index < 0)
269 return ERR_PTR(index); 269 return ERR_PTR(index);
@@ -276,7 +276,7 @@ static struct net_bridge_port *new_nbp(struct net_bridge *br,
276 dev_hold(dev); 276 dev_hold(dev);
277 p->dev = dev; 277 p->dev = dev;
278 p->path_cost = port_cost(dev); 278 p->path_cost = port_cost(dev);
279 p->priority = 0x8000 >> BR_PORT_BITS; 279 p->priority = 0x8000 >> BR_PORT_BITS;
280 p->port_no = index; 280 p->port_no = index;
281 br_init_port(p); 281 br_init_port(p);
282 p->state = BR_STATE_DISABLED; 282 p->state = BR_STATE_DISABLED;
@@ -298,7 +298,7 @@ int br_add_bridge(const char *name)
298 int ret; 298 int ret;
299 299
300 dev = new_bridge_dev(name); 300 dev = new_bridge_dev(name);
301 if (!dev) 301 if (!dev)
302 return -ENOMEM; 302 return -ENOMEM;
303 303
304 rtnl_lock(); 304 rtnl_lock();
@@ -329,7 +329,7 @@ int br_del_bridge(const char *name)
329 329
330 rtnl_lock(); 330 rtnl_lock();
331 dev = __dev_get_by_name(name); 331 dev = __dev_get_by_name(name);
332 if (dev == NULL) 332 if (dev == NULL)
333 ret = -ENXIO; /* Could not find device */ 333 ret = -ENXIO; /* Could not find device */
334 334
335 else if (!(dev->priv_flags & IFF_EBRIDGE)) { 335 else if (!(dev->priv_flags & IFF_EBRIDGE)) {
@@ -340,9 +340,9 @@ int br_del_bridge(const char *name)
340 else if (dev->flags & IFF_UP) { 340 else if (dev->flags & IFF_UP) {
341 /* Not shutdown yet. */ 341 /* Not shutdown yet. */
342 ret = -EBUSY; 342 ret = -EBUSY;
343 } 343 }
344 344
345 else 345 else
346 del_br(netdev_priv(dev)); 346 del_br(netdev_priv(dev));
347 347
348 rtnl_unlock(); 348 rtnl_unlock();
@@ -428,7 +428,7 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)
428 if (err) 428 if (err)
429 goto err0; 429 goto err0;
430 430
431 err = br_fdb_insert(br, p, dev->dev_addr); 431 err = br_fdb_insert(br, p, dev->dev_addr);
432 if (err) 432 if (err)
433 goto err1; 433 goto err1;
434 434
@@ -464,8 +464,8 @@ err0:
464int br_del_if(struct net_bridge *br, struct net_device *dev) 464int br_del_if(struct net_bridge *br, struct net_device *dev)
465{ 465{
466 struct net_bridge_port *p = dev->br_port; 466 struct net_bridge_port *p = dev->br_port;
467 467
468 if (!p || p->br != br) 468 if (!p || p->br != br)
469 return -EINVAL; 469 return -EINVAL;
470 470
471 del_nbp(p); 471 del_nbp(p);
diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c
index bfa4d8c333f7..35b94f9a1ac5 100644
--- a/net/bridge/br_input.c
+++ b/net/bridge/br_input.c
@@ -119,7 +119,7 @@ static inline int is_link_local(const unsigned char *dest)
119 * Called via br_handle_frame_hook. 119 * Called via br_handle_frame_hook.
120 * Return 0 if *pskb should be processed furthur 120 * Return 0 if *pskb should be processed furthur
121 * 1 if *pskb is handled 121 * 1 if *pskb is handled
122 * note: already called with rcu_read_lock (preempt_disabled) 122 * note: already called with rcu_read_lock (preempt_disabled)
123 */ 123 */
124int br_handle_frame(struct net_bridge_port *p, struct sk_buff **pskb) 124int br_handle_frame(struct net_bridge_port *p, struct sk_buff **pskb)
125{ 125{
@@ -137,7 +137,7 @@ int br_handle_frame(struct net_bridge_port *p, struct sk_buff **pskb)
137 137
138 if (p->state == BR_STATE_FORWARDING || p->state == BR_STATE_LEARNING) { 138 if (p->state == BR_STATE_FORWARDING || p->state == BR_STATE_LEARNING) {
139 if (br_should_route_hook) { 139 if (br_should_route_hook) {
140 if (br_should_route_hook(pskb)) 140 if (br_should_route_hook(pskb))
141 return 0; 141 return 0;
142 skb = *pskb; 142 skb = *pskb;
143 dest = eth_hdr(skb)->h_dest; 143 dest = eth_hdr(skb)->h_dest;
diff --git a/net/bridge/br_ioctl.c b/net/bridge/br_ioctl.c
index 4c61a7e0a86e..3ab153d3c508 100644
--- a/net/bridge/br_ioctl.c
+++ b/net/bridge/br_ioctl.c
@@ -28,7 +28,7 @@ static int get_bridge_ifindices(int *indices, int num)
28 int i = 0; 28 int i = 0;
29 29
30 for (dev = dev_base; dev && i < num; dev = dev->next) { 30 for (dev = dev_base; dev && i < num; dev = dev->next) {
31 if (dev->priv_flags & IFF_EBRIDGE) 31 if (dev->priv_flags & IFF_EBRIDGE)
32 indices[i++] = dev->ifindex; 32 indices[i++] = dev->ifindex;
33 } 33 }
34 34
@@ -53,7 +53,7 @@ static void get_port_ifindices(struct net_bridge *br, int *ifindices, int num)
53 * (limited to a page for sanity) 53 * (limited to a page for sanity)
54 * offset -- number of records to skip 54 * offset -- number of records to skip
55 */ 55 */
56static int get_fdb_entries(struct net_bridge *br, void __user *userbuf, 56static int get_fdb_entries(struct net_bridge *br, void __user *userbuf,
57 unsigned long maxnum, unsigned long offset) 57 unsigned long maxnum, unsigned long offset)
58{ 58{
59 int num; 59 int num;
@@ -69,7 +69,7 @@ static int get_fdb_entries(struct net_bridge *br, void __user *userbuf,
69 buf = kmalloc(size, GFP_USER); 69 buf = kmalloc(size, GFP_USER);
70 if (!buf) 70 if (!buf)
71 return -ENOMEM; 71 return -ENOMEM;
72 72
73 num = br_fdb_fillbuf(br, buf, maxnum, offset); 73 num = br_fdb_fillbuf(br, buf, maxnum, offset);
74 if (num > 0) { 74 if (num > 0) {
75 if (copy_to_user(userbuf, buf, num*sizeof(struct __fdb_entry))) 75 if (copy_to_user(userbuf, buf, num*sizeof(struct __fdb_entry)))
@@ -91,7 +91,7 @@ static int add_del_if(struct net_bridge *br, int ifindex, int isadd)
91 dev = dev_get_by_index(ifindex); 91 dev = dev_get_by_index(ifindex);
92 if (dev == NULL) 92 if (dev == NULL)
93 return -EINVAL; 93 return -EINVAL;
94 94
95 if (isadd) 95 if (isadd)
96 ret = br_add_if(br, dev); 96 ret = br_add_if(br, dev);
97 else 97 else
@@ -110,7 +110,7 @@ static int old_dev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
110{ 110{
111 struct net_bridge *br = netdev_priv(dev); 111 struct net_bridge *br = netdev_priv(dev);
112 unsigned long args[4]; 112 unsigned long args[4];
113 113
114 if (copy_from_user(args, rq->ifr_data, sizeof(args))) 114 if (copy_from_user(args, rq->ifr_data, sizeof(args)))
115 return -EFAULT; 115 return -EFAULT;
116 116
@@ -143,7 +143,7 @@ static int old_dev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
143 b.tcn_timer_value = br_timer_value(&br->tcn_timer); 143 b.tcn_timer_value = br_timer_value(&br->tcn_timer);
144 b.topology_change_timer_value = br_timer_value(&br->topology_change_timer); 144 b.topology_change_timer_value = br_timer_value(&br->topology_change_timer);
145 b.gc_timer_value = br_timer_value(&br->gc_timer); 145 b.gc_timer_value = br_timer_value(&br->gc_timer);
146 rcu_read_unlock(); 146 rcu_read_unlock();
147 147
148 if (copy_to_user((void __user *)args[1], &b, sizeof(b))) 148 if (copy_to_user((void __user *)args[1], &b, sizeof(b)))
149 return -EFAULT; 149 return -EFAULT;
@@ -275,7 +275,7 @@ static int old_dev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
275 return -ERANGE; 275 return -ERANGE;
276 276
277 spin_lock_bh(&br->lock); 277 spin_lock_bh(&br->lock);
278 if ((p = br_get_port(br, args[1])) == NULL) 278 if ((p = br_get_port(br, args[1])) == NULL)
279 ret = -EINVAL; 279 ret = -EINVAL;
280 else 280 else
281 br_stp_set_port_priority(p, args[2]); 281 br_stp_set_port_priority(p, args[2]);
@@ -301,7 +301,7 @@ static int old_dev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
301 } 301 }
302 302
303 case BRCTL_GET_FDB_ENTRIES: 303 case BRCTL_GET_FDB_ENTRIES:
304 return get_fdb_entries(br, (void __user *)args[1], 304 return get_fdb_entries(br, (void __user *)args[1],
305 args[2], args[3]); 305 args[2], args[3]);
306 } 306 }
307 307
@@ -368,7 +368,7 @@ int br_ioctl_deviceless_stub(unsigned int cmd, void __user *uarg)
368 case SIOCGIFBR: 368 case SIOCGIFBR:
369 case SIOCSIFBR: 369 case SIOCSIFBR:
370 return old_deviceless(uarg); 370 return old_deviceless(uarg);
371 371
372 case SIOCBRADDBR: 372 case SIOCBRADDBR:
373 case SIOCBRDELBR: 373 case SIOCBRDELBR:
374 { 374 {
diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c
index a25fa8cb5284..a0744e653f09 100644
--- a/net/bridge/br_netfilter.c
+++ b/net/bridge/br_netfilter.c
@@ -68,7 +68,7 @@ static __be16 inline vlan_proto(const struct sk_buff *skb)
68 68
69#define IS_VLAN_IP(skb) \ 69#define IS_VLAN_IP(skb) \
70 (skb->protocol == htons(ETH_P_8021Q) && \ 70 (skb->protocol == htons(ETH_P_8021Q) && \
71 vlan_proto(skb) == htons(ETH_P_IP) && \ 71 vlan_proto(skb) == htons(ETH_P_IP) && \
72 brnf_filter_vlan_tagged) 72 brnf_filter_vlan_tagged)
73 73
74#define IS_VLAN_IPV6(skb) \ 74#define IS_VLAN_IPV6(skb) \
@@ -124,7 +124,7 @@ static inline struct nf_bridge_info *nf_bridge_alloc(struct sk_buff *skb)
124 124
125static inline void nf_bridge_save_header(struct sk_buff *skb) 125static inline void nf_bridge_save_header(struct sk_buff *skb)
126{ 126{
127 int header_size = ETH_HLEN; 127 int header_size = ETH_HLEN;
128 128
129 if (skb->protocol == htons(ETH_P_8021Q)) 129 if (skb->protocol == htons(ETH_P_8021Q))
130 header_size += VLAN_HLEN; 130 header_size += VLAN_HLEN;
@@ -139,7 +139,7 @@ static inline void nf_bridge_save_header(struct sk_buff *skb)
139int nf_bridge_copy_header(struct sk_buff *skb) 139int nf_bridge_copy_header(struct sk_buff *skb)
140{ 140{
141 int err; 141 int err;
142 int header_size = ETH_HLEN; 142 int header_size = ETH_HLEN;
143 143
144 if (skb->protocol == htons(ETH_P_8021Q)) 144 if (skb->protocol == htons(ETH_P_8021Q))
145 header_size += VLAN_HLEN; 145 header_size += VLAN_HLEN;
@@ -836,10 +836,10 @@ static unsigned int ip_sabotage_in(unsigned int hook, struct sk_buff **pskb,
836 * For br_nf_post_routing, we need (prio = NF_BR_PRI_LAST), because 836 * For br_nf_post_routing, we need (prio = NF_BR_PRI_LAST), because
837 * ip_refrag() can return NF_STOLEN. */ 837 * ip_refrag() can return NF_STOLEN. */
838static struct nf_hook_ops br_nf_ops[] = { 838static struct nf_hook_ops br_nf_ops[] = {
839 { .hook = br_nf_pre_routing, 839 { .hook = br_nf_pre_routing,
840 .owner = THIS_MODULE, 840 .owner = THIS_MODULE,
841 .pf = PF_BRIDGE, 841 .pf = PF_BRIDGE,
842 .hooknum = NF_BR_PRE_ROUTING, 842 .hooknum = NF_BR_PRE_ROUTING,
843 .priority = NF_BR_PRI_BRNF, }, 843 .priority = NF_BR_PRI_BRNF, },
844 { .hook = br_nf_local_in, 844 { .hook = br_nf_local_in,
845 .owner = THIS_MODULE, 845 .owner = THIS_MODULE,
diff --git a/net/bridge/br_notify.c b/net/bridge/br_notify.c
index 20278494e4da..8cd3e4229070 100644
--- a/net/bridge/br_notify.c
+++ b/net/bridge/br_notify.c
@@ -26,7 +26,7 @@ struct notifier_block br_device_notifier = {
26 26
27/* 27/*
28 * Handle changes in state of network devices enslaved to a bridge. 28 * Handle changes in state of network devices enslaved to a bridge.
29 * 29 *
30 * Note: don't care about up/down if bridge itself is down, because 30 * Note: don't care about up/down if bridge itself is down, because
31 * port state is checked when bridge is brought up. 31 * port state is checked when bridge is brought up.
32 */ 32 */
@@ -60,11 +60,11 @@ static int br_device_event(struct notifier_block *unused, unsigned long event, v
60 break; 60 break;
61 61
62 case NETDEV_FEAT_CHANGE: 62 case NETDEV_FEAT_CHANGE:
63 if (br->dev->flags & IFF_UP) 63 if (br->dev->flags & IFF_UP)
64 br_features_recompute(br); 64 br_features_recompute(br);
65 65
66 /* could do recursive feature change notification 66 /* could do recursive feature change notification
67 * but who would care?? 67 * but who would care??
68 */ 68 */
69 break; 69 break;
70 70
@@ -74,7 +74,7 @@ static int br_device_event(struct notifier_block *unused, unsigned long event, v
74 break; 74 break;
75 75
76 case NETDEV_UP: 76 case NETDEV_UP:
77 if (netif_carrier_ok(dev) && (br->dev->flags & IFF_UP)) 77 if (netif_carrier_ok(dev) && (br->dev->flags & IFF_UP))
78 br_stp_enable_port(p); 78 br_stp_enable_port(p);
79 break; 79 break;
80 80
@@ -82,7 +82,7 @@ static int br_device_event(struct notifier_block *unused, unsigned long event, v
82 spin_unlock_bh(&br->lock); 82 spin_unlock_bh(&br->lock);
83 br_del_if(br, dev); 83 br_del_if(br, dev);
84 goto done; 84 goto done;
85 } 85 }
86 spin_unlock_bh(&br->lock); 86 spin_unlock_bh(&br->lock);
87 87
88 done: 88 done:
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
index 3a534e94c7f3..6a0540e0591e 100644
--- a/net/bridge/br_private.h
+++ b/net/bridge/br_private.h
@@ -149,7 +149,7 @@ extern struct net_bridge_fdb_entry *__br_fdb_get(struct net_bridge *br,
149extern struct net_bridge_fdb_entry *br_fdb_get(struct net_bridge *br, 149extern struct net_bridge_fdb_entry *br_fdb_get(struct net_bridge *br,
150 unsigned char *addr); 150 unsigned char *addr);
151extern void br_fdb_put(struct net_bridge_fdb_entry *ent); 151extern void br_fdb_put(struct net_bridge_fdb_entry *ent);
152extern int br_fdb_fillbuf(struct net_bridge *br, void *buf, 152extern int br_fdb_fillbuf(struct net_bridge *br, void *buf,
153 unsigned long count, unsigned long off); 153 unsigned long count, unsigned long off);
154extern int br_fdb_insert(struct net_bridge *br, 154extern int br_fdb_insert(struct net_bridge *br,
155 struct net_bridge_port *source, 155 struct net_bridge_port *source,
@@ -203,7 +203,7 @@ extern void br_netfilter_fini(void);
203/* br_stp.c */ 203/* br_stp.c */
204extern void br_log_state(const struct net_bridge_port *p); 204extern void br_log_state(const struct net_bridge_port *p);
205extern struct net_bridge_port *br_get_port(struct net_bridge *br, 205extern struct net_bridge_port *br_get_port(struct net_bridge *br,
206 u16 port_no); 206 u16 port_no);
207extern void br_init_port(struct net_bridge_port *p); 207extern void br_init_port(struct net_bridge_port *p);
208extern void br_become_designated_port(struct net_bridge_port *p); 208extern void br_become_designated_port(struct net_bridge_port *p);
209 209
diff --git a/net/bridge/br_stp.c b/net/bridge/br_stp.c
index 04ca0639a95a..f9ff4d57b0d7 100644
--- a/net/bridge/br_stp.c
+++ b/net/bridge/br_stp.c
@@ -24,17 +24,17 @@
24#define MESSAGE_AGE_INCR ((HZ < 256) ? 1 : (HZ/256)) 24#define MESSAGE_AGE_INCR ((HZ < 256) ? 1 : (HZ/256))
25 25
26static const char *br_port_state_names[] = { 26static const char *br_port_state_names[] = {
27 [BR_STATE_DISABLED] = "disabled", 27 [BR_STATE_DISABLED] = "disabled",
28 [BR_STATE_LISTENING] = "listening", 28 [BR_STATE_LISTENING] = "listening",
29 [BR_STATE_LEARNING] = "learning", 29 [BR_STATE_LEARNING] = "learning",
30 [BR_STATE_FORWARDING] = "forwarding", 30 [BR_STATE_FORWARDING] = "forwarding",
31 [BR_STATE_BLOCKING] = "blocking", 31 [BR_STATE_BLOCKING] = "blocking",
32}; 32};
33 33
34void br_log_state(const struct net_bridge_port *p) 34void br_log_state(const struct net_bridge_port *p)
35{ 35{
36 pr_info("%s: port %d(%s) entering %s state\n", 36 pr_info("%s: port %d(%s) entering %s state\n",
37 p->br->dev->name, p->port_no, p->dev->name, 37 p->br->dev->name, p->port_no, p->dev->name,
38 br_port_state_names[p->state]); 38 br_port_state_names[p->state]);
39 39
40} 40}
@@ -53,7 +53,7 @@ struct net_bridge_port *br_get_port(struct net_bridge *br, u16 port_no)
53} 53}
54 54
55/* called under bridge lock */ 55/* called under bridge lock */
56static int br_should_become_root_port(const struct net_bridge_port *p, 56static int br_should_become_root_port(const struct net_bridge_port *p,
57 u16 root_port) 57 u16 root_port)
58{ 58{
59 struct net_bridge *br; 59 struct net_bridge *br;
@@ -184,7 +184,7 @@ void br_transmit_config(struct net_bridge_port *p)
184} 184}
185 185
186/* called under bridge lock */ 186/* called under bridge lock */
187static inline void br_record_config_information(struct net_bridge_port *p, 187static inline void br_record_config_information(struct net_bridge_port *p,
188 const struct br_config_bpdu *bpdu) 188 const struct br_config_bpdu *bpdu)
189{ 189{
190 p->designated_root = bpdu->root; 190 p->designated_root = bpdu->root;
@@ -192,12 +192,12 @@ static inline void br_record_config_information(struct net_bridge_port *p,
192 p->designated_bridge = bpdu->bridge_id; 192 p->designated_bridge = bpdu->bridge_id;
193 p->designated_port = bpdu->port_id; 193 p->designated_port = bpdu->port_id;
194 194
195 mod_timer(&p->message_age_timer, jiffies 195 mod_timer(&p->message_age_timer, jiffies
196 + (p->br->max_age - bpdu->message_age)); 196 + (p->br->max_age - bpdu->message_age));
197} 197}
198 198
199/* called under bridge lock */ 199/* called under bridge lock */
200static inline void br_record_config_timeout_values(struct net_bridge *br, 200static inline void br_record_config_timeout_values(struct net_bridge *br,
201 const struct br_config_bpdu *bpdu) 201 const struct br_config_bpdu *bpdu)
202{ 202{
203 br->max_age = bpdu->max_age; 203 br->max_age = bpdu->max_age;
@@ -415,7 +415,7 @@ void br_received_config_bpdu(struct net_bridge_port *p, struct br_config_bpdu *b
415{ 415{
416 struct net_bridge *br; 416 struct net_bridge *br;
417 int was_root; 417 int was_root;
418 418
419 br = p->br; 419 br = p->br;
420 was_root = br_is_root_bridge(br); 420 was_root = br_is_root_bridge(br);
421 421
@@ -430,7 +430,7 @@ void br_received_config_bpdu(struct net_bridge_port *p, struct br_config_bpdu *b
430 del_timer(&br->topology_change_timer); 430 del_timer(&br->topology_change_timer);
431 br_transmit_tcn(br); 431 br_transmit_tcn(br);
432 432
433 mod_timer(&br->tcn_timer, 433 mod_timer(&br->tcn_timer,
434 jiffies + br->bridge_hello_time); 434 jiffies + br->bridge_hello_time);
435 } 435 }
436 } 436 }
@@ -441,8 +441,8 @@ void br_received_config_bpdu(struct net_bridge_port *p, struct br_config_bpdu *b
441 if (bpdu->topology_change_ack) 441 if (bpdu->topology_change_ack)
442 br_topology_change_acknowledged(br); 442 br_topology_change_acknowledged(br);
443 } 443 }
444 } else if (br_is_designated_port(p)) { 444 } else if (br_is_designated_port(p)) {
445 br_reply(p); 445 br_reply(p);
446 } 446 }
447} 447}
448 448
diff --git a/net/bridge/br_stp_bpdu.c b/net/bridge/br_stp_bpdu.c
index 068d8afbf0a7..b9fb0dc4ab12 100644
--- a/net/bridge/br_stp_bpdu.c
+++ b/net/bridge/br_stp_bpdu.c
@@ -29,7 +29,7 @@
29#define LLC_RESERVE sizeof(struct llc_pdu_un) 29#define LLC_RESERVE sizeof(struct llc_pdu_un)
30 30
31static void br_send_bpdu(struct net_bridge_port *p, 31static void br_send_bpdu(struct net_bridge_port *p,
32 const unsigned char *data, int length) 32 const unsigned char *data, int length)
33{ 33{
34 struct sk_buff *skb; 34 struct sk_buff *skb;
35 35
diff --git a/net/bridge/br_stp_if.c b/net/bridge/br_stp_if.c
index d294224592db..58d13f2bd121 100644
--- a/net/bridge/br_stp_if.c
+++ b/net/bridge/br_stp_if.c
@@ -28,7 +28,7 @@
28 */ 28 */
29static inline port_id br_make_port_id(__u8 priority, __u16 port_no) 29static inline port_id br_make_port_id(__u8 priority, __u16 port_no)
30{ 30{
31 return ((u16)priority << BR_PORT_BITS) 31 return ((u16)priority << BR_PORT_BITS)
32 | (port_no & ((1<<BR_PORT_BITS)-1)); 32 | (port_no & ((1<<BR_PORT_BITS)-1));
33} 33}
34 34
@@ -50,7 +50,7 @@ void br_stp_enable_bridge(struct net_bridge *br)
50 spin_lock_bh(&br->lock); 50 spin_lock_bh(&br->lock);
51 mod_timer(&br->hello_timer, jiffies + br->hello_time); 51 mod_timer(&br->hello_timer, jiffies + br->hello_time);
52 mod_timer(&br->gc_timer, jiffies + HZ/10); 52 mod_timer(&br->gc_timer, jiffies + HZ/10);
53 53
54 br_config_bpdu_generation(br); 54 br_config_bpdu_generation(br);
55 55
56 list_for_each_entry(p, &br->port_list, list) { 56 list_for_each_entry(p, &br->port_list, list) {
diff --git a/net/bridge/br_stp_timer.c b/net/bridge/br_stp_timer.c
index d0fcde82c6fc..030aa798fea7 100644
--- a/net/bridge/br_stp_timer.c
+++ b/net/bridge/br_stp_timer.c
@@ -27,7 +27,7 @@ static int br_is_designated_for_some_port(const struct net_bridge *br)
27 27
28 list_for_each_entry(p, &br->port_list, list) { 28 list_for_each_entry(p, &br->port_list, list) {
29 if (p->state != BR_STATE_DISABLED && 29 if (p->state != BR_STATE_DISABLED &&
30 !memcmp(&p->designated_bridge, &br->bridge_id, 8)) 30 !memcmp(&p->designated_bridge, &br->bridge_id, 8))
31 return 1; 31 return 1;
32 } 32 }
33 33
@@ -37,7 +37,7 @@ static int br_is_designated_for_some_port(const struct net_bridge *br)
37static void br_hello_timer_expired(unsigned long arg) 37static void br_hello_timer_expired(unsigned long arg)
38{ 38{
39 struct net_bridge *br = (struct net_bridge *)arg; 39 struct net_bridge *br = (struct net_bridge *)arg;
40 40
41 pr_debug("%s: hello timer expired\n", br->dev->name); 41 pr_debug("%s: hello timer expired\n", br->dev->name);
42 spin_lock(&br->lock); 42 spin_lock(&br->lock);
43 if (br->dev->flags & IFF_UP) { 43 if (br->dev->flags & IFF_UP) {
@@ -58,11 +58,11 @@ static void br_message_age_timer_expired(unsigned long arg)
58 if (p->state == BR_STATE_DISABLED) 58 if (p->state == BR_STATE_DISABLED)
59 return; 59 return;
60 60
61 61
62 pr_info("%s: neighbor %.2x%.2x.%.2x:%.2x:%.2x:%.2x:%.2x:%.2x lost on port %d(%s)\n", 62 pr_info("%s: neighbor %.2x%.2x.%.2x:%.2x:%.2x:%.2x:%.2x:%.2x lost on port %d(%s)\n",
63 br->dev->name, 63 br->dev->name,
64 id->prio[0], id->prio[1], 64 id->prio[0], id->prio[1],
65 id->addr[0], id->addr[1], id->addr[2], 65 id->addr[0], id->addr[1], id->addr[2],
66 id->addr[3], id->addr[4], id->addr[5], 66 id->addr[3], id->addr[4], id->addr[5],
67 p->port_no, p->dev->name); 67 p->port_no, p->dev->name);
68 68
@@ -114,7 +114,7 @@ static void br_tcn_timer_expired(unsigned long arg)
114 spin_lock(&br->lock); 114 spin_lock(&br->lock);
115 if (br->dev->flags & IFF_UP) { 115 if (br->dev->flags & IFF_UP) {
116 br_transmit_tcn(br); 116 br_transmit_tcn(br);
117 117
118 mod_timer(&br->tcn_timer,jiffies + br->bridge_hello_time); 118 mod_timer(&br->tcn_timer,jiffies + br->bridge_hello_time);
119 } 119 }
120 spin_unlock(&br->lock); 120 spin_unlock(&br->lock);
@@ -135,7 +135,7 @@ static void br_hold_timer_expired(unsigned long arg)
135{ 135{
136 struct net_bridge_port *p = (struct net_bridge_port *) arg; 136 struct net_bridge_port *p = (struct net_bridge_port *) arg;
137 137
138 pr_debug("%s: %d(%s) hold timer expired\n", 138 pr_debug("%s: %d(%s) hold timer expired\n",
139 p->br->dev->name, p->port_no, p->dev->name); 139 p->br->dev->name, p->port_no, p->dev->name);
140 140
141 spin_lock(&p->br->lock); 141 spin_lock(&p->br->lock);
@@ -166,10 +166,10 @@ void br_stp_port_timer_init(struct net_bridge_port *p)
166 166
167 setup_timer(&p->forward_delay_timer, br_forward_delay_timer_expired, 167 setup_timer(&p->forward_delay_timer, br_forward_delay_timer_expired,
168 (unsigned long) p); 168 (unsigned long) p);
169 169
170 setup_timer(&p->hold_timer, br_hold_timer_expired, 170 setup_timer(&p->hold_timer, br_hold_timer_expired,
171 (unsigned long) p); 171 (unsigned long) p);
172} 172}
173 173
174/* Report ticks left (in USER_HZ) used for API */ 174/* Report ticks left (in USER_HZ) used for API */
175unsigned long br_timer_value(const struct timer_list *timer) 175unsigned long br_timer_value(const struct timer_list *timer)
diff --git a/net/bridge/br_sysfs_br.c b/net/bridge/br_sysfs_br.c
index ce10464716a7..01a22ad0cc75 100644
--- a/net/bridge/br_sysfs_br.c
+++ b/net/bridge/br_sysfs_br.c
@@ -353,19 +353,19 @@ static ssize_t brforward_read(struct kobject *kobj, char *buf,
353 if (off % sizeof(struct __fdb_entry) != 0) 353 if (off % sizeof(struct __fdb_entry) != 0)
354 return -EINVAL; 354 return -EINVAL;
355 355
356 n = br_fdb_fillbuf(br, buf, 356 n = br_fdb_fillbuf(br, buf,
357 count / sizeof(struct __fdb_entry), 357 count / sizeof(struct __fdb_entry),
358 off / sizeof(struct __fdb_entry)); 358 off / sizeof(struct __fdb_entry));
359 359
360 if (n > 0) 360 if (n > 0)
361 n *= sizeof(struct __fdb_entry); 361 n *= sizeof(struct __fdb_entry);
362 362
363 return n; 363 return n;
364} 364}
365 365
366static struct bin_attribute bridge_forward = { 366static struct bin_attribute bridge_forward = {
367 .attr = { .name = SYSFS_BRIDGE_FDB, 367 .attr = { .name = SYSFS_BRIDGE_FDB,
368 .mode = S_IRUGO, 368 .mode = S_IRUGO,
369 .owner = THIS_MODULE, }, 369 .owner = THIS_MODULE, },
370 .read = brforward_read, 370 .read = brforward_read,
371}; 371};
@@ -401,7 +401,7 @@ int br_sysfs_addbr(struct net_device *dev)
401 goto out2; 401 goto out2;
402 } 402 }
403 403
404 404
405 kobject_set_name(&br->ifobj, SYSFS_BRIDGE_PORT_SUBDIR); 405 kobject_set_name(&br->ifobj, SYSFS_BRIDGE_PORT_SUBDIR);
406 br->ifobj.ktype = NULL; 406 br->ifobj.ktype = NULL;
407 br->ifobj.kset = NULL; 407 br->ifobj.kset = NULL;
diff --git a/net/bridge/netfilter/ebt_802_3.c b/net/bridge/netfilter/ebt_802_3.c
index 9abbc09ccdc3..41a78072cd0e 100644
--- a/net/bridge/netfilter/ebt_802_3.c
+++ b/net/bridge/netfilter/ebt_802_3.c
@@ -5,7 +5,7 @@
5 * Chris Vitale csv@bluetail.com 5 * Chris Vitale csv@bluetail.com
6 * 6 *
7 * May 2003 7 * May 2003
8 * 8 *
9 */ 9 */
10 10
11#include <linux/netfilter_bridge/ebtables.h> 11#include <linux/netfilter_bridge/ebtables.h>
@@ -20,7 +20,7 @@ static int ebt_filter_802_3(const struct sk_buff *skb, const struct net_device *
20 __be16 type = hdr->llc.ui.ctrl & IS_UI ? hdr->llc.ui.type : hdr->llc.ni.type; 20 __be16 type = hdr->llc.ui.ctrl & IS_UI ? hdr->llc.ui.type : hdr->llc.ni.type;
21 21
22 if (info->bitmask & EBT_802_3_SAP) { 22 if (info->bitmask & EBT_802_3_SAP) {
23 if (FWINV(info->sap != hdr->llc.ui.ssap, EBT_802_3_SAP)) 23 if (FWINV(info->sap != hdr->llc.ui.ssap, EBT_802_3_SAP))
24 return EBT_NOMATCH; 24 return EBT_NOMATCH;
25 if (FWINV(info->sap != hdr->llc.ui.dsap, EBT_802_3_SAP)) 25 if (FWINV(info->sap != hdr->llc.ui.dsap, EBT_802_3_SAP))
26 return EBT_NOMATCH; 26 return EBT_NOMATCH;
@@ -29,7 +29,7 @@ static int ebt_filter_802_3(const struct sk_buff *skb, const struct net_device *
29 if (info->bitmask & EBT_802_3_TYPE) { 29 if (info->bitmask & EBT_802_3_TYPE) {
30 if (!(hdr->llc.ui.dsap == CHECK_TYPE && hdr->llc.ui.ssap == CHECK_TYPE)) 30 if (!(hdr->llc.ui.dsap == CHECK_TYPE && hdr->llc.ui.ssap == CHECK_TYPE))
31 return EBT_NOMATCH; 31 return EBT_NOMATCH;
32 if (FWINV(info->type != type, EBT_802_3_TYPE)) 32 if (FWINV(info->type != type, EBT_802_3_TYPE))
33 return EBT_NOMATCH; 33 return EBT_NOMATCH;
34 } 34 }
35 35
diff --git a/net/bridge/netfilter/ebt_among.c b/net/bridge/netfilter/ebt_among.c
index ce97c4285f9a..392d877040d3 100644
--- a/net/bridge/netfilter/ebt_among.c
+++ b/net/bridge/netfilter/ebt_among.c
@@ -18,7 +18,7 @@ static int ebt_mac_wormhash_contains(const struct ebt_mac_wormhash *wh,
18 const char *mac, __be32 ip) 18 const char *mac, __be32 ip)
19{ 19{
20 /* You may be puzzled as to how this code works. 20 /* You may be puzzled as to how this code works.
21 * Some tricks were used, refer to 21 * Some tricks were used, refer to
22 * include/linux/netfilter_bridge/ebt_among.h 22 * include/linux/netfilter_bridge/ebt_among.h
23 * as there you can find a solution of this mystery. 23 * as there you can find a solution of this mystery.
24 */ 24 */
@@ -207,8 +207,8 @@ static int ebt_among_check(const char *tablename, unsigned int hookmask,
207} 207}
208 208
209static struct ebt_match filter_among = { 209static struct ebt_match filter_among = {
210 .name = EBT_AMONG_MATCH, 210 .name = EBT_AMONG_MATCH,
211 .match = ebt_filter_among, 211 .match = ebt_filter_among,
212 .check = ebt_among_check, 212 .check = ebt_among_check,
213 .me = THIS_MODULE, 213 .me = THIS_MODULE,
214}; 214};
diff --git a/net/bridge/netfilter/ebt_arpreply.c b/net/bridge/netfilter/ebt_arpreply.c
index 0aa7b9910a86..ffe468a632e7 100644
--- a/net/bridge/netfilter/ebt_arpreply.c
+++ b/net/bridge/netfilter/ebt_arpreply.c
@@ -51,7 +51,7 @@ static int ebt_target_reply(struct sk_buff **pskb, unsigned int hooknr,
51 return EBT_DROP; 51 return EBT_DROP;
52 52
53 arp_send(ARPOP_REPLY, ETH_P_ARP, *siptr, (struct net_device *)in, 53 arp_send(ARPOP_REPLY, ETH_P_ARP, *siptr, (struct net_device *)in,
54 *diptr, shp, info->mac, shp); 54 *diptr, shp, info->mac, shp);
55 55
56 return info->target; 56 return info->target;
57} 57}
diff --git a/net/bridge/netfilter/ebt_ip.c b/net/bridge/netfilter/ebt_ip.c
index 6afa4d017d4a..69f7f0ab9c76 100644
--- a/net/bridge/netfilter/ebt_ip.c
+++ b/net/bridge/netfilter/ebt_ip.c
@@ -61,15 +61,15 @@ static int ebt_filter_ip(const struct sk_buff *skb, const struct net_device *in,
61 if (info->bitmask & EBT_IP_DPORT) { 61 if (info->bitmask & EBT_IP_DPORT) {
62 u32 dst = ntohs(pptr->dst); 62 u32 dst = ntohs(pptr->dst);
63 if (FWINV(dst < info->dport[0] || 63 if (FWINV(dst < info->dport[0] ||
64 dst > info->dport[1], 64 dst > info->dport[1],
65 EBT_IP_DPORT)) 65 EBT_IP_DPORT))
66 return EBT_NOMATCH; 66 return EBT_NOMATCH;
67 } 67 }
68 if (info->bitmask & EBT_IP_SPORT) { 68 if (info->bitmask & EBT_IP_SPORT) {
69 u32 src = ntohs(pptr->src); 69 u32 src = ntohs(pptr->src);
70 if (FWINV(src < info->sport[0] || 70 if (FWINV(src < info->sport[0] ||
71 src > info->sport[1], 71 src > info->sport[1],
72 EBT_IP_SPORT)) 72 EBT_IP_SPORT))
73 return EBT_NOMATCH; 73 return EBT_NOMATCH;
74 } 74 }
75 } 75 }
diff --git a/net/bridge/netfilter/ebt_log.c b/net/bridge/netfilter/ebt_log.c
index 985df82e427b..f9a5ae9d5b6d 100644
--- a/net/bridge/netfilter/ebt_log.c
+++ b/net/bridge/netfilter/ebt_log.c
@@ -169,10 +169,10 @@ static void ebt_log(const struct sk_buff *skb, unsigned int hooknr,
169 169
170 if (info->bitmask & EBT_LOG_NFLOG) 170 if (info->bitmask & EBT_LOG_NFLOG)
171 nf_log_packet(PF_BRIDGE, hooknr, skb, in, out, &li, 171 nf_log_packet(PF_BRIDGE, hooknr, skb, in, out, &li,
172 "%s", info->prefix); 172 "%s", info->prefix);
173 else 173 else
174 ebt_log_packet(PF_BRIDGE, hooknr, skb, in, out, &li, 174 ebt_log_packet(PF_BRIDGE, hooknr, skb, in, out, &li,
175 info->prefix); 175 info->prefix);
176} 176}
177 177
178static struct ebt_watcher log = 178static struct ebt_watcher log =
@@ -199,7 +199,7 @@ static int __init ebt_log_init(void)
199 if (nf_log_register(PF_BRIDGE, &ebt_log_logger) < 0) { 199 if (nf_log_register(PF_BRIDGE, &ebt_log_logger) < 0) {
200 printk(KERN_WARNING "ebt_log: not logging via system console " 200 printk(KERN_WARNING "ebt_log: not logging via system console "
201 "since somebody else already registered for PF_INET\n"); 201 "since somebody else already registered for PF_INET\n");
202 /* we cannot make module load fail here, since otherwise 202 /* we cannot make module load fail here, since otherwise
203 * ebtables userspace would abort */ 203 * ebtables userspace would abort */
204 } 204 }
205 205
diff --git a/net/bridge/netfilter/ebt_mark_m.c b/net/bridge/netfilter/ebt_mark_m.c
index 025869ee0b68..6b0d2169af74 100644
--- a/net/bridge/netfilter/ebt_mark_m.c
+++ b/net/bridge/netfilter/ebt_mark_m.c
@@ -26,7 +26,7 @@ static int ebt_filter_mark(const struct sk_buff *skb,
26static int ebt_mark_check(const char *tablename, unsigned int hookmask, 26static int ebt_mark_check(const char *tablename, unsigned int hookmask,
27 const struct ebt_entry *e, void *data, unsigned int datalen) 27 const struct ebt_entry *e, void *data, unsigned int datalen)
28{ 28{
29 struct ebt_mark_m_info *info = (struct ebt_mark_m_info *) data; 29 struct ebt_mark_m_info *info = (struct ebt_mark_m_info *) data;
30 30
31 if (datalen != EBT_ALIGN(sizeof(struct ebt_mark_m_info))) 31 if (datalen != EBT_ALIGN(sizeof(struct ebt_mark_m_info)))
32 return -EINVAL; 32 return -EINVAL;
diff --git a/net/bridge/netfilter/ebt_stp.c b/net/bridge/netfilter/ebt_stp.c
index a0bed82145ed..31b77367319c 100644
--- a/net/bridge/netfilter/ebt_stp.c
+++ b/net/bridge/netfilter/ebt_stp.c
@@ -62,7 +62,7 @@ static int ebt_filter_config(struct ebt_stp_info *info,
62 verdict = 0; 62 verdict = 0;
63 for (i = 0; i < 6; i++) 63 for (i = 0; i < 6; i++)
64 verdict |= (stpc->root[2+i] ^ c->root_addr[i]) & 64 verdict |= (stpc->root[2+i] ^ c->root_addr[i]) &
65 c->root_addrmsk[i]; 65 c->root_addrmsk[i];
66 if (FWINV(verdict != 0, EBT_STP_ROOTADDR)) 66 if (FWINV(verdict != 0, EBT_STP_ROOTADDR))
67 return EBT_NOMATCH; 67 return EBT_NOMATCH;
68 } 68 }
@@ -82,7 +82,7 @@ static int ebt_filter_config(struct ebt_stp_info *info,
82 verdict = 0; 82 verdict = 0;
83 for (i = 0; i < 6; i++) 83 for (i = 0; i < 6; i++)
84 verdict |= (stpc->sender[2+i] ^ c->sender_addr[i]) & 84 verdict |= (stpc->sender[2+i] ^ c->sender_addr[i]) &
85 c->sender_addrmsk[i]; 85 c->sender_addrmsk[i];
86 if (FWINV(verdict != 0, EBT_STP_SENDERADDR)) 86 if (FWINV(verdict != 0, EBT_STP_SENDERADDR))
87 return EBT_NOMATCH; 87 return EBT_NOMATCH;
88 } 88 }
diff --git a/net/bridge/netfilter/ebt_ulog.c b/net/bridge/netfilter/ebt_ulog.c
index c1af68b5a29c..2e4cb24e191a 100644
--- a/net/bridge/netfilter/ebt_ulog.c
+++ b/net/bridge/netfilter/ebt_ulog.c
@@ -10,8 +10,8 @@
10 * Based on ipt_ULOG.c, which is 10 * Based on ipt_ULOG.c, which is
11 * (C) 2000-2002 by Harald Welte <laforge@netfilter.org> 11 * (C) 2000-2002 by Harald Welte <laforge@netfilter.org>
12 * 12 *
13 * This module accepts two parameters: 13 * This module accepts two parameters:
14 * 14 *
15 * nlbufsiz: 15 * nlbufsiz:
16 * The parameter specifies how big the buffer for each netlink multicast 16 * The parameter specifies how big the buffer for each netlink multicast
17 * group is. e.g. If you say nlbufsiz=8192, up to eight kb of packets will 17 * group is. e.g. If you say nlbufsiz=8192, up to eight kb of packets will
@@ -43,17 +43,17 @@
43#include "../br_private.h" 43#include "../br_private.h"
44 44
45#define PRINTR(format, args...) do { if (net_ratelimit()) \ 45#define PRINTR(format, args...) do { if (net_ratelimit()) \
46 printk(format , ## args); } while (0) 46 printk(format , ## args); } while (0)
47 47
48static unsigned int nlbufsiz = NLMSG_GOODSIZE; 48static unsigned int nlbufsiz = NLMSG_GOODSIZE;
49module_param(nlbufsiz, uint, 0600); 49module_param(nlbufsiz, uint, 0600);
50MODULE_PARM_DESC(nlbufsiz, "netlink buffer size (number of bytes) " 50MODULE_PARM_DESC(nlbufsiz, "netlink buffer size (number of bytes) "
51 "(defaults to 4096)"); 51 "(defaults to 4096)");
52 52
53static unsigned int flushtimeout = 10; 53static unsigned int flushtimeout = 10;
54module_param(flushtimeout, uint, 0600); 54module_param(flushtimeout, uint, 0600);
55MODULE_PARM_DESC(flushtimeout, "buffer flush timeout (hundredths ofa second) " 55MODULE_PARM_DESC(flushtimeout, "buffer flush timeout (hundredths ofa second) "
56 "(defaults to 10)"); 56 "(defaults to 10)");
57 57
58typedef struct { 58typedef struct {
59 unsigned int qlen; /* number of nlmsgs' in the skb */ 59 unsigned int qlen; /* number of nlmsgs' in the skb */
@@ -157,7 +157,7 @@ static void ebt_ulog_packet(unsigned int hooknr, const struct sk_buff *skb,
157 } 157 }
158 158
159 nlh = NLMSG_PUT(ub->skb, 0, ub->qlen, 0, 159 nlh = NLMSG_PUT(ub->skb, 0, ub->qlen, 0,
160 size - NLMSG_ALIGN(sizeof(*nlh))); 160 size - NLMSG_ALIGN(sizeof(*nlh)));
161 ub->qlen++; 161 ub->qlen++;
162 162
163 pm = NLMSG_DATA(nlh); 163 pm = NLMSG_DATA(nlh);
@@ -302,7 +302,7 @@ static int __init ebt_ulog_init(void)
302 } 302 }
303 303
304 ebtulognl = netlink_kernel_create(NETLINK_NFLOG, EBT_ULOG_MAXNLGROUPS, 304 ebtulognl = netlink_kernel_create(NETLINK_NFLOG, EBT_ULOG_MAXNLGROUPS,
305 NULL, THIS_MODULE); 305 NULL, THIS_MODULE);
306 if (!ebtulognl) 306 if (!ebtulognl)
307 ret = -ENOMEM; 307 ret = -ENOMEM;
308 else if ((ret = ebt_register_watcher(&ulog))) 308 else if ((ret = ebt_register_watcher(&ulog)))
@@ -344,4 +344,4 @@ module_exit(ebt_ulog_fini);
344MODULE_LICENSE("GPL"); 344MODULE_LICENSE("GPL");
345MODULE_AUTHOR("Bart De Schuymer <bdschuym@pandora.be>"); 345MODULE_AUTHOR("Bart De Schuymer <bdschuym@pandora.be>");
346MODULE_DESCRIPTION("ebtables userspace logging module for bridged Ethernet" 346MODULE_DESCRIPTION("ebtables userspace logging module for bridged Ethernet"
347 " frames"); 347 " frames");
diff --git a/net/bridge/netfilter/ebt_vlan.c b/net/bridge/netfilter/ebt_vlan.c
index 7ee377622964..a43c697d3d73 100644
--- a/net/bridge/netfilter/ebt_vlan.c
+++ b/net/bridge/netfilter/ebt_vlan.c
@@ -128,9 +128,9 @@ ebt_check_vlan(const char *tablename,
128 128
129 /* Reserved VLAN ID (VID) values 129 /* Reserved VLAN ID (VID) values
130 * ----------------------------- 130 * -----------------------------
131 * 0 - The null VLAN ID. 131 * 0 - The null VLAN ID.
132 * 1 - The default Port VID (PVID) 132 * 1 - The default Port VID (PVID)
133 * 0x0FFF - Reserved for implementation use. 133 * 0x0FFF - Reserved for implementation use.
134 * if_vlan.h: VLAN_GROUP_ARRAY_LEN 4096. */ 134 * if_vlan.h: VLAN_GROUP_ARRAY_LEN 4096. */
135 if (GET_BITMASK(EBT_VLAN_ID)) { 135 if (GET_BITMASK(EBT_VLAN_ID)) {
136 if (!!info->id) { /* if id!=0 => check vid range */ 136 if (!!info->id) { /* if id!=0 => check vid range */
@@ -141,7 +141,7 @@ ebt_check_vlan(const char *tablename,
141 return -EINVAL; 141 return -EINVAL;
142 } 142 }
143 /* Note: This is valid VLAN-tagged frame point. 143 /* Note: This is valid VLAN-tagged frame point.
144 * Any value of user_priority are acceptable, 144 * Any value of user_priority are acceptable,
145 * but should be ignored according to 802.1Q Std. 145 * but should be ignored according to 802.1Q Std.
146 * So we just drop the prio flag. */ 146 * So we just drop the prio flag. */
147 info->bitmask &= ~EBT_VLAN_PRIO; 147 info->bitmask &= ~EBT_VLAN_PRIO;
diff --git a/net/bridge/netfilter/ebtable_filter.c b/net/bridge/netfilter/ebtable_filter.c
index 127135ead2d5..81d84145c417 100644
--- a/net/bridge/netfilter/ebtable_filter.c
+++ b/net/bridge/netfilter/ebtable_filter.c
@@ -51,10 +51,10 @@ static int check(const struct ebt_table_info *info, unsigned int valid_hooks)
51} 51}
52 52
53static struct ebt_table frame_filter = 53static struct ebt_table frame_filter =
54{ 54{
55 .name = "filter", 55 .name = "filter",
56 .table = &initial_table, 56 .table = &initial_table,
57 .valid_hooks = FILTER_VALID_HOOKS, 57 .valid_hooks = FILTER_VALID_HOOKS,
58 .lock = RW_LOCK_UNLOCKED, 58 .lock = RW_LOCK_UNLOCKED,
59 .check = check, 59 .check = check,
60 .me = THIS_MODULE, 60 .me = THIS_MODULE,
diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c
index 6c84ccb8c9d7..5818d70b8e8d 100644
--- a/net/bridge/netfilter/ebtables.c
+++ b/net/bridge/netfilter/ebtables.c
@@ -33,10 +33,10 @@
33#include "../br_private.h" 33#include "../br_private.h"
34 34
35#define BUGPRINT(format, args...) printk("kernel msg: ebtables bug: please "\ 35#define BUGPRINT(format, args...) printk("kernel msg: ebtables bug: please "\
36 "report to author: "format, ## args) 36 "report to author: "format, ## args)
37/* #define BUGPRINT(format, args...) */ 37/* #define BUGPRINT(format, args...) */
38#define MEMPRINT(format, args...) printk("kernel msg: ebtables "\ 38#define MEMPRINT(format, args...) printk("kernel msg: ebtables "\
39 ": out of memory: "format, ## args) 39 ": out of memory: "format, ## args)
40/* #define MEMPRINT(format, args...) */ 40/* #define MEMPRINT(format, args...) */
41 41
42 42
@@ -482,7 +482,7 @@ ebt_check_entry_size_and_hooks(struct ebt_entry *e,
482 as it said it has */ 482 as it said it has */
483 if (*n != *cnt) { 483 if (*n != *cnt) {
484 BUGPRINT("nentries does not equal the nr of entries " 484 BUGPRINT("nentries does not equal the nr of entries "
485 "in the chain\n"); 485 "in the chain\n");
486 return -EINVAL; 486 return -EINVAL;
487 } 487 }
488 if (((struct ebt_entries *)e)->policy != EBT_DROP && 488 if (((struct ebt_entries *)e)->policy != EBT_DROP &&
@@ -809,7 +809,7 @@ static int translate_table(char *name, struct ebt_table_info *newinfo)
809 i = 0; /* holds the expected nr. of entries for the chain */ 809 i = 0; /* holds the expected nr. of entries for the chain */
810 j = 0; /* holds the up to now counted entries for the chain */ 810 j = 0; /* holds the up to now counted entries for the chain */
811 k = 0; /* holds the total nr. of entries, should equal 811 k = 0; /* holds the total nr. of entries, should equal
812 newinfo->nentries afterwards */ 812 newinfo->nentries afterwards */
813 udc_cnt = 0; /* will hold the nr. of user defined chains (udc) */ 813 udc_cnt = 0; /* will hold the nr. of user defined chains (udc) */
814 ret = EBT_ENTRY_ITERATE(newinfo->entries, newinfo->entries_size, 814 ret = EBT_ENTRY_ITERATE(newinfo->entries, newinfo->entries_size,
815 ebt_check_entry_size_and_hooks, newinfo, 815 ebt_check_entry_size_and_hooks, newinfo,
@@ -820,7 +820,7 @@ static int translate_table(char *name, struct ebt_table_info *newinfo)
820 820
821 if (i != j) { 821 if (i != j) {
822 BUGPRINT("nentries does not equal the nr of entries in the " 822 BUGPRINT("nentries does not equal the nr of entries in the "
823 "(last) chain\n"); 823 "(last) chain\n");
824 return -EINVAL; 824 return -EINVAL;
825 } 825 }
826 if (k != newinfo->nentries) { 826 if (k != newinfo->nentries) {
@@ -835,7 +835,7 @@ static int translate_table(char *name, struct ebt_table_info *newinfo)
835 if an error occurs */ 835 if an error occurs */
836 newinfo->chainstack = 836 newinfo->chainstack =
837 vmalloc((highest_possible_processor_id()+1) 837 vmalloc((highest_possible_processor_id()+1)
838 * sizeof(*(newinfo->chainstack))); 838 * sizeof(*(newinfo->chainstack)));
839 if (!newinfo->chainstack) 839 if (!newinfo->chainstack)
840 return -ENOMEM; 840 return -ENOMEM;
841 for_each_possible_cpu(i) { 841 for_each_possible_cpu(i) {
@@ -948,7 +948,7 @@ static int do_replace(void __user *user, unsigned int len)
948 if (tmp.num_counters >= INT_MAX / sizeof(struct ebt_counter)) 948 if (tmp.num_counters >= INT_MAX / sizeof(struct ebt_counter))
949 return -ENOMEM; 949 return -ENOMEM;
950 950
951 countersize = COUNTER_OFFSET(tmp.nentries) * 951 countersize = COUNTER_OFFSET(tmp.nentries) *
952 (highest_possible_processor_id()+1); 952 (highest_possible_processor_id()+1);
953 newinfo = vmalloc(sizeof(*newinfo) + countersize); 953 newinfo = vmalloc(sizeof(*newinfo) + countersize);
954 if (!newinfo) 954 if (!newinfo)
@@ -1350,7 +1350,7 @@ static inline int ebt_make_names(struct ebt_entry *e, char *base, char __user *u
1350 1350
1351 hlp = ubase + (((char *)e + e->target_offset) - base); 1351 hlp = ubase + (((char *)e + e->target_offset) - base);
1352 t = (struct ebt_entry_target *)(((char *)e) + e->target_offset); 1352 t = (struct ebt_entry_target *)(((char *)e) + e->target_offset);
1353 1353
1354 ret = EBT_MATCH_ITERATE(e, ebt_make_matchname, base, ubase); 1354 ret = EBT_MATCH_ITERATE(e, ebt_make_matchname, base, ubase);
1355 if (ret != 0) 1355 if (ret != 0)
1356 return ret; 1356 return ret;