Commit 7cf06bc6ff810178a7fb9f12aaa6b274fc520f6f

Authored by Sven Eckelmann
Committed by Antonio Quartulli
1 parent 08adf15122

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>

Showing 10 changed files with 51 additions and 46 deletions Side-by-side Diff

net/batman-adv/bat_debugfs.c
... ... @@ -236,7 +236,7 @@
236 236 static int gateways_open(struct inode *inode, struct file *file)
237 237 {
238 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  
242 242 static int transtable_global_open(struct inode *inode, struct file *file)
net/batman-adv/bat_iv_ogm.c
... ... @@ -729,8 +729,8 @@
729 729 ntohs(batman_ogm_packet->tt_crc));
730 730  
731 731 if (orig_node->gw_flags != batman_ogm_packet->gw_flags)
732   - gw_node_update(bat_priv, orig_node,
733   - batman_ogm_packet->gw_flags);
  732 + batadv_gw_node_update(bat_priv, orig_node,
  733 + batman_ogm_packet->gw_flags);
734 734  
735 735 orig_node->gw_flags = batman_ogm_packet->gw_flags;
736 736  
... ... @@ -738,7 +738,7 @@
738 738 if ((orig_node->gw_flags) &&
739 739 (atomic_read(&bat_priv->gw_mode) == GW_MODE_CLIENT) &&
740 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 743 goto out;
744 744  
net/batman-adv/bat_sysfs.c
... ... @@ -326,7 +326,7 @@
326 326 static void post_gw_deselect(struct net_device *net_dev)
327 327 {
328 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  
332 332 static ssize_t show_gw_mode(struct kobject *kobj, struct attribute *attr,
... ... @@ -397,7 +397,7 @@
397 397 bat_info(net_dev, "Changing gw mode from: %s to: %s\n",
398 398 curr_gw_mode_str, buff);
399 399  
400   - gw_deselect(bat_priv);
  400 + batadv_gw_deselect(bat_priv);
401 401 atomic_set(&bat_priv->gw_mode, (unsigned int)gw_mode_tmp);
402 402 return count;
403 403 }
net/batman-adv/gateway_client.c
... ... @@ -60,7 +60,7 @@
60 60 return gw_node;
61 61 }
62 62  
63   -struct orig_node *gw_get_selected_orig(struct bat_priv *bat_priv)
  63 +struct orig_node *batadv_gw_get_selected_orig(struct bat_priv *bat_priv)
64 64 {
65 65 struct gw_node *gw_node;
66 66 struct orig_node *orig_node = NULL;
... ... @@ -103,7 +103,7 @@
103 103 spin_unlock_bh(&bat_priv->gw_list_lock);
104 104 }
105 105  
106   -void gw_deselect(struct bat_priv *bat_priv)
  106 +void batadv_gw_deselect(struct bat_priv *bat_priv)
107 107 {
108 108 atomic_set(&bat_priv->gw_reselect, 1);
109 109 }
... ... @@ -182,7 +182,7 @@
182 182 return curr_gw;
183 183 }
184 184  
185   -void gw_election(struct bat_priv *bat_priv)
  185 +void batadv_gw_election(struct bat_priv *bat_priv)
186 186 {
187 187 struct gw_node *curr_gw = NULL, *next_gw = NULL;
188 188 struct neigh_node *router = NULL;
... ... @@ -212,7 +212,7 @@
212 212  
213 213 router = orig_node_get_router(next_gw->orig_node);
214 214 if (!router) {
215   - gw_deselect(bat_priv);
  215 + batadv_gw_deselect(bat_priv);
216 216 goto out;
217 217 }
218 218 }
219 219  
... ... @@ -246,13 +246,14 @@
246 246 neigh_node_free_ref(router);
247 247 }
248 248  
249   -void gw_check_election(struct bat_priv *bat_priv, struct orig_node *orig_node)
  249 +void batadv_gw_check_election(struct bat_priv *bat_priv,
  250 + struct orig_node *orig_node)
250 251 {
251 252 struct orig_node *curr_gw_orig;
252 253 struct neigh_node *router_gw = NULL, *router_orig = NULL;
253 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 257 if (!curr_gw_orig)
257 258 goto deselect;
258 259  
... ... @@ -288,7 +289,7 @@
288 289 gw_tq_avg, orig_tq_avg);
289 290  
290 291 deselect:
291   - gw_deselect(bat_priv);
  292 + batadv_gw_deselect(bat_priv);
