aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorSven Eckelmann <sven@narfation.org>2012-05-11 20:09:39 -0400
committerAntonio Quartulli <ordex@autistici.org>2012-06-20 16:15:29 -0400
commit08c36d3e8ad1f73d3b0322842363b23f6d203630 (patch)
tree9190100a886c18956fee193acbd8fd160060bc19 /net
parent04b482a21aaf22cf5b327fb6a3fba6fdc8cb3de9 (diff)
batman-adv: Prefix translation-table non-static functions with batadv_
batman-adv can be compiled as part of the kernel instead of an module. In that case the linker will see all non-static symbols of batman-adv and all other non-static symbols of the kernel. This could lead to symbol collisions. A prefix for the batman-adv symbols that defines their private namespace avoids such a problem. Reported-by: David Miller <davem@davemloft.net> Signed-off-by: Sven Eckelmann <sven@narfation.org>
Diffstat (limited to 'net')
-rw-r--r--net/batman-adv/bat_debugfs.c4
-rw-r--r--net/batman-adv/bat_iv_ogm.c23
-rw-r--r--net/batman-adv/bridge_loop_avoidance.c4
-rw-r--r--net/batman-adv/gateway_client.c4
-rw-r--r--net/batman-adv/main.c6
-rw-r--r--net/batman-adv/originator.c4
-rw-r--r--net/batman-adv/routing.c23
-rw-r--r--net/batman-adv/soft-interface.c10
-rw-r--r--net/batman-adv/translation-table.c84
-rw-r--r--net/batman-adv/translation-table.h63
-rw-r--r--net/batman-adv/unicast.c7
11 files changed, 125 insertions, 107 deletions
diff --git a/net/batman-adv/bat_debugfs.c b/net/batman-adv/bat_debugfs.c
index 51b67f4a064b..93cc0d14c70a 100644
--- a/net/batman-adv/bat_debugfs.c
+++ b/net/batman-adv/bat_debugfs.c
@@ -242,7 +242,7 @@ static int gateways_open(struct inode *inode, struct file *file)
242static int transtable_global_open(struct inode *inode, struct file *file) 242static int transtable_global_open(struct inode *inode, struct file *file)
243{ 243{
244 struct net_device *net_dev = (struct net_device *)inode->i_private; 244 struct net_device *net_dev = (struct net_device *)inode->i_private;
245 return single_open(file, tt_global_seq_print_text, net_dev); 245 return single_open(file, batadv_tt_global_seq_print_text, net_dev);
246} 246}
247 247
248#ifdef CONFIG_BATMAN_ADV_BLA 248#ifdef CONFIG_BATMAN_ADV_BLA
@@ -257,7 +257,7 @@ static int bla_claim_table_open(struct inode *inode, struct file *file)
257static int transtable_local_open(struct inode *inode, struct file *file) 257static int transtable_local_open(struct inode *inode, struct file *file)
258{ 258{
259 struct net_device *net_dev = (struct net_device *)inode->i_private; 259 struct net_device *net_dev = (struct net_device *)inode->i_private;
260 return single_open(file, tt_local_seq_print_text, net_dev); 260 return single_open(file, batadv_tt_local_seq_print_text, net_dev);
261} 261}
262 262
263static int vis_data_open(struct inode *inode, struct file *file) 263static int vis_data_open(struct inode *inode, struct file *file)
diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c
index 1566eac02d4c..62b52b663afb 100644
--- a/net/batman-adv/bat_iv_ogm.c
+++ b/net/batman-adv/bat_iv_ogm.c
@@ -138,7 +138,10 @@ static uint8_t hop_penalty(uint8_t tq, const struct bat_priv *bat_priv)
138static int bat_iv_ogm_aggr_packet(int buff_pos, int packet_len, 138static int bat_iv_ogm_aggr_packet(int buff_pos, int packet_len,
139 int tt_num_changes) 139 int tt_num_changes)
140{ 140{
141 int next_buff_pos = buff_pos + BATMAN_OGM_HLEN + tt_len(tt_num_changes); 141 int next_buff_pos = 0;
142
143 next_buff_pos += buff_pos + BATMAN_OGM_HLEN;
144 next_buff_pos += batadv_tt_len(tt_num_changes);
142 145
143 return (next_buff_pos <= packet_len) && 146 return (next_buff_pos <= packet_len) &&
144 (next_buff_pos <= MAX_AGGREGATION_BYTES); 147 (next_buff_pos <= MAX_AGGREGATION_BYTES);
@@ -188,8 +191,8 @@ static void bat_iv_ogm_send_to_if(struct forw_packet *forw_packet,
188 batman_ogm_packet->ttvn, hard_iface->net_dev->name, 191 batman_ogm_packet->ttvn, hard_iface->net_dev->name,
189 hard_iface->net_dev->dev_addr); 192 hard_iface->net_dev->dev_addr);
190 193
191 buff_pos += BATMAN_OGM_HLEN + 194 buff_pos += BATMAN_OGM_HLEN;
192 tt_len(batman_ogm_packet->tt_num_changes); 195 buff_pos += batadv_tt_len(batman_ogm_packet->tt_num_changes);
193 packet_num++; 196 packet_num++;
194 batman_ogm_packet = (struct batman_ogm_packet *) 197 batman_ogm_packet = (struct batman_ogm_packet *)
195 (forw_packet->skb->data + buff_pos); 198 (forw_packet->skb->data + buff_pos);
@@ -556,7 +559,7 @@ static void bat_iv_ogm_forward(struct orig_node *orig_node,
556 batman_ogm_packet->flags &= ~DIRECTLINK; 559 batman_ogm_packet->flags &= ~DIRECTLINK;
557 560
558 bat_iv_ogm_queue_add(bat_priv, (unsigned char *)batman_ogm_packet, 561 bat_iv_ogm_queue_add(bat_priv, (unsigned char *)batman_ogm_packet,
559 BATMAN_OGM_HLEN + tt_len(tt_num_changes), 562 BATMAN_OGM_HLEN + batadv_tt_len(tt_num_changes),
560 if_incoming, 0, bat_iv_ogm_fwd_send_time()); 563 if_incoming, 0, bat_iv_ogm_fwd_send_time());
561} 564}
562 565
@@ -724,10 +727,10 @@ update_tt:
724 if (((batman_ogm_packet->orig != ethhdr->h_source) && 727 if (((batman_ogm_packet->orig != ethhdr->h_source) &&
725 (batman_ogm_packet->header.ttl > 2)) || 728 (batman_ogm_packet->header.ttl > 2)) ||
726 (batman_ogm_packet->flags & PRIMARIES_FIRST_HOP)) 729 (batman_ogm_packet->flags & PRIMARIES_FIRST_HOP))
727 tt_update_orig(bat_priv, orig_node, tt_buff, 730 batadv_tt_update_orig(bat_priv, orig_node, tt_buff,
728 batman_ogm_packet->tt_num_changes, 731 batman_ogm_packet->tt_num_changes,
729 batman_ogm_packet->ttvn, 732 batman_ogm_packet->ttvn,
730 ntohs(batman_ogm_packet->tt_crc)); 733 ntohs(batman_ogm_packet->tt_crc));
731 734
732 if (orig_node->gw_flags != batman_ogm_packet->gw_flags) 735 if (orig_node->gw_flags != batman_ogm_packet->gw_flags)
733 batadv_gw_node_update(bat_priv, orig_node, 736 batadv_gw_node_update(bat_priv, orig_node,
@@ -1229,8 +1232,8 @@ static int bat_iv_ogm_receive(struct sk_buff *skb,
1229 bat_iv_ogm_process(ethhdr, batman_ogm_packet, 1232 bat_iv_ogm_process(ethhdr, batman_ogm_packet,
1230 tt_buff, if_incoming); 1233 tt_buff, if_incoming);
1231 1234
1232 buff_pos += BATMAN_OGM_HLEN + 1235 buff_pos += BATMAN_OGM_HLEN;
1233 tt_len(batman_ogm_packet->tt_num_changes); 1236 buff_pos += batadv_tt_len(batman_ogm_packet->tt_num_changes);
1234 1237
1235 batman_ogm_packet = (struct batman_ogm_packet *) 1238 batman_ogm_packet = (struct batman_ogm_packet *)
1236 (packet_buff + buff_pos); 1239 (packet_buff + buff_pos);
diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c
index c4b28af69297..bd356a12882a 100644
--- a/net/batman-adv/bridge_loop_avoidance.c
+++ b/net/batman-adv/bridge_loop_avoidance.c
@@ -397,8 +397,8 @@ static struct backbone_gw *bla_get_backbone_gw(struct bat_priv *bat_priv,
397 /* this is a gateway now, remove any tt entries */ 397 /* this is a gateway now, remove any tt entries */
398 orig_node = orig_hash_find(bat_priv, orig); 398 orig_node = orig_hash_find(bat_priv, orig);
399 if (orig_node) { 399 if (orig_node) {
400 tt_global_del_orig(bat_priv, orig_node, 400 batadv_tt_global_del_orig(bat_priv, orig_node,
401 "became a backbone gateway"); 401 "became a backbone gateway");
402 batadv_orig_node_free_ref(orig_node); 402 batadv_orig_node_free_ref(orig_node);
403 } 403 }
404 return entry; 404 return entry;
diff --git a/net/batman-adv/gateway_client.c b/net/batman-adv/gateway_client.c
index 2bf330d16485..e396029e578b 100644
--- a/net/batman-adv/gateway_client.c
+++ b/net/batman-adv/gateway_client.c
@@ -652,8 +652,8 @@ bool batadv_gw_out_of_range(struct bat_priv *bat_priv,
652 if (!ret) 652 if (!ret)
653 goto out; 653 goto out;
654 654
655 orig_dst_node = transtable_search(bat_priv, ethhdr->h_source, 655 orig_dst_node = batadv_transtable_search(bat_priv, ethhdr->h_source,
656 ethhdr->h_dest); 656 ethhdr->h_dest);
657 if (!orig_dst_node) 657 if (!orig_dst_node)
658 goto out; 658 goto out;
659 659
diff --git a/net/batman-adv/main.c b/net/batman-adv/main.c
index b9531a11b7bf..8d2011b8ed35 100644
--- a/net/batman-adv/main.c
+++ b/net/batman-adv/main.c
@@ -115,11 +115,11 @@ int mesh_init(struct net_device *soft_iface)
115 if (ret < 0) 115 if (ret < 0)
116 goto err; 116 goto err;
117 117
118 ret = tt_init(bat_priv); 118 ret = batadv_tt_init(bat_priv);
119 if (ret < 0) 119 if (ret < 0)
120 goto err; 120 goto err;
121 121
122 tt_local_add(soft_iface, soft_iface->dev_addr, NULL_IFINDEX); 122 batadv_tt_local_add(soft_iface, soft_iface->dev_addr, NULL_IFINDEX);
123 123
124 ret = vis_init(bat_priv); 124 ret = vis_init(bat_priv);
125 if (ret < 0) 125 if (ret < 0)
@@ -152,7 +152,7 @@ void mesh_free(struct net_device *soft_iface)
152 batadv_gw_node_purge(bat_priv); 152 batadv_gw_node_purge(bat_priv);
153 batadv_originator_free(bat_priv); 153 batadv_originator_free(bat_priv);
154 154
155 tt_free(bat_priv); 155 batadv_tt_free(bat_priv);
156 156
157 batadv_bla_free(bat_priv); 157 batadv_bla_free(bat_priv);
158 158
diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c
index 12c2e1ed2560..030666c12daf 100644
--- a/net/batman-adv/originator.c
+++ b/net/batman-adv/originator.c
@@ -139,8 +139,8 @@ static void orig_node_free_rcu(struct rcu_head *rcu)
139 spin_unlock_bh(&orig_node->neigh_list_lock); 139 spin_unlock_bh(&orig_node->neigh_list_lock);
140 140
141 frag_list_free(&orig_node->frag_list); 141 frag_list_free(&orig_node->frag_list);
142 tt_global_del_orig(orig_node->bat_priv, orig_node, 142 batadv_tt_global_del_orig(orig_node->bat_priv, orig_node,
143 "originator timed out"); 143 "originator timed out");
144 144
145 kfree(orig_node->tt_buff); 145 kfree(orig_node->tt_buff);
146 kfree(orig_node->bcast_own); 146 kfree(orig_node->bcast_own);
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
index 0e982218e630..8fb5ae3dee87 100644
--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -75,8 +75,8 @@ static void _update_route(struct bat_priv *bat_priv,
75 if ((curr_router) && (!neigh_node)) { 75 if ((curr_router) && (!neigh_node)) {
76 bat_dbg(DBG_ROUTES, bat_priv, "Deleting route towards: %pM\n", 76 bat_dbg(DBG_ROUTES, bat_priv, "Deleting route towards: %pM\n",
77 orig_node->orig); 77 orig_node->orig);
78 tt_global_del_orig(bat_priv, orig_node, 78 batadv_tt_global_del_orig(bat_priv, orig_node,
79 "Deleted route towards originator"); 79 "Deleted route towards originator");
80 80
81 /* route added */ 81 /* route added */
82 } else if ((!curr_router) && (neigh_node)) { 82 } else if ((!curr_router) && (neigh_node)) {
@@ -603,7 +603,7 @@ int batadv_recv_tt_query(struct sk_buff *skb, struct hard_iface *recv_if)
603 603
604 /* If we cannot provide an answer the tt_request is 604 /* If we cannot provide an answer the tt_request is
605 * forwarded */ 605 * forwarded */
606 if (!send_tt_response(bat_priv, tt_query)) { 606 if (!batadv_send_tt_response(bat_priv, tt_query)) {
607 bat_dbg(DBG_TT, bat_priv, 607 bat_dbg(DBG_TT, bat_priv,
608 "Routing TT_REQUEST to %pM [%c]\n", 608 "Routing TT_REQUEST to %pM [%c]\n",
609 tt_query->dst, 609 tt_query->dst,
@@ -622,14 +622,14 @@ int batadv_recv_tt_query(struct sk_buff *skb, struct hard_iface *recv_if)
622 /* skb_linearize() possibly changed skb->data */ 622 /* skb_linearize() possibly changed skb->data */
623 tt_query = (struct tt_query_packet *)skb->data; 623 tt_query = (struct tt_query_packet *)skb->data;
624 624
625 tt_size = tt_len(ntohs(tt_query->tt_data)); 625 tt_size = batadv_tt_len(ntohs(tt_query->tt_data));
626 626
627 /* Ensure we have all the claimed data */ 627 /* Ensure we have all the claimed data */
628 if (unlikely(skb_headlen(skb) < 628 if (unlikely(skb_headlen(skb) <
629 sizeof(struct tt_query_packet) + tt_size)) 629 sizeof(struct tt_query_packet) + tt_size))
630 goto out; 630 goto out;
631 631
632 handle_tt_response(bat_priv, tt_query); 632 batadv_handle_tt_response(bat_priv, tt_query);
633 } else { 633 } else {
634 bat_dbg(DBG_TT, bat_priv, 634 bat_dbg(DBG_TT, bat_priv,
635 "Routing TT_RESPONSE to %pM [%c]\n", 635 "Routing TT_RESPONSE to %pM [%c]\n",
@@ -688,8 +688,9 @@ int batadv_recv_roam_adv(struct sk_buff *skb, struct hard_iface *recv_if)
688 "Received ROAMING_ADV from %pM (client %pM)\n", 688 "Received ROAMING_ADV from %pM (client %pM)\n",
689 roam_adv_packet->src, roam_adv_packet->client); 689 roam_adv_packet->src, roam_adv_packet->client);
690 690
691 tt_global_add(bat_priv, orig_node, roam_adv_packet->client, 691 batadv_tt_global_add(bat_priv, orig_node, roam_adv_packet->client,
692 atomic_read(&orig_node->last_ttvn) + 1, true, false); 692 atomic_read(&orig_node->last_ttvn) + 1, true,
693 false);
693 694
694 /* Roaming phase starts: I have new information but the ttvn has not 695 /* Roaming phase starts: I have new information but the ttvn has not
695 * been incremented yet. This flag will make me check all the incoming 696 * been incremented yet. This flag will make me check all the incoming
@@ -934,13 +935,15 @@ static int check_unicast_ttvn(struct bat_priv *bat_priv,
934 /* we don't have an updated route for this client, so we should 935 /* we don't have an updated route for this client, so we should
935 * not try to reroute the packet!! 936 * not try to reroute the packet!!
936 */ 937 */
937 if (tt_global_client_is_roaming(bat_priv, ethhdr->h_dest)) 938 if (batadv_tt_global_client_is_roaming(bat_priv,
939 ethhdr->h_dest))
938 return 1; 940 return 1;
939 941
940 orig_node = transtable_search(bat_priv, NULL, ethhdr->h_dest); 942 orig_node = batadv_transtable_search(bat_priv, NULL,
943 ethhdr->h_dest);
941 944
942 if (!orig_node) { 945 if (!orig_node) {
943 if (!is_my_client(bat_priv, ethhdr->h_dest)) 946 if (!batadv_is_my_client(bat_priv, ethhdr->h_dest))
944 return 0; 947 return 0;
945 primary_if = primary_if_get_selected(bat_priv); 948 primary_if = primary_if_get_selected(bat_priv);
946 if (!primary_if) 949 if (!primary_if)
diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c
index cbc36f0ec242..a4b5e64bf0c7 100644
--- a/net/batman-adv/soft-interface.c
+++ b/net/batman-adv/soft-interface.c
@@ -109,9 +109,9 @@ static int interface_set_mac_addr(struct net_device *dev, void *p)
109 109
110 /* only modify transtable if it has been initialized before */ 110 /* only modify transtable if it has been initialized before */
111 if (atomic_read(&bat_priv->mesh_state) == MESH_ACTIVE) { 111 if (atomic_read(&bat_priv->mesh_state) == MESH_ACTIVE) {
112 tt_local_remove(bat_priv, dev->dev_addr, 112 batadv_tt_local_remove(bat_priv, dev->dev_addr,
113 "mac address changed", false); 113 "mac address changed", false);
114 tt_local_add(dev, addr->sa_data, NULL_IFINDEX); 114 batadv_tt_local_add(dev, addr->sa_data, NULL_IFINDEX);
115 } 115 }
116 116
117 memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN); 117 memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
@@ -166,7 +166,7 @@ static int interface_tx(struct sk_buff *skb, struct net_device *soft_iface)
166 goto dropped; 166 goto dropped;
167 167
168 /* Register the client MAC in the transtable */ 168 /* Register the client MAC in the transtable */
169 tt_local_add(soft_iface, ethhdr->h_source, skb->skb_iif); 169 batadv_tt_local_add(soft_iface, ethhdr->h_source, skb->skb_iif);
170 170
171 /* don't accept stp packets. STP does not help in meshes. 171 /* don't accept stp packets. STP does not help in meshes.
172 * better use the bridge loop avoidance ... 172 * better use the bridge loop avoidance ...
@@ -303,7 +303,7 @@ void batadv_interface_rx(struct net_device *soft_iface,
303 303
304 soft_iface->last_rx = jiffies; 304 soft_iface->last_rx = jiffies;
305 305
306 if (is_ap_isolated(bat_priv, ethhdr->h_source, ethhdr->h_dest)) 306 if (batadv_is_ap_isolated(bat_priv, ethhdr->h_source, ethhdr->h_dest))
307 goto dropped; 307 goto dropped;
308 308
309 /* Let the bridge loop avoidance check the packet. If will 309 /* Let the bridge loop avoidance check the packet. If will
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index 445dc25ceba1..ecef827ae28f 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -173,7 +173,7 @@ static void tt_local_event(struct bat_priv *bat_priv, const uint8_t *addr,
173 atomic_set(&bat_priv->tt_ogm_append_cnt, 0); 173 atomic_set(&bat_priv->tt_ogm_append_cnt, 0);
174} 174}
175 175
176int tt_len(int changes_num) 176int batadv_tt_len(int changes_num)
177{ 177{
178 return changes_num * sizeof(struct tt_change); 178 return changes_num * sizeof(struct tt_change);
179} 179}
@@ -191,8 +191,8 @@ static int tt_local_init(struct bat_priv *bat_priv)
191 return 0; 191 return 0;
192} 192}
193 193
194void tt_local_add(struct net_device *soft_iface, const uint8_t *addr, 194void batadv_tt_local_add(struct net_device *soft_iface, const uint8_t *addr,
195 int ifindex) 195 int ifindex)
196{ 196{
197 struct bat_priv *bat_priv = netdev_priv(soft_iface); 197 struct bat_priv *bat_priv = netdev_priv(soft_iface);
198 struct tt_local_entry *tt_local_entry = NULL; 198 struct tt_local_entry *tt_local_entry = NULL;
@@ -302,7 +302,7 @@ static void tt_prepare_packet_buff(struct bat_priv *bat_priv,
302 primary_if = primary_if_get_selected(bat_priv); 302 primary_if = primary_if_get_selected(bat_priv);
303 303
304 req_len = min_packet_len; 304 req_len = min_packet_len;
305 req_len += tt_len(atomic_read(&bat_priv->tt_local_changes)); 305 req_len += batadv_tt_len(atomic_read(&bat_priv->tt_local_changes));
306 306
307 /* if we have too many changes for one packet don't send any 307 /* if we have too many changes for one packet don't send any
308 * and wait for the tt table request which will be fragmented 308 * and wait for the tt table request which will be fragmented
@@ -332,7 +332,7 @@ static int tt_changes_fill_buff(struct bat_priv *bat_priv,
332 tt_buff = *packet_buff + min_packet_len; 332 tt_buff = *packet_buff + min_packet_len;
333 333
334 if (new_len > 0) 334 if (new_len > 0)
335 tot_changes = new_len / tt_len(1); 335 tot_changes = new_len / batadv_tt_len(1);
336 336
337 spin_lock_bh(&bat_priv->tt_changes_list_lock); 337 spin_lock_bh(&bat_priv->tt_changes_list_lock);
338 atomic_set(&bat_priv->tt_local_changes, 0); 338 atomic_set(&bat_priv->tt_local_changes, 0);
@@ -340,7 +340,7 @@ static int tt_changes_fill_buff(struct bat_priv *bat_priv,
340 list_for_each_entry_safe(entry, safe, &bat_priv->tt_changes_list, 340 list_for_each_entry_safe(entry, safe, &bat_priv->tt_changes_list,
341 list) { 341 list) {
342 if (count < tot_changes) { 342 if (count < tot_changes) {
343 memcpy(tt_buff + tt_len(count), 343 memcpy(tt_buff + batadv_tt_len(count),
344 &entry->change, sizeof(struct tt_change)); 344 &entry->change, sizeof(struct tt_change));
345 count++; 345 count++;
346 } 346 }
@@ -370,7 +370,7 @@ static int tt_changes_fill_buff(struct bat_priv *bat_priv,
370 return count; 370 return count;
371} 371}
372 372
373int tt_local_seq_print_text(struct seq_file *seq, void *offset) 373int batadv_tt_local_seq_print_text(struct seq_file *seq, void *offset)
374{ 374{
375 struct net_device *net_dev = (struct net_device *)seq->private; 375 struct net_device *net_dev = (struct net_device *)seq->private;
376 struct bat_priv *bat_priv = netdev_priv(net_dev); 376 struct bat_priv *bat_priv = netdev_priv(net_dev);
@@ -445,8 +445,8 @@ static void tt_local_set_pending(struct bat_priv *bat_priv,
445 tt_local_entry->common.addr, message); 445 tt_local_entry->common.addr, message);
446} 446}
447 447
448void tt_local_remove(struct bat_priv *bat_priv, const uint8_t *addr, 448void batadv_tt_local_remove(struct bat_priv *bat_priv, const uint8_t *addr,
449 const char *message, bool roaming) 449 const char *message, bool roaming)
450{ 450{
451 struct tt_local_entry *tt_local_entry = NULL; 451 struct tt_local_entry *tt_local_entry = NULL;
452 452
@@ -611,9 +611,9 @@ static void tt_global_add_orig_entry(struct tt_global_entry *tt_global_entry,
611} 611}
612 612
613/* caller must hold orig_node refcount */ 613/* caller must hold orig_node refcount */
614int tt_global_add(struct bat_priv *bat_priv, struct orig_node *orig_node, 614int batadv_tt_global_add(struct bat_priv *bat_priv, struct orig_node *orig_node,
615 const unsigned char *tt_addr, uint8_t ttvn, bool roaming, 615 const unsigned char *tt_addr, uint8_t ttvn,
616 bool wifi) 616 bool roaming, bool wifi)
617{ 617{
618 struct tt_global_entry *tt_global_entry = NULL; 618 struct tt_global_entry *tt_global_entry = NULL;
619 int ret = 0; 619 int ret = 0;
@@ -677,8 +677,8 @@ int tt_global_add(struct bat_priv *bat_priv, struct orig_node *orig_node,
677 677
678out_remove: 678out_remove:
679 /* remove address from local hash if present */ 679 /* remove address from local hash if present */
680 tt_local_remove(bat_priv, tt_global_entry->common.addr, 680 batadv_tt_local_remove(bat_priv, tt_global_entry->common.addr,
681 "global tt received", roaming); 681 "global tt received", roaming);
682 ret = 1; 682 ret = 1;
683out: 683out:
684 if (tt_global_entry) 684 if (tt_global_entry)
@@ -714,7 +714,7 @@ static void tt_global_print_entry(struct tt_global_entry *tt_global_entry,
714 } 714 }
715} 715}
716 716
717int tt_global_seq_print_text(struct seq_file *seq, void *offset) 717int batadv_tt_global_seq_print_text(struct seq_file *seq, void *offset)
718{ 718{
719 struct net_device *net_dev = (struct net_device *)seq->private; 719 struct net_device *net_dev = (struct net_device *)seq->private;
720 struct bat_priv *bat_priv = netdev_priv(net_dev); 720 struct bat_priv *bat_priv = netdev_priv(net_dev);
@@ -919,8 +919,8 @@ out:
919 tt_local_entry_free_ref(tt_local_entry); 919 tt_local_entry_free_ref(tt_local_entry);
920} 920}
921 921
922void tt_global_del_orig(struct bat_priv *bat_priv, 922void batadv_tt_global_del_orig(struct bat_priv *bat_priv,
923 struct orig_node *orig_node, const char *message) 923 struct orig_node *orig_node, const char *message)
924{ 924{
925 struct tt_global_entry *tt_global_entry; 925 struct tt_global_entry *tt_global_entry;
926 struct tt_common_entry *tt_common_entry; 926 struct tt_common_entry *tt_common_entry;
@@ -1048,8 +1048,9 @@ static bool _is_ap_isolated(struct tt_local_entry *tt_local_entry,
1048 return ret; 1048 return ret;
1049} 1049}
1050 1050
1051struct orig_node *transtable_search(struct bat_priv *bat_priv, 1051struct orig_node *batadv_transtable_search(struct bat_priv *bat_priv,
1052 const uint8_t *src, const uint8_t *addr) 1052 const uint8_t *src,
1053 const uint8_t *addr)
1053{ 1054{
1054 struct tt_local_entry *tt_local_entry = NULL; 1055 struct tt_local_entry *tt_local_entry = NULL;
1055 struct tt_global_entry *tt_global_entry = NULL; 1056 struct tt_global_entry *tt_global_entry = NULL;
@@ -1204,7 +1205,7 @@ static void tt_save_orig_buffer(struct bat_priv *bat_priv,
1204 const unsigned char *tt_buff, 1205 const unsigned char *tt_buff,
1205 uint8_t tt_num_changes) 1206 uint8_t tt_num_changes)
1206{ 1207{
1207 uint16_t tt_buff_len = tt_len(tt_num_changes); 1208 uint16_t tt_buff_len = batadv_tt_len(tt_num_changes);
1208 1209
1209 /* Replace the old buffer only if I received something in the 1210 /* Replace the old buffer only if I received something in the
1210 * last OGM (the OGM could carry no changes) */ 1211 * last OGM (the OGM could carry no changes) */
@@ -1669,8 +1670,8 @@ out:
1669 return true; 1670 return true;
1670} 1671}
1671 1672
1672bool send_tt_response(struct bat_priv *bat_priv, 1673bool batadv_send_tt_response(struct bat_priv *bat_priv,
1673 struct tt_query_packet *tt_request) 1674 struct tt_query_packet *tt_request)
1674{ 1675{
1675 if (is_my_mac(tt_request->dst)) { 1676 if (is_my_mac(tt_request->dst)) {
1676 /* don't answer backbone gws! */ 1677 /* don't answer backbone gws! */
@@ -1689,18 +1690,19 @@ static void _tt_update_changes(struct bat_priv *bat_priv,
1689 uint16_t tt_num_changes, uint8_t ttvn) 1690 uint16_t tt_num_changes, uint8_t ttvn)
1690{ 1691{
1691 int i; 1692 int i;
1693 int is_wifi;
1692 1694
1693 for (i = 0; i < tt_num_changes; i++) { 1695 for (i = 0; i < tt_num_changes; i++) {
1694 if ((tt_change + i)->flags & TT_CLIENT_DEL) 1696 if ((tt_change + i)->flags & TT_CLIENT_DEL) {
1695 tt_global_del(bat_priv, orig_node, 1697 tt_global_del(bat_priv, orig_node,
1696 (tt_change + i)->addr, 1698 (tt_change + i)->addr,
1697 "tt removed by changes", 1699 "tt removed by changes",
1698 (tt_change + i)->flags & TT_CLIENT_ROAM); 1700 (tt_change + i)->flags & TT_CLIENT_ROAM);
1699 else 1701 } else {
1700 if (!tt_global_add(bat_priv, orig_node, 1702 is_wifi = (tt_change + i)->flags & TT_CLIENT_WIFI;
1701 (tt_change + i)->addr, ttvn, false, 1703 if (!batadv_tt_global_add(bat_priv, orig_node,
1702 (tt_change + i)->flags & 1704 (tt_change + i)->addr, ttvn,
1703 TT_CLIENT_WIFI)) 1705 false, is_wifi))
1704 /* In case of problem while storing a 1706 /* In case of problem while storing a
1705 * global_entry, we stop the updating 1707 * global_entry, we stop the updating
1706 * procedure without committing the 1708 * procedure without committing the
@@ -1708,6 +1710,7 @@ static void _tt_update_changes(struct bat_priv *bat_priv,
1708 * corrupted data on tt_request 1710 * corrupted data on tt_request
1709 */ 1711 */
1710 return; 1712 return;
1713 }
1711 } 1714 }
1712 orig_node->tt_initialised = true; 1715 orig_node->tt_initialised = true;
1713} 1716}
@@ -1722,7 +1725,7 @@ static void tt_fill_gtable(struct bat_priv *bat_priv,
1722 goto out; 1725 goto out;
1723 1726
1724 /* Purge the old table first.. */ 1727 /* Purge the old table first.. */
1725 tt_global_del_orig(bat_priv, orig_node, "Received full table"); 1728 batadv_tt_global_del_orig(bat_priv, orig_node, "Received full table");
1726 1729
1727 _tt_update_changes(bat_priv, orig_node, 1730 _tt_update_changes(bat_priv, orig_node,
1728 (struct tt_change *)(tt_response + 1), 1731 (struct tt_change *)(tt_response + 1),
@@ -1754,7 +1757,7 @@ static void tt_update_changes(struct bat_priv *bat_priv,
1754 atomic_set(&orig_node->last_ttvn, ttvn); 1757 atomic_set(&orig_node->last_ttvn, ttvn);
1755} 1758}
1756 1759
1757bool is_my_client(struct bat_priv *bat_priv, const uint8_t *addr) 1760bool batadv_is_my_client(struct bat_priv *bat_priv, const uint8_t *addr)
1758{ 1761{
1759 struct tt_local_entry *tt_local_entry = NULL; 1762 struct tt_local_entry *tt_local_entry = NULL;
1760 bool ret = false; 1763 bool ret = false;
@@ -1773,8 +1776,8 @@ out:
1773 return ret; 1776 return ret;
1774} 1777}
1775 1778
1776void handle_tt_response(struct bat_priv *bat_priv, 1779void batadv_handle_tt_response(struct bat_priv *bat_priv,
1777 struct tt_query_packet *tt_response) 1780 struct tt_query_packet *tt_response)
1778{ 1781{
1779 struct tt_req_node *node, *safe; 1782 struct tt_req_node *node, *safe;
1780 struct orig_node *orig_node = NULL; 1783 struct orig_node *orig_node = NULL;
@@ -1821,7 +1824,7 @@ out:
1821 batadv_orig_node_free_ref(orig_node); 1824 batadv_orig_node_free_ref(orig_node);
1822} 1825}
1823 1826
1824int tt_init(struct bat_priv *bat_priv) 1827int batadv_tt_init(struct bat_priv *bat_priv)
1825{ 1828{
1826 int ret; 1829 int ret;
1827 1830
@@ -1983,7 +1986,7 @@ static void tt_purge(struct work_struct *work)
1983 tt_start_timer(bat_priv); 1986 tt_start_timer(bat_priv);
1984} 1987}
1985 1988
1986void tt_free(struct bat_priv *bat_priv) 1989void batadv_tt_free(struct bat_priv *bat_priv)
1987{ 1990{
1988 cancel_delayed_work_sync(&bat_priv->tt_work); 1991 cancel_delayed_work_sync(&bat_priv->tt_work);
1989 1992
@@ -2125,7 +2128,8 @@ int batadv_tt_append_diff(struct bat_priv *bat_priv,
2125 return tt_num_changes; 2128 return tt_num_changes;
2126} 2129}
2127 2130
2128bool is_ap_isolated(struct bat_priv *bat_priv, uint8_t *src, uint8_t *dst) 2131bool batadv_is_ap_isolated(struct bat_priv *bat_priv, uint8_t *src,
2132 uint8_t *dst)
2129{ 2133{
2130 struct tt_local_entry *tt_local_entry = NULL; 2134 struct tt_local_entry *tt_local_entry = NULL;
2131 struct tt_global_entry *tt_global_entry = NULL; 2135 struct tt_global_entry *tt_global_entry = NULL;
@@ -2155,9 +2159,10 @@ out:
2155 return ret; 2159 return ret;
2156} 2160}
2157 2161
2158void tt_update_orig(struct bat_priv *bat_priv, struct orig_node *orig_node, 2162void batadv_tt_update_orig(struct bat_priv *bat_priv,
2159 const unsigned char *tt_buff, uint8_t tt_num_changes, 2163 struct orig_node *orig_node,
2160 uint8_t ttvn, uint16_t tt_crc) 2164 const unsigned char *tt_buff, uint8_t tt_num_changes,
2165 uint8_t ttvn, uint16_t tt_crc)
2161{ 2166{
2162 uint8_t orig_ttvn = (uint8_t)atomic_read(&orig_node->last_ttvn); 2167 uint8_t orig_ttvn = (uint8_t)atomic_read(&orig_node->last_ttvn);
2163 bool full_table = true; 2168 bool full_table = true;
@@ -2222,7 +2227,8 @@ request_table:
2222 * originator to another one. This entry is kept is still kept for consistency 2227 * originator to another one. This entry is kept is still kept for consistency
2223 * purposes 2228 * purposes
2224 */ 2229 */
2225bool tt_global_client_is_roaming(struct bat_priv *bat_priv, uint8_t *addr) 2230bool batadv_tt_global_client_is_roaming(struct bat_priv *bat_priv,
2231 uint8_t *addr)
2226{ 2232{
2227 struct tt_global_entry *tt_global_entry; 2233 struct tt_global_entry *tt_global_entry;
2228 bool ret = false; 2234 bool ret = false;
diff --git a/net/batman-adv/translation-table.h b/net/batman-adv/translation-table.h
index d6ea30f9b026..fe1281a71685 100644
--- a/net/batman-adv/translation-table.h
+++ b/net/batman-adv/translation-table.h
@@ -22,37 +22,44 @@
22#ifndef _NET_BATMAN_ADV_TRANSLATION_TABLE_H_ 22#ifndef _NET_BATMAN_ADV_TRANSLATION_TABLE_H_
23#define _NET_BATMAN_ADV_TRANSLATION_TABLE_H_ 23#define _NET_BATMAN_ADV_TRANSLATION_TABLE_H_
24 24
25int tt_len(int changes_num); 25int batadv_tt_len(int changes_num);
26int tt_init(struct bat_priv *bat_priv); 26int batadv_tt_init(struct bat_priv *bat_priv);
27void tt_local_add(struct net_device *soft_iface, const uint8_t *addr, 27void batadv_tt_local_add(struct net_device *soft_iface, const uint8_t *addr,
28 int ifindex); 28 int ifindex);
29void tt_local_remove(struct bat_priv *bat_priv, 29void batadv_tt_local_remove(struct bat_priv *bat_priv,
30 const uint8_t *addr, const char *message, bool roaming); 30 const uint8_t *addr, const char *message,
31int tt_local_seq_print_text(struct seq_file *seq, void *offset); 31 bool roaming);
32void tt_global_add_orig(struct bat_priv *bat_priv, struct orig_node *orig_node, 32int batadv_tt_local_seq_print_text(struct seq_file *seq, void *offset);
33 const unsigned char *tt_buff, int tt_buff_len); 33void batadv_tt_global_add_orig(struct bat_priv *bat_priv,
34int tt_global_add(struct bat_priv *bat_priv, struct orig_node *orig_node, 34 struct orig_node *orig_node,
35 const unsigned char *addr, uint8_t ttvn, bool roaming, 35 const unsigned char *tt_buff, int tt_buff_len);
36 bool wifi); 36int batadv_tt_global_add(struct bat_priv *bat_priv, struct orig_node *orig_node,
37int tt_global_seq_print_text(struct seq_file *seq, void *offset); 37 const unsigned char *addr, uint8_t ttvn, bool roaming,
38void tt_global_del_orig(struct bat_priv *bat_priv, 38 bool wifi);
39 struct orig_node *orig_node, const char *message); 39int batadv_tt_global_seq_print_text(struct seq_file *seq, void *offset);
40struct orig_node *transtable_search(struct bat_priv *bat_priv, 40void batadv_tt_global_del_orig(struct bat_priv *bat_priv,
41 const uint8_t *src, const uint8_t *addr); 41 struct orig_node *orig_node,
42void tt_free(struct bat_priv *bat_priv); 42 const char *message);
43bool send_tt_response(struct bat_priv *bat_priv, 43struct orig_node *batadv_transtable_search(struct bat_priv *bat_priv,
44 struct tt_query_packet *tt_request); 44 const uint8_t *src,
45bool is_my_client(struct bat_priv *bat_priv, const uint8_t *addr); 45 const uint8_t *addr);
46void handle_tt_response(struct bat_priv *bat_priv, 46void batadv_tt_free(struct bat_priv *bat_priv);
47 struct tt_query_packet *tt_response); 47bool batadv_send_tt_response(struct bat_priv *bat_priv,
48bool is_ap_isolated(struct bat_priv *bat_priv, uint8_t *src, uint8_t *dst); 48 struct tt_query_packet *tt_request);
49void tt_update_orig(struct bat_priv *bat_priv, struct orig_node *orig_node, 49bool batadv_is_my_client(struct bat_priv *bat_priv, const uint8_t *addr);
50 const unsigned char *tt_buff, uint8_t tt_num_changes, 50void batadv_handle_tt_response(struct bat_priv *bat_priv,
51 uint8_t ttvn, uint16_t tt_crc); 51 struct tt_query_packet *tt_response);
52bool batadv_is_ap_isolated(struct bat_priv *bat_priv, uint8_t *src,
53 uint8_t *dst);
54void batadv_tt_update_orig(struct bat_priv *bat_priv,
55 struct orig_node *orig_node,
56 const unsigned char *tt_buff, uint8_t tt_num_changes,
57 uint8_t ttvn, uint16_t tt_crc);
52int batadv_tt_append_diff(struct bat_priv *bat_priv, 58int batadv_tt_append_diff(struct bat_priv *bat_priv,
53 unsigned char **packet_buff, int *packet_buff_len, 59 unsigned char **packet_buff, int *packet_buff_len,
54 int packet_min_len); 60 int packet_min_len);
55bool tt_global_client_is_roaming(struct bat_priv *bat_priv, uint8_t *addr); 61bool batadv_tt_global_client_is_roaming(struct bat_priv *bat_priv,
62 uint8_t *addr);
56 63
57 64
58#endif /* _NET_BATMAN_ADV_TRANSLATION_TABLE_H_ */ 65#endif /* _NET_BATMAN_ADV_TRANSLATION_TABLE_H_ */
diff --git a/net/batman-adv/unicast.c b/net/batman-adv/unicast.c
index 52179c8ae9bd..5e699db700b3 100644
--- a/net/batman-adv/unicast.c
+++ b/net/batman-adv/unicast.c
@@ -301,9 +301,8 @@ int unicast_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv)
301 301
302 /* check for tt host - increases orig_node refcount. 302 /* check for tt host - increases orig_node refcount.
303 * returns NULL in case of AP isolation */ 303 * returns NULL in case of AP isolation */
304 orig_node = transtable_search(bat_priv, ethhdr->h_source, 304 orig_node = batadv_transtable_search(bat_priv, ethhdr->h_source,
305 ethhdr->h_dest); 305 ethhdr->h_dest);
306
307find_router: 306find_router:
308 /** 307 /**
309 * find_router(): 308 * find_router():
@@ -335,7 +334,7 @@ find_router:
335 * try to reroute it because the ttvn contained in the header is less 334 * try to reroute it because the ttvn contained in the header is less
336 * than the current one 335 * than the current one
337 */ 336 */
338 if (tt_global_client_is_roaming(bat_priv, ethhdr->h_dest)) 337 if (batadv_tt_global_client_is_roaming(bat_priv, ethhdr->h_dest))
339 unicast_packet->ttvn = unicast_packet->ttvn - 1; 338 unicast_packet->ttvn = unicast_packet->ttvn - 1;
340 339
341 if (atomic_read(&bat_priv->fragmentation) && 340 if (atomic_read(&bat_priv->fragmentation) &&