Commit 7cf06bc6 authored by Sven Eckelmann's avatar Sven Eckelmann Committed by Antonio Quartulli

batman-adv: Prefix gateway-client 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: default avatarDavid Miller <davem@davemloft.net>
Signed-off-by: default avatarSven Eckelmann <sven@narfation.org>
parent 08adf151
...@@ -236,7 +236,7 @@ static int originators_open(struct inode *inode, struct file *file) ...@@ -236,7 +236,7 @@ static int originators_open(struct inode *inode, struct file *file)
static int gateways_open(struct inode *inode, struct file *file) static int gateways_open(struct inode *inode, struct file *file)
{ {
struct net_device *net_dev = (struct net_device *)inode->i_private; struct net_device *net_dev = (struct net_device *)inode->i_private;
return single_open(file, gw_client_seq_print_text, net_dev); return single_open(file, batadv_gw_client_seq_print_text, net_dev);
} }
static int transtable_global_open(struct inode *inode, struct file *file) static int transtable_global_open(struct inode *inode, struct file *file)
......
...@@ -729,8 +729,8 @@ static void bat_iv_ogm_orig_update(struct bat_priv *bat_priv, ...@@ -729,8 +729,8 @@ static void bat_iv_ogm_orig_update(struct bat_priv *bat_priv,
ntohs(batman_ogm_packet->tt_crc)); ntohs(batman_ogm_packet->tt_crc));
if (orig_node->gw_flags != batman_ogm_packet->gw_flags) if (orig_node->gw_flags != batman_ogm_packet->gw_flags)
gw_node_update(bat_priv, orig_node, batadv_gw_node_update(bat_priv, orig_node,
batman_ogm_packet->gw_flags); batman_ogm_packet->gw_flags);
orig_node->gw_flags = batman_ogm_packet->gw_flags; orig_node->gw_flags = batman_ogm_packet->gw_flags;
...@@ -738,7 +738,7 @@ static void bat_iv_ogm_orig_update(struct bat_priv *bat_priv, ...@@ -738,7 +738,7 @@ static void bat_iv_ogm_orig_update(struct bat_priv *bat_priv,
if ((orig_node->gw_flags) && if ((orig_node->gw_flags) &&
(atomic_read(&bat_priv->gw_mode) == GW_MODE_CLIENT) && (atomic_read(&bat_priv->gw_mode) == GW_MODE_CLIENT) &&
(atomic_read(&bat_priv->gw_sel_class) > 2)) (atomic_read(&bat_priv->gw_sel_class) > 2))
gw_check_election(bat_priv, orig_node); batadv_gw_check_election(bat_priv, orig_node);
goto out; goto out;
......
...@@ -326,7 +326,7 @@ static ssize_t show_bat_algo(struct kobject *kobj, struct attribute *attr, ...@@ -326,7 +326,7 @@ static ssize_t show_bat_algo(struct kobject *kobj, struct attribute *attr,
static void post_gw_deselect(struct net_device *net_dev) static void post_gw_deselect(struct net_device *net_dev)
{ {
struct bat_priv *bat_priv = netdev_priv(net_dev); struct bat_priv *bat_priv = netdev_priv(net_dev);
gw_deselect(bat_priv); batadv_gw_deselect(bat_priv);
} }
static ssize_t show_gw_mode(struct kobject *kobj, struct attribute *attr, static ssize_t show_gw_mode(struct kobject *kobj, struct attribute *attr,
...@@ -397,7 +397,7 @@ static ssize_t store_gw_mode(struct kobject *kobj, struct attribute *attr, ...@@ -397,7 +397,7 @@ static ssize_t store_gw_mode(struct kobject *kobj, struct attribute *attr,
bat_info(net_dev, "Changing gw mode from: %s to: %s\n", bat_info(net_dev, "Changing gw mode from: %s to: %s\n",
curr_gw_mode_str, buff); curr_gw_mode_str, buff);
gw_deselect(bat_priv); batadv_gw_deselect(bat_priv);
atomic_set(&bat_priv->gw_mode, (unsigned int)gw_mode_tmp); atomic_set(&bat_priv->gw_mode, (unsigned int)gw_mode_tmp);
return count; return count;
} }
......
...@@ -60,7 +60,7 @@ static struct gw_node *gw_get_selected_gw_node(struct bat_priv *bat_priv) ...@@ -60,7 +60,7 @@ static struct gw_node *gw_get_selected_gw_node(struct bat_priv *bat_priv)
return gw_node; return gw_node;
} }
struct orig_node *gw_get_selected_orig(struct bat_priv *bat_priv) struct orig_node *batadv_gw_get_selected_orig(struct bat_priv *bat_priv)
{ {
struct gw_node *gw_node; struct gw_node *gw_node;
struct orig_node *orig_node = NULL; struct orig_node *orig_node = NULL;
...@@ -103,7 +103,7 @@ static void gw_select(struct bat_priv *bat_priv, struct gw_node *new_gw_node) ...@@ -103,7 +103,7 @@ static void gw_select(struct bat_priv *bat_priv, struct gw_node *new_gw_node)
spin_unlock_bh(&bat_priv->gw_list_lock); spin_unlock_bh(&bat_priv->gw_list_lock);
} }
void gw_deselect(struct bat_priv *bat_priv) void batadv_gw_deselect(struct bat_priv *bat_priv)
{ {
atomic_set(&bat_priv->gw_reselect, 1); atomic_set(&bat_priv->gw_reselect, 1);
} }
...@@ -182,7 +182,7 @@ static struct gw_node *gw_get_best_gw_node(struct bat_priv *bat_priv) ...@@ -182,7 +182,7 @@ static struct gw_node *gw_get_best_gw_node(struct bat_priv *bat_priv)
return curr_gw; return curr_gw;
} }
void gw_election(struct bat_priv *bat_priv) void batadv_gw_election(struct bat_priv *bat_priv)
{ {
struct gw_node *curr_gw = NULL, *next_gw = NULL; struct gw_node *curr_gw = NULL, *next_gw = NULL;
struct neigh_node *router = NULL; struct neigh_node *router = NULL;
...@@ -212,7 +212,7 @@ void gw_election(struct bat_priv *bat_priv) ...@@ -212,7 +212,7 @@ void gw_election(struct bat_priv *bat_priv)
router = orig_node_get_router(next_gw->orig_node); router = orig_node_get_router(next_gw->orig_node);
if (!router) { if (!router) {
gw_deselect(bat_priv); batadv_gw_deselect(bat_priv);
goto out; goto out;
} }
} }
...@@ -246,13 +246,14 @@ void gw_election(struct bat_priv *bat_priv) ...@@ -246,13 +246,14 @@ void gw_election(struct bat_priv *bat_priv)
neigh_node_free_ref(router); neigh_node_free_ref(router);
} }
void gw_check_election(struct bat_priv *bat_priv, struct orig_node *orig_node) void batadv_gw_check_election(struct bat_priv *bat_priv,
struct orig_node *orig_node)
{ {
struct orig_node *curr_gw_orig; struct orig_node *curr_gw_orig;
struct neigh_node *router_gw = NULL, *router_orig = NULL; struct neigh_node *router_gw = NULL, *router_orig = NULL;
uint8_t gw_tq_avg, orig_tq_avg; uint8_t gw_tq_avg, orig_tq_avg;
curr_gw_orig = gw_get_selected_orig(bat_priv); curr_gw_orig = batadv_gw_get_selected_orig(bat_priv);
if (!curr_gw_orig) if (!curr_gw_orig)
goto deselect; goto deselect;
...@@ -288,7 +289,7 @@ void gw_check_election(struct bat_priv *bat_priv, struct orig_node *orig_node) ...@@ -288,7 +289,7 @@ void gw_check_election(struct bat_priv *bat_priv, struct orig_node *orig_node)
gw_tq_avg, orig_tq_avg); gw_tq_avg, orig_tq_avg);
deselect: deselect:
gw_deselect(bat_priv); batadv_gw_deselect(bat_priv);
out: out:
if (curr_gw_orig) if (curr_gw_orig)
orig_node_free_ref(curr_gw_orig); orig_node_free_ref(curr_gw_orig);
...@@ -328,8 +329,8 @@ static void gw_node_add(struct bat_priv *bat_priv, ...@@ -328,8 +329,8 @@ static void gw_node_add(struct bat_priv *bat_priv,
(up > 2048 ? "MBit" : "KBit")); (up > 2048 ? "MBit" : "KBit"));
} }
void gw_node_update(struct bat_priv *bat_priv, void batadv_gw_node_update(struct bat_priv *bat_priv,
struct orig_node *orig_node, uint8_t new_gwflags) struct orig_node *orig_node, uint8_t new_gwflags)
{ {
struct hlist_node *node; struct hlist_node *node;
struct gw_node *gw_node, *curr_gw; struct gw_node *gw_node, *curr_gw;
...@@ -374,7 +375,7 @@ void gw_node_update(struct bat_priv *bat_priv, ...@@ -374,7 +375,7 @@ void gw_node_update(struct bat_priv *bat_priv,
goto unlock; goto unlock;
deselect: deselect:
gw_deselect(bat_priv); batadv_gw_deselect(bat_priv);
unlock: unlock:
rcu_read_unlock(); rcu_read_unlock();
...@@ -382,12 +383,13 @@ void gw_node_update(struct bat_priv *bat_priv, ...@@ -382,12 +383,13 @@ void gw_node_update(struct bat_priv *bat_priv,
gw_node_free_ref(curr_gw); gw_node_free_ref(curr_gw);
} }
void gw_node_delete(struct bat_priv *bat_priv, struct orig_node *orig_node) void batadv_gw_node_delete(struct bat_priv *bat_priv,
struct orig_node *orig_node)
{ {
gw_node_update(bat_priv, orig_node, 0); batadv_gw_node_update(bat_priv, orig_node, 0);
} }
void gw_node_purge(struct bat_priv *bat_priv) void batadv_gw_node_purge(struct bat_priv *bat_priv)
{ {
struct gw_node *gw_node, *curr_gw; struct gw_node *gw_node, *curr_gw;
struct hlist_node *node, *node_tmp; struct hlist_node *node, *node_tmp;
...@@ -416,7 +418,7 @@ void gw_node_purge(struct bat_priv *bat_priv) ...@@ -416,7 +418,7 @@ void gw_node_purge(struct bat_priv *bat_priv)
/* gw_deselect() needs to acquire the gw_list_lock */ /* gw_deselect() needs to acquire the gw_list_lock */
if (do_deselect) if (do_deselect)
gw_deselect(bat_priv); batadv_gw_deselect(bat_priv);
if (curr_gw) if (curr_gw)
gw_node_free_ref(curr_gw); gw_node_free_ref(curr_gw);
...@@ -458,7 +460,7 @@ static int _write_buffer_text(struct bat_priv *bat_priv, struct seq_file *seq, ...@@ -458,7 +460,7 @@ static int _write_buffer_text(struct bat_priv *bat_priv, struct seq_file *seq,
return ret; return ret;
} }
int gw_client_seq_print_text(struct seq_file *seq, void *offset) int batadv_gw_client_seq_print_text(struct seq_file *seq, void *offset)
{ {
struct net_device *net_dev = (struct net_device *)seq->private; struct net_device *net_dev = (struct net_device *)seq->private;
struct bat_priv *bat_priv = netdev_priv(net_dev); struct bat_priv *bat_priv = netdev_priv(net_dev);
...@@ -568,7 +570,7 @@ static bool is_type_dhcprequest(struct sk_buff *skb, int header_len) ...@@ -568,7 +570,7 @@ static bool is_type_dhcprequest(struct sk_buff *skb, int header_len)
return ret; return ret;
} }
bool gw_is_dhcp_target(struct sk_buff *skb, unsigned int *header_len) bool batadv_gw_is_dhcp_target(struct sk_buff *skb, unsigned int *header_len)
{ {
struct ethhdr *ethhdr; struct ethhdr *ethhdr;
struct iphdr *iphdr; struct iphdr *iphdr;
...@@ -634,8 +636,8 @@ bool gw_is_dhcp_target(struct sk_buff *skb, unsigned int *header_len) ...@@ -634,8 +636,8 @@ bool gw_is_dhcp_target(struct sk_buff *skb, unsigned int *header_len)
return true; return true;
} }
bool gw_out_of_range(struct bat_priv *bat_priv, bool batadv_gw_out_of_range(struct bat_priv *bat_priv,
struct sk_buff *skb, struct ethhdr *ethhdr) struct sk_buff *skb, struct ethhdr *ethhdr)
{ {
struct neigh_node *neigh_curr = NULL, *neigh_old = NULL; struct neigh_node *neigh_curr = NULL, *neigh_old = NULL;
struct orig_node *orig_dst_node = NULL; struct orig_node *orig_dst_node = NULL;
...@@ -644,7 +646,7 @@ bool gw_out_of_range(struct bat_priv *bat_priv, ...@@ -644,7 +646,7 @@ bool gw_out_of_range(struct bat_priv *bat_priv,
unsigned int header_len = 0; unsigned int header_len = 0;
uint8_t curr_tq_avg; uint8_t curr_tq_avg;
ret = gw_is_dhcp_target(skb, &header_len); ret = batadv_gw_is_dhcp_target(skb, &header_len);
if (!ret) if (!ret)
goto out; goto out;
......
...@@ -22,17 +22,19 @@ ...@@ -22,17 +22,19 @@
#ifndef _NET_BATMAN_ADV_GATEWAY_CLIENT_H_ #ifndef _NET_BATMAN_ADV_GATEWAY_CLIENT_H_
#define _NET_BATMAN_ADV_GATEWAY_CLIENT_H_ #define _NET_BATMAN_ADV_GATEWAY_CLIENT_H_
void gw_deselect(struct bat_priv *bat_priv); void batadv_gw_deselect(struct bat_priv *bat_priv);
void gw_election(struct bat_priv *bat_priv); void batadv_gw_election(struct bat_priv *bat_priv);
struct orig_node *gw_get_selected_orig(struct bat_priv *bat_priv); struct orig_node *batadv_gw_get_selected_orig(struct bat_priv *bat_priv);
void gw_check_election(struct bat_priv *bat_priv, struct orig_node *orig_node); void batadv_gw_check_election(struct bat_priv *bat_priv,
void gw_node_update(struct bat_priv *bat_priv, struct orig_node *orig_node);
struct orig_node *orig_node, uint8_t new_gwflags); void batadv_gw_node_update(struct bat_priv *bat_priv,
void gw_node_delete(struct bat_priv *bat_priv, struct orig_node *orig_node); struct orig_node *orig_node, uint8_t new_gwflags);
void gw_node_purge(struct bat_priv *bat_priv); void batadv_gw_node_delete(struct bat_priv *bat_priv,
int gw_client_seq_print_text(struct seq_file *seq, void *offset); struct orig_node *orig_node);
bool gw_is_dhcp_target(struct sk_buff *skb, unsigned int *header_len); void batadv_gw_node_purge(struct bat_priv *bat_priv);
bool gw_out_of_range(struct bat_priv *bat_priv, int batadv_gw_client_seq_print_text(struct seq_file *seq, void *offset);
struct sk_buff *skb, struct ethhdr *ethhdr); bool batadv_gw_is_dhcp_target(struct sk_buff *skb, unsigned int *header_len);
bool batadv_gw_out_of_range(struct bat_priv *bat_priv,
struct sk_buff *skb, struct ethhdr *ethhdr);
#endif /* _NET_BATMAN_ADV_GATEWAY_CLIENT_H_ */ #endif /* _NET_BATMAN_ADV_GATEWAY_CLIENT_H_ */
...@@ -165,7 +165,7 @@ ssize_t gw_bandwidth_set(struct net_device *net_dev, char *buff, size_t count) ...@@ -165,7 +165,7 @@ ssize_t gw_bandwidth_set(struct net_device *net_dev, char *buff, size_t count)
if (atomic_read(&bat_priv->gw_bandwidth) == gw_bandwidth_tmp) if (atomic_read(&bat_priv->gw_bandwidth) == gw_bandwidth_tmp)
return count; return count;
gw_deselect(bat_priv); batadv_gw_deselect(bat_priv);
bat_info(net_dev, bat_info(net_dev,
"Changing gateway bandwidth from: '%i' to: '%ld' (propagating: %d%s/%d%s)\n", "Changing gateway bandwidth from: '%i' to: '%ld' (propagating: %d%s/%d%s)\n",
atomic_read(&bat_priv->gw_bandwidth), gw_bandwidth_tmp, atomic_read(&bat_priv->gw_bandwidth), gw_bandwidth_tmp,
......
...@@ -149,7 +149,7 @@ void mesh_free(struct net_device *soft_iface) ...@@ -149,7 +149,7 @@ void mesh_free(struct net_device *soft_iface)
vis_quit(bat_priv); vis_quit(bat_priv);
gw_node_purge(bat_priv); batadv_gw_node_purge(bat_priv);
originator_free(bat_priv); originator_free(bat_priv);
tt_free(bat_priv); tt_free(bat_priv);
......
...@@ -361,7 +361,8 @@ static void _purge_orig(struct bat_priv *bat_priv) ...@@ -361,7 +361,8 @@ static void _purge_orig(struct bat_priv *bat_priv)
head, hash_entry) { head, hash_entry) {
if (purge_orig_node(bat_priv, orig_node)) { if (purge_orig_node(bat_priv, orig_node)) {
if (orig_node->gw_flags) if (orig_node->gw_flags)
gw_node_delete(bat_priv, orig_node); batadv_gw_node_delete(bat_priv,
orig_node);
hlist_del_rcu(node); hlist_del_rcu(node);
orig_node_free_ref(orig_node); orig_node_free_ref(orig_node);
continue; continue;
...@@ -374,8 +375,8 @@ static void _purge_orig(struct bat_priv *bat_priv) ...@@ -374,8 +375,8 @@ static void _purge_orig(struct bat_priv *bat_priv)
spin_unlock_bh(list_lock); spin_unlock_bh(list_lock);
} }
gw_node_purge(bat_priv); batadv_gw_node_purge(bat_priv);
gw_election(bat_priv); batadv_gw_election(bat_priv);
} }
static void purge_orig(struct work_struct *work) static void purge_orig(struct work_struct *work)
......
...@@ -181,14 +181,14 @@ static int interface_tx(struct sk_buff *skb, struct net_device *soft_iface) ...@@ -181,14 +181,14 @@ static int interface_tx(struct sk_buff *skb, struct net_device *soft_iface)
case GW_MODE_SERVER: case GW_MODE_SERVER:
/* gateway servers should not send dhcp /* gateway servers should not send dhcp
* requests into the mesh */ * requests into the mesh */
ret = gw_is_dhcp_target(skb, &header_len); ret = batadv_gw_is_dhcp_target(skb, &header_len);
if (ret) if (ret)
goto dropped; goto dropped;
break; break;
case GW_MODE_CLIENT: case GW_MODE_CLIENT:
/* gateway clients should send dhcp requests /* gateway clients should send dhcp requests
* via unicast to their gateway */ * via unicast to their gateway */
ret = gw_is_dhcp_target(skb, &header_len); ret = batadv_gw_is_dhcp_target(skb, &header_len);
if (ret) if (ret)
do_bcast = false; do_bcast = false;
break; break;
...@@ -232,7 +232,7 @@ static int interface_tx(struct sk_buff *skb, struct net_device *soft_iface) ...@@ -232,7 +232,7 @@ static int interface_tx(struct sk_buff *skb, struct net_device *soft_iface)
/* unicast packet */ /* unicast packet */
} else { } else {
if (atomic_read(&bat_priv->gw_mode) != GW_MODE_OFF) { if (atomic_read(&bat_priv->gw_mode) != GW_MODE_OFF) {
ret = gw_out_of_range(bat_priv, skb, ethhdr); ret = batadv_gw_out_of_range(bat_priv, skb, ethhdr);
if (ret) if (ret)
goto dropped; goto dropped;
} }
......
...@@ -294,7 +294,7 @@ int unicast_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv) ...@@ -294,7 +294,7 @@ int unicast_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv)
/* get routing information */ /* get routing information */
if (is_multicast_ether_addr(ethhdr->h_dest)) { if (is_multicast_ether_addr(ethhdr->h_dest)) {
orig_node = gw_get_selected_orig(bat_priv); orig_node = batadv_gw_get_selected_orig(bat_priv);
if (orig_node) if (orig_node)
goto find_router; goto find_router;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment