aboutsummaryrefslogtreecommitdiffstats
path: root/net/bridge/br_fdb.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/bridge/br_fdb.c')
-rw-r--r--net/bridge/br_fdb.c34
1 files changed, 17 insertions, 17 deletions
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);