aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorSven Eckelmann <sven@narfation.org>2012-05-11 20:09:31 -0400
committerAntonio Quartulli <ordex@autistici.org>2012-06-20 16:15:20 -0400
commit9563877ea52ea18bb4f1ed724c5e3a39bbbcf60b (patch)
tree56bd2312e4aa7d04b448edd1d8ed87309c941f80 /net
parent84d5e5e003752bc56b413f8d2c3fcfeeec066145 (diff)
batman-adv: Prefix hard-interface 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_sysfs.c20
-rw-r--r--net/batman-adv/hard-interface.c32
-rw-r--r--net/batman-adv/hard-interface.h22
-rw-r--r--net/batman-adv/main.c6
-rw-r--r--net/batman-adv/soft-interface.c2
-rw-r--r--net/batman-adv/translation-table.c2
6 files changed, 43 insertions, 41 deletions
diff --git a/net/batman-adv/bat_sysfs.c b/net/batman-adv/bat_sysfs.c
index a8fb66095d83..5a7b042873e1 100644
--- a/net/batman-adv/bat_sysfs.c
+++ b/net/batman-adv/bat_sysfs.c
@@ -122,9 +122,10 @@ ssize_t store_##_name(struct kobject *kobj, struct attribute *attr, \
122 char *buff, size_t count) \ 122 char *buff, size_t count) \
123{ \ 123{ \
124 struct net_device *net_dev = kobj_to_netdev(kobj); \ 124 struct net_device *net_dev = kobj_to_netdev(kobj); \
125 struct hard_iface *hard_iface = hardif_get_by_netdev(net_dev); \ 125 struct hard_iface *hard_iface; \
126 ssize_t length; \ 126 ssize_t length; \
127 \ 127 \
128 hard_iface = batadv_hardif_get_by_netdev(net_dev); \
128 if (!hard_iface) \ 129 if (!hard_iface) \
129 return 0; \ 130 return 0; \
130 \ 131 \
@@ -140,9 +141,10 @@ ssize_t show_##_name(struct kobject *kobj, \
140 struct attribute *attr, char *buff) \ 141 struct attribute *attr, char *buff) \
141{ \ 142{ \
142 struct net_device *net_dev = kobj_to_netdev(kobj); \ 143 struct net_device *net_dev = kobj_to_netdev(kobj); \
143 struct hard_iface *hard_iface = hardif_get_by_netdev(net_dev); \ 144 struct hard_iface *hard_iface; \
144 ssize_t length; \ 145 ssize_t length; \
145 \ 146 \
147 hard_iface = batadv_hardif_get_by_netdev(net_dev); \
146 if (!hard_iface) \ 148 if (!hard_iface) \
147 return 0; \ 149 return 0; \
148 \ 150 \
@@ -433,7 +435,7 @@ BAT_ATTR_SIF_BOOL(bonding, S_IRUGO | S_IWUSR, NULL);
433#ifdef CONFIG_BATMAN_ADV_BLA 435#ifdef CONFIG_BATMAN_ADV_BLA
434BAT_ATTR_SIF_BOOL(bridge_loop_avoidance, S_IRUGO | S_IWUSR, NULL); 436BAT_ATTR_SIF_BOOL(bridge_loop_avoidance, S_IRUGO | S_IWUSR, NULL);
435#endif 437#endif
436BAT_ATTR_SIF_BOOL(fragmentation, S_IRUGO | S_IWUSR, update_min_mtu); 438BAT_ATTR_SIF_BOOL(fragmentation, S_IRUGO | S_IWUSR, batadv_update_min_mtu);
437BAT_ATTR_SIF_BOOL(ap_isolation, S_IRUGO | S_IWUSR, NULL); 439BAT_ATTR_SIF_BOOL(ap_isolation, S_IRUGO | S_IWUSR, NULL);
438static BAT_ATTR(vis_mode, S_IRUGO | S_IWUSR, show_vis_mode, store_vis_mode); 440static BAT_ATTR(vis_mode, S_IRUGO | S_IWUSR, show_vis_mode, store_vis_mode);
439static BAT_ATTR(routing_algo, S_IRUGO, show_bat_algo, NULL); 441static BAT_ATTR(routing_algo, S_IRUGO, show_bat_algo, NULL);
@@ -523,7 +525,7 @@ static ssize_t show_mesh_iface(struct kobject *kobj, struct attribute *attr,
523 char *buff) 525 char *buff)
524{ 526{
525 struct net_device *net_dev = kobj_to_netdev(kobj); 527 struct net_device *net_dev = kobj_to_netdev(kobj);
526 struct hard_iface *hard_iface = hardif_get_by_netdev(net_dev); 528 struct hard_iface *hard_iface = batadv_hardif_get_by_netdev(net_dev);
527 ssize_t length; 529 ssize_t length;
528 530
529 if (!hard_iface) 531 if (!hard_iface)
@@ -541,7 +543,7 @@ static ssize_t store_mesh_iface(struct kobject *kobj, struct attribute *attr,
541 char *buff, size_t count) 543 char *buff, size_t count)
542{ 544{
543 struct net_device *net_dev = kobj_to_netdev(kobj); 545 struct net_device *net_dev = kobj_to_netdev(kobj);
544 struct hard_iface *hard_iface = hardif_get_by_netdev(net_dev); 546 struct hard_iface *hard_iface = batadv_hardif_get_by_netdev(net_dev);
545 int status_tmp = -1; 547 int status_tmp = -1;
546 int ret = count; 548 int ret = count;
547 549
@@ -576,15 +578,15 @@ static ssize_t store_mesh_iface(struct kobject *kobj, struct attribute *attr,
576 } 578 }
577 579
578 if (status_tmp == IF_NOT_IN_USE) { 580 if (status_tmp == IF_NOT_IN_USE) {
579 hardif_disable_interface(hard_iface); 581 batadv_hardif_disable_interface(hard_iface);
580 goto unlock; 582 goto unlock;
581 } 583 }
582 584
583 /* if the interface already is in use */ 585 /* if the interface already is in use */
584 if (hard_iface->if_status != IF_NOT_IN_USE) 586 if (hard_iface->if_status != IF_NOT_IN_USE)
585 hardif_disable_interface(hard_iface); 587 batadv_hardif_disable_interface(hard_iface);
586 588
587 ret = hardif_enable_interface(hard_iface, buff); 589 ret = batadv_hardif_enable_interface(hard_iface, buff);
588 590
589unlock: 591unlock:
590 rtnl_unlock(); 592 rtnl_unlock();
@@ -597,7 +599,7 @@ static ssize_t show_iface_status(struct kobject *kobj, struct attribute *attr,
597 char *buff) 599 char *buff)
598{ 600{
599 struct net_device *net_dev = kobj_to_netdev(kobj); 601 struct net_device *net_dev = kobj_to_netdev(kobj);
600 struct hard_iface *hard_iface = hardif_get_by_netdev(net_dev); 602 struct hard_iface *hard_iface = batadv_hardif_get_by_netdev(net_dev);
601 ssize_t length; 603 ssize_t length;
602 604
603 if (!hard_iface) 605 if (!hard_iface)
diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c
index 1643e7fca6c6..4f44f049186f 100644
--- a/net/batman-adv/hard-interface.c
+++ b/net/batman-adv/hard-interface.c
@@ -32,7 +32,7 @@
32 32
33#include <linux/if_arp.h> 33#include <linux/if_arp.h>
34 34
35void hardif_free_rcu(struct rcu_head *rcu) 35void batadv_hardif_free_rcu(struct rcu_head *rcu)
36{ 36{
37 struct hard_iface *hard_iface; 37 struct hard_iface *hard_iface;
38 38
@@ -41,7 +41,7 @@ void hardif_free_rcu(struct rcu_head *rcu)
41 kfree(hard_iface); 41 kfree(hard_iface);
42} 42}
43 43
44struct hard_iface *hardif_get_by_netdev(const struct net_device *net_dev) 44struct hard_iface *batadv_hardif_get_by_netdev(const struct net_device *net_dev)
45{ 45{
46 struct hard_iface *hard_iface; 46 struct hard_iface *hard_iface;
47 47
@@ -180,7 +180,7 @@ static void check_known_mac_addr(const struct net_device *net_dev)
180 rcu_read_unlock(); 180 rcu_read_unlock();
181} 181}
182 182
183int hardif_min_mtu(struct net_device *soft_iface) 183int batadv_hardif_min_mtu(struct net_device *soft_iface)
184{ 184{
185 const struct bat_priv *bat_priv = netdev_priv(soft_iface); 185 const struct bat_priv *bat_priv = netdev_priv(soft_iface);
186 const struct hard_iface *hard_iface; 186 const struct hard_iface *hard_iface;
@@ -209,11 +209,11 @@ out:
209} 209}
210 210
211/* adjusts the MTU if a new interface with a smaller MTU appeared. */ 211/* adjusts the MTU if a new interface with a smaller MTU appeared. */
212void update_min_mtu(struct net_device *soft_iface) 212void batadv_update_min_mtu(struct net_device *soft_iface)
213{ 213{
214 int min_mtu; 214 int min_mtu;
215 215
216 min_mtu = hardif_min_mtu(soft_iface); 216 min_mtu = batadv_hardif_min_mtu(soft_iface);
217 if (soft_iface->mtu != min_mtu) 217 if (soft_iface->mtu != min_mtu)
218 soft_iface->mtu = min_mtu; 218 soft_iface->mtu = min_mtu;
219} 219}
@@ -242,7 +242,7 @@ static void hardif_activate_interface(struct hard_iface *hard_iface)
242 bat_info(hard_iface->soft_iface, "Interface activated: %s\n", 242 bat_info(hard_iface->soft_iface, "Interface activated: %s\n",
243 hard_iface->net_dev->name); 243 hard_iface->net_dev->name);
244 244
245 update_min_mtu(hard_iface->soft_iface); 245 batadv_update_min_mtu(hard_iface->soft_iface);
246 246
247out: 247out:
248 if (primary_if) 248 if (primary_if)
@@ -260,11 +260,11 @@ static void hardif_deactivate_interface(struct hard_iface *hard_iface)
260 bat_info(hard_iface->soft_iface, "Interface deactivated: %s\n", 260 bat_info(hard_iface->soft_iface, "Interface deactivated: %s\n",
261 hard_iface->net_dev->name); 261 hard_iface->net_dev->name);
262 262
263 update_min_mtu(hard_iface->soft_iface); 263 batadv_update_min_mtu(hard_iface->soft_iface);
264} 264}
265 265
266int hardif_enable_interface(struct hard_iface *hard_iface, 266int batadv_hardif_enable_interface(struct hard_iface *hard_iface,
267 const char *iface_name) 267 const char *iface_name)
268{ 268{
269 struct bat_priv *bat_priv; 269 struct bat_priv *bat_priv;
270 struct net_device *soft_iface; 270 struct net_device *soft_iface;
@@ -357,7 +357,7 @@ err:
357 return ret; 357 return ret;
358} 358}
359 359
360void hardif_disable_interface(struct hard_iface *hard_iface) 360void batadv_hardif_disable_interface(struct hard_iface *hard_iface)
361{ 361{
362 struct bat_priv *bat_priv = netdev_priv(hard_iface->soft_iface); 362 struct bat_priv *bat_priv = netdev_priv(hard_iface->soft_iface);
363 struct hard_iface *primary_if = NULL; 363 struct hard_iface *primary_if = NULL;
@@ -461,7 +461,7 @@ static void hardif_remove_interface(struct hard_iface *hard_iface)
461 461
462 /* first deactivate interface */ 462 /* first deactivate interface */
463 if (hard_iface->if_status != IF_NOT_IN_USE) 463 if (hard_iface->if_status != IF_NOT_IN_USE)
464 hardif_disable_interface(hard_iface); 464 batadv_hardif_disable_interface(hard_iface);
465 465
466 if (hard_iface->if_status != IF_NOT_IN_USE) 466 if (hard_iface->if_status != IF_NOT_IN_USE)
467 return; 467 return;
@@ -471,7 +471,7 @@ static void hardif_remove_interface(struct hard_iface *hard_iface)
471 hardif_free_ref(hard_iface); 471 hardif_free_ref(hard_iface);
472} 472}
473 473
474void hardif_remove_interfaces(void) 474void batadv_hardif_remove_interfaces(void)
475{ 475{
476 struct hard_iface *hard_iface, *hard_iface_tmp; 476 struct hard_iface *hard_iface, *hard_iface_tmp;
477 477
@@ -488,7 +488,7 @@ static int hard_if_event(struct notifier_block *this,
488 unsigned long event, void *ptr) 488 unsigned long event, void *ptr)
489{ 489{
490 struct net_device *net_dev = ptr; 490 struct net_device *net_dev = ptr;
491 struct hard_iface *hard_iface = hardif_get_by_netdev(net_dev); 491 struct hard_iface *hard_iface = batadv_hardif_get_by_netdev(net_dev);
492 struct hard_iface *primary_if = NULL; 492 struct hard_iface *primary_if = NULL;
493 struct bat_priv *bat_priv; 493 struct bat_priv *bat_priv;
494 494
@@ -513,7 +513,7 @@ static int hard_if_event(struct notifier_block *this,
513 break; 513 break;
514 case NETDEV_CHANGEMTU: 514 case NETDEV_CHANGEMTU:
515 if (hard_iface->soft_iface) 515 if (hard_iface->soft_iface)
516 update_min_mtu(hard_iface->soft_iface); 516 batadv_update_min_mtu(hard_iface->soft_iface);
517 break; 517 break;
518 case NETDEV_CHANGEADDR: 518 case NETDEV_CHANGEADDR:
519 if (hard_iface->if_status == IF_NOT_IN_USE) 519 if (hard_iface->if_status == IF_NOT_IN_USE)
@@ -545,7 +545,7 @@ out:
545 545
546/* This function returns true if the interface represented by ifindex is a 546/* This function returns true if the interface represented by ifindex is a
547 * 802.11 wireless device */ 547 * 802.11 wireless device */
548bool is_wifi_iface(int ifindex) 548bool batadv_is_wifi_iface(int ifindex)
549{ 549{
550 struct net_device *net_device = NULL; 550 struct net_device *net_device = NULL;
551 bool ret = false; 551 bool ret = false;
@@ -573,6 +573,6 @@ out:
573 return ret; 573 return ret;
574} 574}
575 575
576struct notifier_block hard_if_notifier = { 576struct notifier_block batadv_hard_if_notifier = {
577 .notifier_call = hard_if_event, 577 .notifier_call = hard_if_event,
578}; 578};
diff --git a/net/batman-adv/hard-interface.h b/net/batman-adv/hard-interface.h
index e68c5655e616..20e09db29d15 100644
--- a/net/batman-adv/hard-interface.h
+++ b/net/batman-adv/hard-interface.h
@@ -31,23 +31,23 @@ enum hard_if_state {
31 IF_I_WANT_YOU 31 IF_I_WANT_YOU
32}; 32};
33 33
34extern struct notifier_block hard_if_notifier; 34extern struct notifier_block batadv_hard_if_notifier;
35 35
36struct hard_iface* 36struct hard_iface*
37hardif_get_by_netdev(const struct net_device *net_dev); 37batadv_hardif_get_by_netdev(const struct net_device *net_dev);
38int hardif_enable_interface(struct hard_iface *hard_iface, 38int batadv_hardif_enable_interface(struct hard_iface *hard_iface,
39 const char *iface_name); 39 const char *iface_name);
40void hardif_disable_interface(struct hard_iface *hard_iface); 40void batadv_hardif_disable_interface(struct hard_iface *hard_iface);
41void hardif_remove_interfaces(void); 41void batadv_hardif_remove_interfaces(void);
42int hardif_min_mtu(struct net_device *soft_iface); 42int batadv_hardif_min_mtu(struct net_device *soft_iface);
43void update_min_mtu(struct net_device *soft_iface); 43void batadv_update_min_mtu(struct net_device *soft_iface);
44void hardif_free_rcu(struct rcu_head *rcu); 44void batadv_hardif_free_rcu(struct rcu_head *rcu);
45bool is_wifi_iface(int ifindex); 45bool batadv_is_wifi_iface(int ifindex);
46 46
47static inline void hardif_free_ref(struct hard_iface *hard_iface) 47static inline void hardif_free_ref(struct hard_iface *hard_iface)
48{ 48{
49 if (atomic_dec_and_test(&hard_iface->refcount)) 49 if (atomic_dec_and_test(&hard_iface->refcount))
50 call_rcu(&hard_iface->rcu, hardif_free_rcu); 50 call_rcu(&hard_iface->rcu, batadv_hardif_free_rcu);
51} 51}
52 52
53static inline struct hard_iface *primary_if_get_selected( 53static inline struct hard_iface *primary_if_get_selected(
diff --git a/net/batman-adv/main.c b/net/batman-adv/main.c
index 8fe70b487b49..8e4083612523 100644
--- a/net/batman-adv/main.c
+++ b/net/batman-adv/main.c
@@ -68,7 +68,7 @@ static int __init batman_init(void)
68 bat_socket_init(); 68 bat_socket_init();
69 batadv_debugfs_init(); 69 batadv_debugfs_init();
70 70
71 register_netdevice_notifier(&hard_if_notifier); 71 register_netdevice_notifier(&batadv_hard_if_notifier);
72 72
73 pr_info("B.A.T.M.A.N. advanced %s (compatibility version %i) loaded\n", 73 pr_info("B.A.T.M.A.N. advanced %s (compatibility version %i) loaded\n",
74 SOURCE_VERSION, COMPAT_VERSION); 74 SOURCE_VERSION, COMPAT_VERSION);
@@ -79,8 +79,8 @@ static int __init batman_init(void)
79static void __exit batman_exit(void) 79static void __exit batman_exit(void)
80{ 80{
81 batadv_debugfs_destroy(); 81 batadv_debugfs_destroy();
82 unregister_netdevice_notifier(&hard_if_notifier); 82 unregister_netdevice_notifier(&batadv_hard_if_notifier);
83 hardif_remove_interfaces(); 83 batadv_hardif_remove_interfaces();
84 84
85 flush_workqueue(bat_event_workqueue); 85 flush_workqueue(bat_event_workqueue);
86 destroy_workqueue(bat_event_workqueue); 86 destroy_workqueue(bat_event_workqueue);
diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c
index bfc4fe03cafa..5bf9a73ae799 100644
--- a/net/batman-adv/soft-interface.c
+++ b/net/batman-adv/soft-interface.c
@@ -122,7 +122,7 @@ static int interface_set_mac_addr(struct net_device *dev, void *p)
122static int interface_change_mtu(struct net_device *dev, int new_mtu) 122static int interface_change_mtu(struct net_device *dev, int new_mtu)
123{ 123{
124 /* check ranges */ 124 /* check ranges */
125 if ((new_mtu < 68) || (new_mtu > hardif_min_mtu(dev))) 125 if ((new_mtu < 68) || (new_mtu > batadv_hardif_min_mtu(dev)))
126 return -EINVAL; 126 return -EINVAL;
127 127
128 dev->mtu = new_mtu; 128 dev->mtu = new_mtu;
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index bb8557ea30f1..7324b89bf731 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -221,7 +221,7 @@ void tt_local_add(struct net_device *soft_iface, const uint8_t *addr,
221 221
222 memcpy(tt_local_entry->common.addr, addr, ETH_ALEN); 222 memcpy(tt_local_entry->common.addr, addr, ETH_ALEN);
223 tt_local_entry->common.flags = NO_FLAGS; 223 tt_local_entry->common.flags = NO_FLAGS;
224 if (is_wifi_iface(ifindex)) 224 if (batadv_is_wifi_iface(ifindex))
225 tt_local_entry->common.flags |= TT_CLIENT_WIFI; 225 tt_local_entry->common.flags |= TT_CLIENT_WIFI;
226 atomic_set(&tt_local_entry->common.refcount, 2); 226 atomic_set(&tt_local_entry->common.refcount, 2);
227 tt_local_entry->last_seen = jiffies; 227 tt_local_entry->last_seen = jiffies;