Skip to content

Commit

Permalink
batman-adv: Prefix unicast 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 08c36d3 commit 88ed1e7
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 22 deletions.
4 changes: 2 additions & 2 deletions net/batman-adv/originator.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ 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);
batadv_frag_list_free(&orig_node->frag_list);
batadv_tt_global_del_orig(orig_node->bat_priv, orig_node,
"originator timed out");

Expand Down Expand Up @@ -372,7 +372,7 @@ static void _purge_orig(struct bat_priv *bat_priv)

if (has_timed_out(orig_node->last_frag_packet,
FRAG_TIMEOUT))
frag_list_free(&orig_node->frag_list);
batadv_frag_list_free(&orig_node->frag_list);
}
spin_unlock_bh(list_lock);
}
Expand Down
9 changes: 5 additions & 4 deletions net/batman-adv/routing.c
Original file line number Diff line number Diff line change
Expand Up @@ -850,15 +850,16 @@ static int route_unicast_packet(struct sk_buff *skb, struct hard_iface *recv_if)
if (unicast_packet->header.packet_type == BAT_UNICAST &&
atomic_read(&bat_priv->fragmentation) &&
skb->len > neigh_node->if_incoming->net_dev->mtu) {
ret = frag_send_skb(skb, bat_priv,
neigh_node->if_incoming, neigh_node->addr);
ret = batadv_frag_send_skb(skb, bat_priv,
neigh_node->if_incoming,
neigh_node->addr);
goto out;
}

if (unicast_packet->header.packet_type == BAT_UNICAST_FRAG &&
frag_can_reassemble(skb, neigh_node->if_incoming->net_dev->mtu)) {

ret = frag_reassemble_skb(skb, bat_priv, &new_skb);
ret = batadv_frag_reassemble_skb(skb, bat_priv, &new_skb);

if (ret == NET_RX_DROP)
goto out;
Expand Down Expand Up @@ -1013,7 +1014,7 @@ int batadv_recv_ucast_frag_packet(struct sk_buff *skb,
/* packet for me */
if (is_my_mac(unicast_packet->dest)) {

ret = frag_reassemble_skb(skb, bat_priv, &new_skb);
ret = batadv_frag_reassemble_skb(skb, bat_priv, &new_skb);

if (ret == NET_RX_DROP)
return NET_RX_DROP;
Expand Down
2 changes: 1 addition & 1 deletion net/batman-adv/soft-interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ static int interface_tx(struct sk_buff *skb, struct net_device *soft_iface)
goto dropped;
}

ret = unicast_send_skb(skb, bat_priv);
ret = batadv_unicast_send_skb(skb, bat_priv);
if (ret != 0)
goto dropped_freed;
}
Expand Down
19 changes: 10 additions & 9 deletions net/batman-adv/unicast.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ static int frag_create_buffer(struct list_head *head)
for (i = 0; i < FRAG_BUFFER_SIZE; i++) {
tfp = kmalloc(sizeof(*tfp), GFP_ATOMIC);
if (!tfp) {
frag_list_free(head);
batadv_frag_list_free(head);
return -ENOMEM;
}
tfp->skb = NULL;
Expand Down Expand Up @@ -151,7 +151,7 @@ static struct frag_packet_list_entry *frag_search_packet(struct list_head *head,
return NULL;
}

void frag_list_free(struct list_head *head)
void batadv_frag_list_free(struct list_head *head)
{
struct frag_packet_list_entry *pf, *tmp_pf;

Expand All @@ -172,8 +172,8 @@ void frag_list_free(struct list_head *head)
* or the skb could be reassembled (skb_new will point to the new packet and
* skb was freed)
*/
int frag_reassemble_skb(struct sk_buff *skb, struct bat_priv *bat_priv,
struct sk_buff **new_skb)
int batadv_frag_reassemble_skb(struct sk_buff *skb, struct bat_priv *bat_priv,
struct sk_buff **new_skb)
{
struct orig_node *orig_node;
struct frag_packet_list_entry *tmp_frag_entry;
Expand Down Expand Up @@ -216,8 +216,8 @@ int frag_reassemble_skb(struct sk_buff *skb, struct bat_priv *bat_priv,
return ret;
}

int frag_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv,
struct hard_iface *hard_iface, const uint8_t dstaddr[])
int batadv_frag_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv,
struct hard_iface *hard_iface, const uint8_t dstaddr[])
{
struct unicast_packet tmp_uc, *unicast_packet;
struct hard_iface *primary_if;
Expand Down Expand Up @@ -283,7 +283,7 @@ int frag_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv,
return ret;
}

int unicast_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv)
int batadv_unicast_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv)
{
struct ethhdr *ethhdr = (struct ethhdr *)skb->data;
struct unicast_packet *unicast_packet;
Expand Down Expand Up @@ -342,8 +342,9 @@ int unicast_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv)
neigh_node->if_incoming->net_dev->mtu) {
/* send frag skb decreases ttl */
unicast_packet->header.ttl++;
ret = frag_send_skb(skb, bat_priv,
neigh_node->if_incoming, neigh_node->addr);
ret = batadv_frag_send_skb(skb, bat_priv,
neigh_node->if_incoming,
neigh_node->addr);
goto out;
}

Expand Down
13 changes: 7 additions & 6 deletions net/batman-adv/unicast.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,13 @@
#define FRAG_TIMEOUT 10000 /* purge frag list entries after time in ms */
#define FRAG_BUFFER_SIZE 6 /* number of list elements in buffer */

int frag_reassemble_skb(struct sk_buff *skb, struct bat_priv *bat_priv,
struct sk_buff **new_skb);
void frag_list_free(struct list_head *head);
int unicast_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv);
int frag_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv,
struct hard_iface *hard_iface, const uint8_t dstaddr[]);
int batadv_frag_reassemble_skb(struct sk_buff *skb, struct bat_priv *bat_priv,
struct sk_buff **new_skb);
void batadv_frag_list_free(struct list_head *head);
int batadv_unicast_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv);
int batadv_frag_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv,
struct hard_iface *hard_iface,
const uint8_t dstaddr[]);

static inline int frag_can_reassemble(const struct sk_buff *skb, int mtu)
{
Expand Down

0 comments on commit 88ed1e7

Please sign in to comment.