aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorSven Eckelmann <sven@narfation.org>2012-05-11 20:09:42 -0400
committerAntonio Quartulli <ordex@autistici.org>2012-06-20 16:15:32 -0400
commit3193e8fdfa355289892661d206d1954114a7be95 (patch)
tree4fce7c85cd572389433a128db0ed180a3928e968 /net
parentd0f714f472967577067853acc8dabe0abc75ae8f (diff)
batman-adv: Prefix main 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.c6
-rw-r--r--net/batman-adv/bat_iv_ogm.c16
-rw-r--r--net/batman-adv/bridge_loop_avoidance.c2
-rw-r--r--net/batman-adv/hard-interface.c14
-rw-r--r--net/batman-adv/icmp_socket.c4
-rw-r--r--net/batman-adv/main.c57
-rw-r--r--net/batman-adv/main.h41
-rw-r--r--net/batman-adv/originator.c4
-rw-r--r--net/batman-adv/routing.c26
-rw-r--r--net/batman-adv/send.c6
-rw-r--r--net/batman-adv/soft-interface.c6
-rw-r--r--net/batman-adv/translation-table.c4
-rw-r--r--net/batman-adv/vis.c10
13 files changed, 99 insertions, 97 deletions
diff --git a/net/batman-adv/bat_debugfs.c b/net/batman-adv/bat_debugfs.c
index ad377aba0661..3900624d333d 100644
--- a/net/batman-adv/bat_debugfs.c
+++ b/net/batman-adv/bat_debugfs.c
@@ -94,13 +94,13 @@ static int log_open(struct inode *inode, struct file *file)
94{ 94{
95 nonseekable_open(inode, file); 95 nonseekable_open(inode, file);
96 file->private_data = inode->i_private; 96 file->private_data = inode->i_private;
97 inc_module_count(); 97 batadv_inc_module_count();
98 return 0; 98 return 0;
99} 99}
100 100
101static int log_release(struct inode *inode, struct file *file) 101static int log_release(struct inode *inode, struct file *file)
102{ 102{
103 dec_module_count(); 103 batadv_dec_module_count();
104 return 0; 104 return 0;
105} 105}
106 106
@@ -224,7 +224,7 @@ static void debug_log_cleanup(struct bat_priv *bat_priv)
224 224
225static int bat_algorithms_open(struct inode *inode, struct file *file) 225static int bat_algorithms_open(struct inode *inode, struct file *file)
226{ 226{
227 return single_open(file, bat_algo_seq_print_text, NULL); 227 return single_open(file, batadv_algo_seq_print_text, NULL);
228} 228}
229 229
230static int originators_open(struct inode *inode, struct file *file) 230static int originators_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 62b52b663afb..0430063d3a7d 100644
--- a/net/batman-adv/bat_iv_ogm.c
+++ b/net/batman-adv/bat_iv_ogm.c
@@ -204,7 +204,7 @@ static void bat_iv_ogm_send_to_if(struct forw_packet *forw_packet,
204 batadv_inc_counter(bat_priv, BAT_CNT_MGMT_TX); 204 batadv_inc_counter(bat_priv, BAT_CNT_MGMT_TX);
205 batadv_add_counter(bat_priv, BAT_CNT_MGMT_TX_BYTES, 205 batadv_add_counter(bat_priv, BAT_CNT_MGMT_TX_BYTES,
206 skb->len + ETH_HLEN); 206 skb->len + ETH_HLEN);
207 batadv_send_skb_packet(skb, hard_iface, broadcast_addr); 207 batadv_send_skb_packet(skb, hard_iface, batadv_broadcast_addr);
208 } 208 }
209} 209}
210 210
@@ -255,7 +255,7 @@ static void bat_iv_ogm_emit(struct forw_packet *forw_packet)
255 /* skb is only used once and than forw_packet is free'd */ 255 /* skb is only used once and than forw_packet is free'd */
256 batadv_send_skb_packet(forw_packet->skb, 256 batadv_send_skb_packet(forw_packet->skb,
257 forw_packet->if_incoming, 257 forw_packet->if_incoming,
258 broadcast_addr); 258 batadv_broadcast_addr);
259 forw_packet->skb = NULL; 259 forw_packet->skb = NULL;
260 260
261 goto out; 261 goto out;
@@ -263,7 +263,7 @@ static void bat_iv_ogm_emit(struct forw_packet *forw_packet)
263 263
264 /* broadcast on every interface */ 264 /* broadcast on every interface */
265 rcu_read_lock(); 265 rcu_read_lock();
266 list_for_each_entry_rcu(hard_iface, &hardif_list, list) { 266 list_for_each_entry_rcu(hard_iface, &batadv_hardif_list, list) {
267 if (hard_iface->soft_iface != soft_iface) 267 if (hard_iface->soft_iface != soft_iface)
268 continue; 268 continue;
269 269
@@ -425,7 +425,7 @@ static void bat_iv_ogm_aggregate_new(const unsigned char *packet_buff,
425 /* start timer for this packet */ 425 /* start timer for this packet */
426 INIT_DELAYED_WORK(&forw_packet_aggr->delayed_work, 426 INIT_DELAYED_WORK(&forw_packet_aggr->delayed_work,
427 batadv_send_outstanding_bat_ogm_packet); 427 batadv_send_outstanding_bat_ogm_packet);
428 queue_delayed_work(bat_event_workqueue, 428 queue_delayed_work(batadv_event_workqueue,
429 &forw_packet_aggr->delayed_work, 429 &forw_packet_aggr->delayed_work,
430 send_time - jiffies); 430 send_time - jiffies);
431 431
@@ -984,7 +984,7 @@ static void bat_iv_ogm_process(const struct ethhdr *ethhdr,
984 batman_ogm_packet->header.version, has_directlink_flag); 984 batman_ogm_packet->header.version, has_directlink_flag);
985 985
986 rcu_read_lock(); 986 rcu_read_lock();
987 list_for_each_entry_rcu(hard_iface, &hardif_list, list) { 987 list_for_each_entry_rcu(hard_iface, &batadv_hardif_list, list) {
988 if (hard_iface->if_status != IF_ACTIVE) 988 if (hard_iface->if_status != IF_ACTIVE)
989 continue; 989 continue;
990 990
@@ -1259,18 +1259,18 @@ int __init batadv_iv_init(void)
1259 int ret; 1259 int ret;
1260 1260
1261 /* batman originator packet */ 1261 /* batman originator packet */
1262 ret = recv_handler_register(BAT_IV_OGM, bat_iv_ogm_receive); 1262 ret = batadv_recv_handler_register(BAT_IV_OGM, bat_iv_ogm_receive);
1263 if (ret < 0) 1263 if (ret < 0)
1264 goto out; 1264 goto out;
1265 1265
1266 ret = bat_algo_register(&batman_iv); 1266 ret = batadv_algo_register(&batman_iv);
1267 if (ret < 0) 1267 if (ret < 0)
1268 goto handler_unregister; 1268 goto handler_unregister;
1269 1269
1270 goto out; 1270 goto out;
1271 1271
1272handler_unregister: 1272handler_unregister:
1273 recv_handler_unregister(BAT_IV_OGM); 1273 batadv_recv_handler_unregister(BAT_IV_OGM);
1274out: 1274out:
1275 return ret; 1275 return ret;
1276} 1276}
diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c
index bd356a12882a..27f451a64ad0 100644
--- a/net/batman-adv/bridge_loop_avoidance.c
+++ b/net/batman-adv/bridge_loop_avoidance.c
@@ -1070,7 +1070,7 @@ void batadv_bla_update_orig_address(struct bat_priv *bat_priv,
1070static void bla_start_timer(struct bat_priv *bat_priv) 1070static void bla_start_timer(struct bat_priv *bat_priv)
1071{ 1071{
1072 INIT_DELAYED_WORK(&bat_priv->bla_work, bla_periodic_work); 1072 INIT_DELAYED_WORK(&bat_priv->bla_work, bla_periodic_work);
1073 queue_delayed_work(bat_event_workqueue, &bat_priv->bla_work, 1073 queue_delayed_work(batadv_event_workqueue, &bat_priv->bla_work,
1074 msecs_to_jiffies(BLA_PERIOD_LENGTH)); 1074 msecs_to_jiffies(BLA_PERIOD_LENGTH));
1075} 1075}
1076 1076
diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c
index 93acf2be7759..ab2fcfaf297e 100644
--- a/net/batman-adv/hard-interface.c
+++ b/net/batman-adv/hard-interface.c
@@ -46,7 +46,7 @@ struct hard_iface *batadv_hardif_get_by_netdev(const struct net_device *net_dev)
46 struct hard_iface *hard_iface; 46 struct hard_iface *hard_iface;
47 47
48 rcu_read_lock(); 48 rcu_read_lock();
49 list_for_each_entry_rcu(hard_iface, &hardif_list, list) { 49 list_for_each_entry_rcu(hard_iface, &batadv_hardif_list, list) {
50 if (hard_iface->net_dev == net_dev && 50 if (hard_iface->net_dev == net_dev &&
51 atomic_inc_not_zero(&hard_iface->refcount)) 51 atomic_inc_not_zero(&hard_iface->refcount))
52 goto out; 52 goto out;
@@ -86,7 +86,7 @@ static struct hard_iface *hardif_get_active(const struct net_device *soft_iface)
86 struct hard_iface *hard_iface; 86 struct hard_iface *hard_iface;
87 87
88 rcu_read_lock(); 88 rcu_read_lock();
89 list_for_each_entry_rcu(hard_iface, &hardif_list, list) { 89 list_for_each_entry_rcu(hard_iface, &batadv_hardif_list, list) {
90 if (hard_iface->soft_iface != soft_iface) 90 if (hard_iface->soft_iface != soft_iface)
91 continue; 91 continue;
92 92
@@ -161,7 +161,7 @@ static void check_known_mac_addr(const struct net_device *net_dev)
161 const struct hard_iface *hard_iface; 161 const struct hard_iface *hard_iface;
162 162
163 rcu_read_lock(); 163 rcu_read_lock();
164 list_for_each_entry_rcu(hard_iface, &hardif_list, list) { 164 list_for_each_entry_rcu(hard_iface, &batadv_hardif_list, list) {
165 if ((hard_iface->if_status != IF_ACTIVE) && 165 if ((hard_iface->if_status != IF_ACTIVE) &&
166 (hard_iface->if_status != IF_TO_BE_ACTIVATED)) 166 (hard_iface->if_status != IF_TO_BE_ACTIVATED))
167 continue; 167 continue;
@@ -192,7 +192,7 @@ int batadv_hardif_min_mtu(struct net_device *soft_iface)
192 goto out; 192 goto out;
193 193
194 rcu_read_lock(); 194 rcu_read_lock();
195 list_for_each_entry_rcu(hard_iface, &hardif_list, list) { 195 list_for_each_entry_rcu(hard_iface, &batadv_hardif_list, list) {
196 if ((hard_iface->if_status != IF_ACTIVE) && 196 if ((hard_iface->if_status != IF_ACTIVE) &&
197 (hard_iface->if_status != IF_TO_BE_ACTIVATED)) 197 (hard_iface->if_status != IF_TO_BE_ACTIVATED))
198 continue; 198 continue;
@@ -315,7 +315,7 @@ int batadv_hardif_enable_interface(struct hard_iface *hard_iface,
315 batadv_orig_hash_add_if(hard_iface, bat_priv->num_ifaces); 315 batadv_orig_hash_add_if(hard_iface, bat_priv->num_ifaces);
316 316
317 hard_iface->batman_adv_ptype.type = __constant_htons(ETH_P_BATMAN); 317 hard_iface->batman_adv_ptype.type = __constant_htons(ETH_P_BATMAN);
318 hard_iface->batman_adv_ptype.func = batman_skb_recv; 318 hard_iface->batman_adv_ptype.func = batadv_batman_skb_recv;
319 hard_iface->batman_adv_ptype.dev = hard_iface->net_dev; 319 hard_iface->batman_adv_ptype.dev = hard_iface->net_dev;
320 dev_add_pack(&hard_iface->batman_adv_ptype); 320 dev_add_pack(&hard_iface->batman_adv_ptype);
321 321
@@ -436,7 +436,7 @@ static struct hard_iface *hardif_add_interface(struct net_device *net_dev)
436 atomic_set(&hard_iface->refcount, 2); 436 atomic_set(&hard_iface->refcount, 2);
437 437
438 check_known_mac_addr(hard_iface->net_dev); 438 check_known_mac_addr(hard_iface->net_dev);
439 list_add_tail_rcu(&hard_iface->list, &hardif_list); 439 list_add_tail_rcu(&hard_iface->list, &batadv_hardif_list);
440 440
441 /** 441 /**
442 * This can't be called via a bat_priv callback because 442 * This can't be called via a bat_priv callback because
@@ -477,7 +477,7 @@ void batadv_hardif_remove_interfaces(void)
477 477
478 rtnl_lock(); 478 rtnl_lock();
479 list_for_each_entry_safe(hard_iface, hard_iface_tmp, 479 list_for_each_entry_safe(hard_iface, hard_iface_tmp,
480 &hardif_list, list) { 480 &batadv_hardif_list, list) {
481 list_del_rcu(&hard_iface->list); 481 list_del_rcu(&hard_iface->list);
482 hardif_remove_interface(hard_iface); 482 hardif_remove_interface(hard_iface);
483 } 483 }
diff --git a/net/batman-adv/icmp_socket.c b/net/batman-adv/icmp_socket.c
index 21c001074ebe..230056139445 100644
--- a/net/batman-adv/icmp_socket.c
+++ b/net/batman-adv/icmp_socket.c
@@ -73,7 +73,7 @@ static int bat_socket_open(struct inode *inode, struct file *file)
73 73
74 file->private_data = socket_client; 74 file->private_data = socket_client;
75 75
76 inc_module_count(); 76 batadv_inc_module_count();
77 return 0; 77 return 0;
78} 78}
79 79
@@ -98,7 +98,7 @@ static int bat_socket_release(struct inode *inode, struct file *file)
98 spin_unlock_bh(&socket_client->lock); 98 spin_unlock_bh(&socket_client->lock);
99 99
100 kfree(socket_client); 100 kfree(socket_client);
101 dec_module_count(); 101 batadv_dec_module_count();
102 102
103 return 0; 103 return 0;
104} 104}
diff --git a/net/batman-adv/main.c b/net/batman-adv/main.c
index ffea3609ea41..5e1d906628f5 100644
--- a/net/batman-adv/main.c
+++ b/net/batman-adv/main.c
@@ -38,20 +38,20 @@
38 38
39/* List manipulations on hardif_list have to be rtnl_lock()'ed, 39/* List manipulations on hardif_list have to be rtnl_lock()'ed,
40 * list traversals just rcu-locked */ 40 * list traversals just rcu-locked */
41struct list_head hardif_list; 41struct list_head batadv_hardif_list;
42static int (*recv_packet_handler[256])(struct sk_buff *, struct hard_iface *); 42static int (*recv_packet_handler[256])(struct sk_buff *, struct hard_iface *);
43char bat_routing_algo[20] = "BATMAN_IV"; 43char batadv_routing_algo[20] = "BATMAN_IV";
44static struct hlist_head bat_algo_list; 44static struct hlist_head bat_algo_list;
45 45
46unsigned char broadcast_addr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; 46unsigned char batadv_broadcast_addr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
47 47
48struct workqueue_struct *bat_event_workqueue; 48struct workqueue_struct *batadv_event_workqueue;
49 49
50static void recv_handler_init(void); 50static void recv_handler_init(void);
51 51
52static int __init batman_init(void) 52static int __init batman_init(void)
53{ 53{
54 INIT_LIST_HEAD(&hardif_list); 54 INIT_LIST_HEAD(&batadv_hardif_list);
55 INIT_HLIST_HEAD(&bat_algo_list); 55 INIT_HLIST_HEAD(&bat_algo_list);
56 56
57 recv_handler_init(); 57 recv_handler_init();
@@ -60,9 +60,9 @@ static int __init batman_init(void)
60 60
61 /* the name should not be longer than 10 chars - see 61 /* the name should not be longer than 10 chars - see
62 * http://lwn.net/Articles/23634/ */ 62 * http://lwn.net/Articles/23634/ */
63 bat_event_workqueue = create_singlethread_workqueue("bat_events"); 63 batadv_event_workqueue = create_singlethread_workqueue("bat_events");
64 64
65 if (!bat_event_workqueue) 65 if (!batadv_event_workqueue)
66 return -ENOMEM; 66 return -ENOMEM;
67 67
68 batadv_socket_init(); 68 batadv_socket_init();
@@ -82,14 +82,14 @@ static void __exit batman_exit(void)
82 unregister_netdevice_notifier(&batadv_hard_if_notifier); 82 unregister_netdevice_notifier(&batadv_hard_if_notifier);
83 batadv_hardif_remove_interfaces(); 83 batadv_hardif_remove_interfaces();
84 84
85 flush_workqueue(bat_event_workqueue); 85 flush_workqueue(batadv_event_workqueue);
86 destroy_workqueue(bat_event_workqueue); 86 destroy_workqueue(batadv_event_workqueue);
87 bat_event_workqueue = NULL; 87 batadv_event_workqueue = NULL;
88 88
89 rcu_barrier(); 89 rcu_barrier();
90} 90}
91 91
92int mesh_init(struct net_device *soft_iface) 92int batadv_mesh_init(struct net_device *soft_iface)
93{ 93{
94 struct bat_priv *bat_priv = netdev_priv(soft_iface); 94 struct bat_priv *bat_priv = netdev_priv(soft_iface);
95 int ret; 95 int ret;
@@ -135,11 +135,11 @@ int mesh_init(struct net_device *soft_iface)
135 return 0; 135 return 0;
136 136
137err: 137err:
138 mesh_free(soft_iface); 138 batadv_mesh_free(soft_iface);
139 return ret; 139 return ret;
140} 140}
141 141
142void mesh_free(struct net_device *soft_iface) 142void batadv_mesh_free(struct net_device *soft_iface)
143{ 143{
144 struct bat_priv *bat_priv = netdev_priv(soft_iface); 144 struct bat_priv *bat_priv = netdev_priv(soft_iface);
145 145
@@ -161,22 +161,22 @@ void mesh_free(struct net_device *soft_iface)
161 atomic_set(&bat_priv->mesh_state, MESH_INACTIVE); 161 atomic_set(&bat_priv->mesh_state, MESH_INACTIVE);
162} 162}
163 163
164void inc_module_count(void) 164void batadv_inc_module_count(void)
165{ 165{
166 try_module_get(THIS_MODULE); 166 try_module_get(THIS_MODULE);
167} 167}
168 168
169void dec_module_count(void) 169void batadv_dec_module_count(void)
170{ 170{
171 module_put(THIS_MODULE); 171 module_put(THIS_MODULE);
172} 172}
173 173
174int is_my_mac(const uint8_t *addr) 174int batadv_is_my_mac(const uint8_t *addr)
175{ 175{
176 const struct hard_iface *hard_iface; 176 const struct hard_iface *hard_iface;
177 177
178 rcu_read_lock(); 178 rcu_read_lock();
179 list_for_each_entry_rcu(hard_iface, &hardif_list, list) { 179 list_for_each_entry_rcu(hard_iface, &batadv_hardif_list, list) {
180 if (hard_iface->if_status != IF_ACTIVE) 180 if (hard_iface->if_status != IF_ACTIVE)
181 continue; 181 continue;
182 182
@@ -198,8 +198,9 @@ static int recv_unhandled_packet(struct sk_buff *skb,
198/* incoming packets with the batman ethertype received on any active hard 198/* incoming packets with the batman ethertype received on any active hard
199 * interface 199 * interface
200 */ 200 */
201int batman_skb_recv(struct sk_buff *skb, struct net_device *dev, 201int batadv_batman_skb_recv(struct sk_buff *skb, struct net_device *dev,
202 struct packet_type *ptype, struct net_device *orig_dev) 202 struct packet_type *ptype,
203 struct net_device *orig_dev)
203{ 204{
204 struct bat_priv *bat_priv; 205 struct bat_priv *bat_priv;
205 struct batman_ogm_packet *batman_ogm_packet; 206 struct batman_ogm_packet *batman_ogm_packet;
@@ -287,9 +288,9 @@ static void recv_handler_init(void)
287 recv_packet_handler[BAT_ROAM_ADV] = batadv_recv_roam_adv; 288 recv_packet_handler[BAT_ROAM_ADV] = batadv_recv_roam_adv;
288} 289}
289 290
290int recv_handler_register(uint8_t packet_type, 291int batadv_recv_handler_register(uint8_t packet_type,
291 int (*recv_handler)(struct sk_buff *, 292 int (*recv_handler)(struct sk_buff *,
292 struct hard_iface *)) 293 struct hard_iface *))
293{ 294{
294 if (recv_packet_handler[packet_type] != &recv_unhandled_packet) 295 if (recv_packet_handler[packet_type] != &recv_unhandled_packet)
295 return -EBUSY; 296 return -EBUSY;
@@ -298,7 +299,7 @@ int recv_handler_register(uint8_t packet_type,
298 return 0; 299 return 0;
299} 300}
300 301
301void recv_handler_unregister(uint8_t packet_type) 302void batadv_recv_handler_unregister(uint8_t packet_type)
302{ 303{
303 recv_packet_handler[packet_type] = recv_unhandled_packet; 304 recv_packet_handler[packet_type] = recv_unhandled_packet;
304} 305}
@@ -319,7 +320,7 @@ static struct bat_algo_ops *bat_algo_get(char *name)
319 return bat_algo_ops; 320 return bat_algo_ops;
320} 321}
321 322
322int bat_algo_register(struct bat_algo_ops *bat_algo_ops) 323int batadv_algo_register(struct bat_algo_ops *bat_algo_ops)
323{ 324{
324 struct bat_algo_ops *bat_algo_ops_tmp; 325 struct bat_algo_ops *bat_algo_ops_tmp;
325 int ret; 326 int ret;
@@ -353,7 +354,7 @@ out:
353 return ret; 354 return ret;
354} 355}
355 356
356int bat_algo_select(struct bat_priv *bat_priv, char *name) 357int batadv_algo_select(struct bat_priv *bat_priv, char *name)
357{ 358{
358 struct bat_algo_ops *bat_algo_ops; 359 struct bat_algo_ops *bat_algo_ops;
359 int ret = -EINVAL; 360 int ret = -EINVAL;
@@ -369,7 +370,7 @@ out:
369 return ret; 370 return ret;
370} 371}
371 372
372int bat_algo_seq_print_text(struct seq_file *seq, void *offset) 373int batadv_algo_seq_print_text(struct seq_file *seq, void *offset)
373{ 374{
374 struct bat_algo_ops *bat_algo_ops; 375 struct bat_algo_ops *bat_algo_ops;
375 struct hlist_node *node; 376 struct hlist_node *node;
@@ -407,8 +408,8 @@ static const struct kernel_param_ops param_ops_ra = {
407}; 408};
408 409
409static struct kparam_string __param_string_ra = { 410static struct kparam_string __param_string_ra = {
410 .maxlen = sizeof(bat_routing_algo), 411 .maxlen = sizeof(batadv_routing_algo),
411 .string = bat_routing_algo, 412 .string = batadv_routing_algo,
412}; 413};
413 414
414module_param_cb(routing_algo, &param_ops_ra, &__param_string_ra, 0644); 415module_param_cb(routing_algo, &param_ops_ra, &__param_string_ra, 0644);
diff --git a/net/batman-adv/main.h b/net/batman-adv/main.h
index ea9d433ad46d..12386421a55b 100644
--- a/net/batman-adv/main.h
+++ b/net/batman-adv/main.h
@@ -145,26 +145,27 @@ enum dbg_level {
145#include <linux/seq_file.h> 145#include <linux/seq_file.h>
146#include "types.h" 146#include "types.h"
147 147
148extern char bat_routing_algo[]; 148extern char batadv_routing_algo[];
149extern struct list_head hardif_list; 149extern struct list_head batadv_hardif_list;
150 150
151extern unsigned char broadcast_addr[]; 151extern unsigned char batadv_broadcast_addr[];
152extern struct workqueue_struct *bat_event_workqueue; 152extern struct workqueue_struct *batadv_event_workqueue;
153 153
154int mesh_init(struct net_device *soft_iface); 154int batadv_mesh_init(struct net_device *soft_iface);
155void mesh_free(struct net_device *soft_iface); 155void batadv_mesh_free(struct net_device *soft_iface);
156void inc_module_count(void); 156void batadv_inc_module_count(void);
157void dec_module_count(void); 157void batadv_dec_module_count(void);
158int is_my_mac(const uint8_t *addr); 158int batadv_is_my_mac(const uint8_t *addr);
159int batman_skb_recv(struct sk_buff *skb, struct net_device *dev, 159int batadv_batman_skb_recv(struct sk_buff *skb, struct net_device *dev,
160 struct packet_type *ptype, struct net_device *orig_dev); 160 struct packet_type *ptype,
161int recv_handler_register(uint8_t packet_type, 161 struct net_device *orig_dev);
162 int (*recv_handler)(struct sk_buff *, 162int batadv_recv_handler_register(uint8_t packet_type,
163 struct hard_iface *)); 163 int (*recv_handler)(struct sk_buff *,
164void recv_handler_unregister(uint8_t packet_type); 164 struct hard_iface *));
165int bat_algo_register(struct bat_algo_ops *bat_algo_ops); 165void batadv_recv_handler_unregister(uint8_t packet_type);
166int bat_algo_select(struct bat_priv *bat_priv, char *name); 166int batadv_algo_register(struct bat_algo_ops *bat_algo_ops);
167int bat_algo_seq_print_text(struct seq_file *seq, void *offset); 167int batadv_algo_select(struct bat_priv *bat_priv, char *name);
168int batadv_algo_seq_print_text(struct seq_file *seq, void *offset);
168 169
169#ifdef CONFIG_BATMAN_ADV_DEBUG 170#ifdef CONFIG_BATMAN_ADV_DEBUG
170int batadv_debug_log(struct bat_priv *bat_priv, const char *fmt, ...) 171int batadv_debug_log(struct bat_priv *bat_priv, const char *fmt, ...)
diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c
index 9d77edeff589..3e902042af8f 100644
--- a/net/batman-adv/originator.c
+++ b/net/batman-adv/originator.c
@@ -35,7 +35,7 @@ static void purge_orig(struct work_struct *work);
35static void start_purge_timer(struct bat_priv *bat_priv) 35static void start_purge_timer(struct bat_priv *bat_priv)
36{ 36{
37 INIT_DELAYED_WORK(&bat_priv->orig_work, purge_orig); 37 INIT_DELAYED_WORK(&bat_priv->orig_work, purge_orig);
38 queue_delayed_work(bat_event_workqueue, 38 queue_delayed_work(batadv_event_workqueue,
39 &bat_priv->orig_work, msecs_to_jiffies(1000)); 39 &bat_priv->orig_work, msecs_to_jiffies(1000));
40} 40}
41 41
@@ -623,7 +623,7 @@ int batadv_orig_hash_del_if(struct hard_iface *hard_iface, int max_if_num)
623 623
624 /* renumber remaining batman interfaces _inside_ of orig_hash_lock */ 624 /* renumber remaining batman interfaces _inside_ of orig_hash_lock */
625 rcu_read_lock(); 625 rcu_read_lock();
626 list_for_each_entry_rcu(hard_iface_tmp, &hardif_list, list) { 626 list_for_each_entry_rcu(hard_iface_tmp, &batadv_hardif_list, list) {
627 if (hard_iface_tmp->if_status == IF_NOT_IN_USE) 627 if (hard_iface_tmp->if_status == IF_NOT_IN_USE)
628 continue; 628 continue;
629 629
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
index d492634dd040..1b1dd41f5fe6 100644
--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -419,7 +419,7 @@ int batadv_recv_icmp_packet(struct sk_buff *skb, struct hard_iface *recv_if)
419 goto out; 419 goto out;
420 420
421 /* not for me */ 421 /* not for me */
422 if (!is_my_mac(ethhdr->h_dest)) 422 if (!batadv_is_my_mac(ethhdr->h_dest))
423 goto out; 423 goto out;
424 424
425 icmp_packet = (struct icmp_packet_rr *)skb->data; 425 icmp_packet = (struct icmp_packet_rr *)skb->data;
@@ -433,7 +433,7 @@ int batadv_recv_icmp_packet(struct sk_buff *skb, struct hard_iface *recv_if)
433 } 433 }
434 434
435 /* packet for me */ 435 /* packet for me */
436 if (is_my_mac(icmp_packet->dst)) 436 if (batadv_is_my_mac(icmp_packet->dst))
437 return recv_my_icmp_packet(bat_priv, skb, hdr_size); 437 return recv_my_icmp_packet(bat_priv, skb, hdr_size);
438 438
439 /* TTL exceeded */ 439 /* TTL exceeded */
@@ -614,7 +614,7 @@ int batadv_recv_tt_query(struct sk_buff *skb, struct hard_iface *recv_if)
614 case TT_RESPONSE: 614 case TT_RESPONSE:
615 batadv_inc_counter(bat_priv, BAT_CNT_TT_RESPONSE_RX); 615 batadv_inc_counter(bat_priv, BAT_CNT_TT_RESPONSE_RX);
616 616
617 if (is_my_mac(tt_query->dst)) { 617 if (batadv_is_my_mac(tt_query->dst)) {
618 /* packet needs to be linearized to access the TT 618 /* packet needs to be linearized to access the TT
619 * changes */ 619 * changes */
620 if (skb_linearize(skb) < 0) 620 if (skb_linearize(skb) < 0)
@@ -670,7 +670,7 @@ int batadv_recv_roam_adv(struct sk_buff *skb, struct hard_iface *recv_if)
670 670
671 roam_adv_packet = (struct roam_adv_packet *)skb->data; 671 roam_adv_packet = (struct roam_adv_packet *)skb->data;
672 672
673 if (!is_my_mac(roam_adv_packet->dst)) 673 if (!batadv_is_my_mac(roam_adv_packet->dst))
674 return route_unicast_packet(skb, recv_if); 674 return route_unicast_packet(skb, recv_if);
675 675
676 /* check if it is a backbone gateway. we don't accept 676 /* check if it is a backbone gateway. we don't accept
@@ -804,7 +804,7 @@ static int check_unicast_packet(struct sk_buff *skb, int hdr_size)
804 return -1; 804 return -1;
805 805
806 /* not for me */ 806 /* not for me */
807 if (!is_my_mac(ethhdr->h_dest)) 807 if (!batadv_is_my_mac(ethhdr->h_dest))
808 return -1; 808 return -1;
809 809
810 return 0; 810 return 0;
@@ -909,7 +909,7 @@ static int check_unicast_ttvn(struct bat_priv *bat_priv,
909 909
910 unicast_packet = (struct unicast_packet *)skb->data; 910 unicast_packet = (struct unicast_packet *)skb->data;
911 911
912 if (is_my_mac(unicast_packet->dest)) { 912 if (batadv_is_my_mac(unicast_packet->dest)) {
913 tt_poss_change = bat_priv->tt_poss_change; 913 tt_poss_change = bat_priv->tt_poss_change;
914 curr_ttvn = (uint8_t)atomic_read(&bat_priv->ttvn); 914 curr_ttvn = (uint8_t)atomic_read(&bat_priv->ttvn);
915 } else { 915 } else {
@@ -985,7 +985,7 @@ int batadv_recv_unicast_packet(struct sk_buff *skb, struct hard_iface *recv_if)
985 unicast_packet = (struct unicast_packet *)skb->data; 985 unicast_packet = (struct unicast_packet *)skb->data;
986 986
987 /* packet for me */ 987 /* packet for me */
988 if (is_my_mac(unicast_packet->dest)) { 988 if (batadv_is_my_mac(unicast_packet->dest)) {
989 batadv_interface_rx(recv_if->soft_iface, skb, recv_if, 989 batadv_interface_rx(recv_if->soft_iface, skb, recv_if,
990 hdr_size); 990 hdr_size);
991 return NET_RX_SUCCESS; 991 return NET_RX_SUCCESS;
@@ -1012,7 +1012,7 @@ int batadv_recv_ucast_frag_packet(struct sk_buff *skb,
1012 unicast_packet = (struct unicast_frag_packet *)skb->data; 1012 unicast_packet = (struct unicast_frag_packet *)skb->data;
1013 1013
1014 /* packet for me */ 1014 /* packet for me */
1015 if (is_my_mac(unicast_packet->dest)) { 1015 if (batadv_is_my_mac(unicast_packet->dest)) {
1016 1016
1017 ret = batadv_frag_reassemble_skb(skb, bat_priv, &new_skb); 1017 ret = batadv_frag_reassemble_skb(skb, bat_priv, &new_skb);
1018 1018
@@ -1057,13 +1057,13 @@ int batadv_recv_bcast_packet(struct sk_buff *skb, struct hard_iface *recv_if)
1057 goto out; 1057 goto out;
1058 1058
1059 /* ignore broadcasts sent by myself */ 1059 /* ignore broadcasts sent by myself */
1060 if (is_my_mac(ethhdr->h_source)) 1060 if (batadv_is_my_mac(ethhdr->h_source))
1061 goto out; 1061 goto out;
1062 1062
1063 bcast_packet = (struct bcast_packet *)skb->data; 1063 bcast_packet = (struct bcast_packet *)skb->data;
1064 1064
1065 /* ignore broadcasts originated by myself */ 1065 /* ignore broadcasts originated by myself */
1066 if (is_my_mac(bcast_packet->orig)) 1066 if (batadv_is_my_mac(bcast_packet->orig))
1067 goto out; 1067 goto out;
1068 1068
1069 if (bcast_packet->header.ttl < 2) 1069 if (bcast_packet->header.ttl < 2)
@@ -1139,14 +1139,14 @@ int batadv_recv_vis_packet(struct sk_buff *skb, struct hard_iface *recv_if)
1139 ethhdr = (struct ethhdr *)skb_mac_header(skb); 1139 ethhdr = (struct ethhdr *)skb_mac_header(skb);
1140 1140
1141 /* not for me */ 1141 /* not for me */
1142 if (!is_my_mac(ethhdr->h_dest)) 1142 if (!batadv_is_my_mac(ethhdr->h_dest))
1143 return NET_RX_DROP; 1143 return NET_RX_DROP;
1144 1144
1145 /* ignore own packets */ 1145 /* ignore own packets */
1146 if (is_my_mac(vis_packet->vis_orig)) 1146 if (batadv_is_my_mac(vis_packet->vis_orig))
1147 return NET_RX_DROP; 1147 return NET_RX_DROP;
1148 1148
1149 if (is_my_mac(vis_packet->sender_orig)) 1149 if (batadv_is_my_mac(vis_packet->sender_orig))
1150 return NET_RX_DROP; 1150 return NET_RX_DROP;
1151 1151
1152 switch (vis_packet->vis_type) { 1152 switch (vis_packet->vis_type) {
diff --git a/net/batman-adv/send.c b/net/batman-adv/send.c
index 8226b1cf05eb..1a0f7c364ea0 100644
--- a/net/batman-adv/send.c
+++ b/net/batman-adv/send.c
@@ -121,7 +121,7 @@ static void _add_bcast_packet_to_list(struct bat_priv *bat_priv,
121 /* start timer for this packet */ 121 /* start timer for this packet */
122 INIT_DELAYED_WORK(&forw_packet->delayed_work, 122 INIT_DELAYED_WORK(&forw_packet->delayed_work,
123 send_outstanding_bcast_packet); 123 send_outstanding_bcast_packet);
124 queue_delayed_work(bat_event_workqueue, &forw_packet->delayed_work, 124 queue_delayed_work(batadv_event_workqueue, &forw_packet->delayed_work,
125 send_time); 125 send_time);
126} 126}
127 127
@@ -205,7 +205,7 @@ static void send_outstanding_bcast_packet(struct work_struct *work)
205 205
206 /* rebroadcast packet */ 206 /* rebroadcast packet */
207 rcu_read_lock(); 207 rcu_read_lock();
208 list_for_each_entry_rcu(hard_iface, &hardif_list, list) { 208 list_for_each_entry_rcu(hard_iface, &batadv_hardif_list, list) {
209 if (hard_iface->soft_iface != soft_iface) 209 if (hard_iface->soft_iface != soft_iface)
210 continue; 210 continue;
211 211
@@ -213,7 +213,7 @@ static void send_outstanding_bcast_packet(struct work_struct *work)
213 skb1 = skb_clone(forw_packet->skb, GFP_ATOMIC); 213 skb1 = skb_clone(forw_packet->skb, GFP_ATOMIC);
214 if (skb1) 214 if (skb1)
215 batadv_send_skb_packet(skb1, hard_iface, 215 batadv_send_skb_packet(skb1, hard_iface,
216 broadcast_addr); 216 batadv_broadcast_addr);
217 } 217 }
218 rcu_read_unlock(); 218 rcu_read_unlock();
219 219
diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c
index 9fd1925775c7..994b2b8d7e10 100644
--- a/net/batman-adv/soft-interface.c
+++ b/net/batman-adv/soft-interface.c
@@ -411,7 +411,7 @@ struct net_device *batadv_softif_create(const char *name)
411 if (!bat_priv->bat_counters) 411 if (!bat_priv->bat_counters)
412 goto unreg_soft_iface; 412 goto unreg_soft_iface;
413 413
414 ret = bat_algo_select(bat_priv, bat_routing_algo); 414 ret = batadv_algo_select(bat_priv, batadv_routing_algo);
415 if (ret < 0) 415 if (ret < 0)
416 goto free_bat_counters; 416 goto free_bat_counters;
417 417
@@ -423,7 +423,7 @@ struct net_device *batadv_softif_create(const char *name)
423 if (ret < 0) 423 if (ret < 0)
424 goto unreg_sysfs; 424 goto unreg_sysfs;
425 425
426 ret = mesh_init(soft_iface); 426 ret = batadv_mesh_init(soft_iface);
427 if (ret < 0) 427 if (ret < 0)
428 goto unreg_debugfs; 428 goto unreg_debugfs;
429 429
@@ -449,7 +449,7 @@ void batadv_softif_destroy(struct net_device *soft_iface)
449{ 449{
450 batadv_debugfs_del_meshif(soft_iface); 450 batadv_debugfs_del_meshif(soft_iface);
451 batadv_sysfs_del_meshif(soft_iface); 451 batadv_sysfs_del_meshif(soft_iface);
452 mesh_free(soft_iface); 452 batadv_mesh_free(soft_iface);
453 unregister_netdevice(soft_iface); 453 unregister_netdevice(soft_iface);
454} 454}
455 455
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index ecef827ae28f..66e11b58312e 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -48,7 +48,7 @@ static int compare_tt(const struct hlist_node *node, const void *data2)
48static void tt_start_timer(struct bat_priv *bat_priv) 48static void tt_start_timer(struct bat_priv *bat_priv)
49{ 49{
50 INIT_DELAYED_WORK(&bat_priv->tt_work, tt_purge); 50 INIT_DELAYED_WORK(&bat_priv->tt_work, tt_purge);
51 queue_delayed_work(bat_event_workqueue, &bat_priv->tt_work, 51 queue_delayed_work(batadv_event_workqueue, &bat_priv->tt_work,
52 msecs_to_jiffies(5000)); 52 msecs_to_jiffies(5000));
53} 53}
54 54
@@ -1673,7 +1673,7 @@ out:
1673bool batadv_send_tt_response(struct bat_priv *bat_priv, 1673bool batadv_send_tt_response(struct bat_priv *bat_priv,
1674 struct tt_query_packet *tt_request) 1674 struct tt_query_packet *tt_request)
1675{ 1675{
1676 if (is_my_mac(tt_request->dst)) { 1676 if (batadv_is_my_mac(tt_request->dst)) {
1677 /* don't answer backbone gws! */ 1677 /* don't answer backbone gws! */
1678 if (batadv_bla_is_backbone_gw_orig(bat_priv, tt_request->src)) 1678 if (batadv_bla_is_backbone_gw_orig(bat_priv, tt_request->src))
1679 return true; 1679 return true;
diff --git a/net/batman-adv/vis.c b/net/batman-adv/vis.c
index 24040c300636..83c931fa5c21 100644
--- a/net/batman-adv/vis.c
+++ b/net/batman-adv/vis.c
@@ -462,7 +462,7 @@ static struct vis_info *add_packet(struct bat_priv *bat_priv,
462 462
463 /* Make it a broadcast packet, if required */ 463 /* Make it a broadcast packet, if required */
464 if (make_broadcast) 464 if (make_broadcast)
465 memcpy(packet->target_orig, broadcast_addr, ETH_ALEN); 465 memcpy(packet->target_orig, batadv_broadcast_addr, ETH_ALEN);
466 466
467 /* repair if entries is longer than packet. */ 467 /* repair if entries is longer than packet. */
468 if (packet->entries * sizeof(struct vis_info_entry) > vis_info_len) 468 if (packet->entries * sizeof(struct vis_info_entry) > vis_info_len)
@@ -524,7 +524,7 @@ void batadv_receive_client_update_packet(struct bat_priv *bat_priv,
524 524
525 /* Are we the target for this VIS packet? */ 525 /* Are we the target for this VIS packet? */
526 if (vis_server == VIS_TYPE_SERVER_SYNC && 526 if (vis_server == VIS_TYPE_SERVER_SYNC &&
527 is_my_mac(vis_packet->target_orig)) 527 batadv_is_my_mac(vis_packet->target_orig))
528 are_target = 1; 528 are_target = 1;
529 529
530 spin_lock_bh(&bat_priv->vis_hash_lock); 530 spin_lock_bh(&bat_priv->vis_hash_lock);
@@ -543,7 +543,7 @@ void batadv_receive_client_update_packet(struct bat_priv *bat_priv,
543 send_list_add(bat_priv, info); 543 send_list_add(bat_priv, info);
544 544
545 /* ... we're not the recipient (and thus need to forward). */ 545 /* ... we're not the recipient (and thus need to forward). */
546 } else if (!is_my_mac(packet->target_orig)) { 546 } else if (!batadv_is_my_mac(packet->target_orig)) {
547 send_list_add(bat_priv, info); 547 send_list_add(bat_priv, info);
548 } 548 }
549 549
@@ -623,7 +623,7 @@ static int generate_vis_packet(struct bat_priv *bat_priv)
623 info->first_seen = jiffies; 623 info->first_seen = jiffies;
624 packet->vis_type = atomic_read(&bat_priv->vis_mode); 624 packet->vis_type = atomic_read(&bat_priv->vis_mode);
625 625
626 memcpy(packet->target_orig, broadcast_addr, ETH_ALEN); 626 memcpy(packet->target_orig, batadv_broadcast_addr, ETH_ALEN);
627 packet->header.ttl = TTL; 627 packet->header.ttl = TTL;
628 packet->seqno = htonl(ntohl(packet->seqno) + 1); 628 packet->seqno = htonl(ntohl(packet->seqno) + 1);
629 packet->entries = 0; 629 packet->entries = 0;
@@ -978,6 +978,6 @@ void batadv_vis_quit(struct bat_priv *bat_priv)
978static void start_vis_timer(struct bat_priv *bat_priv) 978static void start_vis_timer(struct bat_priv *bat_priv)
979{ 979{
980 INIT_DELAYED_WORK(&bat_priv->vis_work, send_vis_packets); 980 INIT_DELAYED_WORK(&bat_priv->vis_work, send_vis_packets);
981 queue_delayed_work(bat_event_workqueue, &bat_priv->vis_work, 981 queue_delayed_work(batadv_event_workqueue, &bat_priv->vis_work,
982 msecs_to_jiffies(VIS_INTERVAL)); 982 msecs_to_jiffies(VIS_INTERVAL));
983} 983}