292 293 out:
293 294 if (curr_gw_orig)
294 295 orig_node_free_ref(curr_gw_orig);
... ... @@ -328,8 +329,8 @@
328 329 (up > 2048 ? "MBit" : "KBit"));
329 330 }
330 331  
331   -void gw_node_update(struct bat_priv *bat_priv,
332   - struct orig_node *orig_node, uint8_t new_gwflags)
  332 +void batadv_gw_node_update(struct bat_priv *bat_priv,
  333 + struct orig_node *orig_node, uint8_t new_gwflags)
333 334 {
334 335 struct hlist_node *node;
335 336 struct gw_node *gw_node, *curr_gw;
... ... @@ -374,7 +375,7 @@
374 375 goto unlock;
375 376  
376 377 deselect:
377   - gw_deselect(bat_priv);
  378 + batadv_gw_deselect(bat_priv);
378 379 unlock:
379 380 rcu_read_unlock();
380 381  
381 382  
382 383  
... ... @@ -382,12 +383,13 @@
382 383 gw_node_free_ref(curr_gw);
383 384 }
384 385  
385   -void gw_node_delete(struct bat_priv *bat_priv, struct orig_node *orig_node)
  386 +void 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  
390   -void gw_node_purge(struct bat_priv *bat_priv)
  392 +void batadv_gw_node_purge(struct bat_priv *bat_priv)
391 393 {
392 394 struct gw_node *gw_node, *curr_gw;
393 395 struct hlist_node *node, *node_tmp;
... ... @@ -416,7 +418,7 @@
416 418  
417 419 /* gw_deselect() needs to acquire the gw_list_lock */
418 420 if (do_deselect)
419   - gw_deselect(bat_priv);
  421 + batadv_gw_deselect(bat_priv);
420 422  
421 423 if (curr_gw)
422 424 gw_node_free_ref(curr_gw);
... ... @@ -458,7 +460,7 @@
458 460 return ret;
459 461 }
460 462  
461   -int gw_client_seq_print_text(struct seq_file *seq, void *offset)
  463 +int batadv_gw_client_seq_print_text(struct seq_file *seq, void *offset)
462 464 {
463 465 struct net_device *net_dev = (struct net_device *)seq->private;
464 466 struct bat_priv *bat_priv = netdev_priv(net_dev);
... ... @@ -568,7 +570,7 @@
568 570 return ret;
569 571 }
570 572  
571   -bool gw_is_dhcp_target(struct sk_buff *skb, unsigned int *header_len)
  573 +bool batadv_gw_is_dhcp_target(struct sk_buff *skb, unsigned int *header_len)
572 574 {
573 575 struct ethhdr *ethhdr;
574 576 struct iphdr *iphdr;
... ... @@ -634,8 +636,8 @@
634 636 return true;
635 637 }
636 638  
637   -bool gw_out_of_range(struct bat_priv *bat_priv,
638   - struct sk_buff *skb, struct ethhdr *ethhdr)
  639 +bool batadv_gw_out_of_range(struct bat_priv *bat_priv,
  640 + struct sk_buff *skb, struct ethhdr *ethhdr)
