aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv
diff options
context:
space:
mode:
authorSven Eckelmann <sven@narfation.org>2012-05-11 20:09:29 -0400
committerAntonio Quartulli <ordex@autistici.org>2012-06-20 16:15:18 -0400
commit7cf06bc6ff810178a7fb9f12aaa6b274fc520f6f (patch)
treed2155e204af6153174f9a7f37596c21e04c65ddb /net/batman-adv
parent08adf1512298201a53b88bb0a3d67e0dbbe0ed9b (diff)
batman-adv: Prefix gateway-client 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/batman-adv')
-rw-r--r--net/batman-adv/bat_debugfs.c2
-rw-r--r--net/batman-adv/bat_iv_ogm.c6
-rw-r--r--net/batman-adv/bat_sysfs.c4
-rw-r--r--net/batman-adv/gateway_client.c40
-rw-r--r--net/batman-adv/gateway_client.h26
-rw-r--r--net/batman-adv/gateway_common.c2
-rw-r--r--net/batman-adv/main.c2
-rw-r--r--net/batman-adv/originator.c7
-rw-r--r--net/batman-adv/soft-interface.c6
-rw-r--r--net/batman-adv/unicast.c2
10 files changed, 51 insertions, 46 deletions
diff --git a/net/batman-adv/bat_debugfs.c b/net/batman-adv/bat_debugfs.c
index 71b225c1b5ca..7b294b431f88 100644
--- a/net/batman-adv/bat_debugfs.c
+++ b/net/batman-adv/bat_debugfs.c
@@ -236,7 +236,7 @@ static int originators_open(struct inode *inode, struct file *file)
236static int gateways_open(struct inode *inode, struct file *file) 236static int gateways_open(struct inode *inode, struct file *file)
237{ 237{
238 struct net_device *net_dev = (struct net_device *)inode->i_private; 238 struct net_device *net_dev = (struct net_device *)inode->i_private;
239 return single_open(file, gw_client_seq_print_text, net_dev); 239 return single_open(file, batadv_gw_client_seq_print_text, net_dev);
240} 240}
241 241
242static int transtable_global_open(struct inode *inode, struct file *file) 242static int transtable_global_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 53bce95e5f33..defcac1184c4 100644
--- a/net/batman-adv/bat_iv_ogm.c
+++ b/net/batman-adv/bat_iv_ogm.c
@@ -729,8 +729,8 @@ update_tt:
729 ntohs(batman_ogm_packet->tt_crc)); 729 ntohs(batman_ogm_packet->tt_crc));
730 730
731 if (orig_node->gw_flags != batman_ogm_packet->gw_flags) 731 if (orig_node->gw_flags != batman_ogm_packet->gw_flags)
732 gw_node_update(bat_priv, orig_node, 732 batadv_gw_node_update(bat_priv, orig_node,
733 batman_ogm_packet->gw_flags); 733 batman_ogm_packet->gw_flags);
734 734
735 orig_node->gw_flags = batman_ogm_packet->gw_flags; 735 orig_node->gw_flags = batman_ogm_packet->gw_flags;
736 736
@@ -738,7 +738,7 @@ update_tt:
738 if ((orig_node->gw_flags) && 738 if ((orig_node->gw_flags) &&
739 (atomic_read(&bat_priv->gw_mode) == GW_MODE_CLIENT) && 739 (atomic_read(&bat_priv->gw_mode) == GW_MODE_CLIENT) &&
740 (atomic_read(&bat_priv->gw_sel_class) > 2)) 740 (atomic_read(&bat_priv->gw_sel_class) > 2))
741 gw_check_election(bat_priv, orig_node); 741 batadv_gw_check_election(bat_priv, orig_node);
742 742
743 goto out; 743 goto out;
744 744
diff --git a/net/batman-adv/bat_sysfs.c b/net/batman-adv/bat_sysfs.c
index 5dce1abc35d4..31d23dbccc38 100644
--- a/net/batman-adv/bat_sysfs.c
+++ b/net/batman-adv/bat_sysfs.c
@@ -326,7 +326,7 @@ static ssize_t show_bat_algo(struct kobject *kobj, struct attribute *attr,
326static void post_gw_deselect(struct net_device *net_dev) 326static void post_gw_deselect(struct net_device *net_dev)
327{ 327{
328 struct bat_priv *bat_priv = netdev_priv(net_dev); 328 struct bat_priv *bat_priv = netdev_priv(net_dev);
329 gw_deselect(bat_priv); 329 batadv_gw_deselect(bat_priv);
330} 330}
331 331
332static ssize_t show_gw_mode(struct kobject *kobj, struct attribute *attr, 332static ssize_t show_gw_mode(struct kobject *kobj, struct attribute *attr,
@@ -397,7 +397,7 @@ static ssize_t store_gw_mode(struct kobject *kobj, struct attribute *attr,
397 bat_info(net_dev, "Changing gw mode from: %s to: %s\n", 397 bat_info(net_dev, "Changing gw mode from: %s to: %s\n",
398 curr_gw_mode_str, buff); 398 curr_gw_mode_str, buff);
399 399
400 gw_deselect(bat_priv); 400 batadv_gw_deselect(bat_priv);
401 atomic_set(&bat_priv->gw_mode, (unsigned int)gw_mode_tmp); 401 atomic_set(&bat_priv->gw_mode, (unsigned int)gw_mode_tmp);
402 return count; 402 return count;
403} 403}
diff --git a/net/batman-adv/gateway_client.c b/net/batman-adv/gateway_client.c
index 1d7f08e026f3..a28d9ce86812 100644
--- a/net/batman-adv/gateway_client.c
+++ b/net/batman-adv/gateway_client.c
@@ -60,7 +60,7 @@ out:
60 return gw_node; 60 return gw_node;
61} 61}
62 62
63struct orig_node *gw_get_selected_orig(struct bat_priv *bat_priv) 63struct orig_node *batadv_gw_get_selected_orig(struct bat_priv *bat_priv)
64{ 64{
65 struct gw_node *gw_node; 65 struct gw_node *gw_node;
66 struct orig_node *orig_node = NULL; 66 struct orig_node *orig_node = NULL;
@@ -103,7 +103,7 @@ static void gw_select(struct bat_priv *bat_priv, struct gw_node *new_gw_node)
103 spin_unlock_bh(&bat_priv->gw_list_lock); 103 spin_unlock_bh(&bat_priv->gw_list_lock);
104} 104}
105 105
106void gw_deselect(struct bat_priv *bat_priv) 106void batadv_gw_deselect(struct bat_priv *bat_priv)
107{ 107{
108 atomic_set(&bat_priv->gw_reselect, 1); 108 atomic_set(&bat_priv->gw_reselect, 1);
109} 109}
@@ -182,7 +182,7 @@ next:
182 return curr_gw; 182 return curr_gw;
183} 183}
184 184
185void gw_election(struct bat_priv *bat_priv) 185void batadv_gw_election(struct bat_priv *bat_priv)
186{ 186{
187 struct gw_node *curr_gw = NULL, *next_gw = NULL; 187 struct gw_node *curr_gw = NULL, *next_gw = NULL;
188 struct neigh_node *router = NULL; 188 struct neigh_node *router = NULL;
@@ -212,7 +212,7 @@ void gw_election(struct bat_priv *bat_priv)
212 212
213 router = orig_node_get_router(next_gw->orig_node); 213 router = orig_node_get_router(next_gw->orig_node);
214 if (!router) { 214 if (!router) {
215 gw_deselect(bat_priv); 215 batadv_gw_deselect(bat_priv);
216 goto out; 216 goto out;
217 } 217 }
218 } 218 }
@@ -246,13 +246,14 @@ out:
246 neigh_node_free_ref(router); 246 neigh_node_free_ref(router);
247} 247}
248 248
249void gw_check_election(struct bat_priv *bat_priv, struct orig_node *orig_node) 249void batadv_gw_check_election(struct bat_priv *bat_priv,
250 struct orig_node *orig_node)
250{ 251{
251 struct orig_node *curr_gw_orig; 252 struct orig_node *curr_gw_orig;
252 struct neigh_node *router_gw = NULL, *router_orig = NULL; 253 struct neigh_node *router_gw = NULL, *router_orig = NULL;
253 uint8_t gw_tq_avg, orig_tq_avg; 254 uint8_t gw_tq_avg, orig_tq_avg;
254 255
255 curr_gw_orig = gw_get_selected_orig(bat_priv); 256 curr_gw_orig = batadv_gw_get_selected_orig(bat_priv);
256 if (!curr_gw_orig) 257 if (!curr_gw_orig)
257 goto deselect; 258 goto deselect;
258 259
@@ -288,7 +289,7 @@ void gw_check_election(struct bat_priv *bat_priv, struct orig_node *orig_node)
288 gw_tq_avg, orig_tq_avg); 289 gw_tq_avg, orig_tq_avg);
289 290
290deselect: 291deselect:
291 gw_deselect(bat_priv); 292 batadv_gw_deselect(bat_priv);
292out: 293out:
293 if (curr_gw_orig) 294 if (curr_gw_orig)
294 orig_node_free_ref(curr_gw_orig); 295 orig_node_free_ref(curr_gw_orig);
@@ -328,8 +329,8 @@ static void gw_node_add(struct bat_priv *bat_priv,
328 (up > 2048 ? "MBit" : "KBit")); 329 (up > 2048 ? "MBit" : "KBit"));
329} 330}
330 331
331void gw_node_update(struct bat_priv *bat_priv, 332void batadv_gw_node_update(struct bat_priv *bat_priv,
332 struct orig_node *orig_node, uint8_t new_gwflags) 333 struct orig_node *orig_node, uint8_t new_gwflags)
333{ 334{
334 struct hlist_node *node; 335 struct hlist_node *node;
335 struct gw_node *gw_node, *curr_gw; 336 struct gw_node *gw_node, *curr_gw;
@@ -374,7 +375,7 @@ void gw_node_update(struct bat_priv *bat_priv,
374 goto unlock; 375 goto unlock;
375 376
376deselect: 377deselect:
377 gw_deselect(bat_priv); 378 batadv_gw_deselect(bat_priv);
378unlock: 379unlock:
379 rcu_read_unlock(); 380 rcu_read_unlock();
380 381
@@ -382,12 +383,13 @@ unlock:
382 gw_node_free_ref(curr_gw); 383 gw_node_free_ref(curr_gw);
383} 384}
384 385
385void gw_node_delete(struct bat_priv *bat_priv, struct orig_node *orig_node) 386void batadv_gw_node_delete(struct bat_priv *bat_priv,
387 struct orig_node *orig_node)
386{ 388{
387 gw_node_update(bat_priv, orig_node, 0); 389 batadv_gw_node_update(bat_priv, orig_node, 0);
388} 390}
389 391
390void gw_node_purge(struct bat_priv *bat_priv) 392void batadv_gw_node_purge(struct bat_priv *bat_priv)
391{ 393{
392 struct gw_node *gw_node, *curr_gw; 394 struct gw_node *gw_node, *curr_gw;
393 struct hlist_node *node, *node_tmp; 395 struct hlist_node *node, *node_tmp;
@@ -416,7 +418,7 @@ void gw_node_purge(struct bat_priv *bat_priv)
416 418
417 /* gw_deselect() needs to acquire the gw_list_lock */ 419 /* gw_deselect() needs to acquire the gw_list_lock */
418 if (do_deselect) 420 if (do_deselect)
419 gw_deselect(bat_priv); 421 batadv_gw_deselect(bat_priv);
420 422
421 if (curr_gw) 423 if (curr_gw)
422 gw_node_free_ref(curr_gw); 424 gw_node_free_ref(curr_gw);
@@ -458,7 +460,7 @@ out:
458 return ret; 460 return ret;
459} 461}
460 462
461int gw_client_seq_print_text(struct seq_file *seq, void *offset) 463int batadv_gw_client_seq_print_text(struct seq_file *seq, void *offset)
462{ 464{
463 struct net_device *net_dev = (struct net_device *)seq->private; 465 struct net_device *net_dev = (struct net_device *)seq->private;
464 struct bat_priv *bat_priv = netdev_priv(net_dev); 466 struct bat_priv *bat_priv = netdev_priv(net_dev);
@@ -568,7 +570,7 @@ out:
568 return ret; 570 return ret;
569} 571}
570 572
571bool gw_is_dhcp_target(struct sk_buff *skb, unsigned int *header_len) 573bool batadv_gw_is_dhcp_target(struct sk_buff *skb, unsigned int *header_len)
572{ 574{
573 struct ethhdr *ethhdr; 575 struct ethhdr *ethhdr;
574 struct iphdr *iphdr; 576 struct iphdr *iphdr;
@@ -634,8 +636,8 @@ bool gw_is_dhcp_target(struct sk_buff *skb, unsigned int *header_len)
634 return true; 636 return true;
635} 637}
636 638
637bool gw_out_of_range(struct bat_priv *bat_priv, 639bool batadv_gw_out_of_range(struct bat_priv *bat_priv,
638 struct sk_buff *skb, struct ethhdr *ethhdr) 640 struct sk_buff *skb, struct ethhdr *ethhdr)
639{ 641{
640 struct neigh_node *neigh_curr = NULL, *neigh_old = NULL; 642 struct neigh_node *neigh_curr = NULL, *neigh_old = NULL;
641 struct orig_node *orig_dst_node = NULL; 643 struct orig_node *orig_dst_node = NULL;
@@ -644,7 +646,7 @@ bool gw_out_of_range(struct bat_priv *bat_priv,
644 unsigned int header_len = 0; 646 unsigned int header_len = 0;
645 uint8_t curr_tq_avg; 647 uint8_t curr_tq_avg;
646 648
647 ret = gw_is_dhcp_target(skb, &header_len); 649 ret = batadv_gw_is_dhcp_target(skb, &header_len);
648 if (!ret) 650 if (!ret)
649 goto out; 651 goto out;
650 652
diff --git a/net/batman-adv/gateway_client.h b/net/batman-adv/gateway_client.h
index bf56a5aea10b..2c2446f3f124 100644
--- a/net/batman-adv/gateway_client.h
+++ b/net/batman-adv/gateway_client.h
@@ -22,17 +22,19 @@
22#ifndef _NET_BATMAN_ADV_GATEWAY_CLIENT_H_ 22#ifndef _NET_BATMAN_ADV_GATEWAY_CLIENT_H_
23#define _NET_BATMAN_ADV_GATEWAY_CLIENT_H_ 23#define _NET_BATMAN_ADV_GATEWAY_CLIENT_H_
24 24
25void gw_deselect(struct bat_priv *bat_priv); 25void batadv_gw_deselect(struct bat_priv *bat_priv);
26void gw_election(struct bat_priv *bat_priv); 26void batadv_gw_election(struct bat_priv *bat_priv);
27struct orig_node *gw_get_selected_orig(struct bat_priv *bat_priv); 27struct orig_node *batadv_gw_get_selected_orig(struct bat_priv *bat_priv);
28void gw_check_election(struct bat_priv *bat_priv, struct orig_node *orig_node); 28void batadv_gw_check_election(struct bat_priv *bat_priv,
29void gw_node_update(struct bat_priv *bat_priv, 29 struct orig_node *orig_node);
30 struct orig_node *orig_node, uint8_t new_gwflags); 30void batadv_gw_node_update(struct bat_priv *bat_priv,
31void gw_node_delete(struct bat_priv *bat_priv, struct orig_node *orig_node); 31 struct orig_node *orig_node, uint8_t new_gwflags);
32void gw_node_purge(struct bat_priv *bat_priv); 32void batadv_gw_node_delete(struct bat_priv *bat_priv,
33int gw_client_seq_print_text(struct seq_file *seq, void *offset); 33 struct orig_node *orig_node);
34bool gw_is_dhcp_target(struct sk_buff *skb, unsigned int *header_len); 34void batadv_gw_node_purge(struct bat_priv *bat_priv);
35bool gw_out_of_range(struct bat_priv *bat_priv, 35int batadv_gw_client_seq_print_text(struct seq_file *seq, void *offset);
36 struct sk_buff *skb, struct ethhdr *ethhdr); 36bool batadv_gw_is_dhcp_target(struct sk_buff *skb, unsigned int *header_len);
37bool batadv_gw_out_of_range(struct bat_priv *bat_priv,
38 struct sk_buff *skb, struct ethhdr *ethhdr);
37 39
38#endif /* _NET_BATMAN_ADV_GATEWAY_CLIENT_H_ */ 40#endif /* _NET_BATMAN_ADV_GATEWAY_CLIENT_H_ */
diff --git a/net/batman-adv/gateway_common.c b/net/batman-adv/gateway_common.c
index 6e3b052b935d..a0b0f52d961a 100644
--- a/net/batman-adv/gateway_common.c
+++ b/net/batman-adv/gateway_common.c
@@ -165,7 +165,7 @@ ssize_t gw_bandwidth_set(struct net_device *net_dev, char *buff, size_t count)
165 if (atomic_read(&bat_priv->gw_bandwidth) == gw_bandwidth_tmp) 165 if (atomic_read(&bat_priv->gw_bandwidth) == gw_bandwidth_tmp)
166 return count; 166 return count;
167 167
168 gw_deselect(bat_priv); 168 batadv_gw_deselect(bat_priv);
169 bat_info(net_dev, 169 bat_info(net_dev,
170 "Changing gateway bandwidth from: '%i' to: '%ld' (propagating: %d%s/%d%s)\n", 170 "Changing gateway bandwidth from: '%i' to: '%ld' (propagating: %d%s/%d%s)\n",
171 atomic_read(&bat_priv->gw_bandwidth), gw_bandwidth_tmp, 171 atomic_read(&bat_priv->gw_bandwidth), gw_bandwidth_tmp,
diff --git a/net/batman-adv/main.c b/net/batman-adv/main.c
index 3e1bb7a1f8b4..8fe70b487b49 100644
--- a/net/batman-adv/main.c
+++ b/net/batman-adv/main.c
@@ -149,7 +149,7 @@ void mesh_free(struct net_device *soft_iface)
149 149
150 vis_quit(bat_priv); 150 vis_quit(bat_priv);
151 151
152 gw_node_purge(bat_priv); 152 batadv_gw_node_purge(bat_priv);
153 originator_free(bat_priv); 153 originator_free(bat_priv);
154 154
155 tt_free(bat_priv); 155 tt_free(bat_priv);
diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c
index cf83c5422e9a..2f921bff84a9 100644
--- a/net/batman-adv/originator.c
+++ b/net/batman-adv/originator.c
@@ -361,7 +361,8 @@ static void _purge_orig(struct bat_priv *bat_priv)
361 head, hash_entry) { 361 head, hash_entry) {
362 if (purge_orig_node(bat_priv, orig_node)) { 362 if (purge_orig_node(bat_priv, orig_node)) {
363 if (orig_node->gw_flags) 363 if (orig_node->gw_flags)
364 gw_node_delete(bat_priv, orig_node); 364 batadv_gw_node_delete(bat_priv,
365 orig_node);
365 hlist_del_rcu(node); 366 hlist_del_rcu(node);
366 orig_node_free_ref(orig_node); 367 orig_node_free_ref(orig_node);
367 continue; 368 continue;
@@ -374,8 +375,8 @@ static void _purge_orig(struct bat_priv *bat_priv)
374 spin_unlock_bh(list_lock); 375 spin_unlock_bh(list_lock);
375 } 376 }
376 377
377 gw_node_purge(bat_priv); 378 batadv_gw_node_purge(bat_priv);
378 gw_election(bat_priv); 379 batadv_gw_election(bat_priv);
379} 380}
380 381
381static void purge_orig(struct work_struct *work) 382static void purge_orig(struct work_struct *work)
diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c
index 16e866ad1759..bfc4fe03cafa 100644
--- a/net/batman-adv/soft-interface.c
+++ b/net/batman-adv/soft-interface.c
@@ -181,14 +181,14 @@ static int interface_tx(struct sk_buff *skb, struct net_device *soft_iface)
181 case GW_MODE_SERVER: 181 case GW_MODE_SERVER:
182 /* gateway servers should not send dhcp 182 /* gateway servers should not send dhcp
183 * requests into the mesh */ 183 * requests into the mesh */
184 ret = gw_is_dhcp_target(skb, &header_len); 184 ret = batadv_gw_is_dhcp_target(skb, &header_len);
185 if (ret) 185 if (ret)
186 goto dropped; 186 goto dropped;
187 break; 187 break;
188 case GW_MODE_CLIENT: 188 case GW_MODE_CLIENT:
189 /* gateway clients should send dhcp requests 189 /* gateway clients should send dhcp requests
190 * via unicast to their gateway */ 190 * via unicast to their gateway */
191 ret = gw_is_dhcp_target(skb, &header_len); 191 ret = batadv_gw_is_dhcp_target(skb, &header_len);
192 if (ret) 192 if (ret)
193 do_bcast = false; 193 do_bcast = false;
194 break; 194 break;
@@ -232,7 +232,7 @@ static int interface_tx(struct sk_buff *skb, struct net_device *soft_iface)
232 /* unicast packet */ 232 /* unicast packet */
233 } else { 233 } else {
234 if (atomic_read(&bat_priv->gw_mode) != GW_MODE_OFF) { 234 if (atomic_read(&bat_priv->gw_mode) != GW_MODE_OFF) {
235 ret = gw_out_of_range(bat_priv, skb, ethhdr); 235 ret = batadv_gw_out_of_range(bat_priv, skb, ethhdr);
236 if (ret) 236 if (ret)
237 goto dropped; 237 goto dropped;
238 } 238 }
diff --git a/net/batman-adv/unicast.c b/net/batman-adv/unicast.c
index 74175c210858..92d3ea3e6ce4 100644
--- a/net/batman-adv/unicast.c
+++ b/net/batman-adv/unicast.c
@@ -294,7 +294,7 @@ int unicast_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv)
294 294
295 /* get routing information */ 295 /* get routing information */
296 if (is_multicast_ether_addr(ethhdr->h_dest)) { 296 if (is_multicast_ether_addr(ethhdr->h_dest)) {
297 orig_node = gw_get_selected_orig(bat_priv); 297 orig_node = batadv_gw_get_selected_orig(bat_priv);
298 if (orig_node) 298 if (orig_node)
299 goto find_router; 299 goto find_router;
300 } 300 }