aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv/bridge_loop_avoidance.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/batman-adv/bridge_loop_avoidance.c')
-rw-r--r--net/batman-adv/bridge_loop_avoidance.c518
1 files changed, 270 insertions, 248 deletions
diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c
index 52c0d637d581..0592d2bcb9b5 100644
--- a/net/batman-adv/bridge_loop_avoidance.c
+++ b/net/batman-adv/bridge_loop_avoidance.c
@@ -31,14 +31,14 @@
31#include <net/arp.h> 31#include <net/arp.h>
32#include <linux/if_vlan.h> 32#include <linux/if_vlan.h>
33 33
34static const uint8_t announce_mac[4] = {0x43, 0x05, 0x43, 0x05}; 34static const uint8_t batadv_announce_mac[4] = {0x43, 0x05, 0x43, 0x05};
35 35
36static void bla_periodic_work(struct work_struct *work); 36static void batadv_bla_periodic_work(struct work_struct *work);
37static void bla_send_announce(struct bat_priv *bat_priv, 37static void batadv_bla_send_announce(struct bat_priv *bat_priv,
38 struct backbone_gw *backbone_gw); 38 struct backbone_gw *backbone_gw);
39 39
40/* return the index of the claim */ 40/* return the index of the claim */
41static inline uint32_t choose_claim(const void *data, uint32_t size) 41static inline uint32_t batadv_choose_claim(const void *data, uint32_t size)
42{ 42{
43 const unsigned char *key = data; 43 const unsigned char *key = data;
44 uint32_t hash = 0; 44 uint32_t hash = 0;
@@ -58,7 +58,8 @@ static inline uint32_t choose_claim(const void *data, uint32_t size)
58} 58}
59 59
60/* return the index of the backbone gateway */ 60/* return the index of the backbone gateway */
61static inline uint32_t choose_backbone_gw(const void *data, uint32_t size) 61static inline uint32_t batadv_choose_backbone_gw(const void *data,
62 uint32_t size)
62{ 63{
63 const unsigned char *key = data; 64 const unsigned char *key = data;
64 uint32_t hash = 0; 65 uint32_t hash = 0;
@@ -79,7 +80,8 @@ static inline uint32_t choose_backbone_gw(const void *data, uint32_t size)
79 80
80 81
81/* compares address and vid of two backbone gws */ 82/* compares address and vid of two backbone gws */
82static int compare_backbone_gw(const struct hlist_node *node, const void *data2) 83static int batadv_compare_backbone_gw(const struct hlist_node *node,
84 const void *data2)
83{ 85{
84 const void *data1 = container_of(node, struct backbone_gw, 86 const void *data1 = container_of(node, struct backbone_gw,
85 hash_entry); 87 hash_entry);
@@ -88,7 +90,8 @@ static int compare_backbone_gw(const struct hlist_node *node, const void *data2)
88} 90}
89 91
90/* compares address and vid of two claims */ 92/* compares address and vid of two claims */
91static int compare_claim(const struct hlist_node *node, const void *data2) 93static int batadv_compare_claim(const struct hlist_node *node,
94 const void *data2)
92{ 95{
93 const void *data1 = container_of(node, struct claim, 96 const void *data1 = container_of(node, struct claim,
94 hash_entry); 97 hash_entry);
@@ -97,28 +100,28 @@ static int compare_claim(const struct hlist_node *node, const void *data2)
97} 100}
98 101
99/* free a backbone gw */ 102/* free a backbone gw */
100static void backbone_gw_free_ref(struct backbone_gw *backbone_gw) 103static void batadv_backbone_gw_free_ref(struct backbone_gw *backbone_gw)
101{ 104{
102 if (atomic_dec_and_test(&backbone_gw->refcount)) 105 if (atomic_dec_and_test(&backbone_gw->refcount))
103 kfree_rcu(backbone_gw, rcu); 106 kfree_rcu(backbone_gw, rcu);
104} 107}
105 108
106/* finally deinitialize the claim */ 109/* finally deinitialize the claim */
107static void claim_free_rcu(struct rcu_head *rcu) 110static void batadv_claim_free_rcu(struct rcu_head *rcu)
108{ 111{
109 struct claim *claim; 112 struct claim *claim;
110 113
111 claim = container_of(rcu, struct claim, rcu); 114 claim = container_of(rcu, struct claim, rcu);
112 115
113 backbone_gw_free_ref(claim->backbone_gw); 116 batadv_backbone_gw_free_ref(claim->backbone_gw);
114 kfree(claim); 117 kfree(claim);
115} 118}
116 119
117/* free a claim, call claim_free_rcu if its the last reference */ 120/* free a claim, call claim_free_rcu if its the last reference */
118static void claim_free_ref(struct claim *claim) 121static void batadv_claim_free_ref(struct claim *claim)
119{ 122{
120 if (atomic_dec_and_test(&claim->refcount)) 123 if (atomic_dec_and_test(&claim->refcount))
121 call_rcu(&claim->rcu, claim_free_rcu); 124 call_rcu(&claim->rcu, batadv_claim_free_rcu);
122} 125}
123 126
124/* @bat_priv: the bat priv with all the soft interface information 127/* @bat_priv: the bat priv with all the soft interface information
@@ -127,8 +130,8 @@ static void claim_free_ref(struct claim *claim)
127 * looks for a claim in the hash, and returns it if found 130 * looks for a claim in the hash, and returns it if found
128 * or NULL otherwise. 131 * or NULL otherwise.
129 */ 132 */
130static struct claim *claim_hash_find(struct bat_priv *bat_priv, 133static struct claim *batadv_claim_hash_find(struct bat_priv *bat_priv,
131 struct claim *data) 134 struct claim *data)
132{ 135{
133 struct hashtable_t *hash = bat_priv->claim_hash; 136 struct hashtable_t *hash = bat_priv->claim_hash;
134 struct hlist_head *head; 137 struct hlist_head *head;
@@ -140,12 +143,12 @@ static struct claim *claim_hash_find(struct bat_priv *bat_priv,
140 if (!hash) 143 if (!hash)
141 return NULL; 144 return NULL;
142 145
143 index = choose_claim(data, hash->size); 146 index = batadv_choose_claim(data, hash->size);
144 head = &hash->table[index]; 147 head = &hash->table[index];
145 148
146 rcu_read_lock(); 149 rcu_read_lock();
147 hlist_for_each_entry_rcu(claim, node, head, hash_entry) { 150 hlist_for_each_entry_rcu(claim, node, head, hash_entry) {
148 if (!compare_claim(&claim->hash_entry, data)) 151 if (!batadv_compare_claim(&claim->hash_entry, data))
149 continue; 152 continue;
150 153
151 if (!atomic_inc_not_zero(&claim->refcount)) 154 if (!atomic_inc_not_zero(&claim->refcount))
@@ -166,8 +169,8 @@ static struct claim *claim_hash_find(struct bat_priv *bat_priv,
166 * looks for a claim in the hash, and returns it if found 169 * looks for a claim in the hash, and returns it if found
167 * or NULL otherwise. 170 * or NULL otherwise.
168 */ 171 */
169static struct backbone_gw *backbone_hash_find(struct bat_priv *bat_priv, 172static struct backbone_gw *batadv_backbone_hash_find(struct bat_priv *bat_priv,
170 uint8_t *addr, short vid) 173 uint8_t *addr, short vid)
171{ 174{
172 struct hashtable_t *hash = bat_priv->backbone_hash; 175 struct hashtable_t *hash = bat_priv->backbone_hash;
173 struct hlist_head *head; 176 struct hlist_head *head;
@@ -182,13 +185,13 @@ static struct backbone_gw *backbone_hash_find(struct bat_priv *bat_priv,
182 memcpy(search_entry.orig, addr, ETH_ALEN); 185 memcpy(search_entry.orig, addr, ETH_ALEN);
183 search_entry.vid = vid; 186 search_entry.vid = vid;
184 187
185 index = choose_backbone_gw(&search_entry, hash->size); 188 index = batadv_choose_backbone_gw(&search_entry, hash->size);
186 head = &hash->table[index]; 189 head = &hash->table[index];
187 190
188 rcu_read_lock(); 191 rcu_read_lock();
189 hlist_for_each_entry_rcu(backbone_gw, node, head, hash_entry) { 192 hlist_for_each_entry_rcu(backbone_gw, node, head, hash_entry) {
190 if (!compare_backbone_gw(&backbone_gw->hash_entry, 193 if (!batadv_compare_backbone_gw(&backbone_gw->hash_entry,
191 &search_entry)) 194 &search_entry))
192 continue; 195 continue;
193 196
194 if (!atomic_inc_not_zero(&backbone_gw->refcount)) 197 if (!atomic_inc_not_zero(&backbone_gw->refcount))
@@ -203,7 +206,7 @@ static struct backbone_gw *backbone_hash_find(struct bat_priv *bat_priv,
203} 206}
204 207
205/* delete all claims for a backbone */ 208/* delete all claims for a backbone */
206static void bla_del_backbone_claims(struct backbone_gw *backbone_gw) 209static void batadv_bla_del_backbone_claims(struct backbone_gw *backbone_gw)
207{ 210{
208 struct hashtable_t *hash; 211 struct hashtable_t *hash;
209 struct hlist_node *node, *node_tmp; 212 struct hlist_node *node, *node_tmp;
@@ -227,7 +230,7 @@ static void bla_del_backbone_claims(struct backbone_gw *backbone_gw)
227 if (claim->backbone_gw != backbone_gw) 230 if (claim->backbone_gw != backbone_gw)
228 continue; 231 continue;
229 232
230 claim_free_ref(claim); 233 batadv_claim_free_ref(claim);
231 hlist_del_rcu(node); 234 hlist_del_rcu(node);
232 } 235 }
233 spin_unlock_bh(list_lock); 236 spin_unlock_bh(list_lock);
@@ -244,8 +247,8 @@ static void bla_del_backbone_claims(struct backbone_gw *backbone_gw)
244 * 247 *
245 * sends a claim frame according to the provided info. 248 * sends a claim frame according to the provided info.
246 */ 249 */
247static void bla_send_claim(struct bat_priv *bat_priv, uint8_t *mac, 250static void batadv_bla_send_claim(struct bat_priv *bat_priv, uint8_t *mac,
248 short vid, int claimtype) 251 short vid, int claimtype)
249{ 252{
250 struct sk_buff *skb; 253 struct sk_buff *skb;
251 struct ethhdr *ethhdr; 254 struct ethhdr *ethhdr;
@@ -255,7 +258,7 @@ static void bla_send_claim(struct bat_priv *bat_priv, uint8_t *mac,
255 struct bla_claim_dst local_claim_dest; 258 struct bla_claim_dst local_claim_dest;
256 __be32 zeroip = 0; 259 __be32 zeroip = 0;
257 260
258 primary_if = primary_if_get_selected(bat_priv); 261 primary_if = batadv_primary_if_get_selected(bat_priv);
259 if (!primary_if) 262 if (!primary_if)
260 return; 263 return;
261 264
@@ -294,25 +297,26 @@ static void bla_send_claim(struct bat_priv *bat_priv, uint8_t *mac,
294 * set Ethernet SRC to the clients mac 297 * set Ethernet SRC to the clients mac
295 */ 298 */
296 memcpy(ethhdr->h_source, mac, ETH_ALEN); 299 memcpy(ethhdr->h_source, mac, ETH_ALEN);
297 bat_dbg(DBG_BLA, bat_priv, 300 batadv_dbg(DBG_BLA, bat_priv,
298 "bla_send_claim(): CLAIM %pM on vid %d\n", mac, vid); 301 "bla_send_claim(): CLAIM %pM on vid %d\n", mac, vid);
299 break; 302 break;
300 case CLAIM_TYPE_DEL: 303 case CLAIM_TYPE_DEL:
301 /* unclaim frame 304 /* unclaim frame
302 * set HW SRC to the clients mac 305 * set HW SRC to the clients mac
303 */ 306 */
304 memcpy(hw_src, mac, ETH_ALEN); 307 memcpy(hw_src, mac, ETH_ALEN);
305 bat_dbg(DBG_BLA, bat_priv, 308 batadv_dbg(DBG_BLA, bat_priv,
306 "bla_send_claim(): UNCLAIM %pM on vid %d\n", mac, vid); 309 "bla_send_claim(): UNCLAIM %pM on vid %d\n", mac,
310 vid);
307 break; 311 break;
308 case CLAIM_TYPE_ANNOUNCE: 312 case CLAIM_TYPE_ANNOUNCE:
309 /* announcement frame 313 /* announcement frame
310 * set HW SRC to the special mac containg the crc 314 * set HW SRC to the special mac containg the crc
311 */ 315 */
312 memcpy(hw_src, mac, ETH_ALEN); 316 memcpy(hw_src, mac, ETH_ALEN);
313 bat_dbg(DBG_BLA, bat_priv, 317 batadv_dbg(DBG_BLA, bat_priv,
314 "bla_send_claim(): ANNOUNCE of %pM on vid %d\n", 318 "bla_send_claim(): ANNOUNCE of %pM on vid %d\n",
315 ethhdr->h_source, vid); 319 ethhdr->h_source, vid);
316 break; 320 break;
317 case CLAIM_TYPE_REQUEST: 321 case CLAIM_TYPE_REQUEST:
318 /* request frame 322 /* request frame
@@ -320,9 +324,9 @@ static void bla_send_claim(struct bat_priv *bat_priv, uint8_t *mac,
320 */ 324 */
321 memcpy(hw_src, mac, ETH_ALEN); 325 memcpy(hw_src, mac, ETH_ALEN);
322 memcpy(ethhdr->h_dest, mac, ETH_ALEN); 326 memcpy(ethhdr->h_dest, mac, ETH_ALEN);
323 bat_dbg(DBG_BLA, bat_priv, 327 batadv_dbg(DBG_BLA, bat_priv,
324 "bla_send_claim(): REQUEST of %pM to %pMon vid %d\n", 328 "bla_send_claim(): REQUEST of %pM to %pMon vid %d\n",
325 ethhdr->h_source, ethhdr->h_dest, vid); 329 ethhdr->h_source, ethhdr->h_dest, vid);
326 break; 330 break;
327 331
328 } 332 }
@@ -339,7 +343,7 @@ static void bla_send_claim(struct bat_priv *bat_priv, uint8_t *mac,
339 netif_rx(skb); 343 netif_rx(skb);
340out: 344out:
341 if (primary_if) 345 if (primary_if)
342 hardif_free_ref(primary_if); 346 batadv_hardif_free_ref(primary_if);
343} 347}
344 348
345/* @bat_priv: the bat priv with all the soft interface information 349/* @bat_priv: the bat priv with all the soft interface information
@@ -349,21 +353,21 @@ out:
349 * searches for the backbone gw or creates a new one if it could not 353 * searches for the backbone gw or creates a new one if it could not
350 * be found. 354 * be found.
351 */ 355 */
352static struct backbone_gw *bla_get_backbone_gw(struct bat_priv *bat_priv, 356static struct backbone_gw *batadv_bla_get_backbone_gw(struct bat_priv *bat_priv,
353 uint8_t *orig, short vid) 357 uint8_t *orig, short vid)
354{ 358{
355 struct backbone_gw *entry; 359 struct backbone_gw *entry;
356 struct orig_node *orig_node; 360 struct orig_node *orig_node;
357 int hash_added; 361 int hash_added;
358 362
359 entry = backbone_hash_find(bat_priv, orig, vid); 363 entry = batadv_backbone_hash_find(bat_priv, orig, vid);
360 364
361 if (entry) 365 if (entry)
362 return entry; 366 return entry;
363 367
364 bat_dbg(DBG_BLA, bat_priv, 368 batadv_dbg(DBG_BLA, bat_priv,
365 "bla_get_backbone_gw(): not found (%pM, %d), creating new entry\n", 369 "bla_get_backbone_gw(): not found (%pM, %d), creating new entry\n",
366 orig, vid); 370 orig, vid);
367 371
368 entry = kzalloc(sizeof(*entry), GFP_ATOMIC); 372 entry = kzalloc(sizeof(*entry), GFP_ATOMIC);
369 if (!entry) 373 if (!entry)
@@ -379,8 +383,10 @@ static struct backbone_gw *bla_get_backbone_gw(struct bat_priv *bat_priv,
379 /* one for the hash, one for returning */ 383 /* one for the hash, one for returning */
380 atomic_set(&entry->refcount, 2); 384 atomic_set(&entry->refcount, 2);
381 385
382 hash_added = hash_add(bat_priv->backbone_hash, compare_backbone_gw, 386 hash_added = batadv_hash_add(bat_priv->backbone_hash,
383 choose_backbone_gw, entry, &entry->hash_entry); 387 batadv_compare_backbone_gw,
388 batadv_choose_backbone_gw, entry,
389 &entry->hash_entry);
384 390
385 if (unlikely(hash_added != 0)) { 391 if (unlikely(hash_added != 0)) {
386 /* hash failed, free the structure */ 392 /* hash failed, free the structure */
@@ -389,7 +395,7 @@ static struct backbone_gw *bla_get_backbone_gw(struct bat_priv *bat_priv,
389 } 395 }
390 396
391 /* this is a gateway now, remove any tt entries */ 397 /* this is a gateway now, remove any tt entries */
392 orig_node = orig_hash_find(bat_priv, orig); 398 orig_node = batadv_orig_hash_find(bat_priv, orig);
393 if (orig_node) { 399 if (orig_node) {
394 batadv_tt_global_del_orig(bat_priv, orig_node, 400 batadv_tt_global_del_orig(bat_priv, orig_node,
395 "became a backbone gateway"); 401 "became a backbone gateway");
@@ -401,19 +407,20 @@ static struct backbone_gw *bla_get_backbone_gw(struct bat_priv *bat_priv,
401/* update or add the own backbone gw to make sure we announce 407/* update or add the own backbone gw to make sure we announce
402 * where we receive other backbone gws 408 * where we receive other backbone gws
403 */ 409 */
404static void bla_update_own_backbone_gw(struct bat_priv *bat_priv, 410static void batadv_bla_update_own_backbone_gw(struct bat_priv *bat_priv,
405 struct hard_iface *primary_if, 411 struct hard_iface *primary_if,
406 short vid) 412 short vid)
407{ 413{
408 struct backbone_gw *backbone_gw; 414 struct backbone_gw *backbone_gw;
409 415
410 backbone_gw = bla_get_backbone_gw(bat_priv, 416 backbone_gw = batadv_bla_get_backbone_gw(bat_priv,
411 primary_if->net_dev->dev_addr, vid); 417 primary_if->net_dev->dev_addr,
418 vid);
412 if (unlikely(!backbone_gw)) 419 if (unlikely(!backbone_gw))
413 return; 420 return;
414 421
415 backbone_gw->lasttime = jiffies; 422 backbone_gw->lasttime = jiffies;
416 backbone_gw_free_ref(backbone_gw); 423 batadv_backbone_gw_free_ref(backbone_gw);
417} 424}
418 425
419/* @bat_priv: the bat priv with all the soft interface information 426/* @bat_priv: the bat priv with all the soft interface information
@@ -422,8 +429,8 @@ static void bla_update_own_backbone_gw(struct bat_priv *bat_priv,
422 * Repeat all of our own claims, and finally send an ANNOUNCE frame 429 * Repeat all of our own claims, and finally send an ANNOUNCE frame
423 * to allow the requester another check if the CRC is correct now. 430 * to allow the requester another check if the CRC is correct now.
424 */ 431 */
425static void bla_answer_request(struct bat_priv *bat_priv, 432static void batadv_bla_answer_request(struct bat_priv *bat_priv,
426 struct hard_iface *primary_if, short vid) 433 struct hard_iface *primary_if, short vid)
427{ 434{
428 struct hlist_node *node; 435 struct hlist_node *node;
429 struct hlist_head *head; 436 struct hlist_head *head;
@@ -432,11 +439,12 @@ static void bla_answer_request(struct bat_priv *bat_priv,
432 struct backbone_gw *backbone_gw; 439 struct backbone_gw *backbone_gw;
433 int i; 440 int i;
434 441
435 bat_dbg(DBG_BLA, bat_priv, 442 batadv_dbg(DBG_BLA, bat_priv,
436 "bla_answer_request(): received a claim request, send all of our own claims again\n"); 443 "bla_answer_request(): received a claim request, send all of our own claims again\n");
437 444
438 backbone_gw = backbone_hash_find(bat_priv, 445 backbone_gw = batadv_backbone_hash_find(bat_priv,
439 primary_if->net_dev->dev_addr, vid); 446 primary_if->net_dev->dev_addr,
447 vid);
440 if (!backbone_gw) 448 if (!backbone_gw)
441 return; 449 return;
442 450
@@ -450,15 +458,15 @@ static void bla_answer_request(struct bat_priv *bat_priv,
450 if (claim->backbone_gw != backbone_gw) 458 if (claim->backbone_gw != backbone_gw)
451 continue; 459 continue;
452 460
453 bla_send_claim(bat_priv, claim->addr, claim->vid, 461 batadv_bla_send_claim(bat_priv, claim->addr, claim->vid,
454 CLAIM_TYPE_ADD); 462 CLAIM_TYPE_ADD);
455 } 463 }
456 rcu_read_unlock(); 464 rcu_read_unlock();
457 } 465 }
458 466
459 /* finally, send an announcement frame */ 467 /* finally, send an announcement frame */
460 bla_send_announce(bat_priv, backbone_gw); 468 batadv_bla_send_announce(bat_priv, backbone_gw);
461 backbone_gw_free_ref(backbone_gw); 469 batadv_backbone_gw_free_ref(backbone_gw);
462} 470}
463 471
464/* @backbone_gw: the backbone gateway from whom we are out of sync 472/* @backbone_gw: the backbone gateway from whom we are out of sync
@@ -467,18 +475,17 @@ static void bla_answer_request(struct bat_priv *bat_priv,
467 * After the request, it will repeat all of his own claims and finally 475 * After the request, it will repeat all of his own claims and finally
468 * send an announcement claim with which we can check again. 476 * send an announcement claim with which we can check again.
469 */ 477 */
470static void bla_send_request(struct backbone_gw *backbone_gw) 478static void batadv_bla_send_request(struct backbone_gw *backbone_gw)
471{ 479{
472 /* first, remove all old entries */ 480 /* first, remove all old entries */
473 bla_del_backbone_claims(backbone_gw); 481 batadv_bla_del_backbone_claims(backbone_gw);
474 482
475 bat_dbg(DBG_BLA, backbone_gw->bat_priv, 483 batadv_dbg(DBG_BLA, backbone_gw->bat_priv, "Sending REQUEST to %pM\n",
476 "Sending REQUEST to %pM\n", 484 backbone_gw->orig);
477 backbone_gw->orig);
478 485
479 /* send request */ 486 /* send request */
480 bla_send_claim(backbone_gw->bat_priv, backbone_gw->orig, 487 batadv_bla_send_claim(backbone_gw->bat_priv, backbone_gw->orig,
481 backbone_gw->vid, CLAIM_TYPE_REQUEST); 488 backbone_gw->vid, CLAIM_TYPE_REQUEST);
482 489
483 /* no local broadcasts should be sent or received, for now. */ 490 /* no local broadcasts should be sent or received, for now. */
484 if (!atomic_read(&backbone_gw->request_sent)) { 491 if (!atomic_read(&backbone_gw->request_sent)) {
@@ -493,17 +500,18 @@ static void bla_send_request(struct backbone_gw *backbone_gw)
493 * This function sends an announcement. It is called from multiple 500 * This function sends an announcement. It is called from multiple
494 * places. 501 * places.
495 */ 502 */
496static void bla_send_announce(struct bat_priv *bat_priv, 503static void batadv_bla_send_announce(struct bat_priv *bat_priv,
497 struct backbone_gw *backbone_gw) 504 struct backbone_gw *backbone_gw)
498{ 505{
499 uint8_t mac[ETH_ALEN]; 506 uint8_t mac[ETH_ALEN];
500 __be16 crc; 507 __be16 crc;
501 508
502 memcpy(mac, announce_mac, 4); 509 memcpy(mac, batadv_announce_mac, 4);
503 crc = htons(backbone_gw->crc); 510 crc = htons(backbone_gw->crc);
504 memcpy(&mac[4], &crc, 2); 511 memcpy(&mac[4], &crc, 2);
505 512
506 bla_send_claim(bat_priv, mac, backbone_gw->vid, CLAIM_TYPE_ANNOUNCE); 513 batadv_bla_send_claim(bat_priv, mac, backbone_gw->vid,
514 CLAIM_TYPE_ANNOUNCE);
507 515
508} 516}
509 517
@@ -514,8 +522,9 @@ static void bla_send_announce(struct bat_priv *bat_priv,
514 * 522 *
515 * Adds a claim in the claim hash. 523 * Adds a claim in the claim hash.
516 */ 524 */
517static void bla_add_claim(struct bat_priv *bat_priv, const uint8_t *mac, 525static void batadv_bla_add_claim(struct bat_priv *bat_priv, const uint8_t *mac,
518 const short vid, struct backbone_gw *backbone_gw) 526 const short vid,
527 struct backbone_gw *backbone_gw)
519{ 528{
520 struct claim *claim; 529 struct claim *claim;
521 struct claim search_claim; 530 struct claim search_claim;
@@ -523,7 +532,7 @@ static void bla_add_claim(struct bat_priv *bat_priv, const uint8_t *mac,
523 532
524 memcpy(search_claim.addr, mac, ETH_ALEN); 533 memcpy(search_claim.addr, mac, ETH_ALEN);
525 search_claim.vid = vid; 534 search_claim.vid = vid;
526 claim = claim_hash_find(bat_priv, &search_claim); 535 claim = batadv_claim_hash_find(bat_priv, &search_claim);
527 536
528 /* create a new claim entry if it does not exist yet. */ 537 /* create a new claim entry if it does not exist yet. */
529 if (!claim) { 538 if (!claim) {
@@ -537,11 +546,13 @@ static void bla_add_claim(struct bat_priv *bat_priv, const uint8_t *mac,
537 claim->backbone_gw = backbone_gw; 546 claim->backbone_gw = backbone_gw;
538 547
539 atomic_set(&claim->refcount, 2); 548 atomic_set(&claim->refcount, 2);
540 bat_dbg(DBG_BLA, bat_priv, 549 batadv_dbg(DBG_BLA, bat_priv,
541 "bla_add_claim(): adding new entry %pM, vid %d to hash ...\n", 550 "bla_add_claim(): adding new entry %pM, vid %d to hash ...\n",
542 mac, vid); 551 mac, vid);
543 hash_added = hash_add(bat_priv->claim_hash, compare_claim, 552 hash_added = batadv_hash_add(bat_priv->claim_hash,
544 choose_claim, claim, &claim->hash_entry); 553 batadv_compare_claim,
554 batadv_choose_claim, claim,
555 &claim->hash_entry);
545 556
546 if (unlikely(hash_added != 0)) { 557 if (unlikely(hash_added != 0)) {
547 /* only local changes happened. */ 558 /* only local changes happened. */
@@ -554,13 +565,13 @@ static void bla_add_claim(struct bat_priv *bat_priv, const uint8_t *mac,
554 /* no need to register a new backbone */ 565 /* no need to register a new backbone */
555 goto claim_free_ref; 566 goto claim_free_ref;
556 567
557 bat_dbg(DBG_BLA, bat_priv, 568 batadv_dbg(DBG_BLA, bat_priv,
558 "bla_add_claim(): changing ownership for %pM, vid %d\n", 569 "bla_add_claim(): changing ownership for %pM, vid %d\n",
559 mac, vid); 570 mac, vid);
560 571
561 claim->backbone_gw->crc ^= 572 claim->backbone_gw->crc ^=
562 crc16(0, claim->addr, ETH_ALEN); 573 crc16(0, claim->addr, ETH_ALEN);
563 backbone_gw_free_ref(claim->backbone_gw); 574 batadv_backbone_gw_free_ref(claim->backbone_gw);
564 575
565 } 576 }
566 /* set (new) backbone gw */ 577 /* set (new) backbone gw */
@@ -571,45 +582,48 @@ static void bla_add_claim(struct bat_priv *bat_priv, const uint8_t *mac,
571 backbone_gw->lasttime = jiffies; 582 backbone_gw->lasttime = jiffies;
572 583
573claim_free_ref: 584claim_free_ref:
574 claim_free_ref(claim); 585 batadv_claim_free_ref(claim);
575} 586}
576 587
577/* Delete a claim from the claim hash which has the 588/* Delete a claim from the claim hash which has the
578 * given mac address and vid. 589 * given mac address and vid.
579 */ 590 */
580static void bla_del_claim(struct bat_priv *bat_priv, const uint8_t *mac, 591static void batadv_bla_del_claim(struct bat_priv *bat_priv, const uint8_t *mac,
581 const short vid) 592 const short vid)
582{ 593{
583 struct claim search_claim, *claim; 594 struct claim search_claim, *claim;
584 595
585 memcpy(search_claim.addr, mac, ETH_ALEN); 596 memcpy(search_claim.addr, mac, ETH_ALEN);
586 search_claim.vid = vid; 597 search_claim.vid = vid;
587 claim = claim_hash_find(bat_priv, &search_claim); 598 claim = batadv_claim_hash_find(bat_priv, &search_claim);
588 if (!claim) 599 if (!claim)
589 return; 600 return;
590 601
591 bat_dbg(DBG_BLA, bat_priv, "bla_del_claim(): %pM, vid %d\n", mac, vid); 602 batadv_dbg(DBG_BLA, bat_priv, "bla_del_claim(): %pM, vid %d\n", mac,
603 vid);
592 604
593 hash_remove(bat_priv->claim_hash, compare_claim, choose_claim, claim); 605 batadv_hash_remove(bat_priv->claim_hash, batadv_compare_claim,
594 claim_free_ref(claim); /* reference from the hash is gone */ 606 batadv_choose_claim, claim);
607 batadv_claim_free_ref(claim); /* reference from the hash is gone */
595 608
596 claim->backbone_gw->crc ^= crc16(0, claim->addr, ETH_ALEN); 609 claim->backbone_gw->crc ^= crc16(0, claim->addr, ETH_ALEN);
597 610
598 /* don't need the reference from hash_find() anymore */ 611 /* don't need the reference from hash_find() anymore */
599 claim_free_ref(claim); 612 batadv_claim_free_ref(claim);
600} 613}
601 614
602/* check for ANNOUNCE frame, return 1 if handled */ 615/* check for ANNOUNCE frame, return 1 if handled */
603static int handle_announce(struct bat_priv *bat_priv, 616static int batadv_handle_announce(struct bat_priv *bat_priv,
604 uint8_t *an_addr, uint8_t *backbone_addr, short vid) 617 uint8_t *an_addr, uint8_t *backbone_addr,
618 short vid)
605{ 619{
606 struct backbone_gw *backbone_gw; 620 struct backbone_gw *backbone_gw;
607 uint16_t crc; 621 uint16_t crc;
608 622
609 if (memcmp(an_addr, announce_mac, 4) != 0) 623 if (memcmp(an_addr, batadv_announce_mac, 4) != 0)
610 return 0; 624 return 0;
611 625
612 backbone_gw = bla_get_backbone_gw(bat_priv, backbone_addr, vid); 626 backbone_gw = batadv_bla_get_backbone_gw(bat_priv, backbone_addr, vid);
613 627
614 if (unlikely(!backbone_gw)) 628 if (unlikely(!backbone_gw))
615 return 1; 629 return 1;
@@ -619,17 +633,17 @@ static int handle_announce(struct bat_priv *bat_priv,
619 backbone_gw->lasttime = jiffies; 633 backbone_gw->lasttime = jiffies;
620 crc = ntohs(*((__be16 *)(&an_addr[4]))); 634 crc = ntohs(*((__be16 *)(&an_addr[4])));
621 635
622 bat_dbg(DBG_BLA, bat_priv, 636 batadv_dbg(DBG_BLA, bat_priv,
623 "handle_announce(): ANNOUNCE vid %d (sent by %pM)... CRC = %04x\n", 637 "handle_announce(): ANNOUNCE vid %d (sent by %pM)... CRC = %04x\n",
624 vid, backbone_gw->orig, crc); 638 vid, backbone_gw->orig, crc);
625 639
626 if (backbone_gw->crc != crc) { 640 if (backbone_gw->crc != crc) {
627 bat_dbg(DBG_BLA, backbone_gw->bat_priv, 641 batadv_dbg(DBG_BLA, backbone_gw->bat_priv,
628 "handle_announce(): CRC FAILED for %pM/%d (my = %04x, sent = %04x)\n", 642 "handle_announce(): CRC FAILED for %pM/%d (my = %04x, sent = %04x)\n",
629 backbone_gw->orig, backbone_gw->vid, backbone_gw->crc, 643 backbone_gw->orig, backbone_gw->vid,
630 crc); 644 backbone_gw->crc, crc);
631 645
632 bla_send_request(backbone_gw); 646 batadv_bla_send_request(backbone_gw);
633 } else { 647 } else {
634 /* if we have sent a request and the crc was OK, 648 /* if we have sent a request and the crc was OK,
635 * we can allow traffic again. 649 * we can allow traffic again.
@@ -640,84 +654,87 @@ static int handle_announce(struct bat_priv *bat_priv,
640 } 654 }
641 } 655 }
642 656
643 backbone_gw_free_ref(backbone_gw); 657 batadv_backbone_gw_free_ref(backbone_gw);
644 return 1; 658 return 1;
645} 659}
646 660
647/* check for REQUEST frame, return 1 if handled */ 661/* check for REQUEST frame, return 1 if handled */
648static int handle_request(struct bat_priv *bat_priv, 662static int batadv_handle_request(struct bat_priv *bat_priv,
649 struct hard_iface *primary_if, 663 struct hard_iface *primary_if,
650 uint8_t *backbone_addr, 664 uint8_t *backbone_addr,
651 struct ethhdr *ethhdr, short vid) 665 struct ethhdr *ethhdr, short vid)
652{ 666{
653 /* check for REQUEST frame */ 667 /* check for REQUEST frame */
654 if (!compare_eth(backbone_addr, ethhdr->h_dest)) 668 if (!batadv_compare_eth(backbone_addr, ethhdr->h_dest))
655 return 0; 669 return 0;
656 670
657 /* sanity check, this should not happen on a normal switch, 671 /* sanity check, this should not happen on a normal switch,
658 * we ignore it in this case. 672 * we ignore it in this case.
659 */ 673 */
660 if (!compare_eth(ethhdr->h_dest, primary_if->net_dev->dev_addr)) 674 if (!batadv_compare_eth(ethhdr->h_dest, primary_if->net_dev->dev_addr))
661 return 1; 675 return 1;
662 676
663 bat_dbg(DBG_BLA, bat_priv, 677 batadv_dbg(DBG_BLA, bat_priv,
664 "handle_request(): REQUEST vid %d (sent by %pM)...\n", 678 "handle_request(): REQUEST vid %d (sent by %pM)...\n",
665 vid, ethhdr->h_source); 679 vid, ethhdr->h_source);
666 680
667 bla_answer_request(bat_priv, primary_if, vid); 681 batadv_bla_answer_request(bat_priv, primary_if, vid);
668 return 1; 682 return 1;
669} 683}
670 684
671/* check for UNCLAIM frame, return 1 if handled */ 685/* check for UNCLAIM frame, return 1 if handled */
672static int handle_unclaim(struct bat_priv *bat_priv, 686static int batadv_handle_unclaim(struct bat_priv *bat_priv,
673 struct hard_iface *primary_if, 687 struct hard_iface *primary_if,
674 uint8_t *backbone_addr, 688 uint8_t *backbone_addr,
675 uint8_t *claim_addr, short vid) 689 uint8_t *claim_addr, short vid)
676{ 690{
677 struct backbone_gw *backbone_gw; 691 struct backbone_gw *backbone_gw;
678 692
679 /* unclaim in any case if it is our own */ 693 /* unclaim in any case if it is our own */
680 if (primary_if && compare_eth(backbone_addr, 694 if (primary_if && batadv_compare_eth(backbone_addr,
681 primary_if->net_dev->dev_addr)) 695 primary_if->net_dev->dev_addr))
682 bla_send_claim(bat_priv, claim_addr, vid, CLAIM_TYPE_DEL); 696 batadv_bla_send_claim(bat_priv, claim_addr, vid,
697 CLAIM_TYPE_DEL);
683 698
684 backbone_gw = backbone_hash_find(bat_priv, backbone_addr, vid); 699 backbone_gw = batadv_backbone_hash_find(bat_priv, backbone_addr, vid);
685 700
686 if (!backbone_gw) 701 if (!backbone_gw)
687 return 1; 702 return 1;
688 703
689 /* this must be an UNCLAIM frame */ 704 /* this must be an UNCLAIM frame */
690 bat_dbg(DBG_BLA, bat_priv, 705 batadv_dbg(DBG_BLA, bat_priv,
691 "handle_unclaim(): UNCLAIM %pM on vid %d (sent by %pM)...\n", 706 "handle_unclaim(): UNCLAIM %pM on vid %d (sent by %pM)...\n",
692 claim_addr, vid, backbone_gw->orig); 707 claim_addr, vid, backbone_gw->orig);
693 708
694 bla_del_claim(bat_priv, claim_addr, vid); 709 batadv_bla_del_claim(bat_priv, claim_addr, vid);
695 backbone_gw_free_ref(backbone_gw); 710 batadv_backbone_gw_free_ref(backbone_gw);
696 return 1; 711 return 1;
697} 712}
698 713
699/* check for CLAIM frame, return 1 if handled */ 714/* check for CLAIM frame, return 1 if handled */
700static int handle_claim(struct bat_priv *bat_priv, 715static int batadv_handle_claim(struct bat_priv *bat_priv,
701 struct hard_iface *primary_if, uint8_t *backbone_addr, 716 struct hard_iface *primary_if,
702 uint8_t *claim_addr, short vid) 717 uint8_t *backbone_addr, uint8_t *claim_addr,
718 short vid)
703{ 719{
704 struct backbone_gw *backbone_gw; 720 struct backbone_gw *backbone_gw;
705 721
706 /* register the gateway if not yet available, and add the claim. */ 722 /* register the gateway if not yet available, and add the claim. */
707 723
708 backbone_gw = bla_get_backbone_gw(bat_priv, backbone_addr, vid); 724 backbone_gw = batadv_bla_get_backbone_gw(bat_priv, backbone_addr, vid);
709 725
710 if (unlikely(!backbone_gw)) 726 if (unlikely(!backbone_gw))
711 return 1; 727 return 1;
712 728
713 /* this must be a CLAIM frame */ 729 /* this must be a CLAIM frame */
714 bla_add_claim(bat_priv, claim_addr, vid, backbone_gw); 730 batadv_bla_add_claim(bat_priv, claim_addr, vid, backbone_gw);
715 if (compare_eth(backbone_addr, primary_if->net_dev->dev_addr)) 731 if (batadv_compare_eth(backbone_addr, primary_if->net_dev->dev_addr))
716 bla_send_claim(bat_priv, claim_addr, vid, CLAIM_TYPE_ADD); 732 batadv_bla_send_claim(bat_priv, claim_addr, vid,
733 CLAIM_TYPE_ADD);
717 734
718 /* TODO: we could call something like tt_local_del() here. */ 735 /* TODO: we could call something like tt_local_del() here. */
719 736
720 backbone_gw_free_ref(backbone_gw); 737 batadv_backbone_gw_free_ref(backbone_gw);
721 return 1; 738 return 1;
722} 739}
723 740
@@ -735,10 +752,10 @@ static int handle_claim(struct bat_priv *bat_priv,
735 * 1 - if is a claim packet from another group 752 * 1 - if is a claim packet from another group
736 * 0 - if it is not a claim packet 753 * 0 - if it is not a claim packet
737 */ 754 */
738static int check_claim_group(struct bat_priv *bat_priv, 755static int batadv_check_claim_group(struct bat_priv *bat_priv,
739 struct hard_iface *primary_if, 756 struct hard_iface *primary_if,
740 uint8_t *hw_src, uint8_t *hw_dst, 757 uint8_t *hw_src, uint8_t *hw_dst,
741 struct ethhdr *ethhdr) 758 struct ethhdr *ethhdr)
742{ 759{
743 uint8_t *backbone_addr; 760 uint8_t *backbone_addr;
744 struct orig_node *orig_node; 761 struct orig_node *orig_node;
@@ -769,7 +786,7 @@ static int check_claim_group(struct bat_priv *bat_priv,
769 } 786 }
770 787
771 /* don't accept claim frames from ourselves */ 788 /* don't accept claim frames from ourselves */
772 if (compare_eth(backbone_addr, primary_if->net_dev->dev_addr)) 789 if (batadv_compare_eth(backbone_addr, primary_if->net_dev->dev_addr))
773 return 0; 790 return 0;
774 791
775 /* if its already the same group, it is fine. */ 792 /* if its already the same group, it is fine. */
@@ -777,7 +794,7 @@ static int check_claim_group(struct bat_priv *bat_priv,
777 return 2; 794 return 2;
778 795
779 /* lets see if this originator is in our mesh */ 796 /* lets see if this originator is in our mesh */
780 orig_node = orig_hash_find(bat_priv, backbone_addr); 797 orig_node = batadv_orig_hash_find(bat_priv, backbone_addr);
781 798
782 /* dont accept claims from gateways which are not in 799 /* dont accept claims from gateways which are not in
783 * the same mesh or group. 800 * the same mesh or group.
@@ -787,9 +804,9 @@ static int check_claim_group(struct bat_priv *bat_priv,
787 804
788 /* if our mesh friends mac is bigger, use it for ourselves. */ 805 /* if our mesh friends mac is bigger, use it for ourselves. */
789 if (ntohs(bla_dst->group) > ntohs(bla_dst_own->group)) { 806 if (ntohs(bla_dst->group) > ntohs(bla_dst_own->group)) {
790 bat_dbg(DBG_BLA, bat_priv, 807 batadv_dbg(DBG_BLA, bat_priv,
791 "taking other backbones claim group: %04x\n", 808 "taking other backbones claim group: %04x\n",
792 ntohs(bla_dst->group)); 809 ntohs(bla_dst->group));
793 bla_dst_own->group = bla_dst->group; 810 bla_dst_own->group = bla_dst->group;
794 } 811 }
795 812
@@ -807,9 +824,9 @@ static int check_claim_group(struct bat_priv *bat_priv,
807 * returns 1 if it was a claim frame, otherwise return 0 to 824 * returns 1 if it was a claim frame, otherwise return 0 to
808 * tell the callee that it can use the frame on its own. 825 * tell the callee that it can use the frame on its own.
809 */ 826 */
810static int bla_process_claim(struct bat_priv *bat_priv, 827static int batadv_bla_process_claim(struct bat_priv *bat_priv,
811 struct hard_iface *primary_if, 828 struct hard_iface *primary_if,
812 struct sk_buff *skb) 829 struct sk_buff *skb)
813{ 830{
814 struct ethhdr *ethhdr; 831 struct ethhdr *ethhdr;
815 struct vlan_ethhdr *vhdr; 832 struct vlan_ethhdr *vhdr;
@@ -862,51 +879,54 @@ static int bla_process_claim(struct bat_priv *bat_priv,
862 bla_dst = (struct bla_claim_dst *)hw_dst; 879 bla_dst = (struct bla_claim_dst *)hw_dst;
863 880
864 /* check if it is a claim frame. */ 881 /* check if it is a claim frame. */
865 ret = check_claim_group(bat_priv, primary_if, hw_src, hw_dst, ethhdr); 882 ret = batadv_check_claim_group(bat_priv, primary_if, hw_src, hw_dst,
883 ethhdr);
866 if (ret == 1) 884 if (ret == 1)
867 bat_dbg(DBG_BLA, bat_priv, 885 batadv_dbg(DBG_BLA, bat_priv,
868 "bla_process_claim(): received a claim frame from another group. From: %pM on vid %d ...(hw_src %pM, hw_dst %pM)\n", 886 "bla_process_claim(): received a claim frame from another group. From: %pM on vid %d ...(hw_src %pM, hw_dst %pM)\n",
869 ethhdr->h_source, vid, hw_src, hw_dst); 887 ethhdr->h_source, vid, hw_src, hw_dst);
870 888
871 if (ret < 2) 889 if (ret < 2)
872 return ret; 890 return ret;
873 891
874 /* become a backbone gw ourselves on this vlan if not happened yet */ 892 /* become a backbone gw ourselves on this vlan if not happened yet */
875 bla_update_own_backbone_gw(bat_priv, primary_if, vid); 893 batadv_bla_update_own_backbone_gw(bat_priv, primary_if, vid);
876 894
877 /* check for the different types of claim frames ... */ 895 /* check for the different types of claim frames ... */
878 switch (bla_dst->type) { 896 switch (bla_dst->type) {
879 case CLAIM_TYPE_ADD: 897 case CLAIM_TYPE_ADD:
880 if (handle_claim(bat_priv, primary_if, hw_src, 898 if (batadv_handle_claim(bat_priv, primary_if, hw_src,
881 ethhdr->h_source, vid)) 899 ethhdr->h_source, vid))
882 return 1; 900 return 1;
883 break; 901 break;
884 case CLAIM_TYPE_DEL: 902 case CLAIM_TYPE_DEL:
885 if (handle_unclaim(bat_priv, primary_if, 903 if (batadv_handle_unclaim(bat_priv, primary_if,
886 ethhdr->h_source, hw_src, vid)) 904 ethhdr->h_source, hw_src, vid))
887 return 1; 905 return 1;
888 break; 906 break;
889 907
890 case CLAIM_TYPE_ANNOUNCE: 908 case CLAIM_TYPE_ANNOUNCE:
891 if (handle_announce(bat_priv, hw_src, ethhdr->h_source, vid)) 909 if (batadv_handle_announce(bat_priv, hw_src, ethhdr->h_source,
910 vid))
892 return 1; 911 return 1;
893 break; 912 break;
894 case CLAIM_TYPE_REQUEST: 913 case CLAIM_TYPE_REQUEST:
895 if (handle_request(bat_priv, primary_if, hw_src, ethhdr, vid)) 914 if (batadv_handle_request(bat_priv, primary_if, hw_src, ethhdr,
915 vid))
896 return 1; 916 return 1;
897 break; 917 break;
898 } 918 }
899 919
900 bat_dbg(DBG_BLA, bat_priv, 920 batadv_dbg(DBG_BLA, bat_priv,
901 "bla_process_claim(): ERROR - this looks like a claim frame, but is useless. eth src %pM on vid %d ...(hw_src %pM, hw_dst %pM)\n", 921 "bla_process_claim(): ERROR - this looks like a claim frame, but is useless. eth src %pM on vid %d ...(hw_src %pM, hw_dst %pM)\n",
902 ethhdr->h_source, vid, hw_src, hw_dst); 922 ethhdr->h_source, vid, hw_src, hw_dst);
903 return 1; 923 return 1;
904} 924}
905 925
906/* Check when we last heard from other nodes, and remove them in case of 926/* Check when we last heard from other nodes, and remove them in case of
907 * a time out, or clean all backbone gws if now is set. 927 * a time out, or clean all backbone gws if now is set.
908 */ 928 */
909static void bla_purge_backbone_gw(struct bat_priv *bat_priv, int now) 929static void batadv_bla_purge_backbone_gw(struct bat_priv *bat_priv, int now)
910{ 930{
911 struct backbone_gw *backbone_gw; 931 struct backbone_gw *backbone_gw;
912 struct hlist_node *node, *node_tmp; 932 struct hlist_node *node, *node_tmp;
@@ -928,23 +948,23 @@ static void bla_purge_backbone_gw(struct bat_priv *bat_priv, int now)
928 head, hash_entry) { 948 head, hash_entry) {
929 if (now) 949 if (now)
930 goto purge_now; 950 goto purge_now;
931 if (!has_timed_out(backbone_gw->lasttime, 951 if (!batadv_has_timed_out(backbone_gw->lasttime,
932 BLA_BACKBONE_TIMEOUT)) 952 BLA_BACKBONE_TIMEOUT))
933 continue; 953 continue;
934 954
935 bat_dbg(DBG_BLA, backbone_gw->bat_priv, 955 batadv_dbg(DBG_BLA, backbone_gw->bat_priv,
936 "bla_purge_backbone_gw(): backbone gw %pM timed out\n", 956 "bla_purge_backbone_gw(): backbone gw %pM timed out\n",
937 backbone_gw->orig); 957 backbone_gw->orig);
938 958
939purge_now: 959purge_now:
940 /* don't wait for the pending request anymore */ 960 /* don't wait for the pending request anymore */
941 if (atomic_read(&backbone_gw->request_sent)) 961 if (atomic_read(&backbone_gw->request_sent))
942 atomic_dec(&bat_priv->bla_num_requests); 962 atomic_dec(&bat_priv->bla_num_requests);
943 963
944 bla_del_backbone_claims(backbone_gw); 964 batadv_bla_del_backbone_claims(backbone_gw);
945 965
946 hlist_del_rcu(node); 966 hlist_del_rcu(node);
947 backbone_gw_free_ref(backbone_gw); 967 batadv_backbone_gw_free_ref(backbone_gw);
948 } 968 }
949 spin_unlock_bh(list_lock); 969 spin_unlock_bh(list_lock);
950 } 970 }
@@ -957,8 +977,8 @@ purge_now:
957 * Check when we heard last time from our own claims, and remove them in case of 977 * Check when we heard last time from our own claims, and remove them in case of
958 * a time out, or clean all claims if now is set 978 * a time out, or clean all claims if now is set
959 */ 979 */
960static void bla_purge_claims(struct bat_priv *bat_priv, 980static void batadv_bla_purge_claims(struct bat_priv *bat_priv,
961 struct hard_iface *primary_if, int now) 981 struct hard_iface *primary_if, int now)
962{ 982{
963 struct claim *claim; 983 struct claim *claim;
964 struct hlist_node *node; 984 struct hlist_node *node;
@@ -977,21 +997,21 @@ static void bla_purge_claims(struct bat_priv *bat_priv,
977 hlist_for_each_entry_rcu(claim, node, head, hash_entry) { 997 hlist_for_each_entry_rcu(claim, node, head, hash_entry) {
978 if (now) 998 if (now)
979 goto purge_now; 999 goto purge_now;
980 if (!compare_eth(claim->backbone_gw->orig, 1000 if (!batadv_compare_eth(claim->backbone_gw->orig,
981 primary_if->net_dev->dev_addr)) 1001 primary_if->net_dev->dev_addr))
982 continue; 1002 continue;
983 if (!has_timed_out(claim->lasttime, 1003 if (!batadv_has_timed_out(claim->lasttime,
984 BLA_CLAIM_TIMEOUT)) 1004 BLA_CLAIM_TIMEOUT))
985 continue; 1005 continue;
986 1006
987 bat_dbg(DBG_BLA, bat_priv, 1007 batadv_dbg(DBG_BLA, bat_priv,
988 "bla_purge_claims(): %pM, vid %d, time out\n", 1008 "bla_purge_claims(): %pM, vid %d, time out\n",
989 claim->addr, claim->vid); 1009 claim->addr, claim->vid);
990 1010
991purge_now: 1011purge_now:
992 handle_unclaim(bat_priv, primary_if, 1012 batadv_handle_unclaim(bat_priv, primary_if,
993 claim->backbone_gw->orig, 1013 claim->backbone_gw->orig,
994 claim->addr, claim->vid); 1014 claim->addr, claim->vid);
995 } 1015 }
996 rcu_read_unlock(); 1016 rcu_read_unlock();
997 } 1017 }
@@ -1018,8 +1038,8 @@ void batadv_bla_update_orig_address(struct bat_priv *bat_priv,
1018 htons(crc16(0, primary_if->net_dev->dev_addr, ETH_ALEN)); 1038 htons(crc16(0, primary_if->net_dev->dev_addr, ETH_ALEN));
1019 1039
1020 if (!oldif) { 1040 if (!oldif) {
1021 bla_purge_claims(bat_priv, NULL, 1); 1041 batadv_bla_purge_claims(bat_priv, NULL, 1);
1022 bla_purge_backbone_gw(bat_priv, 1); 1042 batadv_bla_purge_backbone_gw(bat_priv, 1);
1023 return; 1043 return;
1024 } 1044 }
1025 1045
@@ -1033,8 +1053,8 @@ void batadv_bla_update_orig_address(struct bat_priv *bat_priv,
1033 rcu_read_lock(); 1053 rcu_read_lock();
1034 hlist_for_each_entry_rcu(backbone_gw, node, head, hash_entry) { 1054 hlist_for_each_entry_rcu(backbone_gw, node, head, hash_entry) {
1035 /* own orig still holds the old value. */ 1055 /* own orig still holds the old value. */
1036 if (!compare_eth(backbone_gw->orig, 1056 if (!batadv_compare_eth(backbone_gw->orig,
1037 oldif->net_dev->dev_addr)) 1057 oldif->net_dev->dev_addr))
1038 continue; 1058 continue;
1039 1059
1040 memcpy(backbone_gw->orig, 1060 memcpy(backbone_gw->orig,
@@ -1042,7 +1062,7 @@ void batadv_bla_update_orig_address(struct bat_priv *bat_priv,
1042 /* send an announce frame so others will ask for our 1062 /* send an announce frame so others will ask for our
1043 * claims and update their tables. 1063 * claims and update their tables.
1044 */ 1064 */
1045 bla_send_announce(bat_priv, backbone_gw); 1065 batadv_bla_send_announce(bat_priv, backbone_gw);
1046 } 1066 }
1047 rcu_read_unlock(); 1067 rcu_read_unlock();
1048 } 1068 }
@@ -1051,9 +1071,9 @@ void batadv_bla_update_orig_address(struct bat_priv *bat_priv,
1051 1071
1052 1072
1053/* (re)start the timer */ 1073/* (re)start the timer */
1054static void bla_start_timer(struct bat_priv *bat_priv) 1074static void batadv_bla_start_timer(struct bat_priv *bat_priv)
1055{ 1075{
1056 INIT_DELAYED_WORK(&bat_priv->bla_work, bla_periodic_work); 1076 INIT_DELAYED_WORK(&bat_priv->bla_work, batadv_bla_periodic_work);
1057 queue_delayed_work(batadv_event_workqueue, &bat_priv->bla_work, 1077 queue_delayed_work(batadv_event_workqueue, &bat_priv->bla_work,
1058 msecs_to_jiffies(BLA_PERIOD_LENGTH)); 1078 msecs_to_jiffies(BLA_PERIOD_LENGTH));
1059} 1079}
@@ -1062,7 +1082,7 @@ static void bla_start_timer(struct bat_priv *bat_priv)
1062 * * purge structures when they are too old 1082 * * purge structures when they are too old
1063 * * send announcements 1083 * * send announcements
1064 */ 1084 */
1065static void bla_periodic_work(struct work_struct *work) 1085static void batadv_bla_periodic_work(struct work_struct *work)
1066{ 1086{
1067 struct delayed_work *delayed_work = 1087 struct delayed_work *delayed_work =
1068 container_of(work, struct delayed_work, work); 1088 container_of(work, struct delayed_work, work);
@@ -1075,12 +1095,12 @@ static void bla_periodic_work(struct work_struct *work)
1075 struct hard_iface *primary_if; 1095 struct hard_iface *primary_if;
1076 int i; 1096 int i;
1077 1097
1078 primary_if = primary_if_get_selected(bat_priv); 1098 primary_if = batadv_primary_if_get_selected(bat_priv);
1079 if (!primary_if) 1099 if (!primary_if)
1080 goto out; 1100 goto out;
1081 1101
1082 bla_purge_claims(bat_priv, primary_if, 0); 1102 batadv_bla_purge_claims(bat_priv, primary_if, 0);
1083 bla_purge_backbone_gw(bat_priv, 0); 1103 batadv_bla_purge_backbone_gw(bat_priv, 0);
1084 1104
1085 if (!atomic_read(&bat_priv->bridge_loop_avoidance)) 1105 if (!atomic_read(&bat_priv->bridge_loop_avoidance))
1086 goto out; 1106 goto out;
@@ -1094,21 +1114,21 @@ static void bla_periodic_work(struct work_struct *work)
1094 1114
1095 rcu_read_lock(); 1115 rcu_read_lock();
1096 hlist_for_each_entry_rcu(backbone_gw, node, head, hash_entry) { 1116 hlist_for_each_entry_rcu(backbone_gw, node, head, hash_entry) {
1097 if (!compare_eth(backbone_gw->orig, 1117 if (!batadv_compare_eth(backbone_gw->orig,
1098 primary_if->net_dev->dev_addr)) 1118 primary_if->net_dev->dev_addr))
1099 continue; 1119 continue;
1100 1120
1101 backbone_gw->lasttime = jiffies; 1121 backbone_gw->lasttime = jiffies;
1102 1122
1103 bla_send_announce(bat_priv, backbone_gw); 1123 batadv_bla_send_announce(bat_priv, backbone_gw);
1104 } 1124 }
1105 rcu_read_unlock(); 1125 rcu_read_unlock();
1106 } 1126 }
1107out: 1127out:
1108 if (primary_if) 1128 if (primary_if)
1109 hardif_free_ref(primary_if); 1129 batadv_hardif_free_ref(primary_if);
1110 1130
1111 bla_start_timer(bat_priv); 1131 batadv_bla_start_timer(bat_priv);
1112} 1132}
1113 1133
1114/* The hash for claim and backbone hash receive the same key because they 1134/* The hash for claim and backbone hash receive the same key because they
@@ -1116,8 +1136,8 @@ out:
1116 * them with to different keys to allow nested locking without generating 1136 * them with to different keys to allow nested locking without generating
1117 * lockdep warnings 1137 * lockdep warnings
1118 */ 1138 */
1119static struct lock_class_key claim_hash_lock_class_key; 1139static struct lock_class_key batadv_claim_hash_lock_class_key;
1120static struct lock_class_key backbone_hash_lock_class_key; 1140static struct lock_class_key batadv_backbone_hash_lock_class_key;
1121 1141
1122/* initialize all bla structures */ 1142/* initialize all bla structures */
1123int batadv_bla_init(struct bat_priv *bat_priv) 1143int batadv_bla_init(struct bat_priv *bat_priv)
@@ -1126,17 +1146,17 @@ int batadv_bla_init(struct bat_priv *bat_priv)
1126 uint8_t claim_dest[ETH_ALEN] = {0xff, 0x43, 0x05, 0x00, 0x00, 0x00}; 1146 uint8_t claim_dest[ETH_ALEN] = {0xff, 0x43, 0x05, 0x00, 0x00, 0x00};
1127 struct hard_iface *primary_if; 1147 struct hard_iface *primary_if;
1128 1148
1129 bat_dbg(DBG_BLA, bat_priv, "bla hash registering\n"); 1149 batadv_dbg(DBG_BLA, bat_priv, "bla hash registering\n");
1130 1150
1131 /* setting claim destination address */ 1151 /* setting claim destination address */
1132 memcpy(&bat_priv->claim_dest.magic, claim_dest, 3); 1152 memcpy(&bat_priv->claim_dest.magic, claim_dest, 3);
1133 bat_priv->claim_dest.type = 0; 1153 bat_priv->claim_dest.type = 0;
1134 primary_if = primary_if_get_selected(bat_priv); 1154 primary_if = batadv_primary_if_get_selected(bat_priv);
1135 if (primary_if) { 1155 if (primary_if) {
1136 bat_priv->claim_dest.group = 1156 bat_priv->claim_dest.group =
1137 htons(crc16(0, primary_if->net_dev->dev_addr, 1157 htons(crc16(0, primary_if->net_dev->dev_addr,
1138 ETH_ALEN)); 1158 ETH_ALEN));
1139 hardif_free_ref(primary_if); 1159 batadv_hardif_free_ref(primary_if);
1140 } else { 1160 } else {
1141 bat_priv->claim_dest.group = 0; /* will be set later */ 1161 bat_priv->claim_dest.group = 0; /* will be set later */
1142 } 1162 }
@@ -1157,13 +1177,13 @@ int batadv_bla_init(struct bat_priv *bat_priv)
1157 return -ENOMEM; 1177 return -ENOMEM;
1158 1178
1159 batadv_hash_set_lock_class(bat_priv->claim_hash, 1179 batadv_hash_set_lock_class(bat_priv->claim_hash,
1160 &claim_hash_lock_class_key); 1180 &batadv_claim_hash_lock_class_key);
1161 batadv_hash_set_lock_class(bat_priv->backbone_hash, 1181 batadv_hash_set_lock_class(bat_priv->backbone_hash,
1162 &backbone_hash_lock_class_key); 1182 &batadv_backbone_hash_lock_class_key);
1163 1183
1164 bat_dbg(DBG_BLA, bat_priv, "bla hashes initialized\n"); 1184 batadv_dbg(DBG_BLA, bat_priv, "bla hashes initialized\n");
1165 1185
1166 bla_start_timer(bat_priv); 1186 batadv_bla_start_timer(bat_priv);
1167 return 0; 1187 return 0;
1168} 1188}
1169 1189
@@ -1203,13 +1223,13 @@ int batadv_bla_check_bcast_duplist(struct bat_priv *bat_priv,
1203 /* we can stop searching if the entry is too old ; 1223 /* we can stop searching if the entry is too old ;
1204 * later entries will be even older 1224 * later entries will be even older
1205 */ 1225 */
1206 if (has_timed_out(entry->entrytime, DUPLIST_TIMEOUT)) 1226 if (batadv_has_timed_out(entry->entrytime, DUPLIST_TIMEOUT))
1207 break; 1227 break;
1208 1228
1209 if (entry->crc != crc) 1229 if (entry->crc != crc)
1210 continue; 1230 continue;
1211 1231
1212 if (compare_eth(entry->orig, bcast_packet->orig)) 1232 if (batadv_compare_eth(entry->orig, bcast_packet->orig))
1213 continue; 1233 continue;
1214 1234
1215 /* this entry seems to match: same crc, not too old, 1235 /* this entry seems to match: same crc, not too old,
@@ -1257,7 +1277,7 @@ int batadv_bla_is_backbone_gw_orig(struct bat_priv *bat_priv, uint8_t *orig)
1257 1277
1258 rcu_read_lock(); 1278 rcu_read_lock();
1259 hlist_for_each_entry_rcu(backbone_gw, node, head, hash_entry) { 1279 hlist_for_each_entry_rcu(backbone_gw, node, head, hash_entry) {
1260 if (compare_eth(backbone_gw->orig, orig)) { 1280 if (batadv_compare_eth(backbone_gw->orig, orig)) {
1261 rcu_read_unlock(); 1281 rcu_read_unlock();
1262 return 1; 1282 return 1;
1263 } 1283 }
@@ -1304,12 +1324,12 @@ int batadv_bla_is_backbone_gw(struct sk_buff *skb,
1304 } 1324 }
1305 1325
1306 /* see if this originator is a backbone gw for this VLAN */ 1326 /* see if this originator is a backbone gw for this VLAN */
1307 backbone_gw = backbone_hash_find(orig_node->bat_priv, 1327 backbone_gw = batadv_backbone_hash_find(orig_node->bat_priv,
1308 orig_node->orig, vid); 1328 orig_node->orig, vid);
1309 if (!backbone_gw) 1329 if (!backbone_gw)
1310 return 0; 1330 return 0;
1311 1331
1312 backbone_gw_free_ref(backbone_gw); 1332 batadv_backbone_gw_free_ref(backbone_gw);
1313 return 1; 1333 return 1;
1314} 1334}
1315 1335
@@ -1319,20 +1339,20 @@ void batadv_bla_free(struct bat_priv *bat_priv)
1319 struct hard_iface *primary_if; 1339 struct hard_iface *primary_if;
1320 1340
1321 cancel_delayed_work_sync(&bat_priv->bla_work); 1341 cancel_delayed_work_sync(&bat_priv->bla_work);
1322 primary_if = primary_if_get_selected(bat_priv); 1342 primary_if = batadv_primary_if_get_selected(bat_priv);
1323 1343
1324 if (bat_priv->claim_hash) { 1344 if (bat_priv->claim_hash) {
1325 bla_purge_claims(bat_priv, primary_if, 1); 1345 batadv_bla_purge_claims(bat_priv, primary_if, 1);
1326 batadv_hash_destroy(bat_priv->claim_hash); 1346 batadv_hash_destroy(bat_priv->claim_hash);
1327 bat_priv->claim_hash = NULL; 1347 bat_priv->claim_hash = NULL;
1328 } 1348 }
1329 if (bat_priv->backbone_hash) { 1349 if (bat_priv->backbone_hash) {
1330 bla_purge_backbone_gw(bat_priv, 1); 1350 batadv_bla_purge_backbone_gw(bat_priv, 1);
1331 batadv_hash_destroy(bat_priv->backbone_hash); 1351 batadv_hash_destroy(bat_priv->backbone_hash);
1332 bat_priv->backbone_hash = NULL; 1352 bat_priv->backbone_hash = NULL;
1333 } 1353 }
1334 if (primary_if) 1354 if (primary_if)
1335 hardif_free_ref(primary_if); 1355 batadv_hardif_free_ref(primary_if);
1336} 1356}
1337 1357
1338/* @bat_priv: the bat priv with all the soft interface information 1358/* @bat_priv: the bat priv with all the soft interface information
@@ -1356,7 +1376,7 @@ int batadv_bla_rx(struct bat_priv *bat_priv, struct sk_buff *skb, short vid)
1356 1376
1357 ethhdr = (struct ethhdr *)skb_mac_header(skb); 1377 ethhdr = (struct ethhdr *)skb_mac_header(skb);
1358 1378
1359 primary_if = primary_if_get_selected(bat_priv); 1379 primary_if = batadv_primary_if_get_selected(bat_priv);
1360 if (!primary_if) 1380 if (!primary_if)
1361 goto handled; 1381 goto handled;
1362 1382
@@ -1371,21 +1391,21 @@ int batadv_bla_rx(struct bat_priv *bat_priv, struct sk_buff *skb, short vid)
1371 1391
1372 memcpy(search_claim.addr, ethhdr->h_source, ETH_ALEN); 1392 memcpy(search_claim.addr, ethhdr->h_source, ETH_ALEN);
1373 search_claim.vid = vid; 1393 search_claim.vid = vid;
1374 claim = claim_hash_find(bat_priv, &search_claim); 1394 claim = batadv_claim_hash_find(bat_priv, &search_claim);
1375 1395
1376 if (!claim) { 1396 if (!claim) {
1377 /* possible optimization: race for a claim */ 1397 /* possible optimization: race for a claim */
1378 /* No claim exists yet, claim it for us! 1398 /* No claim exists yet, claim it for us!
1379 */ 1399 */
1380 handle_claim(bat_priv, primary_if, 1400 batadv_handle_claim(bat_priv, primary_if,
1381 primary_if->net_dev->dev_addr, 1401 primary_if->net_dev->dev_addr,
1382 ethhdr->h_source, vid); 1402 ethhdr->h_source, vid);
1383 goto allow; 1403 goto allow;
1384 } 1404 }
1385 1405
1386 /* if it is our own claim ... */ 1406 /* if it is our own claim ... */
1387 if (compare_eth(claim->backbone_gw->orig, 1407 if (batadv_compare_eth(claim->backbone_gw->orig,
1388 primary_if->net_dev->dev_addr)) { 1408 primary_if->net_dev->dev_addr)) {
1389 /* ... allow it in any case */ 1409 /* ... allow it in any case */
1390 claim->lasttime = jiffies; 1410 claim->lasttime = jiffies;
1391 goto allow; 1411 goto allow;
@@ -1400,13 +1420,13 @@ int batadv_bla_rx(struct bat_priv *bat_priv, struct sk_buff *skb, short vid)
1400 * send a claim and update the claim table 1420 * send a claim and update the claim table
1401 * immediately. 1421 * immediately.
1402 */ 1422 */
1403 handle_claim(bat_priv, primary_if, 1423 batadv_handle_claim(bat_priv, primary_if,
1404 primary_if->net_dev->dev_addr, 1424 primary_if->net_dev->dev_addr,
1405 ethhdr->h_source, vid); 1425 ethhdr->h_source, vid);
1406 goto allow; 1426 goto allow;
1407 } 1427 }
1408allow: 1428allow:
1409 bla_update_own_backbone_gw(bat_priv, primary_if, vid); 1429 batadv_bla_update_own_backbone_gw(bat_priv, primary_if, vid);
1410 ret = 0; 1430 ret = 0;
1411 goto out; 1431 goto out;
1412 1432
@@ -1416,9 +1436,9 @@ handled:
1416 1436
1417out: 1437out:
1418 if (primary_if) 1438 if (primary_if)
1419 hardif_free_ref(primary_if); 1439 batadv_hardif_free_ref(primary_if);
1420 if (claim) 1440 if (claim)
1421 claim_free_ref(claim); 1441 batadv_claim_free_ref(claim);
1422 return ret; 1442 return ret;
1423} 1443}
1424 1444
@@ -1441,7 +1461,7 @@ int batadv_bla_tx(struct bat_priv *bat_priv, struct sk_buff *skb, short vid)
1441 struct hard_iface *primary_if; 1461 struct hard_iface *primary_if;
1442 int ret = 0; 1462 int ret = 0;
1443 1463
1444 primary_if = primary_if_get_selected(bat_priv); 1464 primary_if = batadv_primary_if_get_selected(bat_priv);
1445 if (!primary_if) 1465 if (!primary_if)
1446 goto out; 1466 goto out;
1447 1467
@@ -1451,7 +1471,7 @@ int batadv_bla_tx(struct bat_priv *bat_priv, struct sk_buff *skb, short vid)
1451 /* in VLAN case, the mac header might not be set. */ 1471 /* in VLAN case, the mac header might not be set. */
1452 skb_reset_mac_header(skb); 1472 skb_reset_mac_header(skb);
1453 1473
1454 if (bla_process_claim(bat_priv, primary_if, skb)) 1474 if (batadv_bla_process_claim(bat_priv, primary_if, skb))
1455 goto handled; 1475 goto handled;
1456 1476
1457 ethhdr = (struct ethhdr *)skb_mac_header(skb); 1477 ethhdr = (struct ethhdr *)skb_mac_header(skb);
@@ -1464,21 +1484,21 @@ int batadv_bla_tx(struct bat_priv *bat_priv, struct sk_buff *skb, short vid)
1464 memcpy(search_claim.addr, ethhdr->h_source, ETH_ALEN); 1484 memcpy(search_claim.addr, ethhdr->h_source, ETH_ALEN);
1465 search_claim.vid = vid; 1485 search_claim.vid = vid;
1466 1486
1467 claim = claim_hash_find(bat_priv, &search_claim); 1487 claim = batadv_claim_hash_find(bat_priv, &search_claim);
1468 1488
1469 /* if no claim exists, allow it. */ 1489 /* if no claim exists, allow it. */
1470 if (!claim) 1490 if (!claim)
1471 goto allow; 1491 goto allow;
1472 1492
1473 /* check if we are responsible. */ 1493 /* check if we are responsible. */
1474 if (compare_eth(claim->backbone_gw->orig, 1494 if (batadv_compare_eth(claim->backbone_gw->orig,
1475 primary_if->net_dev->dev_addr)) { 1495 primary_if->net_dev->dev_addr)) {
1476 /* if yes, the client has roamed and we have 1496 /* if yes, the client has roamed and we have
1477 * to unclaim it. 1497 * to unclaim it.
1478 */ 1498 */
1479 handle_unclaim(bat_priv, primary_if, 1499 batadv_handle_unclaim(bat_priv, primary_if,
1480 primary_if->net_dev->dev_addr, 1500 primary_if->net_dev->dev_addr,
1481 ethhdr->h_source, vid); 1501 ethhdr->h_source, vid);
1482 goto allow; 1502 goto allow;
1483 } 1503 }
1484 1504
@@ -1495,16 +1515,16 @@ int batadv_bla_tx(struct bat_priv *bat_priv, struct sk_buff *skb, short vid)
1495 goto allow; 1515 goto allow;
1496 } 1516 }
1497allow: 1517allow:
1498 bla_update_own_backbone_gw(bat_priv, primary_if, vid); 1518 batadv_bla_update_own_backbone_gw(bat_priv, primary_if, vid);
1499 ret = 0; 1519 ret = 0;
1500 goto out; 1520 goto out;
1501handled: 1521handled:
1502 ret = 1; 1522 ret = 1;
1503out: 1523out:
1504 if (primary_if) 1524 if (primary_if)
1505 hardif_free_ref(primary_if); 1525 batadv_hardif_free_ref(primary_if);
1506 if (claim) 1526 if (claim)
1507 claim_free_ref(claim); 1527 batadv_claim_free_ref(claim);
1508 return ret; 1528 return ret;
1509} 1529}
1510 1530
@@ -1520,8 +1540,9 @@ int batadv_bla_claim_table_seq_print_text(struct seq_file *seq, void *offset)
1520 uint32_t i; 1540 uint32_t i;
1521 bool is_own; 1541 bool is_own;
1522 int ret = 0; 1542 int ret = 0;
1543 uint8_t *primary_addr;
1523 1544
1524 primary_if = primary_if_get_selected(bat_priv); 1545 primary_if = batadv_primary_if_get_selected(bat_priv);
1525 if (!primary_if) { 1546 if (!primary_if) {
1526 ret = seq_printf(seq, 1547 ret = seq_printf(seq,
1527 "BATMAN mesh %s disabled - please specify interfaces to enable it\n", 1548 "BATMAN mesh %s disabled - please specify interfaces to enable it\n",
@@ -1536,9 +1557,10 @@ int batadv_bla_claim_table_seq_print_text(struct seq_file *seq, void *offset)
1536 goto out; 1557 goto out;
1537 } 1558 }
1538 1559
1560 primary_addr = primary_if->net_dev->dev_addr;
1539 seq_printf(seq, 1561 seq_printf(seq,
1540 "Claims announced for the mesh %s (orig %pM, group id %04x)\n", 1562 "Claims announced for the mesh %s (orig %pM, group id %04x)\n",
1541 net_dev->name, primary_if->net_dev->dev_addr, 1563 net_dev->name, primary_addr,
1542 ntohs(bat_priv->claim_dest.group)); 1564 ntohs(bat_priv->claim_dest.group));
1543 seq_printf(seq, " %-17s %-5s %-17s [o] (%-4s)\n", 1565 seq_printf(seq, " %-17s %-5s %-17s [o] (%-4s)\n",
1544 "Client", "VID", "Originator", "CRC"); 1566 "Client", "VID", "Originator", "CRC");
@@ -1547,8 +1569,8 @@ int batadv_bla_claim_table_seq_print_text(struct seq_file *seq, void *offset)
1547 1569
1548 rcu_read_lock(); 1570 rcu_read_lock();
1549 hlist_for_each_entry_rcu(claim, node, head, hash_entry) { 1571 hlist_for_each_entry_rcu(claim, node, head, hash_entry) {
1550 is_own = compare_eth(claim->backbone_gw->orig, 1572 is_own = batadv_compare_eth(claim->backbone_gw->orig,
1551 primary_if->net_dev->dev_addr); 1573 primary_addr);
1552 seq_printf(seq, " * %pM on % 5d by %pM [%c] (%04x)\n", 1574 seq_printf(seq, " * %pM on % 5d by %pM [%c] (%04x)\n",
1553 claim->addr, claim->vid, 1575 claim->addr, claim->vid,
1554 claim->backbone_gw->orig, 1576 claim->backbone_gw->orig,
@@ -1559,6 +1581,6 @@ int batadv_bla_claim_table_seq_print_text(struct seq_file *seq, void *offset)
1559 } 1581 }
1560out: 1582out:
1561 if (primary_if) 1583 if (primary_if)
1562 hardif_free_ref(primary_if); 1584 batadv_hardif_free_ref(primary_if);
1563 return ret; 1585 return ret;
1564} 1586}