aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorSven Eckelmann <sven@narfation.org>2012-05-12 07:48:54 -0400
committerAntonio Quartulli <ordex@autistici.org>2012-06-24 12:41:41 -0400
commite5d89254bf763da35b42a3c65289c9962f7240c2 (patch)
tree1e981f14fc7d386e4f848e7fbf822f9a773fc2ed /net
parent9b4a1159dff76f938aa64f7000621552e4d9ad18 (diff)
batman-adv: Prefix hard-interface static inline functions with batadv_
All non-static symbols of batman-adv were prefixed with batadv_ to avoid collisions with other symbols of the kernel. Other symbols of batman-adv should use the same prefix to keep the naming scheme consistent. Signed-off-by: Sven Eckelmann <sven@narfation.org>
Diffstat (limited to 'net')
-rw-r--r--net/batman-adv/bat_iv_ogm.c14
-rw-r--r--net/batman-adv/bat_sysfs.c16
-rw-r--r--net/batman-adv/bridge_loop_avoidance.c28
-rw-r--r--net/batman-adv/gateway_client.c4
-rw-r--r--net/batman-adv/hard-interface.c28
-rw-r--r--net/batman-adv/hard-interface.h7
-rw-r--r--net/batman-adv/icmp_socket.c4
-rw-r--r--net/batman-adv/originator.c4
-rw-r--r--net/batman-adv/routing.c12
-rw-r--r--net/batman-adv/send.c6
-rw-r--r--net/batman-adv/soft-interface.c4
-rw-r--r--net/batman-adv/translation-table.c28
-rw-r--r--net/batman-adv/unicast.c4
-rw-r--r--net/batman-adv/vis.c8
14 files changed, 84 insertions, 83 deletions
diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c
index ad641e8d3c0f..94e6fdbdd13d 100644
--- a/net/batman-adv/bat_iv_ogm.c
+++ b/net/batman-adv/bat_iv_ogm.c
@@ -232,7 +232,7 @@ static void bat_iv_ogm_emit(struct forw_packet *forw_packet)
232 if (forw_packet->if_incoming->if_status != IF_ACTIVE) 232 if (forw_packet->if_incoming->if_status != IF_ACTIVE)
233 goto out; 233 goto out;
234 234
235 primary_if = primary_if_get_selected(bat_priv); 235 primary_if = batadv_primary_if_get_selected(bat_priv);
236 if (!primary_if) 236 if (!primary_if)
237 goto out; 237 goto out;
238 238
@@ -273,7 +273,7 @@ static void bat_iv_ogm_emit(struct forw_packet *forw_packet)
273 273
274out: 274out:
275 if (primary_if) 275 if (primary_if)
276 hardif_free_ref(primary_if); 276 batadv_hardif_free_ref(primary_if);
277} 277}
278 278
279/* return true if new_packet can be aggregated with forw_packet */ 279/* return true if new_packet can be aggregated with forw_packet */
@@ -311,7 +311,7 @@ static bool bat_iv_ogm_can_aggregate(const struct batman_ogm_packet
311 * a "global" packet as well as the base 311 * a "global" packet as well as the base
312 * packet 312 * packet
313 */ 313 */
314 primary_if = primary_if_get_selected(bat_priv); 314 primary_if = batadv_primary_if_get_selected(bat_priv);
315 if (!primary_if) 315 if (!primary_if)
316 goto out; 316 goto out;
317 317
@@ -352,7 +352,7 @@ static bool bat_iv_ogm_can_aggregate(const struct batman_ogm_packet
352 352
353out: 353out:
354 if (primary_if) 354 if (primary_if)
355 hardif_free_ref(primary_if); 355 batadv_hardif_free_ref(primary_if);
356 return res; 356 return res;
357} 357}
358 358
@@ -431,7 +431,7 @@ static void bat_iv_ogm_aggregate_new(const unsigned char *packet_buff,
431 431
432 return; 432 return;
433out: 433out:
434 hardif_free_ref(if_incoming); 434 batadv_hardif_free_ref(if_incoming);
435} 435}
436 436
437/* aggregate a new packet into the existing ogm packet */ 437/* aggregate a new packet into the existing ogm packet */
@@ -570,7 +570,7 @@ static void bat_iv_ogm_schedule(struct hard_iface *hard_iface)
570 int vis_server, tt_num_changes = 0; 570 int vis_server, tt_num_changes = 0;
571 571
572 vis_server = atomic_read(&bat_priv->vis_mode); 572 vis_server = atomic_read(&bat_priv->vis_mode);
573 primary_if = primary_if_get_selected(bat_priv); 573 primary_if = batadv_primary_if_get_selected(bat_priv);
574 574
575 if (hard_iface == primary_if) 575 if (hard_iface == primary_if)
576 tt_num_changes = batadv_tt_append_diff(bat_priv, 576 tt_num_changes = batadv_tt_append_diff(bat_priv,
@@ -608,7 +608,7 @@ static void bat_iv_ogm_schedule(struct hard_iface *hard_iface)
608 bat_iv_ogm_emit_send_time(bat_priv)); 608 bat_iv_ogm_emit_send_time(bat_priv));
609 609
610 if (primary_if) 610 if (primary_if)
611 hardif_free_ref(primary_if); 611 batadv_hardif_free_ref(primary_if);
612} 612}
613 613
614static void bat_iv_ogm_orig_update(struct bat_priv *bat_priv, 614static void bat_iv_ogm_orig_update(struct bat_priv *bat_priv,
diff --git a/net/batman-adv/bat_sysfs.c b/net/batman-adv/bat_sysfs.c
index 8196fa6ff22e..0c7e22e4d5f3 100644
--- a/net/batman-adv/bat_sysfs.c
+++ b/net/batman-adv/bat_sysfs.c
@@ -132,7 +132,7 @@ ssize_t store_##_name(struct kobject *kobj, struct attribute *attr, \
132 length = __store_uint_attr(buff, count, _min, _max, _post_func, \ 132 length = __store_uint_attr(buff, count, _min, _max, _post_func, \
133 attr, &hard_iface->_name, net_dev); \ 133 attr, &hard_iface->_name, net_dev); \
134 \ 134 \
135 hardif_free_ref(hard_iface); \ 135 batadv_hardif_free_ref(hard_iface); \
136 return length; \ 136 return length; \
137} 137}
138 138
@@ -150,7 +150,7 @@ ssize_t show_##_name(struct kobject *kobj, \
150 \ 150 \
151 length = sprintf(buff, "%i\n", atomic_read(&hard_iface->_name));\ 151 length = sprintf(buff, "%i\n", atomic_read(&hard_iface->_name));\
152 \ 152 \
153 hardif_free_ref(hard_iface); \ 153 batadv_hardif_free_ref(hard_iface); \
154 return length; \ 154 return length; \
155} 155}
156 156
@@ -535,7 +535,7 @@ static ssize_t show_mesh_iface(struct kobject *kobj, struct attribute *attr,
535 length = sprintf(buff, "%s\n", hard_iface->if_status == IF_NOT_IN_USE ? 535 length = sprintf(buff, "%s\n", hard_iface->if_status == IF_NOT_IN_USE ?
536 "none" : hard_iface->soft_iface->name); 536 "none" : hard_iface->soft_iface->name);
537 537
538 hardif_free_ref(hard_iface); 538 batadv_hardif_free_ref(hard_iface);
539 539
540 return length; 540 return length;
541} 541}
@@ -557,7 +557,7 @@ static ssize_t store_mesh_iface(struct kobject *kobj, struct attribute *attr,
557 if (strlen(buff) >= IFNAMSIZ) { 557 if (strlen(buff) >= IFNAMSIZ) {
558 pr_err("Invalid parameter for 'mesh_iface' setting received: interface name too long '%s'\n", 558 pr_err("Invalid parameter for 'mesh_iface' setting received: interface name too long '%s'\n",
559 buff); 559 buff);
560 hardif_free_ref(hard_iface); 560 batadv_hardif_free_ref(hard_iface);
561 return -EINVAL; 561 return -EINVAL;
562 } 562 }
563 563
@@ -592,7 +592,7 @@ static ssize_t store_mesh_iface(struct kobject *kobj, struct attribute *attr,
592unlock: 592unlock:
593 rtnl_unlock(); 593 rtnl_unlock();
594out: 594out:
595 hardif_free_ref(hard_iface); 595 batadv_hardif_free_ref(hard_iface);
596 return ret; 596 return ret;
597} 597}
598 598
@@ -625,7 +625,7 @@ static ssize_t show_iface_status(struct kobject *kobj, struct attribute *attr,
625 break; 625 break;
626 } 626 }
627 627
628 hardif_free_ref(hard_iface); 628 batadv_hardif_free_ref(hard_iface);
629 629
630 return length; 630 return length;
631} 631}
@@ -688,7 +688,7 @@ int batadv_throw_uevent(struct bat_priv *bat_priv, enum uev_type type,
688 struct kobject *bat_kobj; 688 struct kobject *bat_kobj;
689 char *uevent_env[4] = { NULL, NULL, NULL, NULL }; 689 char *uevent_env[4] = { NULL, NULL, NULL, NULL };
690 690
691 primary_if = primary_if_get_selected(bat_priv); 691 primary_if = batadv_primary_if_get_selected(bat_priv);
692 if (!primary_if) 692 if (!primary_if)
693 goto out; 693 goto out;
694 694
@@ -727,7 +727,7 @@ out:
727 kfree(uevent_env[2]); 727 kfree(uevent_env[2]);
728 728
729 if (primary_if) 729 if (primary_if)
730 hardif_free_ref(primary_if); 730 batadv_hardif_free_ref(primary_if);
731 731
732 if (ret) 732 if (ret)
733 bat_dbg(DBG_BATMAN, bat_priv, 733 bat_dbg(DBG_BATMAN, bat_priv,
diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c
index 52c0d637d581..72ff8b90e222 100644
--- a/net/batman-adv/bridge_loop_avoidance.c
+++ b/net/batman-adv/bridge_loop_avoidance.c
@@ -255,7 +255,7 @@ static void bla_send_claim(struct bat_priv *bat_priv, uint8_t *mac,
255 struct bla_claim_dst local_claim_dest; 255 struct bla_claim_dst local_claim_dest;
256 __be32 zeroip = 0; 256 __be32 zeroip = 0;
257 257
258 primary_if = primary_if_get_selected(bat_priv); 258 primary_if = batadv_primary_if_get_selected(bat_priv);
259 if (!primary_if) 259 if (!primary_if)
260 return; 260 return;
261 261
@@ -339,7 +339,7 @@ static void bla_send_claim(struct bat_priv *bat_priv, uint8_t *mac,
339 netif_rx(skb); 339 netif_rx(skb);
340out: 340out:
341 if (primary_if) 341 if (primary_if)
342 hardif_free_ref(primary_if); 342 batadv_hardif_free_ref(primary_if);
343} 343}
344 344
345/* @bat_priv: the bat priv with all the soft interface information 345/* @bat_priv: the bat priv with all the soft interface information
@@ -1075,7 +1075,7 @@ static void bla_periodic_work(struct work_struct *work)
1075 struct hard_iface *primary_if; 1075 struct hard_iface *primary_if;
1076 int i; 1076 int i;
1077 1077
1078 primary_if = primary_if_get_selected(bat_priv); 1078 primary_if = batadv_primary_if_get_selected(bat_priv);
1079 if (!primary_if) 1079 if (!primary_if)
1080 goto out; 1080 goto out;
1081 1081
@@ -1106,7 +1106,7 @@ static void bla_periodic_work(struct work_struct *work)
1106 } 1106 }
1107out: 1107out:
1108 if (primary_if) 1108 if (primary_if)
1109 hardif_free_ref(primary_if); 1109 batadv_hardif_free_ref(primary_if);
1110 1110
1111 bla_start_timer(bat_priv); 1111 bla_start_timer(bat_priv);
1112} 1112}
@@ -1131,12 +1131,12 @@ int batadv_bla_init(struct bat_priv *bat_priv)
1131 /* setting claim destination address */ 1131 /* setting claim destination address */
1132 memcpy(&bat_priv->claim_dest.magic, claim_dest, 3); 1132 memcpy(&bat_priv->claim_dest.magic, claim_dest, 3);
1133 bat_priv->claim_dest.type = 0; 1133 bat_priv->claim_dest.type = 0;
1134 primary_if = primary_if_get_selected(bat_priv); 1134 primary_if = batadv_primary_if_get_selected(bat_priv);
1135 if (primary_if) { 1135 if (primary_if) {
1136 bat_priv->claim_dest.group = 1136 bat_priv->claim_dest.group =
1137 htons(crc16(0, primary_if->net_dev->dev_addr, 1137 htons(crc16(0, primary_if->net_dev->dev_addr,
1138 ETH_ALEN)); 1138 ETH_ALEN));
1139 hardif_free_ref(primary_if); 1139 batadv_hardif_free_ref(primary_if);
1140 } else { 1140 } else {
1141 bat_priv->claim_dest.group = 0; /* will be set later */ 1141 bat_priv->claim_dest.group = 0; /* will be set later */
1142 } 1142 }
@@ -1319,7 +1319,7 @@ void batadv_bla_free(struct bat_priv *bat_priv)
1319 struct hard_iface *primary_if; 1319 struct hard_iface *primary_if;
1320 1320
1321 cancel_delayed_work_sync(&bat_priv->bla_work); 1321 cancel_delayed_work_sync(&bat_priv->bla_work);
1322 primary_if = primary_if_get_selected(bat_priv); 1322 primary_if = batadv_primary_if_get_selected(bat_priv);
1323 1323
1324 if (bat_priv->claim_hash) { 1324 if (bat_priv->claim_hash) {
1325 bla_purge_claims(bat_priv, primary_if, 1); 1325 bla_purge_claims(bat_priv, primary_if, 1);
@@ -1332,7 +1332,7 @@ void batadv_bla_free(struct bat_priv *bat_priv)
1332 bat_priv->backbone_hash = NULL; 1332 bat_priv->backbone_hash = NULL;
1333 } 1333 }
1334 if (primary_if) 1334 if (primary_if)
1335 hardif_free_ref(primary_if); 1335 batadv_hardif_free_ref(primary_if);
1336} 1336}
1337 1337
1338/* @bat_priv: the bat priv with all the soft interface information 1338/* @bat_priv: the bat priv with all the soft interface information
@@ -1356,7 +1356,7 @@ int batadv_bla_rx(struct bat_priv *bat_priv, struct sk_buff *skb, short vid)
1356 1356
1357 ethhdr = (struct ethhdr *)skb_mac_header(skb); 1357 ethhdr = (struct ethhdr *)skb_mac_header(skb);
1358 1358
1359 primary_if = primary_if_get_selected(bat_priv); 1359 primary_if = batadv_primary_if_get_selected(bat_priv);
1360 if (!primary_if) 1360 if (!primary_if)
1361 goto handled; 1361 goto handled;
1362 1362
@@ -1416,7 +1416,7 @@ handled:
1416 1416
1417out: 1417out:
1418 if (primary_if) 1418 if (primary_if)
1419 hardif_free_ref(primary_if); 1419 batadv_hardif_free_ref(primary_if);
1420 if (claim) 1420 if (claim)
1421 claim_free_ref(claim); 1421 claim_free_ref(claim);
1422 return ret; 1422 return ret;
@@ -1441,7 +1441,7 @@ int batadv_bla_tx(struct bat_priv *bat_priv, struct sk_buff *skb, short vid)
1441 struct hard_iface *primary_if; 1441 struct hard_iface *primary_if;
1442 int ret = 0; 1442 int ret = 0;
1443 1443
1444 primary_if = primary_if_get_selected(bat_priv); 1444 primary_if = batadv_primary_if_get_selected(bat_priv);
1445 if (!primary_if) 1445 if (!primary_if)
1446 goto out; 1446 goto out;
1447 1447
@@ -1502,7 +1502,7 @@ handled:
1502 ret = 1; 1502 ret = 1;
1503out: 1503out:
1504 if (primary_if) 1504 if (primary_if)
1505 hardif_free_ref(primary_if); 1505 batadv_hardif_free_ref(primary_if);
1506 if (claim) 1506 if (claim)
1507 claim_free_ref(claim); 1507 claim_free_ref(claim);
1508 return ret; 1508 return ret;
@@ -1521,7 +1521,7 @@ int batadv_bla_claim_table_seq_print_text(struct seq_file *seq, void *offset)
1521 bool is_own; 1521 bool is_own;
1522 int ret = 0; 1522 int ret = 0;
1523 1523
1524 primary_if = primary_if_get_selected(bat_priv); 1524 primary_if = batadv_primary_if_get_selected(bat_priv);
1525 if (!primary_if) { 1525 if (!primary_if) {
1526 ret = seq_printf(seq, 1526 ret = seq_printf(seq,
1527 "BATMAN mesh %s disabled - please specify interfaces to enable it\n", 1527 "BATMAN mesh %s disabled - please specify interfaces to enable it\n",
@@ -1559,6 +1559,6 @@ int batadv_bla_claim_table_seq_print_text(struct seq_file *seq, void *offset)
1559 } 1559 }
1560out: 1560out:
1561 if (primary_if) 1561 if (primary_if)
1562 hardif_free_ref(primary_if); 1562 batadv_hardif_free_ref(primary_if);
1563 return ret; 1563 return ret;
1564} 1564}
diff --git a/net/batman-adv/gateway_client.c b/net/batman-adv/gateway_client.c
index 0d90fffd9efb..c917a2ee1f39 100644
--- a/net/batman-adv/gateway_client.c
+++ b/net/batman-adv/gateway_client.c
@@ -464,7 +464,7 @@ int batadv_gw_client_seq_print_text(struct seq_file *seq, void *offset)
464 struct hlist_node *node; 464 struct hlist_node *node;
465 int gw_count = 0, ret = 0; 465 int gw_count = 0, ret = 0;
466 466
467 primary_if = primary_if_get_selected(bat_priv); 467 primary_if = batadv_primary_if_get_selected(bat_priv);
468 if (!primary_if) { 468 if (!primary_if) {
469 ret = seq_printf(seq, 469 ret = seq_printf(seq,
470 "BATMAN mesh %s disabled - please specify interfaces to enable it\n", 470 "BATMAN mesh %s disabled - please specify interfaces to enable it\n",
@@ -503,7 +503,7 @@ int batadv_gw_client_seq_print_text(struct seq_file *seq, void *offset)
503 503
504out: 504out:
505 if (primary_if) 505 if (primary_if)
506 hardif_free_ref(primary_if); 506 batadv_hardif_free_ref(primary_if);
507 return ret; 507 return ret;
508} 508}
509 509
diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c
index 2a4d394771b8..06f8d63d741d 100644
--- a/net/batman-adv/hard-interface.c
+++ b/net/batman-adv/hard-interface.c
@@ -102,7 +102,7 @@ static void primary_if_update_addr(struct bat_priv *bat_priv,
102 struct vis_packet *vis_packet; 102 struct vis_packet *vis_packet;
103 struct hard_iface *primary_if; 103 struct hard_iface *primary_if;
104 104
105 primary_if = primary_if_get_selected(bat_priv); 105 primary_if = batadv_primary_if_get_selected(bat_priv);
106 if (!primary_if) 106 if (!primary_if)
107 goto out; 107 goto out;
108 108
@@ -115,7 +115,7 @@ static void primary_if_update_addr(struct bat_priv *bat_priv,
115 batadv_bla_update_orig_address(bat_priv, primary_if, oldif); 115 batadv_bla_update_orig_address(bat_priv, primary_if, oldif);
116out: 116out:
117 if (primary_if) 117 if (primary_if)
118 hardif_free_ref(primary_if); 118 batadv_hardif_free_ref(primary_if);
119} 119}
120 120
121static void primary_if_select(struct bat_priv *bat_priv, 121static void primary_if_select(struct bat_priv *bat_priv,
@@ -139,7 +139,7 @@ static void primary_if_select(struct bat_priv *bat_priv,
139 139
140out: 140out:
141 if (curr_hard_iface) 141 if (curr_hard_iface)
142 hardif_free_ref(curr_hard_iface); 142 batadv_hardif_free_ref(curr_hard_iface);
143} 143}
144 144
145static bool hardif_is_iface_up(const struct hard_iface *hard_iface) 145static bool hardif_is_iface_up(const struct hard_iface *hard_iface)
@@ -229,7 +229,7 @@ static void hardif_activate_interface(struct hard_iface *hard_iface)
229 /* the first active interface becomes our primary interface or 229 /* the first active interface becomes our primary interface or
230 * the next active interface after the old primary interface was removed 230 * the next active interface after the old primary interface was removed
231 */ 231 */
232 primary_if = primary_if_get_selected(bat_priv); 232 primary_if = batadv_primary_if_get_selected(bat_priv);
233 if (!primary_if) 233 if (!primary_if)
234 primary_if_select(bat_priv, hard_iface); 234 primary_if_select(bat_priv, hard_iface);
235 235
@@ -240,7 +240,7 @@ static void hardif_activate_interface(struct hard_iface *hard_iface)
240 240
241out: 241out:
242 if (primary_if) 242 if (primary_if)
243 hardif_free_ref(primary_if); 243 batadv_hardif_free_ref(primary_if);
244} 244}
245 245
246static void hardif_deactivate_interface(struct hard_iface *hard_iface) 246static void hardif_deactivate_interface(struct hard_iface *hard_iface)
@@ -347,7 +347,7 @@ out:
347err_dev: 347err_dev:
348 dev_put(soft_iface); 348 dev_put(soft_iface);
349err: 349err:
350 hardif_free_ref(hard_iface); 350 batadv_hardif_free_ref(hard_iface);
351 return ret; 351 return ret;
352} 352}
353 353
@@ -369,7 +369,7 @@ void batadv_hardif_disable_interface(struct hard_iface *hard_iface)
369 bat_priv->num_ifaces--; 369 bat_priv->num_ifaces--;
370 batadv_orig_hash_del_if(hard_iface, bat_priv->num_ifaces); 370 batadv_orig_hash_del_if(hard_iface, bat_priv->num_ifaces);
371 371
372 primary_if = primary_if_get_selected(bat_priv); 372 primary_if = batadv_primary_if_get_selected(bat_priv);
373 if (hard_iface == primary_if) { 373 if (hard_iface == primary_if) {
374 struct hard_iface *new_if; 374 struct hard_iface *new_if;
375 375
@@ -377,7 +377,7 @@ void batadv_hardif_disable_interface(struct hard_iface *hard_iface)
377 primary_if_select(bat_priv, new_if); 377 primary_if_select(bat_priv, new_if);
378 378
379 if (new_if) 379 if (new_if)
380 hardif_free_ref(new_if); 380 batadv_hardif_free_ref(new_if);
381 } 381 }
382 382
383 bat_priv->bat_algo_ops->bat_iface_disable(hard_iface); 383 bat_priv->bat_algo_ops->bat_iface_disable(hard_iface);
@@ -393,11 +393,11 @@ void batadv_hardif_disable_interface(struct hard_iface *hard_iface)
393 batadv_softif_destroy(hard_iface->soft_iface); 393 batadv_softif_destroy(hard_iface->soft_iface);
394 394
395 hard_iface->soft_iface = NULL; 395 hard_iface->soft_iface = NULL;
396 hardif_free_ref(hard_iface); 396 batadv_hardif_free_ref(hard_iface);
397 397
398out: 398out:
399 if (primary_if) 399 if (primary_if)
400 hardif_free_ref(primary_if); 400 batadv_hardif_free_ref(primary_if);
401} 401}
402 402
403static struct hard_iface *hardif_add_interface(struct net_device *net_dev) 403static struct hard_iface *hardif_add_interface(struct net_device *net_dev)
@@ -461,7 +461,7 @@ static void hardif_remove_interface(struct hard_iface *hard_iface)
461 461
462 hard_iface->if_status = IF_TO_BE_REMOVED; 462 hard_iface->if_status = IF_TO_BE_REMOVED;
463 batadv_sysfs_del_hardif(&hard_iface->hardif_obj); 463 batadv_sysfs_del_hardif(&hard_iface->hardif_obj);
464 hardif_free_ref(hard_iface); 464 batadv_hardif_free_ref(hard_iface);
465} 465}
466 466
467void batadv_hardif_remove_interfaces(void) 467void batadv_hardif_remove_interfaces(void)
@@ -517,7 +517,7 @@ static int hard_if_event(struct notifier_block *this,
517 bat_priv = netdev_priv(hard_iface->soft_iface); 517 bat_priv = netdev_priv(hard_iface->soft_iface);
518 bat_priv->bat_algo_ops->bat_iface_update_mac(hard_iface); 518 bat_priv->bat_algo_ops->bat_iface_update_mac(hard_iface);
519 519
520 primary_if = primary_if_get_selected(bat_priv); 520 primary_if = batadv_primary_if_get_selected(bat_priv);
521 if (!primary_if) 521 if (!primary_if)
522 goto hardif_put; 522 goto hardif_put;
523 523
@@ -529,10 +529,10 @@ static int hard_if_event(struct notifier_block *this,
529 } 529 }
530 530
531hardif_put: 531hardif_put:
532 hardif_free_ref(hard_iface); 532 batadv_hardif_free_ref(hard_iface);
533out: 533out:
534 if (primary_if) 534 if (primary_if)
535 hardif_free_ref(primary_if); 535 batadv_hardif_free_ref(primary_if);
536 return NOTIFY_DONE; 536 return NOTIFY_DONE;
537} 537}
538 538
diff --git a/net/batman-adv/hard-interface.h b/net/batman-adv/hard-interface.h
index 6bc12c0eb2f0..d66dabd620b7 100644
--- a/net/batman-adv/hard-interface.h
+++ b/net/batman-adv/hard-interface.h
@@ -42,14 +42,15 @@ void batadv_update_min_mtu(struct net_device *soft_iface);
42void batadv_hardif_free_rcu(struct rcu_head *rcu); 42void batadv_hardif_free_rcu(struct rcu_head *rcu);
43bool batadv_is_wifi_iface(int ifindex); 43bool batadv_is_wifi_iface(int ifindex);
44 44
45static inline void hardif_free_ref(struct hard_iface *hard_iface) 45static inline void
46batadv_hardif_free_ref(struct hard_iface *hard_iface)
46{ 47{
47 if (atomic_dec_and_test(&hard_iface->refcount)) 48 if (atomic_dec_and_test(&hard_iface->refcount))
48 call_rcu(&hard_iface->rcu, batadv_hardif_free_rcu); 49 call_rcu(&hard_iface->rcu, batadv_hardif_free_rcu);
49} 50}
50 51
51static inline struct hard_iface *primary_if_get_selected( 52static inline struct hard_iface *
52 struct bat_priv *bat_priv) 53batadv_primary_if_get_selected(struct bat_priv *bat_priv)
53{ 54{
54 struct hard_iface *hard_iface; 55 struct hard_iface *hard_iface;
55 56
diff --git a/net/batman-adv/icmp_socket.c b/net/batman-adv/icmp_socket.c
index 40c5e189e6fd..2523436907e6 100644
--- a/net/batman-adv/icmp_socket.c
+++ b/net/batman-adv/icmp_socket.c
@@ -163,7 +163,7 @@ static ssize_t bat_socket_write(struct file *file, const char __user *buff,
163 return -EINVAL; 163 return -EINVAL;
164 } 164 }
165 165
166 primary_if = primary_if_get_selected(bat_priv); 166 primary_if = batadv_primary_if_get_selected(bat_priv);
167 167
168 if (!primary_if) { 168 if (!primary_if) {
169 len = -EFAULT; 169 len = -EFAULT;
@@ -244,7 +244,7 @@ free_skb:
244 kfree_skb(skb); 244 kfree_skb(skb);
245out: 245out:
246 if (primary_if) 246 if (primary_if)
247 hardif_free_ref(primary_if); 247 batadv_hardif_free_ref(primary_if);
248 if (neigh_node) 248 if (neigh_node)
249 batadv_neigh_node_free_ref(neigh_node); 249 batadv_neigh_node_free_ref(neigh_node);
250 if (orig_node) 250 if (orig_node)
diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c
index 86e7e082c2bc..90d24fccb9cf 100644
--- a/net/batman-adv/originator.c
+++ b/net/batman-adv/originator.c
@@ -412,7 +412,7 @@ int batadv_orig_seq_print_text(struct seq_file *seq, void *offset)
412 uint32_t i; 412 uint32_t i;
413 int ret = 0; 413 int ret = 0;
414 414
415 primary_if = primary_if_get_selected(bat_priv); 415 primary_if = batadv_primary_if_get_selected(bat_priv);
416 416
417 if (!primary_if) { 417 if (!primary_if) {
418 ret = seq_printf(seq, 418 ret = seq_printf(seq,
@@ -479,7 +479,7 @@ next:
479 479
480out: 480out:
481 if (primary_if) 481 if (primary_if)
482 hardif_free_ref(primary_if); 482 batadv_hardif_free_ref(primary_if);
483 return ret; 483 return ret;
484} 484}
485 485
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
index 9c90cceda17d..9c6edc23bfc4 100644
--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -292,7 +292,7 @@ static int recv_my_icmp_packet(struct bat_priv *bat_priv,
292 goto out; 292 goto out;
293 } 293 }
294 294
295 primary_if = primary_if_get_selected(bat_priv); 295 primary_if = batadv_primary_if_get_selected(bat_priv);
296 if (!primary_if) 296 if (!primary_if)
297 goto out; 297 goto out;
298 298
@@ -322,7 +322,7 @@ static int recv_my_icmp_packet(struct bat_priv *bat_priv,
322 322
323out: 323out:
324 if (primary_if) 324 if (primary_if)
325 hardif_free_ref(primary_if); 325 batadv_hardif_free_ref(primary_if);
326 if (router) 326 if (router)
327 batadv_neigh_node_free_ref(router); 327 batadv_neigh_node_free_ref(router);
328 if (orig_node) 328 if (orig_node)
@@ -348,7 +348,7 @@ static int recv_icmp_ttl_exceeded(struct bat_priv *bat_priv,
348 goto out; 348 goto out;
349 } 349 }
350 350
351 primary_if = primary_if_get_selected(bat_priv); 351 primary_if = batadv_primary_if_get_selected(bat_priv);
352 if (!primary_if) 352 if (!primary_if)
353 goto out; 353 goto out;
354 354
@@ -377,7 +377,7 @@ static int recv_icmp_ttl_exceeded(struct bat_priv *bat_priv,
377 377
378out: 378out:
379 if (primary_if) 379 if (primary_if)
380 hardif_free_ref(primary_if); 380 batadv_hardif_free_ref(primary_if);
381 if (router) 381 if (router)
382 batadv_neigh_node_free_ref(router); 382 batadv_neigh_node_free_ref(router);
383 if (orig_node) 383 if (orig_node)
@@ -955,12 +955,12 @@ static int check_unicast_ttvn(struct bat_priv *bat_priv,
955 if (!orig_node) { 955 if (!orig_node) {
956 if (!batadv_is_my_client(bat_priv, ethhdr->h_dest)) 956 if (!batadv_is_my_client(bat_priv, ethhdr->h_dest))
957 return 0; 957 return 0;
958 primary_if = primary_if_get_selected(bat_priv); 958 primary_if = batadv_primary_if_get_selected(bat_priv);
959 if (!primary_if) 959 if (!primary_if)
960 return 0; 960 return 0;
961 memcpy(unicast_packet->dest, 961 memcpy(unicast_packet->dest,
962 primary_if->net_dev->dev_addr, ETH_ALEN); 962 primary_if->net_dev->dev_addr, ETH_ALEN);
963 hardif_free_ref(primary_if); 963 batadv_hardif_free_ref(primary_if);
964 } else { 964 } else {
965 memcpy(unicast_packet->dest, orig_node->orig, 965 memcpy(unicast_packet->dest, orig_node->orig,
966 ETH_ALEN); 966 ETH_ALEN);
diff --git a/net/batman-adv/send.c b/net/batman-adv/send.c
index 2c92a32ec6c6..54091db9d5ff 100644
--- a/net/batman-adv/send.c
+++ b/net/batman-adv/send.c
@@ -101,7 +101,7 @@ static void forw_packet_free(struct forw_packet *forw_packet)
101 if (forw_packet->skb) 101 if (forw_packet->skb)
102 kfree_skb(forw_packet->skb); 102 kfree_skb(forw_packet->skb);
103 if (forw_packet->if_incoming) 103 if (forw_packet->if_incoming)
104 hardif_free_ref(forw_packet->if_incoming); 104 batadv_hardif_free_ref(forw_packet->if_incoming);
105 kfree(forw_packet); 105 kfree(forw_packet);
106} 106}
107 107
@@ -146,7 +146,7 @@ int batadv_add_bcast_packet_to_list(struct bat_priv *bat_priv,
146 goto out; 146 goto out;
147 } 147 }
148 148
149 primary_if = primary_if_get_selected(bat_priv); 149 primary_if = batadv_primary_if_get_selected(bat_priv);
150 if (!primary_if) 150 if (!primary_if)
151 goto out_and_inc; 151 goto out_and_inc;
152 152
@@ -180,7 +180,7 @@ out_and_inc:
180 atomic_inc(&bat_priv->bcast_queue_left); 180 atomic_inc(&bat_priv->bcast_queue_left);
181out: 181out:
182 if (primary_if) 182 if (primary_if)
183 hardif_free_ref(primary_if); 183 batadv_hardif_free_ref(primary_if);
184 return NETDEV_TX_BUSY; 184 return NETDEV_TX_BUSY;
185} 185}
186 186
diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c
index 0658781febde..85fe9c1ce5bc 100644
--- a/net/batman-adv/soft-interface.c
+++ b/net/batman-adv/soft-interface.c
@@ -199,7 +199,7 @@ static int interface_tx(struct sk_buff *skb, struct net_device *soft_iface)
199 199
200 /* ethernet packet should be broadcasted */ 200 /* ethernet packet should be broadcasted */
201 if (do_bcast) { 201 if (do_bcast) {
202 primary_if = primary_if_get_selected(bat_priv); 202 primary_if = batadv_primary_if_get_selected(bat_priv);
203 if (!primary_if) 203 if (!primary_if)
204 goto dropped; 204 goto dropped;
205 205
@@ -253,7 +253,7 @@ dropped_freed:
253 bat_priv->stats.tx_dropped++; 253 bat_priv->stats.tx_dropped++;
254end: 254end:
255 if (primary_if) 255 if (primary_if)
256 hardif_free_ref(primary_if); 256 batadv_hardif_free_ref(primary_if);
257 return NETDEV_TX_OK; 257 return NETDEV_TX_OK;
258} 258}
259 259
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index 5180d50e909d..bc06af4781b3 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -298,7 +298,7 @@ static void tt_prepare_packet_buff(struct bat_priv *bat_priv,
298 struct hard_iface *primary_if; 298 struct hard_iface *primary_if;
299 int req_len; 299 int req_len;
300 300
301 primary_if = primary_if_get_selected(bat_priv); 301 primary_if = batadv_primary_if_get_selected(bat_priv);
302 302
303 req_len = min_packet_len; 303 req_len = min_packet_len;
304 req_len += batadv_tt_len(atomic_read(&bat_priv->tt_local_changes)); 304 req_len += batadv_tt_len(atomic_read(&bat_priv->tt_local_changes));
@@ -313,7 +313,7 @@ static void tt_prepare_packet_buff(struct bat_priv *bat_priv,
313 min_packet_len, req_len); 313 min_packet_len, req_len);
314 314
315 if (primary_if) 315 if (primary_if)
316 hardif_free_ref(primary_if); 316 batadv_hardif_free_ref(primary_if);
317} 317}
318 318
319static int tt_changes_fill_buff(struct bat_priv *bat_priv, 319static int tt_changes_fill_buff(struct bat_priv *bat_priv,
@@ -381,7 +381,7 @@ int batadv_tt_local_seq_print_text(struct seq_file *seq, void *offset)
381 uint32_t i; 381 uint32_t i;
382 int ret = 0; 382 int ret = 0;
383 383
384 primary_if = primary_if_get_selected(bat_priv); 384 primary_if = batadv_primary_if_get_selected(bat_priv);
385 if (!primary_if) { 385 if (!primary_if) {
386 ret = seq_printf(seq, 386 ret = seq_printf(seq,
387 "BATMAN mesh %s disabled - please specify interfaces to enable it\n", 387 "BATMAN mesh %s disabled - please specify interfaces to enable it\n",
@@ -423,7 +423,7 @@ int batadv_tt_local_seq_print_text(struct seq_file *seq, void *offset)
423 } 423 }
424out: 424out:
425 if (primary_if) 425 if (primary_if)
426 hardif_free_ref(primary_if); 426 batadv_hardif_free_ref(primary_if);
427 return ret; 427 return ret;
428} 428}
429 429
@@ -727,7 +727,7 @@ int batadv_tt_global_seq_print_text(struct seq_file *seq, void *offset)
727 uint32_t i; 727 uint32_t i;
728 int ret = 0; 728 int ret = 0;
729 729
730 primary_if = primary_if_get_selected(bat_priv); 730 primary_if = batadv_primary_if_get_selected(bat_priv);
731 if (!primary_if) { 731 if (!primary_if) {
732 ret = seq_printf(seq, 732 ret = seq_printf(seq,
733 "BATMAN mesh %s disabled - please specify interfaces to enable it\n", 733 "BATMAN mesh %s disabled - please specify interfaces to enable it\n",
@@ -763,7 +763,7 @@ int batadv_tt_global_seq_print_text(struct seq_file *seq, void *offset)
763 } 763 }
764out: 764out:
765 if (primary_if) 765 if (primary_if)
766 hardif_free_ref(primary_if); 766 batadv_hardif_free_ref(primary_if);
767 return ret; 767 return ret;
768} 768}
769 769
@@ -1370,7 +1370,7 @@ static int send_tt_request(struct bat_priv *bat_priv,
1370 struct tt_req_node *tt_req_node = NULL; 1370 struct tt_req_node *tt_req_node = NULL;
1371 int ret = 1; 1371 int ret = 1;
1372 1372
1373 primary_if = primary_if_get_selected(bat_priv); 1373 primary_if = batadv_primary_if_get_selected(bat_priv);
1374 if (!primary_if) 1374 if (!primary_if)
1375 goto out; 1375 goto out;
1376 1376
@@ -1420,7 +1420,7 @@ out:
1420 if (neigh_node) 1420 if (neigh_node)
1421 batadv_neigh_node_free_ref(neigh_node); 1421 batadv_neigh_node_free_ref(neigh_node);
1422 if (primary_if) 1422 if (primary_if)
1423 hardif_free_ref(primary_if); 1423 batadv_hardif_free_ref(primary_if);
1424 if (ret) 1424 if (ret)
1425 kfree_skb(skb); 1425 kfree_skb(skb);
1426 if (ret && tt_req_node) { 1426 if (ret && tt_req_node) {
@@ -1464,7 +1464,7 @@ static bool send_other_tt_response(struct bat_priv *bat_priv,
1464 if (!neigh_node) 1464 if (!neigh_node)
1465 goto out; 1465 goto out;
1466 1466
1467 primary_if = primary_if_get_selected(bat_priv); 1467 primary_if = batadv_primary_if_get_selected(bat_priv);
1468 if (!primary_if) 1468 if (!primary_if)
1469 goto out; 1469 goto out;
1470 1470
@@ -1555,7 +1555,7 @@ out:
1555 if (neigh_node) 1555 if (neigh_node)
1556 batadv_neigh_node_free_ref(neigh_node); 1556 batadv_neigh_node_free_ref(neigh_node);
1557 if (primary_if) 1557 if (primary_if)
1558 hardif_free_ref(primary_if); 1558 batadv_hardif_free_ref(primary_if);
1559 if (!ret) 1559 if (!ret)
1560 kfree_skb(skb); 1560 kfree_skb(skb);
1561 return ret; 1561 return ret;
@@ -1592,7 +1592,7 @@ static bool send_my_tt_response(struct bat_priv *bat_priv,
1592 if (!neigh_node) 1592 if (!neigh_node)
1593 goto out; 1593 goto out;
1594 1594
1595 primary_if = primary_if_get_selected(bat_priv); 1595 primary_if = batadv_primary_if_get_selected(bat_priv);
1596 if (!primary_if) 1596 if (!primary_if)
1597 goto out; 1597 goto out;
1598 1598
@@ -1672,7 +1672,7 @@ out:
1672 if (neigh_node) 1672 if (neigh_node)
1673 batadv_neigh_node_free_ref(neigh_node); 1673 batadv_neigh_node_free_ref(neigh_node);
1674 if (primary_if) 1674 if (primary_if)
1675 hardif_free_ref(primary_if); 1675 batadv_hardif_free_ref(primary_if);
1676 if (!ret) 1676 if (!ret)
1677 kfree_skb(skb); 1677 kfree_skb(skb);
1678 /* This packet was for me, so it doesn't need to be re-routed */ 1678 /* This packet was for me, so it doesn't need to be re-routed */
@@ -1956,11 +1956,11 @@ static void send_roam_adv(struct bat_priv *bat_priv, uint8_t *client,
1956 roam_adv_packet->header.packet_type = BAT_ROAM_ADV; 1956 roam_adv_packet->header.packet_type = BAT_ROAM_ADV;
1957 roam_adv_packet->header.version = COMPAT_VERSION; 1957 roam_adv_packet->header.version = COMPAT_VERSION;
1958 roam_adv_packet->header.ttl = TTL; 1958 roam_adv_packet->header.ttl = TTL;
1959 primary_if = primary_if_get_selected(bat_priv); 1959 primary_if = batadv_primary_if_get_selected(bat_priv);
1960 if (!primary_if) 1960 if (!primary_if)
1961 goto out; 1961 goto out;
1962 memcpy(roam_adv_packet->src, primary_if->net_dev->dev_addr, ETH_ALEN); 1962 memcpy(roam_adv_packet->src, primary_if->net_dev->dev_addr, ETH_ALEN);
1963 hardif_free_ref(primary_if); 1963 batadv_hardif_free_ref(primary_if);
1964 memcpy(roam_adv_packet->dst, orig_node->orig, ETH_ALEN); 1964 memcpy(roam_adv_packet->dst, orig_node->orig, ETH_ALEN);
1965 memcpy(roam_adv_packet->client, client, ETH_ALEN); 1965 memcpy(roam_adv_packet->client, client, ETH_ALEN);
1966 1966
diff --git a/net/batman-adv/unicast.c b/net/batman-adv/unicast.c
index b2b76df69607..fff34e05a5d9 100644
--- a/net/batman-adv/unicast.c
+++ b/net/batman-adv/unicast.c
@@ -227,7 +227,7 @@ int batadv_frag_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv,
227 int large_tail = 0, ret = NET_RX_DROP; 227 int large_tail = 0, ret = NET_RX_DROP;
228 uint16_t seqno; 228 uint16_t seqno;
229 229
230 primary_if = primary_if_get_selected(bat_priv); 230 primary_if = batadv_primary_if_get_selected(bat_priv);
231 if (!primary_if) 231 if (!primary_if)
232 goto dropped; 232 goto dropped;
233 233
@@ -277,7 +277,7 @@ dropped:
277 kfree_skb(skb); 277 kfree_skb(skb);
278out: 278out:
279 if (primary_if) 279 if (primary_if)
280 hardif_free_ref(primary_if); 280 batadv_hardif_free_ref(primary_if);
281 return ret; 281 return ret;
282} 282}
283 283
diff --git a/net/batman-adv/vis.c b/net/batman-adv/vis.c
index 20eef04645bd..619f0a5a8484 100644
--- a/net/batman-adv/vis.c
+++ b/net/batman-adv/vis.c
@@ -208,7 +208,7 @@ int batadv_vis_seq_print_text(struct seq_file *seq, void *offset)
208 size_t buff_pos, buf_size; 208 size_t buff_pos, buf_size;
209 char *buff; 209 char *buff;
210 210
211 primary_if = primary_if_get_selected(bat_priv); 211 primary_if = batadv_primary_if_get_selected(bat_priv);
212 if (!primary_if) 212 if (!primary_if)
213 goto out; 213 goto out;
214 214
@@ -329,7 +329,7 @@ int batadv_vis_seq_print_text(struct seq_file *seq, void *offset)
329 329
330out: 330out:
331 if (primary_if) 331 if (primary_if)
332 hardif_free_ref(primary_if); 332 batadv_hardif_free_ref(primary_if);
333 return ret; 333 return ret;
334} 334}
335 335
@@ -828,7 +828,7 @@ static void send_vis_packet(struct bat_priv *bat_priv, struct vis_info *info)
828 struct hard_iface *primary_if; 828 struct hard_iface *primary_if;
829 struct vis_packet *packet; 829 struct vis_packet *packet;
830 830
831 primary_if = primary_if_get_selected(bat_priv); 831 primary_if = batadv_primary_if_get_selected(bat_priv);
832 if (!primary_if) 832 if (!primary_if)
833 goto out; 833 goto out;
834 834
@@ -849,7 +849,7 @@ static void send_vis_packet(struct bat_priv *bat_priv, struct vis_info *info)
849 849
850out: 850out:
851 if (primary_if) 851 if (primary_if)
852 hardif_free_ref(primary_if); 852 batadv_hardif_free_ref(primary_if);
853} 853}
854 854
855/* called from timer; send (and maybe generate) vis packet. */ 855/* called from timer; send (and maybe generate) vis packet. */