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.c188
1 files changed, 97 insertions, 91 deletions
diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c
index fdda2c8d48fe..49e10d91c00b 100644
--- a/net/batman-adv/bridge_loop_avoidance.c
+++ b/net/batman-adv/bridge_loop_avoidance.c
@@ -34,8 +34,8 @@
34static const uint8_t batadv_announce_mac[4] = {0x43, 0x05, 0x43, 0x05}; 34static const uint8_t batadv_announce_mac[4] = {0x43, 0x05, 0x43, 0x05};
35 35
36static void batadv_bla_periodic_work(struct work_struct *work); 36static void batadv_bla_periodic_work(struct work_struct *work);
37static void batadv_bla_send_announce(struct bat_priv *bat_priv, 37static void batadv_bla_send_announce(struct batadv_priv *bat_priv,
38 struct backbone_gw *backbone_gw); 38 struct batadv_backbone_gw *backbone_gw);
39 39
40/* return the index of the claim */ 40/* return the index of the claim */
41static inline uint32_t batadv_choose_claim(const void *data, uint32_t size) 41static inline uint32_t batadv_choose_claim(const void *data, uint32_t size)
@@ -83,7 +83,7 @@ static inline uint32_t batadv_choose_backbone_gw(const void *data,
83static int batadv_compare_backbone_gw(const struct hlist_node *node, 83static int batadv_compare_backbone_gw(const struct hlist_node *node,
84 const void *data2) 84 const void *data2)
85{ 85{
86 const void *data1 = container_of(node, struct backbone_gw, 86 const void *data1 = container_of(node, struct batadv_backbone_gw,
87 hash_entry); 87 hash_entry);
88 88
89 return (memcmp(data1, data2, ETH_ALEN + sizeof(short)) == 0 ? 1 : 0); 89 return (memcmp(data1, data2, ETH_ALEN + sizeof(short)) == 0 ? 1 : 0);
@@ -93,14 +93,14 @@ static int batadv_compare_backbone_gw(const struct hlist_node *node,
93static int batadv_compare_claim(const struct hlist_node *node, 93static int batadv_compare_claim(const struct hlist_node *node,
94 const void *data2) 94 const void *data2)
95{ 95{
96 const void *data1 = container_of(node, struct claim, 96 const void *data1 = container_of(node, struct batadv_claim,
97 hash_entry); 97 hash_entry);
98 98
99 return (memcmp(data1, data2, ETH_ALEN + sizeof(short)) == 0 ? 1 : 0); 99 return (memcmp(data1, data2, ETH_ALEN + sizeof(short)) == 0 ? 1 : 0);
100} 100}
101 101
102/* free a backbone gw */ 102/* free a backbone gw */
103static void batadv_backbone_gw_free_ref(struct backbone_gw *backbone_gw) 103static void batadv_backbone_gw_free_ref(struct batadv_backbone_gw *backbone_gw)
104{ 104{
105 if (atomic_dec_and_test(&backbone_gw->refcount)) 105 if (atomic_dec_and_test(&backbone_gw->refcount))
106 kfree_rcu(backbone_gw, rcu); 106 kfree_rcu(backbone_gw, rcu);
@@ -109,16 +109,16 @@ static void batadv_backbone_gw_free_ref(struct backbone_gw *backbone_gw)
109/* finally deinitialize the claim */ 109/* finally deinitialize the claim */
110static void batadv_claim_free_rcu(struct rcu_head *rcu) 110static void batadv_claim_free_rcu(struct rcu_head *rcu)
111{ 111{
112 struct claim *claim; 112 struct batadv_claim *claim;
113 113
114 claim = container_of(rcu, struct claim, rcu); 114 claim = container_of(rcu, struct batadv_claim, rcu);
115 115
116 batadv_backbone_gw_free_ref(claim->backbone_gw); 116 batadv_backbone_gw_free_ref(claim->backbone_gw);
117 kfree(claim); 117 kfree(claim);
118} 118}
119 119
120/* 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 */
121static void batadv_claim_free_ref(struct claim *claim) 121static void batadv_claim_free_ref(struct batadv_claim *claim)
122{ 122{
123 if (atomic_dec_and_test(&claim->refcount)) 123 if (atomic_dec_and_test(&claim->refcount))
124 call_rcu(&claim->rcu, batadv_claim_free_rcu); 124 call_rcu(&claim->rcu, batadv_claim_free_rcu);
@@ -130,14 +130,14 @@ static void batadv_claim_free_ref(struct claim *claim)
130 * 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
131 * or NULL otherwise. 131 * or NULL otherwise.
132 */ 132 */
133static struct claim *batadv_claim_hash_find(struct bat_priv *bat_priv, 133static struct batadv_claim *batadv_claim_hash_find(struct batadv_priv *bat_priv,
134 struct claim *data) 134 struct batadv_claim *data)
135{ 135{
136 struct batadv_hashtable *hash = bat_priv->claim_hash; 136 struct batadv_hashtable *hash = bat_priv->claim_hash;
137 struct hlist_head *head; 137 struct hlist_head *head;
138 struct hlist_node *node; 138 struct hlist_node *node;
139 struct claim *claim; 139 struct batadv_claim *claim;
140 struct claim *claim_tmp = NULL; 140 struct batadv_claim *claim_tmp = NULL;
141 int index; 141 int index;
142 142
143 if (!hash) 143 if (!hash)
@@ -169,14 +169,15 @@ static struct claim *batadv_claim_hash_find(struct bat_priv *bat_priv,
169 * 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
170 * or NULL otherwise. 170 * or NULL otherwise.
171 */ 171 */
172static struct backbone_gw *batadv_backbone_hash_find(struct bat_priv *bat_priv, 172static struct batadv_backbone_gw *
173 uint8_t *addr, short vid) 173batadv_backbone_hash_find(struct batadv_priv *bat_priv,
174 uint8_t *addr, short vid)
174{ 175{
175 struct batadv_hashtable *hash = bat_priv->backbone_hash; 176 struct batadv_hashtable *hash = bat_priv->backbone_hash;
176 struct hlist_head *head; 177 struct hlist_head *head;
177 struct hlist_node *node; 178 struct hlist_node *node;
178 struct backbone_gw search_entry, *backbone_gw; 179 struct batadv_backbone_gw search_entry, *backbone_gw;
179 struct backbone_gw *backbone_gw_tmp = NULL; 180 struct batadv_backbone_gw *backbone_gw_tmp = NULL;
180 int index; 181 int index;
181 182
182 if (!hash) 183 if (!hash)
@@ -206,12 +207,13 @@ static struct backbone_gw *batadv_backbone_hash_find(struct bat_priv *bat_priv,
206} 207}
207 208
208/* delete all claims for a backbone */ 209/* delete all claims for a backbone */
209static void batadv_bla_del_backbone_claims(struct backbone_gw *backbone_gw) 210static void
211batadv_bla_del_backbone_claims(struct batadv_backbone_gw *backbone_gw)
210{ 212{
211 struct batadv_hashtable *hash; 213 struct batadv_hashtable *hash;
212 struct hlist_node *node, *node_tmp; 214 struct hlist_node *node, *node_tmp;
213 struct hlist_head *head; 215 struct hlist_head *head;
214 struct claim *claim; 216 struct batadv_claim *claim;
215 int i; 217 int i;
216 spinlock_t *list_lock; /* protects write access to the hash lists */ 218 spinlock_t *list_lock; /* protects write access to the hash lists */
217 219
@@ -247,12 +249,12 @@ static void batadv_bla_del_backbone_claims(struct backbone_gw *backbone_gw)
247 * 249 *
248 * sends a claim frame according to the provided info. 250 * sends a claim frame according to the provided info.
249 */ 251 */
250static void batadv_bla_send_claim(struct bat_priv *bat_priv, uint8_t *mac, 252static void batadv_bla_send_claim(struct batadv_priv *bat_priv, uint8_t *mac,
251 short vid, int claimtype) 253 short vid, int claimtype)
252{ 254{
253 struct sk_buff *skb; 255 struct sk_buff *skb;
254 struct ethhdr *ethhdr; 256 struct ethhdr *ethhdr;
255 struct hard_iface *primary_if; 257 struct batadv_hard_iface *primary_if;
256 struct net_device *soft_iface; 258 struct net_device *soft_iface;
257 uint8_t *hw_src; 259 uint8_t *hw_src;
258 struct batadv_bla_claim_dst local_claim_dest; 260 struct batadv_bla_claim_dst local_claim_dest;
@@ -353,11 +355,12 @@ out:
353 * searches for the backbone gw or creates a new one if it could not 355 * searches for the backbone gw or creates a new one if it could not
354 * be found. 356 * be found.
355 */ 357 */
356static struct backbone_gw *batadv_bla_get_backbone_gw(struct bat_priv *bat_priv, 358static struct batadv_backbone_gw *
357 uint8_t *orig, short vid) 359batadv_bla_get_backbone_gw(struct batadv_priv *bat_priv, uint8_t *orig,
360 short vid)
358{ 361{
359 struct backbone_gw *entry; 362 struct batadv_backbone_gw *entry;
360 struct orig_node *orig_node; 363 struct batadv_orig_node *orig_node;
361 int hash_added; 364 int hash_added;
362 365
363 entry = batadv_backbone_hash_find(bat_priv, orig, vid); 366 entry = batadv_backbone_hash_find(bat_priv, orig, vid);
@@ -407,11 +410,12 @@ static struct backbone_gw *batadv_bla_get_backbone_gw(struct bat_priv *bat_priv,
407/* update or add the own backbone gw to make sure we announce 410/* update or add the own backbone gw to make sure we announce
408 * where we receive other backbone gws 411 * where we receive other backbone gws
409 */ 412 */
410static void batadv_bla_update_own_backbone_gw(struct bat_priv *bat_priv, 413static void
411 struct hard_iface *primary_if, 414batadv_bla_update_own_backbone_gw(struct batadv_priv *bat_priv,
412 short vid) 415 struct batadv_hard_iface *primary_if,
416 short vid)
413{ 417{
414 struct backbone_gw *backbone_gw; 418 struct batadv_backbone_gw *backbone_gw;
415 419
416 backbone_gw = batadv_bla_get_backbone_gw(bat_priv, 420 backbone_gw = batadv_bla_get_backbone_gw(bat_priv,
417 primary_if->net_dev->dev_addr, 421 primary_if->net_dev->dev_addr,
@@ -429,14 +433,15 @@ static void batadv_bla_update_own_backbone_gw(struct bat_priv *bat_priv,
429 * Repeat all of our own claims, and finally send an ANNOUNCE frame 433 * Repeat all of our own claims, and finally send an ANNOUNCE frame
430 * to allow the requester another check if the CRC is correct now. 434 * to allow the requester another check if the CRC is correct now.
431 */ 435 */
432static void batadv_bla_answer_request(struct bat_priv *bat_priv, 436static void batadv_bla_answer_request(struct batadv_priv *bat_priv,
433 struct hard_iface *primary_if, short vid) 437 struct batadv_hard_iface *primary_if,
438 short vid)
434{ 439{
435 struct hlist_node *node; 440 struct hlist_node *node;
436 struct hlist_head *head; 441 struct hlist_head *head;
437 struct batadv_hashtable *hash; 442 struct batadv_hashtable *hash;
438 struct claim *claim; 443 struct batadv_claim *claim;
439 struct backbone_gw *backbone_gw; 444 struct batadv_backbone_gw *backbone_gw;
440 int i; 445 int i;
441 446
442 batadv_dbg(BATADV_DBG_BLA, bat_priv, 447 batadv_dbg(BATADV_DBG_BLA, bat_priv,
@@ -475,7 +480,7 @@ static void batadv_bla_answer_request(struct bat_priv *bat_priv,
475 * After the request, it will repeat all of his own claims and finally 480 * After the request, it will repeat all of his own claims and finally
476 * send an announcement claim with which we can check again. 481 * send an announcement claim with which we can check again.
477 */ 482 */
478static void batadv_bla_send_request(struct backbone_gw *backbone_gw) 483static void batadv_bla_send_request(struct batadv_backbone_gw *backbone_gw)
479{ 484{
480 /* first, remove all old entries */ 485 /* first, remove all old entries */
481 batadv_bla_del_backbone_claims(backbone_gw); 486 batadv_bla_del_backbone_claims(backbone_gw);
@@ -500,8 +505,8 @@ static void batadv_bla_send_request(struct backbone_gw *backbone_gw)
500 * This function sends an announcement. It is called from multiple 505 * This function sends an announcement. It is called from multiple
501 * places. 506 * places.
502 */ 507 */
503static void batadv_bla_send_announce(struct bat_priv *bat_priv, 508static void batadv_bla_send_announce(struct batadv_priv *bat_priv,
504 struct backbone_gw *backbone_gw) 509 struct batadv_backbone_gw *backbone_gw)
505{ 510{
506 uint8_t mac[ETH_ALEN]; 511 uint8_t mac[ETH_ALEN];
507 __be16 crc; 512 __be16 crc;
@@ -522,12 +527,12 @@ static void batadv_bla_send_announce(struct bat_priv *bat_priv,
522 * 527 *
523 * Adds a claim in the claim hash. 528 * Adds a claim in the claim hash.
524 */ 529 */
525static void batadv_bla_add_claim(struct bat_priv *bat_priv, const uint8_t *mac, 530static void batadv_bla_add_claim(struct batadv_priv *bat_priv,
526 const short vid, 531 const uint8_t *mac, const short vid,
527 struct backbone_gw *backbone_gw) 532 struct batadv_backbone_gw *backbone_gw)
528{ 533{
529 struct claim *claim; 534 struct batadv_claim *claim;
530 struct claim search_claim; 535 struct batadv_claim search_claim;
531 int hash_added; 536 int hash_added;
532 537
533 memcpy(search_claim.addr, mac, ETH_ALEN); 538 memcpy(search_claim.addr, mac, ETH_ALEN);
@@ -588,10 +593,10 @@ claim_free_ref:
588/* Delete a claim from the claim hash which has the 593/* Delete a claim from the claim hash which has the
589 * given mac address and vid. 594 * given mac address and vid.
590 */ 595 */
591static void batadv_bla_del_claim(struct bat_priv *bat_priv, const uint8_t *mac, 596static void batadv_bla_del_claim(struct batadv_priv *bat_priv,
592 const short vid) 597 const uint8_t *mac, const short vid)
593{ 598{
594 struct claim search_claim, *claim; 599 struct batadv_claim search_claim, *claim;
595 600
596 memcpy(search_claim.addr, mac, ETH_ALEN); 601 memcpy(search_claim.addr, mac, ETH_ALEN);
597 search_claim.vid = vid; 602 search_claim.vid = vid;
@@ -613,11 +618,11 @@ static void batadv_bla_del_claim(struct bat_priv *bat_priv, const uint8_t *mac,
613} 618}
614 619
615/* check for ANNOUNCE frame, return 1 if handled */ 620/* check for ANNOUNCE frame, return 1 if handled */
616static int batadv_handle_announce(struct bat_priv *bat_priv, 621static int batadv_handle_announce(struct batadv_priv *bat_priv,
617 uint8_t *an_addr, uint8_t *backbone_addr, 622 uint8_t *an_addr, uint8_t *backbone_addr,
618 short vid) 623 short vid)
619{ 624{
620 struct backbone_gw *backbone_gw; 625 struct batadv_backbone_gw *backbone_gw;
621 uint16_t crc; 626 uint16_t crc;
622 627
623 if (memcmp(an_addr, batadv_announce_mac, 4) != 0) 628 if (memcmp(an_addr, batadv_announce_mac, 4) != 0)
@@ -659,8 +664,8 @@ static int batadv_handle_announce(struct bat_priv *bat_priv,
659} 664}
660 665
661/* check for REQUEST frame, return 1 if handled */ 666/* check for REQUEST frame, return 1 if handled */
662static int batadv_handle_request(struct bat_priv *bat_priv, 667static int batadv_handle_request(struct batadv_priv *bat_priv,
663 struct hard_iface *primary_if, 668 struct batadv_hard_iface *primary_if,
664 uint8_t *backbone_addr, 669 uint8_t *backbone_addr,
665 struct ethhdr *ethhdr, short vid) 670 struct ethhdr *ethhdr, short vid)
666{ 671{
@@ -683,12 +688,12 @@ static int batadv_handle_request(struct bat_priv *bat_priv,
683} 688}
684 689
685/* check for UNCLAIM frame, return 1 if handled */ 690/* check for UNCLAIM frame, return 1 if handled */
686static int batadv_handle_unclaim(struct bat_priv *bat_priv, 691static int batadv_handle_unclaim(struct batadv_priv *bat_priv,
687 struct hard_iface *primary_if, 692 struct batadv_hard_iface *primary_if,
688 uint8_t *backbone_addr, 693 uint8_t *backbone_addr,
689 uint8_t *claim_addr, short vid) 694 uint8_t *claim_addr, short vid)
690{ 695{
691 struct backbone_gw *backbone_gw; 696 struct batadv_backbone_gw *backbone_gw;
692 697
693 /* unclaim in any case if it is our own */ 698 /* unclaim in any case if it is our own */
694 if (primary_if && batadv_compare_eth(backbone_addr, 699 if (primary_if && batadv_compare_eth(backbone_addr,
@@ -712,12 +717,12 @@ static int batadv_handle_unclaim(struct bat_priv *bat_priv,
712} 717}
713 718
714/* check for CLAIM frame, return 1 if handled */ 719/* check for CLAIM frame, return 1 if handled */
715static int batadv_handle_claim(struct bat_priv *bat_priv, 720static int batadv_handle_claim(struct batadv_priv *bat_priv,
716 struct hard_iface *primary_if, 721 struct batadv_hard_iface *primary_if,
717 uint8_t *backbone_addr, uint8_t *claim_addr, 722 uint8_t *backbone_addr, uint8_t *claim_addr,
718 short vid) 723 short vid)
719{ 724{
720 struct backbone_gw *backbone_gw; 725 struct batadv_backbone_gw *backbone_gw;
721 726
722 /* register the gateway if not yet available, and add the claim. */ 727 /* register the gateway if not yet available, and add the claim. */
723 728
@@ -752,13 +757,13 @@ static int batadv_handle_claim(struct bat_priv *bat_priv,
752 * 1 - if is a claim packet from another group 757 * 1 - if is a claim packet from another group
753 * 0 - if it is not a claim packet 758 * 0 - if it is not a claim packet
754 */ 759 */
755static int batadv_check_claim_group(struct bat_priv *bat_priv, 760static int batadv_check_claim_group(struct batadv_priv *bat_priv,
756 struct hard_iface *primary_if, 761 struct batadv_hard_iface *primary_if,
757 uint8_t *hw_src, uint8_t *hw_dst, 762 uint8_t *hw_src, uint8_t *hw_dst,
758 struct ethhdr *ethhdr) 763 struct ethhdr *ethhdr)
759{ 764{
760 uint8_t *backbone_addr; 765 uint8_t *backbone_addr;
761 struct orig_node *orig_node; 766 struct batadv_orig_node *orig_node;
762 struct batadv_bla_claim_dst *bla_dst, *bla_dst_own; 767 struct batadv_bla_claim_dst *bla_dst, *bla_dst_own;
763 768
764 bla_dst = (struct batadv_bla_claim_dst *)hw_dst; 769 bla_dst = (struct batadv_bla_claim_dst *)hw_dst;
@@ -824,8 +829,8 @@ static int batadv_check_claim_group(struct bat_priv *bat_priv,
824 * returns 1 if it was a claim frame, otherwise return 0 to 829 * returns 1 if it was a claim frame, otherwise return 0 to
825 * tell the callee that it can use the frame on its own. 830 * tell the callee that it can use the frame on its own.
826 */ 831 */
827static int batadv_bla_process_claim(struct bat_priv *bat_priv, 832static int batadv_bla_process_claim(struct batadv_priv *bat_priv,
828 struct hard_iface *primary_if, 833 struct batadv_hard_iface *primary_if,
829 struct sk_buff *skb) 834 struct sk_buff *skb)
830{ 835{
831 struct ethhdr *ethhdr; 836 struct ethhdr *ethhdr;
@@ -926,9 +931,9 @@ static int batadv_bla_process_claim(struct bat_priv *bat_priv,
926/* Check when we last heard from other nodes, and remove them in case of 931/* Check when we last heard from other nodes, and remove them in case of
927 * a time out, or clean all backbone gws if now is set. 932 * a time out, or clean all backbone gws if now is set.
928 */ 933 */
929static void batadv_bla_purge_backbone_gw(struct bat_priv *bat_priv, int now) 934static void batadv_bla_purge_backbone_gw(struct batadv_priv *bat_priv, int now)
930{ 935{
931 struct backbone_gw *backbone_gw; 936 struct batadv_backbone_gw *backbone_gw;
932 struct hlist_node *node, *node_tmp; 937 struct hlist_node *node, *node_tmp;
933 struct hlist_head *head; 938 struct hlist_head *head;
934 struct batadv_hashtable *hash; 939 struct batadv_hashtable *hash;
@@ -977,10 +982,11 @@ purge_now:
977 * Check when we heard last time from our own claims, and remove them in case of 982 * Check when we heard last time from our own claims, and remove them in case of
978 * a time out, or clean all claims if now is set 983 * a time out, or clean all claims if now is set
979 */ 984 */
980static void batadv_bla_purge_claims(struct bat_priv *bat_priv, 985static void batadv_bla_purge_claims(struct batadv_priv *bat_priv,
981 struct hard_iface *primary_if, int now) 986 struct batadv_hard_iface *primary_if,
987 int now)
982{ 988{
983 struct claim *claim; 989 struct batadv_claim *claim;
984 struct hlist_node *node; 990 struct hlist_node *node;
985 struct hlist_head *head; 991 struct hlist_head *head;
986 struct batadv_hashtable *hash; 992 struct batadv_hashtable *hash;
@@ -1023,11 +1029,11 @@ purge_now:
1023 * 1029 *
1024 * Update the backbone gateways when the own orig address changes. 1030 * Update the backbone gateways when the own orig address changes.
1025 */ 1031 */
1026void batadv_bla_update_orig_address(struct bat_priv *bat_priv, 1032void batadv_bla_update_orig_address(struct batadv_priv *bat_priv,
1027 struct hard_iface *primary_if, 1033 struct batadv_hard_iface *primary_if,
1028 struct hard_iface *oldif) 1034 struct batadv_hard_iface *oldif)
1029{ 1035{
1030 struct backbone_gw *backbone_gw; 1036 struct batadv_backbone_gw *backbone_gw;
1031 struct hlist_node *node; 1037 struct hlist_node *node;
1032 struct hlist_head *head; 1038 struct hlist_head *head;
1033 struct batadv_hashtable *hash; 1039 struct batadv_hashtable *hash;
@@ -1071,7 +1077,7 @@ void batadv_bla_update_orig_address(struct bat_priv *bat_priv,
1071 1077
1072 1078
1073/* (re)start the timer */ 1079/* (re)start the timer */
1074static void batadv_bla_start_timer(struct bat_priv *bat_priv) 1080static void batadv_bla_start_timer(struct batadv_priv *bat_priv)
1075{ 1081{
1076 INIT_DELAYED_WORK(&bat_priv->bla_work, batadv_bla_periodic_work); 1082 INIT_DELAYED_WORK(&bat_priv->bla_work, batadv_bla_periodic_work);
1077 queue_delayed_work(batadv_event_workqueue, &bat_priv->bla_work, 1083 queue_delayed_work(batadv_event_workqueue, &bat_priv->bla_work,
@@ -1086,15 +1092,15 @@ static void batadv_bla_periodic_work(struct work_struct *work)
1086{ 1092{
1087 struct delayed_work *delayed_work = 1093 struct delayed_work *delayed_work =
1088 container_of(work, struct delayed_work, work); 1094 container_of(work, struct delayed_work, work);
1089 struct bat_priv *bat_priv = 1095 struct batadv_priv *bat_priv;
1090 container_of(delayed_work, struct bat_priv, bla_work);
1091 struct hlist_node *node; 1096 struct hlist_node *node;
1092 struct hlist_head *head; 1097 struct hlist_head *head;
1093 struct backbone_gw *backbone_gw; 1098 struct batadv_backbone_gw *backbone_gw;
1094 struct batadv_hashtable *hash; 1099 struct batadv_hashtable *hash;
1095 struct hard_iface *primary_if; 1100 struct batadv_hard_iface *primary_if;
1096 int i; 1101 int i;
1097 1102
1103 bat_priv = container_of(delayed_work, struct batadv_priv, bla_work);
1098 primary_if = batadv_primary_if_get_selected(bat_priv); 1104 primary_if = batadv_primary_if_get_selected(bat_priv);
1099 if (!primary_if) 1105 if (!primary_if)
1100 goto out; 1106 goto out;
@@ -1140,11 +1146,11 @@ static struct lock_class_key batadv_claim_hash_lock_class_key;
1140static struct lock_class_key batadv_backbone_hash_lock_class_key; 1146static struct lock_class_key batadv_backbone_hash_lock_class_key;
1141 1147
1142/* initialize all bla structures */ 1148/* initialize all bla structures */
1143int batadv_bla_init(struct bat_priv *bat_priv) 1149int batadv_bla_init(struct batadv_priv *bat_priv)
1144{ 1150{
1145 int i; 1151 int i;
1146 uint8_t claim_dest[ETH_ALEN] = {0xff, 0x43, 0x05, 0x00, 0x00, 0x00}; 1152 uint8_t claim_dest[ETH_ALEN] = {0xff, 0x43, 0x05, 0x00, 0x00, 0x00};
1147 struct hard_iface *primary_if; 1153 struct batadv_hard_iface *primary_if;
1148 1154
1149 batadv_dbg(BATADV_DBG_BLA, bat_priv, "bla hash registering\n"); 1155 batadv_dbg(BATADV_DBG_BLA, bat_priv, "bla hash registering\n");
1150 1156
@@ -1200,14 +1206,14 @@ int batadv_bla_init(struct bat_priv *bat_priv)
1200 * sent by another host, drop it. We allow equal packets from 1206 * sent by another host, drop it. We allow equal packets from
1201 * the same host however as this might be intended. 1207 * the same host however as this might be intended.
1202 */ 1208 */
1203int batadv_bla_check_bcast_duplist(struct bat_priv *bat_priv, 1209int batadv_bla_check_bcast_duplist(struct batadv_priv *bat_priv,
1204 struct batadv_bcast_packet *bcast_packet, 1210 struct batadv_bcast_packet *bcast_packet,
1205 int hdr_size) 1211 int hdr_size)
1206{ 1212{
1207 int i, length, curr; 1213 int i, length, curr;
1208 uint8_t *content; 1214 uint8_t *content;
1209 uint16_t crc; 1215 uint16_t crc;
1210 struct bcast_duplist_entry *entry; 1216 struct batadv_bcast_duplist_entry *entry;
1211 1217
1212 length = hdr_size - sizeof(*bcast_packet); 1218 length = hdr_size - sizeof(*bcast_packet);
1213 content = (uint8_t *)bcast_packet; 1219 content = (uint8_t *)bcast_packet;
@@ -1260,12 +1266,12 @@ int batadv_bla_check_bcast_duplist(struct bat_priv *bat_priv,
1260 * 1266 *
1261 * returns 1 if it is found, 0 otherwise 1267 * returns 1 if it is found, 0 otherwise
1262 */ 1268 */
1263int batadv_bla_is_backbone_gw_orig(struct bat_priv *bat_priv, uint8_t *orig) 1269int batadv_bla_is_backbone_gw_orig(struct batadv_priv *bat_priv, uint8_t *orig)
1264{ 1270{
1265 struct batadv_hashtable *hash = bat_priv->backbone_hash; 1271 struct batadv_hashtable *hash = bat_priv->backbone_hash;
1266 struct hlist_head *head; 1272 struct hlist_head *head;
1267 struct hlist_node *node; 1273 struct hlist_node *node;
1268 struct backbone_gw *backbone_gw; 1274 struct batadv_backbone_gw *backbone_gw;
1269 int i; 1275 int i;
1270 1276
1271 if (!atomic_read(&bat_priv->bridge_loop_avoidance)) 1277 if (!atomic_read(&bat_priv->bridge_loop_avoidance))
@@ -1300,11 +1306,11 @@ int batadv_bla_is_backbone_gw_orig(struct bat_priv *bat_priv, uint8_t *orig)
1300 * returns 0. 1306 * returns 0.
1301 */ 1307 */
1302int batadv_bla_is_backbone_gw(struct sk_buff *skb, 1308int batadv_bla_is_backbone_gw(struct sk_buff *skb,
1303 struct orig_node *orig_node, int hdr_size) 1309 struct batadv_orig_node *orig_node, int hdr_size)
1304{ 1310{
1305 struct ethhdr *ethhdr; 1311 struct ethhdr *ethhdr;
1306 struct vlan_ethhdr *vhdr; 1312 struct vlan_ethhdr *vhdr;
1307 struct backbone_gw *backbone_gw; 1313 struct batadv_backbone_gw *backbone_gw;
1308 short vid = -1; 1314 short vid = -1;
1309 1315
1310 if (!atomic_read(&orig_node->bat_priv->bridge_loop_avoidance)) 1316 if (!atomic_read(&orig_node->bat_priv->bridge_loop_avoidance))
@@ -1336,9 +1342,9 @@ int batadv_bla_is_backbone_gw(struct sk_buff *skb,
1336} 1342}
1337 1343
1338/* free all bla structures (for softinterface free or module unload) */ 1344/* free all bla structures (for softinterface free or module unload) */
1339void batadv_bla_free(struct bat_priv *bat_priv) 1345void batadv_bla_free(struct batadv_priv *bat_priv)
1340{ 1346{
1341 struct hard_iface *primary_if; 1347 struct batadv_hard_iface *primary_if;
1342 1348
1343 cancel_delayed_work_sync(&bat_priv->bla_work); 1349 cancel_delayed_work_sync(&bat_priv->bla_work);
1344 primary_if = batadv_primary_if_get_selected(bat_priv); 1350 primary_if = batadv_primary_if_get_selected(bat_priv);
@@ -1369,11 +1375,11 @@ void batadv_bla_free(struct bat_priv *bat_priv)
1369 * returns 1, otherwise it returns 0 and the caller shall further 1375 * returns 1, otherwise it returns 0 and the caller shall further
1370 * process the skb. 1376 * process the skb.
1371 */ 1377 */
1372int batadv_bla_rx(struct bat_priv *bat_priv, struct sk_buff *skb, short vid) 1378int batadv_bla_rx(struct batadv_priv *bat_priv, struct sk_buff *skb, short vid)
1373{ 1379{
1374 struct ethhdr *ethhdr; 1380 struct ethhdr *ethhdr;
1375 struct claim search_claim, *claim = NULL; 1381 struct batadv_claim search_claim, *claim = NULL;
1376 struct hard_iface *primary_if; 1382 struct batadv_hard_iface *primary_if;
1377 int ret; 1383 int ret;
1378 1384
1379 ethhdr = (struct ethhdr *)skb_mac_header(skb); 1385 ethhdr = (struct ethhdr *)skb_mac_header(skb);
@@ -1456,11 +1462,11 @@ out:
1456 * returns 1, otherwise it returns 0 and the caller shall further 1462 * returns 1, otherwise it returns 0 and the caller shall further
1457 * process the skb. 1463 * process the skb.
1458 */ 1464 */
1459int batadv_bla_tx(struct bat_priv *bat_priv, struct sk_buff *skb, short vid) 1465int batadv_bla_tx(struct batadv_priv *bat_priv, struct sk_buff *skb, short vid)
1460{ 1466{
1461 struct ethhdr *ethhdr; 1467 struct ethhdr *ethhdr;
1462 struct claim search_claim, *claim = NULL; 1468 struct batadv_claim search_claim, *claim = NULL;
1463 struct hard_iface *primary_if; 1469 struct batadv_hard_iface *primary_if;
1464 int ret = 0; 1470 int ret = 0;
1465 1471
1466 primary_if = batadv_primary_if_get_selected(bat_priv); 1472 primary_if = batadv_primary_if_get_selected(bat_priv);
@@ -1533,10 +1539,10 @@ out:
1533int batadv_bla_claim_table_seq_print_text(struct seq_file *seq, void *offset) 1539int batadv_bla_claim_table_seq_print_text(struct seq_file *seq, void *offset)
1534{ 1540{
1535 struct net_device *net_dev = (struct net_device *)seq->private; 1541 struct net_device *net_dev = (struct net_device *)seq->private;
1536 struct bat_priv *bat_priv = netdev_priv(net_dev); 1542 struct batadv_priv *bat_priv = netdev_priv(net_dev);
1537 struct batadv_hashtable *hash = bat_priv->claim_hash; 1543 struct batadv_hashtable *hash = bat_priv->claim_hash;
1538 struct claim *claim; 1544 struct batadv_claim *claim;
1539 struct hard_iface *primary_if; 1545 struct batadv_hard_iface *primary_if;
1540 struct hlist_node *node; 1546 struct hlist_node *node;
1541 struct hlist_head *head; 1547 struct hlist_head *head;
1542 uint32_t i; 1548 uint32_t i;