aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv/translation-table.c
diff options
context:
space:
mode:
authorSven Eckelmann <sven@narfation.org>2012-05-11 20:09:39 -0400
committerAntonio Quartulli <ordex@autistici.org>2012-06-20 16:15:29 -0400
commit08c36d3e8ad1f73d3b0322842363b23f6d203630 (patch)
tree9190100a886c18956fee193acbd8fd160060bc19 /net/batman-adv/translation-table.c
parent04b482a21aaf22cf5b327fb6a3fba6fdc8cb3de9 (diff)
batman-adv: Prefix translation-table non-static functions with batadv_
batman-adv can be compiled as part of the kernel instead of an module. In that case the linker will see all non-static symbols of batman-adv and all other non-static symbols of the kernel. This could lead to symbol collisions. A prefix for the batman-adv symbols that defines their private namespace avoids such a problem. Reported-by: David Miller <davem@davemloft.net> Signed-off-by: Sven Eckelmann <sven@narfation.org>
Diffstat (limited to 'net/batman-adv/translation-table.c')
-rw-r--r--net/batman-adv/translation-table.c84
1 files changed, 45 insertions, 39 deletions
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index 445dc25ceba1..ecef827ae28f 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -173,7 +173,7 @@ static void tt_local_event(struct bat_priv *bat_priv, const uint8_t *addr,
173 atomic_set(&bat_priv->tt_ogm_append_cnt, 0); 173 atomic_set(&bat_priv->tt_ogm_append_cnt, 0);
174} 174}
175 175
176int tt_len(int changes_num) 176int batadv_tt_len(int changes_num)
177{ 177{
178 return changes_num * sizeof(struct tt_change); 178 return changes_num * sizeof(struct tt_change);
179} 179}
@@ -191,8 +191,8 @@ static int tt_local_init(struct bat_priv *bat_priv)
191 return 0; 191 return 0;
192} 192}
193 193
194void tt_local_add(struct net_device *soft_iface, const uint8_t *addr, 194void batadv_tt_local_add(struct net_device *soft_iface, const uint8_t *addr,
195 int ifindex) 195 int ifindex)
196{ 196{
197 struct bat_priv *bat_priv = netdev_priv(soft_iface); 197 struct bat_priv *bat_priv = netdev_priv(soft_iface);
198 struct tt_local_entry *tt_local_entry = NULL; 198 struct tt_local_entry *tt_local_entry = NULL;
@@ -302,7 +302,7 @@ static void tt_prepare_packet_buff(struct bat_priv *bat_priv,
302 primary_if = primary_if_get_selected(bat_priv); 302 primary_if = primary_if_get_selected(bat_priv);
303 303
304 req_len = min_packet_len; 304 req_len = min_packet_len;
305 req_len += tt_len(atomic_read(&bat_priv->tt_local_changes)); 305 req_len += batadv_tt_len(atomic_read(&bat_priv->tt_local_changes));
306 306
307 /* if we have too many changes for one packet don't send any 307 /* if we have too many changes for one packet don't send any
308 * and wait for the tt table request which will be fragmented 308 * and wait for the tt table request which will be fragmented
@@ -332,7 +332,7 @@ static int tt_changes_fill_buff(struct bat_priv *bat_priv,
332 tt_buff = *packet_buff + min_packet_len; 332 tt_buff = *packet_buff + min_packet_len;
333 333
334 if (new_len > 0) 334 if (new_len > 0)
335 tot_changes = new_len / tt_len(1); 335 tot_changes = new_len / batadv_tt_len(1);
336 336
337 spin_lock_bh(&bat_priv->tt_changes_list_lock); 337 spin_lock_bh(&bat_priv->tt_changes_list_lock);
338 atomic_set(&bat_priv->tt_local_changes, 0); 338 atomic_set(&bat_priv->tt_local_changes, 0);
@@ -340,7 +340,7 @@ static int tt_changes_fill_buff(struct bat_priv *bat_priv,
340 list_for_each_entry_safe(entry, safe, &bat_priv->tt_changes_list, 340 list_for_each_entry_safe(entry, safe, &bat_priv->tt_changes_list,
341 list) { 341 list) {
342 if (count < tot_changes) { 342 if (count < tot_changes) {
343 memcpy(tt_buff + tt_len(count), 343 memcpy(tt_buff + batadv_tt_len(count),
344 &entry->change, sizeof(struct tt_change)); 344 &entry->change, sizeof(struct tt_change));
345 count++; 345 count++;
346 } 346 }
@@ -370,7 +370,7 @@ static int tt_changes_fill_buff(struct bat_priv *bat_priv,
370 return count; 370 return count;
371} 371}
372 372
373int tt_local_seq_print_text(struct seq_file *seq, void *offset) 373int batadv_tt_local_seq_print_text(struct seq_file *seq, void *offset)
374{ 374{
375 struct net_device *net_dev = (struct net_device *)seq->private; 375 struct net_device *net_dev = (struct net_device *)seq->private;
376 struct bat_priv *bat_priv = netdev_priv(net_dev); 376 struct bat_priv *bat_priv = netdev_priv(net_dev);
@@ -445,8 +445,8 @@ static void tt_local_set_pending(struct bat_priv *bat_priv,
445 tt_local_entry->common.addr, message); 445 tt_local_entry->common.addr, message);
446} 446}
447 447
448void tt_local_remove(struct bat_priv *bat_priv, const uint8_t *addr, 448void batadv_tt_local_remove(struct bat_priv *bat_priv, const uint8_t *addr,
449 const char *message, bool roaming) 449 const char *message, bool roaming)
450{ 450{
451 struct tt_local_entry *tt_local_entry = NULL; 451 struct tt_local_entry *tt_local_entry = NULL;
452 452
@@ -611,9 +611,9 @@ static void tt_global_add_orig_entry(struct tt_global_entry *tt_global_entry,
611} 611}
612 612
613/* caller must hold orig_node refcount */ 613/* caller must hold orig_node refcount */
614int tt_global_add(struct bat_priv *bat_priv, struct orig_node *orig_node, 614int batadv_tt_global_add(struct bat_priv *bat_priv, struct orig_node *orig_node,
615 const unsigned char *tt_addr, uint8_t ttvn, bool roaming, 615 const unsigned char *tt_addr, uint8_t ttvn,
616 bool wifi) 616 bool roaming, bool wifi)
617{ 617{
618 struct tt_global_entry *tt_global_entry = NULL; 618 struct tt_global_entry *tt_global_entry = NULL;
619 int ret = 0; 619 int ret = 0;
@@ -677,8 +677,8 @@ int tt_global_add(struct bat_priv *bat_priv, struct orig_node *orig_node,
677 677
678out_remove: 678out_remove:
679 /* remove address from local hash if present */ 679 /* remove address from local hash if present */
680 tt_local_remove(bat_priv, tt_global_entry->common.addr, 680 batadv_tt_local_remove(bat_priv, tt_global_entry->common.addr,
681 "global tt received", roaming); 681 "global tt received", roaming);
682 ret = 1; 682 ret = 1;
683out: 683out:
684 if (tt_global_entry) 684 if (tt_global_entry)
@@ -714,7 +714,7 @@ static void tt_global_print_entry(struct tt_global_entry *tt_global_entry,
714 } 714 }
715} 715}
716 716
717int tt_global_seq_print_text(struct seq_file *seq, void *offset) 717int batadv_tt_global_seq_print_text(struct seq_file *seq, void *offset)
718{ 718{
719 struct net_device *net_dev = (struct net_device *)seq->private; 719 struct net_device *net_dev = (struct net_device *)seq->private;
720 struct bat_priv *bat_priv = netdev_priv(net_dev); 720 struct bat_priv *bat_priv = netdev_priv(net_dev);
@@ -919,8 +919,8 @@ out:
919 tt_local_entry_free_ref(tt_local_entry); 919 tt_local_entry_free_ref(tt_local_entry);
920} 920}
921 921
922void tt_global_del_orig(struct bat_priv *bat_priv, 922void batadv_tt_global_del_orig(struct bat_priv *bat_priv,
923 struct orig_node *orig_node, const char *message) 923 struct orig_node *orig_node, const char *message)
924{ 924{
925 struct tt_global_entry *tt_global_entry; 925 struct tt_global_entry *tt_global_entry;
926 struct tt_common_entry *tt_common_entry; 926 struct tt_common_entry *tt_common_entry;
@@ -1048,8 +1048,9 @@ static bool _is_ap_isolated(struct tt_local_entry *tt_local_entry,
1048 return ret; 1048 return ret;
1049} 1049}
1050 1050
1051struct orig_node *transtable_search(struct bat_priv *bat_priv, 1051struct orig_node *batadv_transtable_search(struct bat_priv *bat_priv,
1052 const uint8_t *src, const uint8_t *addr) 1052 const uint8_t *src,
1053 const uint8_t *addr)
1053{ 1054{
1054 struct tt_local_entry *tt_local_entry = NULL; 1055 struct tt_local_entry *tt_local_entry = NULL;
1055 struct tt_global_entry *tt_global_entry = NULL; 1056 struct tt_global_entry *tt_global_entry = NULL;
@@ -1204,7 +1205,7 @@ static void tt_save_orig_buffer(struct bat_priv *bat_priv,
1204 const unsigned char *tt_buff, 1205 const unsigned char *tt_buff,
1205 uint8_t tt_num_changes) 1206 uint8_t tt_num_changes)
1206{ 1207{
1207 uint16_t tt_buff_len = tt_len(tt_num_changes); 1208 uint16_t tt_buff_len = batadv_tt_len(tt_num_changes);
1208 1209
1209 /* Replace the old buffer only if I received something in the 1210 /* Replace the old buffer only if I received something in the
1210 * last OGM (the OGM could carry no changes) */ 1211 * last OGM (the OGM could carry no changes) */
@@ -1669,8 +1670,8 @@ out:
1669 return true; 1670 return true;
1670} 1671}
1671 1672
1672bool send_tt_response(struct bat_priv *bat_priv, 1673bool batadv_send_tt_response(struct bat_priv *bat_priv,
1673 struct tt_query_packet *tt_request) 1674 struct tt_query_packet *tt_request)
1674{ 1675{
1675 if (is_my_mac(tt_request->dst)) { 1676 if (is_my_mac(tt_request->dst)) {
1676 /* don't answer backbone gws! */ 1677 /* don't answer backbone gws! */
@@ -1689,18 +1690,19 @@ static void _tt_update_changes(struct bat_priv *bat_priv,
1689 uint16_t tt_num_changes, uint8_t ttvn) 1690 uint16_t tt_num_changes, uint8_t ttvn)
1690{ 1691{
1691 int i; 1692 int i;
1693 int is_wifi;
1692 1694
1693 for (i = 0; i < tt_num_changes; i++) { 1695 for (i = 0; i < tt_num_changes; i++) {
1694 if ((tt_change + i)->flags & TT_CLIENT_DEL) 1696 if ((tt_change + i)->flags & TT_CLIENT_DEL) {
1695 tt_global_del(bat_priv, orig_node, 1697 tt_global_del(bat_priv, orig_node,
1696 (tt_change + i)->addr, 1698 (tt_change + i)->addr,
1697 "tt removed by changes", 1699 "tt removed by changes",
1698 (tt_change + i)->flags & TT_CLIENT_ROAM); 1700 (tt_change + i)->flags & TT_CLIENT_ROAM);
1699 else 1701 } else {
1700 if (!tt_global_add(bat_priv, orig_node, 1702 is_wifi = (tt_change + i)->flags & TT_CLIENT_WIFI;
1701 (tt_change + i)->addr, ttvn, false, 1703 if (!batadv_tt_global_add(bat_priv, orig_node,
1702 (tt_change + i)->flags & 1704 (tt_change + i)->addr, ttvn,
1703 TT_CLIENT_WIFI)) 1705 false, is_wifi))
1704 /* In case of problem while storing a 1706 /* In case of problem while storing a
1705 * global_entry, we stop the updating 1707 * global_entry, we stop the updating
1706 * procedure without committing the 1708 * procedure without committing the
@@ -1708,6 +1710,7 @@ static void _tt_update_changes(struct bat_priv *bat_priv,
1708 * corrupted data on tt_request 1710 * corrupted data on tt_request
1709 */ 1711 */
1710 return; 1712 return;
1713 }
1711 } 1714 }
1712 orig_node->tt_initialised = true; 1715 orig_node->tt_initialised = true;
1713} 1716}
@@ -1722,7 +1725,7 @@ static void tt_fill_gtable(struct bat_priv *bat_priv,
1722 goto out; 1725 goto out;
1723 1726
1724 /* Purge the old table first.. */ 1727 /* Purge the old table first.. */
1725 tt_global_del_orig(bat_priv, orig_node, "Received full table"); 1728 batadv_tt_global_del_orig(bat_priv, orig_node, "Received full table");
1726 1729
1727 _tt_update_changes(bat_priv, orig_node, 1730 _tt_update_changes(bat_priv, orig_node,
1728 (struct tt_change *)(tt_response + 1), 1731 (struct tt_change *)(tt_response + 1),
@@ -1754,7 +1757,7 @@ static void tt_update_changes(struct bat_priv *bat_priv,
1754 atomic_set(&orig_node->last_ttvn, ttvn); 1757 atomic_set(&orig_node->last_ttvn, ttvn);
1755} 1758}
1756 1759
1757bool is_my_client(struct bat_priv *bat_priv, const uint8_t *addr) 1760bool batadv_is_my_client(struct bat_priv *bat_priv, const uint8_t *addr)
1758{ 1761{
1759 struct tt_local_entry *tt_local_entry = NULL; 1762 struct tt_local_entry *tt_local_entry = NULL;
1760 bool ret = false; 1763 bool ret = false;
@@ -1773,8 +1776,8 @@ out:
1773 return ret; 1776 return ret;
1774} 1777}
1775 1778
1776void handle_tt_response(struct bat_priv *bat_priv, 1779void batadv_handle_tt_response(struct bat_priv *bat_priv,
1777 struct tt_query_packet *tt_response) 1780 struct tt_query_packet *tt_response)
1778{ 1781{
1779 struct tt_req_node *node, *safe; 1782 struct tt_req_node *node, *safe;
1780 struct orig_node *orig_node = NULL; 1783 struct orig_node *orig_node = NULL;
@@ -1821,7 +1824,7 @@ out:
1821 batadv_orig_node_free_ref(orig_node); 1824 batadv_orig_node_free_ref(orig_node);
1822} 1825}
1823 1826
1824int tt_init(struct bat_priv *bat_priv) 1827int batadv_tt_init(struct bat_priv *bat_priv)
1825{ 1828{
1826 int ret; 1829 int ret;
1827 1830
@@ -1983,7 +1986,7 @@ static void tt_purge(struct work_struct *work)
1983 tt_start_timer(bat_priv); 1986 tt_start_timer(bat_priv);
1984} 1987}
1985 1988
1986void tt_free(struct bat_priv *bat_priv) 1989void batadv_tt_free(struct bat_priv *bat_priv)
1987{ 1990{
1988 cancel_delayed_work_sync(&bat_priv->tt_work); 1991 cancel_delayed_work_sync(&bat_priv->tt_work);
1989 1992
@@ -2125,7 +2128,8 @@ int batadv_tt_append_diff(struct bat_priv *bat_priv,
2125 return tt_num_changes; 2128 return tt_num_changes;
2126} 2129}
2127 2130
2128bool is_ap_isolated(struct bat_priv *bat_priv, uint8_t *src, uint8_t *dst) 2131bool batadv_is_ap_isolated(struct bat_priv *bat_priv, uint8_t *src,
2132 uint8_t *dst)
2129{ 2133{
2130 struct tt_local_entry *tt_local_entry = NULL; 2134 struct tt_local_entry *tt_local_entry = NULL;
2131 struct tt_global_entry *tt_global_entry = NULL; 2135 struct tt_global_entry *tt_global_entry = NULL;
@@ -2155,9 +2159,10 @@ out:
2155 return ret; 2159 return ret;
2156} 2160}
2157 2161
2158void tt_update_orig(struct bat_priv *bat_priv, struct orig_node *orig_node, 2162void batadv_tt_update_orig(struct bat_priv *bat_priv,
2159 const unsigned char *tt_buff, uint8_t tt_num_changes, 2163 struct orig_node *orig_node,
2160 uint8_t ttvn, uint16_t tt_crc) 2164 const unsigned char *tt_buff, uint8_t tt_num_changes,
2165 uint8_t ttvn, uint16_t tt_crc)
2161{ 2166{
2162 uint8_t orig_ttvn = (uint8_t)atomic_read(&orig_node->last_ttvn); 2167 uint8_t orig_ttvn = (uint8_t)atomic_read(&orig_node->last_ttvn);
2163 bool full_table = true; 2168 bool full_table = true;
@@ -2222,7 +2227,8 @@ request_table:
2222 * originator to another one. This entry is kept is still kept for consistency 2227 * originator to another one. This entry is kept is still kept for consistency
2223 * purposes 2228 * purposes
2224 */ 2229 */
2225bool tt_global_client_is_roaming(struct bat_priv *bat_priv, uint8_t *addr) 2230bool batadv_tt_global_client_is_roaming(struct bat_priv *bat_priv,
2231 uint8_t *addr)
2226{ 2232{
2227 struct tt_global_entry *tt_global_entry; 2233 struct tt_global_entry *tt_global_entry;
2228 bool ret = false; 2234 bool ret = false;