Skip to content

Commit

Permalink
batman-adv: Prefix translation-table non-static functions with batadv_
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Sven Eckelmann authored and Antonio Quartulli committed Jun 20, 2012
1 parent 04b482a commit 08c36d3
Show file tree
Hide file tree
Showing 11 changed files with 125 additions and 107 deletions.
4 changes: 2 additions & 2 deletions net/batman-adv/bat_debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ static int gateways_open(struct inode *inode, struct file *file)
static int transtable_global_open(struct inode *inode, struct file *file)
{
struct net_device *net_dev = (struct net_device *)inode->i_private;
return single_open(file, tt_global_seq_print_text, net_dev);
return single_open(file, batadv_tt_global_seq_print_text, net_dev);
}

#ifdef CONFIG_BATMAN_ADV_BLA
Expand All @@ -257,7 +257,7 @@ static int bla_claim_table_open(struct inode *inode, struct file *file)
static int transtable_local_open(struct inode *inode, struct file *file)
{
struct net_device *net_dev = (struct net_device *)inode->i_private;
return single_open(file, tt_local_seq_print_text, net_dev);
return single_open(file, batadv_tt_local_seq_print_text, net_dev);
}

static int vis_data_open(struct inode *inode, struct file *file)
Expand Down
23 changes: 13 additions & 10 deletions net/batman-adv/bat_iv_ogm.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,10 @@ static uint8_t hop_penalty(uint8_t tq, const struct bat_priv *bat_priv)
static int bat_iv_ogm_aggr_packet(int buff_pos, int packet_len,
int tt_num_changes)
{
int next_buff_pos = buff_pos + BATMAN_OGM_HLEN + tt_len(tt_num_changes);
int next_buff_pos = 0;

next_buff_pos += buff_pos + BATMAN_OGM_HLEN;
next_buff_pos += batadv_tt_len(tt_num_changes);

return (next_buff_pos <= packet_len) &&
(next_buff_pos <= MAX_AGGREGATION_BYTES);
Expand Down Expand Up @@ -188,8 +191,8 @@ static void bat_iv_ogm_send_to_if(struct forw_packet *forw_packet,
batman_ogm_packet->ttvn, hard_iface->net_dev->name,
hard_iface->net_dev->dev_addr);

buff_pos += BATMAN_OGM_HLEN +
tt_len(batman_ogm_packet->tt_num_changes);
buff_pos += BATMAN_OGM_HLEN;
buff_pos += batadv_tt_len(batman_ogm_packet->tt_num_changes);
packet_num++;
batman_ogm_packet = (struct batman_ogm_packet *)
(forw_packet->skb->data + buff_pos);
Expand Down Expand Up @@ -556,7 +559,7 @@ static void bat_iv_ogm_forward(struct orig_node *orig_node,
batman_ogm_packet->flags &= ~DIRECTLINK;

bat_iv_ogm_queue_add(bat_priv, (unsigned char *)batman_ogm_packet,
BATMAN_OGM_HLEN + tt_len(tt_num_changes),
BATMAN_OGM_HLEN + batadv_tt_len(tt_num_changes),
if_incoming, 0, bat_iv_ogm_fwd_send_time());
}

Expand Down Expand Up @@ -724,10 +727,10 @@ static void bat_iv_ogm_orig_update(struct bat_priv *bat_priv,
if (((batman_ogm_packet->orig != ethhdr->h_source) &&
(batman_ogm_packet->header.ttl > 2)) ||
(batman_ogm_packet->flags & PRIMARIES_FIRST_HOP))
tt_update_orig(bat_priv, orig_node, tt_buff,
batman_ogm_packet->tt_num_changes,
batman_ogm_packet->ttvn,
ntohs(batman_ogm_packet->tt_crc));
batadv_tt_update_orig(bat_priv, orig_node, tt_buff,
batman_ogm_packet->tt_num_changes,
batman_ogm_packet->ttvn,
ntohs(batman_ogm_packet->tt_crc));

if (orig_node->gw_flags != batman_ogm_packet->gw_flags)
batadv_gw_node_update(bat_priv, orig_node,
Expand Down Expand Up @@ -1229,8 +1232,8 @@ static int bat_iv_ogm_receive(struct sk_buff *skb,
bat_iv_ogm_process(ethhdr, batman_ogm_packet,
tt_buff, if_incoming);

buff_pos += BATMAN_OGM_HLEN +
tt_len(batman_ogm_packet->tt_num_changes);
buff_pos += BATMAN_OGM_HLEN;
buff_pos += batadv_tt_len(batman_ogm_packet->tt_num_changes);

batman_ogm_packet = (struct batman_ogm_packet *)
(packet_buff + buff_pos);
Expand Down
4 changes: 2 additions & 2 deletions net/batman-adv/bridge_loop_avoidance.c
Original file line number Diff line number Diff line change
Expand Up @@ -397,8 +397,8 @@ static struct backbone_gw *bla_get_backbone_gw(struct bat_priv *bat_priv,
/* this is a gateway now, remove any tt entries */
orig_node = orig_hash_find(bat_priv, orig);
if (orig_node) {
tt_global_del_orig(bat_priv, orig_node,
"became a backbone gateway");
batadv_tt_global_del_orig(bat_priv, orig_node,
"became a backbone gateway");
batadv_orig_node_free_ref(orig_node);
}
return entry;
Expand Down
4 changes: 2 additions & 2 deletions net/batman-adv/gateway_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -652,8 +652,8 @@ bool batadv_gw_out_of_range(struct bat_priv *bat_priv,
if (!ret)
goto out;

orig_dst_node = transtable_search(bat_priv, ethhdr->h_source,
ethhdr->h_dest);
orig_dst_node = batadv_transtable_search(bat_priv, ethhdr->h_source,
ethhdr->h_dest);
if (!orig_dst_node)
goto out;

Expand Down
6 changes: 3 additions & 3 deletions net/batman-adv/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,11 @@ int mesh_init(struct net_device *soft_iface)
if (ret < 0)
goto err;

ret = tt_init(bat_priv);
ret = batadv_tt_init(bat_priv);
if (ret < 0)
goto err;

tt_local_add(soft_iface, soft_iface->dev_addr, NULL_IFINDEX);
batadv_tt_local_add(soft_iface, soft_iface->dev_addr, NULL_IFINDEX);

ret = vis_init(bat_priv);
if (ret < 0)
Expand Down Expand Up @@ -152,7 +152,7 @@ void mesh_free(struct net_device *soft_iface)
batadv_gw_node_purge(bat_priv);
batadv_originator_free(bat_priv);

tt_free(bat_priv);
batadv_tt_free(bat_priv);

batadv_bla_free(bat_priv);

Expand Down
4 changes: 2 additions & 2 deletions net/batman-adv/originator.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ static void orig_node_free_rcu(struct rcu_head *rcu)
spin_unlock_bh(&orig_node->neigh_list_lock);

frag_list_free(&orig_node->frag_list);
tt_global_del_orig(orig_node->bat_priv, orig_node,
"originator timed out");
batadv_tt_global_del_orig(orig_node->bat_priv, orig_node,
"originator timed out");

kfree(orig_node->tt_buff);
kfree(orig_node->bcast_own);
Expand Down
23 changes: 13 additions & 10 deletions net/batman-adv/routing.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ static void _update_route(struct bat_priv *bat_priv,
if ((curr_router) && (!neigh_node)) {
bat_dbg(DBG_ROUTES, bat_priv, "Deleting route towards: %pM\n",
orig_node->orig);
tt_global_del_orig(bat_priv, orig_node,
"Deleted route towards originator");
batadv_tt_global_del_orig(bat_priv, orig_node,
"Deleted route towards originator");

/* route added */
} else if ((!curr_router) && (neigh_node)) {
Expand Down Expand Up @@ -603,7 +603,7 @@ int batadv_recv_tt_query(struct sk_buff *skb, struct hard_iface *recv_if)

/* If we cannot provide an answer the tt_request is
* forwarded */
if (!send_tt_response(bat_priv, tt_query)) {
if (!batadv_send_tt_response(bat_priv, tt_query)) {
bat_dbg(DBG_TT, bat_priv,
"Routing TT_REQUEST to %pM [%c]\n",
tt_query->dst,
Expand All @@ -622,14 +622,14 @@ int batadv_recv_tt_query(struct sk_buff *skb, struct hard_iface *recv_if)
/* skb_linearize() possibly changed skb->data */
tt_query = (struct tt_query_packet *)skb->data;

tt_size = tt_len(ntohs(tt_query->tt_data));
tt_size = batadv_tt_len(ntohs(tt_query->tt_data));

/* Ensure we have all the claimed data */
if (unlikely(skb_headlen(skb) <
sizeof(struct tt_query_packet) + tt_size))
goto out;

handle_tt_response(bat_priv, tt_query);
batadv_handle_tt_response(bat_priv, tt_query);
} else {
bat_dbg(DBG_TT, bat_priv,
"Routing TT_RESPONSE to %pM [%c]\n",
Expand Down Expand Up @@ -688,8 +688,9 @@ int batadv_recv_roam_adv(struct sk_buff *skb, struct hard_iface *recv_if)
"Received ROAMING_ADV from %pM (client %pM)\n",
roam_adv_packet->src, roam_adv_packet->client);

tt_global_add(bat_priv, orig_node, roam_adv_packet->client,
atomic_read(&orig_node->last_ttvn) + 1, true, false);
batadv_tt_global_add(bat_priv, orig_node, roam_adv_packet->client,
atomic_read(&orig_node->last_ttvn) + 1, true,
false);

/* Roaming phase starts: I have new information but the ttvn has not
* been incremented yet. This flag will make me check all the incoming
Expand Down Expand Up @@ -934,13 +935,15 @@ static int check_unicast_ttvn(struct bat_priv *bat_priv,
/* we don't have an updated route for this client, so we should
* not try to reroute the packet!!
*/
if (tt_global_client_is_roaming(bat_priv, ethhdr->h_dest))
if (batadv_tt_global_client_is_roaming(bat_priv,
ethhdr->h_dest))
return 1;

orig_node = transtable_search(bat_priv, NULL, ethhdr->h_dest);
orig_node = batadv_transtable_search(bat_priv, NULL,
ethhdr->h_dest);

if (!orig_node) {
if (!is_my_client(bat_priv, ethhdr->h_dest))
if (!batadv_is_my_client(bat_priv, ethhdr->h_dest))
return 0;
primary_if = primary_if_get_selected(bat_priv);
if (!primary_if)
Expand Down
10 changes: 5 additions & 5 deletions net/batman-adv/soft-interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ static int interface_set_mac_addr(struct net_device *dev, void *p)

/* only modify transtable if it has been initialized before */
if (atomic_read(&bat_priv->mesh_state) == MESH_ACTIVE) {
tt_local_remove(bat_priv, dev->dev_addr,
"mac address changed", false);
tt_local_add(dev, addr->sa_data, NULL_IFINDEX);
batadv_tt_local_remove(bat_priv, dev->dev_addr,
"mac address changed", false);
batadv_tt_local_add(dev, addr->sa_data, NULL_IFINDEX);
}

memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
Expand Down Expand Up @@ -166,7 +166,7 @@ static int interface_tx(struct sk_buff *skb, struct net_device *soft_iface)
goto dropped;

/* Register the client MAC in the transtable */
tt_local_add(soft_iface, ethhdr->h_source, skb->skb_iif);
batadv_tt_local_add(soft_iface, ethhdr->h_source, skb->skb_iif);

/* don't accept stp packets. STP does not help in meshes.
* better use the bridge loop avoidance ...
Expand Down Expand Up @@ -303,7 +303,7 @@ void batadv_interface_rx(struct net_device *soft_iface,

soft_iface->last_rx = jiffies;

if (is_ap_isolated(bat_priv, ethhdr->h_source, ethhdr->h_dest))
if (batadv_is_ap_isolated(bat_priv, ethhdr->h_source, ethhdr->h_dest))
goto dropped;

/* Let the bridge loop avoidance check the packet. If will
Expand Down
Loading

0 comments on commit 08c36d3

Please sign in to comment.