639 641 {
640 642 struct neigh_node *neigh_curr = NULL, *neigh_old = NULL;
641 643 struct orig_node *orig_dst_node = NULL;
... ... @@ -644,7 +646,7 @@
644 646 unsigned int header_len = 0;
645 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 650 if (!ret)
649 651 goto out;
650 652  
net/batman-adv/gateway_client.h
... ... @@ -22,18 +22,20 @@
22 22 #ifndef _NET_BATMAN_ADV_GATEWAY_CLIENT_H_
23 23 #define _NET_BATMAN_ADV_GATEWAY_CLIENT_H_
24 24  
25   -void gw_deselect(struct bat_priv *bat_priv);
26   -void gw_election(struct bat_priv *bat_priv);
27   -struct orig_node *gw_get_selected_orig(struct bat_priv *bat_priv);
28   -void gw_check_election(struct bat_priv *bat_priv, struct orig_node *orig_node);
29   -void gw_node_update(struct bat_priv *bat_priv,
30   - struct orig_node *orig_node, uint8_t new_gwflags);
31   -void gw_node_delete(struct bat_priv *bat_priv, struct orig_node *orig_node);
32   -void gw_node_purge(struct bat_priv *bat_priv);
33   -int gw_client_seq_print_text(struct seq_file *seq, void *offset);
34   -bool gw_is_dhcp_target(struct sk_buff *skb, unsigned int *header_len);
35   -bool gw_out_of_range(struct bat_priv *bat_priv,
36   - struct sk_buff *skb, struct ethhdr *ethhdr);
  25 +void batadv_gw_deselect(struct bat_priv *bat_priv);
  26 +void batadv_gw_election(struct bat_priv *bat_priv);
  27 +struct orig_node *batadv_gw_get_selected_orig(struct bat_priv *bat_priv);
  28 +void batadv_gw_check_election(struct bat_priv *bat_priv,
  29 + struct orig_node *orig_node);
  30 +void batadv_gw_node_update(struct bat_priv *bat_priv,
  31 + struct orig_node *orig_node, uint8_t new_gwflags);
  32 +void batadv_gw_node_delete(struct bat_priv *bat_priv,
  33 + struct orig_node *orig_node);
  34 +void batadv_gw_node_purge(struct bat_priv *bat_priv);
  35 +int batadv_gw_client_seq_print_text(struct seq_file *seq, void *offset);
  36 +bool batadv_gw_is_dhcp_target(struct sk_buff *skb, unsigned int *header_len);
  37 +bool batadv_gw_out_of_range(struct bat_priv *bat_priv,
  38 + struct sk_buff *skb, struct ethhdr *ethhdr);
37 39  
38 40 #endif /* _NET_BATMAN_ADV_GATEWAY_CLIENT_H_ */
net/batman-adv/gateway_common.c
... ... @@ -165,7 +165,7 @@
165 165 if (atomic_read(&bat_priv->gw_bandwidth) == gw_bandwidth_tmp)
166 166 return count;
167 167  
168   - gw_deselect(bat_priv);
  168 + batadv_gw_deselect(bat_priv);
169 169 bat_info(net_dev,
170 170 "Changing gateway bandwidth from: '%i' to: '%ld' (propagating: %d%s/%d%s)\n",
171 171 atomic_read(&bat_priv->gw_bandwidth), gw_bandwidth_tmp,
net/batman-adv/main.c
... ... @@ -149,7 +149,7 @@
149 149  
150 150 vis_quit(bat_priv);
151 151  
152   - gw_node_purge(bat_priv);
  152 + batadv_gw_node_purge(bat_priv);
153 153 originator_free(bat_priv);
154 154  
155 155 tt_free(bat_priv);
net/batman-adv/originator.c
... ... @@ -361,7 +361,8 @@
361 361 head, hash_entry) {
362 362 if (purge_orig_node(bat_priv, orig_node)) {
363 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 366 hlist_del_rcu(node);
366 367 orig_node_free_ref(orig_node);
367 368 continue;
... ... @@ -374,8 +375,8 @@
374 375 spin_unlock_bh(list_lock);
375 376 }
376 377  
377   - gw_node_purge(bat_priv);
378   - gw_election(bat_priv);
  378 + batadv_gw_node_purge(bat_priv);
  379 + batadv_gw_election(bat_priv);
379 380 }
380 381  
381 382 static void purge_orig(struct work_struct *work)
net/batman-adv/soft-interface.c
... ... @@ -181,14 +181,14 @@
181 181 case GW_MODE_SERVER:
182 182 /* gateway servers should not send dhcp
183 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 185 if (ret)
186 186 goto dropped;
187 187 break;
188 188 case GW_MODE_CLIENT:
189 189 /* gateway clients should send dhcp requests
190 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 192 if (ret)
193 193 do_bcast = false;
194 194 break;
... ... @@ -232,7 +232,7 @@
232 232 /* unicast packet */
233 233 } else {
234 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 236 if (ret)
237 237 goto dropped;
238 238 }
net/batman-adv/unicast.c
... ... @@ -294,7 +294,7 @@
294 294  
295 295 /* get routing information */
296 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 298 if (orig_node)
299 299 goto find_router;
300 300 }