batman-adv: Prefix routing 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>
This commit is contained in:
Sven Eckelmann 2012-05-12 02:09:36 +02:00 committed by Antonio Quartulli
parent 925a6672fa
commit 30d3c5113f
7 changed files with 80 additions and 74 deletions

View file

@ -599,7 +599,7 @@ static void bat_iv_ogm_schedule(struct hard_iface *hard_iface)
else else
batman_ogm_packet->gw_flags = NO_FLAGS; batman_ogm_packet->gw_flags = NO_FLAGS;
slide_own_bcast_window(hard_iface); batadv_slide_own_bcast_window(hard_iface);
bat_iv_ogm_queue_add(bat_priv, hard_iface->packet_buff, bat_iv_ogm_queue_add(bat_priv, hard_iface->packet_buff,
hard_iface->packet_len, hard_iface, 1, hard_iface->packet_len, hard_iface, 1,
bat_iv_ogm_emit_send_time(bat_priv)); bat_iv_ogm_emit_send_time(bat_priv));
@ -684,7 +684,7 @@ static void bat_iv_ogm_orig_update(struct bat_priv *bat_priv,
neigh_node->last_ttl = batman_ogm_packet->header.ttl; neigh_node->last_ttl = batman_ogm_packet->header.ttl;
} }
bonding_candidate_add(orig_node, neigh_node); batadv_bonding_candidate_add(orig_node, neigh_node);
/* if this neighbor already is our next hop there is nothing /* if this neighbor already is our next hop there is nothing
* to change */ * to change */
@ -715,7 +715,7 @@ static void bat_iv_ogm_orig_update(struct bat_priv *bat_priv,
goto update_tt; goto update_tt;
} }
update_route(bat_priv, orig_node, neigh_node); batadv_update_route(bat_priv, orig_node, neigh_node);
update_tt: update_tt:
/* I have to check for transtable changes only if the OGM has been /* I have to check for transtable changes only if the OGM has been
@ -884,8 +884,8 @@ static int bat_iv_ogm_update_seqnos(const struct ethhdr *ethhdr,
/* signalize caller that the packet is to be dropped. */ /* signalize caller that the packet is to be dropped. */
if (!hlist_empty(&orig_node->neigh_list) && if (!hlist_empty(&orig_node->neigh_list) &&
window_protected(bat_priv, seq_diff, batadv_window_protected(bat_priv, seq_diff,
&orig_node->batman_seqno_reset)) &orig_node->batman_seqno_reset))
goto out; goto out;
rcu_read_lock(); rcu_read_lock();
@ -1133,7 +1133,8 @@ static void bat_iv_ogm_process(const struct ethhdr *ethhdr,
is_bidirectional = bat_iv_ogm_calc_tq(orig_node, orig_neigh_node, is_bidirectional = bat_iv_ogm_calc_tq(orig_node, orig_neigh_node,
batman_ogm_packet, if_incoming); batman_ogm_packet, if_incoming);
bonding_save_primary(orig_node, orig_neigh_node, batman_ogm_packet); batadv_bonding_save_primary(orig_node, orig_neigh_node,
batman_ogm_packet);
/* update ranking if it is not a duplicate or has the same /* update ranking if it is not a duplicate or has the same
* seqno and similar ttl as the non-duplicate */ * seqno and similar ttl as the non-duplicate */
@ -1201,7 +1202,7 @@ static int bat_iv_ogm_receive(struct sk_buff *skb,
unsigned char *tt_buff, *packet_buff; unsigned char *tt_buff, *packet_buff;
bool ret; bool ret;
ret = check_management_packet(skb, if_incoming, BATMAN_OGM_HLEN); ret = batadv_check_management_packet(skb, if_incoming, BATMAN_OGM_HLEN);
if (!ret) if (!ret)
return NET_RX_DROP; return NET_RX_DROP;

View file

@ -682,7 +682,8 @@ bool batadv_gw_out_of_range(struct bat_priv *bat_priv,
/* If the dhcp packet has been sent to a different gw, /* If the dhcp packet has been sent to a different gw,
* we have to evaluate whether the old gw is still * we have to evaluate whether the old gw is still
* reliable enough */ * reliable enough */
neigh_curr = find_router(bat_priv, curr_gw->orig_node, NULL); neigh_curr = batadv_find_router(bat_priv, curr_gw->orig_node,
NULL);
if (!neigh_curr) if (!neigh_curr)
goto out; goto out;
@ -693,7 +694,7 @@ bool batadv_gw_out_of_range(struct bat_priv *bat_priv,
goto out; goto out;
} }
neigh_old = find_router(bat_priv, orig_dst_node, NULL); neigh_old = batadv_find_router(bat_priv, orig_dst_node, NULL);
if (!neigh_old) if (!neigh_old)
goto out; goto out;

View file

@ -272,19 +272,19 @@ static void recv_handler_init(void)
recv_packet_handler[i] = recv_unhandled_packet; recv_packet_handler[i] = recv_unhandled_packet;
/* batman icmp packet */ /* batman icmp packet */
recv_packet_handler[BAT_ICMP] = recv_icmp_packet; recv_packet_handler[BAT_ICMP] = batadv_recv_icmp_packet;
/* unicast packet */ /* unicast packet */
recv_packet_handler[BAT_UNICAST] = recv_unicast_packet; recv_packet_handler[BAT_UNICAST] = batadv_recv_unicast_packet;
/* fragmented unicast packet */ /* fragmented unicast packet */
recv_packet_handler[BAT_UNICAST_FRAG] = recv_ucast_frag_packet; recv_packet_handler[BAT_UNICAST_FRAG] = batadv_recv_ucast_frag_packet;
/* broadcast packet */ /* broadcast packet */
recv_packet_handler[BAT_BCAST] = recv_bcast_packet; recv_packet_handler[BAT_BCAST] = batadv_recv_bcast_packet;
/* vis packet */ /* vis packet */
recv_packet_handler[BAT_VIS] = recv_vis_packet; recv_packet_handler[BAT_VIS] = batadv_recv_vis_packet;
/* Translation table query (request or response) */ /* Translation table query (request or response) */
recv_packet_handler[BAT_TT_QUERY] = recv_tt_query; recv_packet_handler[BAT_TT_QUERY] = batadv_recv_tt_query;
/* Roaming advertisement */ /* Roaming advertisement */
recv_packet_handler[BAT_ROAM_ADV] = recv_roam_adv; recv_packet_handler[BAT_ROAM_ADV] = batadv_recv_roam_adv;
} }
int recv_handler_register(uint8_t packet_type, int recv_handler_register(uint8_t packet_type,

View file

@ -307,7 +307,7 @@ static bool purge_orig_neighbors(struct bat_priv *bat_priv,
neigh_purged = true; neigh_purged = true;
hlist_del_rcu(&neigh_node->list); hlist_del_rcu(&neigh_node->list);
bonding_candidate_del(orig_node, neigh_node); batadv_bonding_candidate_del(orig_node, neigh_node);
batadv_neigh_node_free_ref(neigh_node); batadv_neigh_node_free_ref(neigh_node);
} else { } else {
if ((!*best_neigh_node) || if ((!*best_neigh_node) ||
@ -334,7 +334,8 @@ static bool purge_orig_node(struct bat_priv *bat_priv,
} else { } else {
if (purge_orig_neighbors(bat_priv, orig_node, if (purge_orig_neighbors(bat_priv, orig_node,
&best_neigh_node)) &best_neigh_node))
update_route(bat_priv, orig_node, best_neigh_node); batadv_update_route(bat_priv, orig_node,
best_neigh_node);
} }
return false; return false;

View file

@ -34,7 +34,7 @@
static int route_unicast_packet(struct sk_buff *skb, static int route_unicast_packet(struct sk_buff *skb,
struct hard_iface *recv_if); struct hard_iface *recv_if);
void slide_own_bcast_window(struct hard_iface *hard_iface) void batadv_slide_own_bcast_window(struct hard_iface *hard_iface)
{ {
struct bat_priv *bat_priv = netdev_priv(hard_iface->soft_iface); struct bat_priv *bat_priv = netdev_priv(hard_iface->soft_iface);
struct hashtable_t *hash = bat_priv->orig_hash; struct hashtable_t *hash = bat_priv->orig_hash;
@ -108,8 +108,8 @@ static void _update_route(struct bat_priv *bat_priv,
batadv_neigh_node_free_ref(curr_router); batadv_neigh_node_free_ref(curr_router);
} }
void update_route(struct bat_priv *bat_priv, struct orig_node *orig_node, void batadv_update_route(struct bat_priv *bat_priv, struct orig_node *orig_node,
struct neigh_node *neigh_node) struct neigh_node *neigh_node)
{ {
struct neigh_node *router = NULL; struct neigh_node *router = NULL;
@ -127,8 +127,8 @@ void update_route(struct bat_priv *bat_priv, struct orig_node *orig_node,
} }
/* caller must hold the neigh_list_lock */ /* caller must hold the neigh_list_lock */
void bonding_candidate_del(struct orig_node *orig_node, void batadv_bonding_candidate_del(struct orig_node *orig_node,
struct neigh_node *neigh_node) struct neigh_node *neigh_node)
{ {
/* this neighbor is not part of our candidate list */ /* this neighbor is not part of our candidate list */
if (list_empty(&neigh_node->bonding_list)) if (list_empty(&neigh_node->bonding_list))
@ -143,8 +143,8 @@ void bonding_candidate_del(struct orig_node *orig_node,
return; return;
} }
void bonding_candidate_add(struct orig_node *orig_node, void batadv_bonding_candidate_add(struct orig_node *orig_node,
struct neigh_node *neigh_node) struct neigh_node *neigh_node)
{ {
struct hlist_node *node; struct hlist_node *node;
struct neigh_node *tmp_neigh_node, *router = NULL; struct neigh_node *tmp_neigh_node, *router = NULL;
@ -204,7 +204,7 @@ void bonding_candidate_add(struct orig_node *orig_node,
goto out; goto out;
candidate_del: candidate_del:
bonding_candidate_del(orig_node, neigh_node); batadv_bonding_candidate_del(orig_node, neigh_node);
out: out:
spin_unlock_bh(&orig_node->neigh_list_lock); spin_unlock_bh(&orig_node->neigh_list_lock);
@ -214,9 +214,10 @@ void bonding_candidate_add(struct orig_node *orig_node,
} }
/* copy primary address for bonding */ /* copy primary address for bonding */
void bonding_save_primary(const struct orig_node *orig_node, void
struct orig_node *orig_neigh_node, batadv_bonding_save_primary(const struct orig_node *orig_node,
const struct batman_ogm_packet *batman_ogm_packet) struct orig_node *orig_neigh_node,
const struct batman_ogm_packet *batman_ogm_packet)
{ {
if (!(batman_ogm_packet->flags & PRIMARIES_FIRST_HOP)) if (!(batman_ogm_packet->flags & PRIMARIES_FIRST_HOP))
return; return;
@ -229,8 +230,8 @@ void bonding_save_primary(const struct orig_node *orig_node,
* 0 if the packet is to be accepted * 0 if the packet is to be accepted
* 1 if the packet is to be ignored. * 1 if the packet is to be ignored.
*/ */
int window_protected(struct bat_priv *bat_priv, int32_t seq_num_diff, int batadv_window_protected(struct bat_priv *bat_priv, int32_t seq_num_diff,
unsigned long *last_reset) unsigned long *last_reset)
{ {
if ((seq_num_diff <= -TQ_LOCAL_WINDOW_SIZE) || if ((seq_num_diff <= -TQ_LOCAL_WINDOW_SIZE) ||
(seq_num_diff >= EXPECTED_SEQNO_RANGE)) { (seq_num_diff >= EXPECTED_SEQNO_RANGE)) {
@ -245,9 +246,9 @@ int window_protected(struct bat_priv *bat_priv, int32_t seq_num_diff,
return 0; return 0;
} }
bool check_management_packet(struct sk_buff *skb, bool batadv_check_management_packet(struct sk_buff *skb,
struct hard_iface *hard_iface, struct hard_iface *hard_iface,
int header_len) int header_len)
{ {
struct ethhdr *ethhdr; struct ethhdr *ethhdr;
@ -387,7 +388,7 @@ static int recv_icmp_ttl_exceeded(struct bat_priv *bat_priv,
} }
int recv_icmp_packet(struct sk_buff *skb, struct hard_iface *recv_if) int batadv_recv_icmp_packet(struct sk_buff *skb, struct hard_iface *recv_if)
{ {
struct bat_priv *bat_priv = netdev_priv(recv_if->soft_iface); struct bat_priv *bat_priv = netdev_priv(recv_if->soft_iface);
struct icmp_packet_rr *icmp_packet; struct icmp_packet_rr *icmp_packet;
@ -569,7 +570,7 @@ static struct neigh_node *find_ifalter_router(struct orig_node *primary_orig,
return router; return router;
} }
int recv_tt_query(struct sk_buff *skb, struct hard_iface *recv_if) int batadv_recv_tt_query(struct sk_buff *skb, struct hard_iface *recv_if)
{ {
struct bat_priv *bat_priv = netdev_priv(recv_if->soft_iface); struct bat_priv *bat_priv = netdev_priv(recv_if->soft_iface);
struct tt_query_packet *tt_query; struct tt_query_packet *tt_query;
@ -644,7 +645,7 @@ int recv_tt_query(struct sk_buff *skb, struct hard_iface *recv_if)
return NET_RX_DROP; return NET_RX_DROP;
} }
int recv_roam_adv(struct sk_buff *skb, struct hard_iface *recv_if) int batadv_recv_roam_adv(struct sk_buff *skb, struct hard_iface *recv_if)
{ {
struct bat_priv *bat_priv = netdev_priv(recv_if->soft_iface); struct bat_priv *bat_priv = netdev_priv(recv_if->soft_iface);
struct roam_adv_packet *roam_adv_packet; struct roam_adv_packet *roam_adv_packet;
@ -704,9 +705,9 @@ int recv_roam_adv(struct sk_buff *skb, struct hard_iface *recv_if)
/* find a suitable router for this originator, and use /* find a suitable router for this originator, and use
* bonding if possible. increases the found neighbors * bonding if possible. increases the found neighbors
* refcount.*/ * refcount.*/
struct neigh_node *find_router(struct bat_priv *bat_priv, struct neigh_node *batadv_find_router(struct bat_priv *bat_priv,
struct orig_node *orig_node, struct orig_node *orig_node,
const struct hard_iface *recv_if) const struct hard_iface *recv_if)
{ {
struct orig_node *primary_orig_node; struct orig_node *primary_orig_node;
struct orig_node *router_orig; struct orig_node *router_orig;
@ -834,7 +835,7 @@ static int route_unicast_packet(struct sk_buff *skb, struct hard_iface *recv_if)
goto out; goto out;
/* find_router() increases neigh_nodes refcount if found. */ /* find_router() increases neigh_nodes refcount if found. */
neigh_node = find_router(bat_priv, orig_node, recv_if); neigh_node = batadv_find_router(bat_priv, orig_node, recv_if);
if (!neigh_node) if (!neigh_node)
goto out; goto out;
@ -965,7 +966,7 @@ static int check_unicast_ttvn(struct bat_priv *bat_priv,
return 1; return 1;
} }
int recv_unicast_packet(struct sk_buff *skb, struct hard_iface *recv_if) int batadv_recv_unicast_packet(struct sk_buff *skb, struct hard_iface *recv_if)
{ {
struct bat_priv *bat_priv = netdev_priv(recv_if->soft_iface); struct bat_priv *bat_priv = netdev_priv(recv_if->soft_iface);
struct unicast_packet *unicast_packet; struct unicast_packet *unicast_packet;
@ -988,7 +989,8 @@ int recv_unicast_packet(struct sk_buff *skb, struct hard_iface *recv_if)
return route_unicast_packet(skb, recv_if); return route_unicast_packet(skb, recv_if);
} }
int recv_ucast_frag_packet(struct sk_buff *skb, struct hard_iface *recv_if) int batadv_recv_ucast_frag_packet(struct sk_buff *skb,
struct hard_iface *recv_if)
{ {
struct bat_priv *bat_priv = netdev_priv(recv_if->soft_iface); struct bat_priv *bat_priv = netdev_priv(recv_if->soft_iface);
struct unicast_frag_packet *unicast_packet; struct unicast_frag_packet *unicast_packet;
@ -1025,7 +1027,7 @@ int recv_ucast_frag_packet(struct sk_buff *skb, struct hard_iface *recv_if)
} }
int recv_bcast_packet(struct sk_buff *skb, struct hard_iface *recv_if) int batadv_recv_bcast_packet(struct sk_buff *skb, struct hard_iface *recv_if)
{ {
struct bat_priv *bat_priv = netdev_priv(recv_if->soft_iface); struct bat_priv *bat_priv = netdev_priv(recv_if->soft_iface);
struct orig_node *orig_node = NULL; struct orig_node *orig_node = NULL;
@ -1077,8 +1079,8 @@ int recv_bcast_packet(struct sk_buff *skb, struct hard_iface *recv_if)
seq_diff = ntohl(bcast_packet->seqno) - orig_node->last_bcast_seqno; seq_diff = ntohl(bcast_packet->seqno) - orig_node->last_bcast_seqno;
/* check whether the packet is old and the host just restarted. */ /* check whether the packet is old and the host just restarted. */
if (window_protected(bat_priv, seq_diff, if (batadv_window_protected(bat_priv, seq_diff,
&orig_node->bcast_seqno_reset)) &orig_node->bcast_seqno_reset))
goto spin_unlock; goto spin_unlock;
/* mark broadcast in flood history, update window position /* mark broadcast in flood history, update window position
@ -1114,7 +1116,7 @@ int recv_bcast_packet(struct sk_buff *skb, struct hard_iface *recv_if)
return ret; return ret;
} }
int recv_vis_packet(struct sk_buff *skb, struct hard_iface *recv_if) int batadv_recv_vis_packet(struct sk_buff *skb, struct hard_iface *recv_if)
{ {
struct vis_packet *vis_packet; struct vis_packet *vis_packet;
struct ethhdr *ethhdr; struct ethhdr *ethhdr;

View file

@ -22,30 +22,32 @@
#ifndef _NET_BATMAN_ADV_ROUTING_H_ #ifndef _NET_BATMAN_ADV_ROUTING_H_
#define _NET_BATMAN_ADV_ROUTING_H_ #define _NET_BATMAN_ADV_ROUTING_H_
void slide_own_bcast_window(struct hard_iface *hard_iface); void batadv_slide_own_bcast_window(struct hard_iface *hard_iface);
bool check_management_packet(struct sk_buff *skb, bool batadv_check_management_packet(struct sk_buff *skb,
struct hard_iface *hard_iface, struct hard_iface *hard_iface,
int header_len); int header_len);
void update_route(struct bat_priv *bat_priv, struct orig_node *orig_node, void batadv_update_route(struct bat_priv *bat_priv, struct orig_node *orig_node,
struct neigh_node *neigh_node); struct neigh_node *neigh_node);
int recv_icmp_packet(struct sk_buff *skb, struct hard_iface *recv_if); int batadv_recv_icmp_packet(struct sk_buff *skb, struct hard_iface *recv_if);
int recv_unicast_packet(struct sk_buff *skb, struct hard_iface *recv_if); int batadv_recv_unicast_packet(struct sk_buff *skb, struct hard_iface *recv_if);
int recv_ucast_frag_packet(struct sk_buff *skb, struct hard_iface *recv_if); int batadv_recv_ucast_frag_packet(struct sk_buff *skb,
int recv_bcast_packet(struct sk_buff *skb, struct hard_iface *recv_if); struct hard_iface *recv_if);
int recv_vis_packet(struct sk_buff *skb, struct hard_iface *recv_if); int batadv_recv_bcast_packet(struct sk_buff *skb, struct hard_iface *recv_if);
int recv_tt_query(struct sk_buff *skb, struct hard_iface *recv_if); int batadv_recv_vis_packet(struct sk_buff *skb, struct hard_iface *recv_if);
int recv_roam_adv(struct sk_buff *skb, struct hard_iface *recv_if); int batadv_recv_tt_query(struct sk_buff *skb, struct hard_iface *recv_if);
struct neigh_node *find_router(struct bat_priv *bat_priv, int batadv_recv_roam_adv(struct sk_buff *skb, struct hard_iface *recv_if);
struct orig_node *orig_node, struct neigh_node *batadv_find_router(struct bat_priv *bat_priv,
const struct hard_iface *recv_if); struct orig_node *orig_node,
void bonding_candidate_del(struct orig_node *orig_node, const struct hard_iface *recv_if);
struct neigh_node *neigh_node); void batadv_bonding_candidate_del(struct orig_node *orig_node,
void bonding_candidate_add(struct orig_node *orig_node, struct neigh_node *neigh_node);
struct neigh_node *neigh_node); void batadv_bonding_candidate_add(struct orig_node *orig_node,
void bonding_save_primary(const struct orig_node *orig_node, struct neigh_node *neigh_node);
struct orig_node *orig_neigh_node, void batadv_bonding_save_primary(const struct orig_node *orig_node,
const struct batman_ogm_packet *batman_ogm_packet); struct orig_node *orig_neigh_node,
int window_protected(struct bat_priv *bat_priv, int32_t seq_num_diff, const struct batman_ogm_packet
unsigned long *last_reset); *batman_ogm_packet);
int batadv_window_protected(struct bat_priv *bat_priv, int32_t seq_num_diff,
unsigned long *last_reset);
#endif /* _NET_BATMAN_ADV_ROUTING_H_ */ #endif /* _NET_BATMAN_ADV_ROUTING_H_ */

View file

@ -310,8 +310,7 @@ int unicast_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv)
* - if orig_node is NULL it returns NULL * - if orig_node is NULL it returns NULL
* - increases neigh_nodes refcount if found. * - increases neigh_nodes refcount if found.
*/ */
neigh_node = find_router(bat_priv, orig_node, NULL); neigh_node = batadv_find_router(bat_priv, orig_node, NULL);
if (!neigh_node) if (!neigh_node)
goto out; goto out;