Commit 04b482a2 authored by Sven Eckelmann's avatar Sven Eckelmann Committed by Antonio Quartulli

batman-adv: Prefix soft-interface 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 9455e34c
...@@ -71,7 +71,7 @@ static int is_valid_iface(const struct net_device *net_dev) ...@@ -71,7 +71,7 @@ static int is_valid_iface(const struct net_device *net_dev)
return 0; return 0;
/* no batman over batman */ /* no batman over batman */
if (softif_is_valid(net_dev)) if (batadv_softif_is_valid(net_dev))
return 0; return 0;
/* Device is being bridged */ /* Device is being bridged */
...@@ -284,7 +284,7 @@ int batadv_hardif_enable_interface(struct hard_iface *hard_iface, ...@@ -284,7 +284,7 @@ int batadv_hardif_enable_interface(struct hard_iface *hard_iface,
soft_iface = dev_get_by_name(&init_net, iface_name); soft_iface = dev_get_by_name(&init_net, iface_name);
if (!soft_iface) { if (!soft_iface) {
soft_iface = softif_create(iface_name); soft_iface = batadv_softif_create(iface_name);
if (!soft_iface) { if (!soft_iface) {
ret = -ENOMEM; ret = -ENOMEM;
...@@ -295,7 +295,7 @@ int batadv_hardif_enable_interface(struct hard_iface *hard_iface, ...@@ -295,7 +295,7 @@ int batadv_hardif_enable_interface(struct hard_iface *hard_iface,
dev_hold(soft_iface); dev_hold(soft_iface);
} }
if (!softif_is_valid(soft_iface)) { if (!batadv_softif_is_valid(soft_iface)) {
pr_err("Can't create batman mesh interface %s: already exists as regular interface\n", pr_err("Can't create batman mesh interface %s: already exists as regular interface\n",
soft_iface->name); soft_iface->name);
ret = -EINVAL; ret = -EINVAL;
...@@ -396,7 +396,7 @@ void batadv_hardif_disable_interface(struct hard_iface *hard_iface) ...@@ -396,7 +396,7 @@ void batadv_hardif_disable_interface(struct hard_iface *hard_iface)
/* nobody uses this interface anymore */ /* nobody uses this interface anymore */
if (!bat_priv->num_ifaces) if (!bat_priv->num_ifaces)
softif_destroy(hard_iface->soft_iface); batadv_softif_destroy(hard_iface->soft_iface);
hard_iface->soft_iface = NULL; hard_iface->soft_iface = NULL;
hardif_free_ref(hard_iface); hardif_free_ref(hard_iface);
......
...@@ -982,7 +982,8 @@ int batadv_recv_unicast_packet(struct sk_buff *skb, struct hard_iface *recv_if) ...@@ -982,7 +982,8 @@ int batadv_recv_unicast_packet(struct sk_buff *skb, struct hard_iface *recv_if)
/* packet for me */ /* packet for me */
if (is_my_mac(unicast_packet->dest)) { if (is_my_mac(unicast_packet->dest)) {
interface_rx(recv_if->soft_iface, skb, recv_if, hdr_size); batadv_interface_rx(recv_if->soft_iface, skb, recv_if,
hdr_size);
return NET_RX_SUCCESS; return NET_RX_SUCCESS;
} }
...@@ -1018,7 +1019,7 @@ int batadv_recv_ucast_frag_packet(struct sk_buff *skb, ...@@ -1018,7 +1019,7 @@ int batadv_recv_ucast_frag_packet(struct sk_buff *skb,
if (!new_skb) if (!new_skb)
return NET_RX_SUCCESS; return NET_RX_SUCCESS;
interface_rx(recv_if->soft_iface, new_skb, recv_if, batadv_interface_rx(recv_if->soft_iface, new_skb, recv_if,
sizeof(struct unicast_packet)); sizeof(struct unicast_packet));
return NET_RX_SUCCESS; return NET_RX_SUCCESS;
} }
...@@ -1104,7 +1105,7 @@ int batadv_recv_bcast_packet(struct sk_buff *skb, struct hard_iface *recv_if) ...@@ -1104,7 +1105,7 @@ int batadv_recv_bcast_packet(struct sk_buff *skb, struct hard_iface *recv_if)
goto out; goto out;
/* broadcast for me */ /* broadcast for me */
interface_rx(recv_if->soft_iface, skb, recv_if, hdr_size); batadv_interface_rx(recv_if->soft_iface, skb, recv_if, hdr_size);
ret = NET_RX_SUCCESS; ret = NET_RX_SUCCESS;
goto out; goto out;
......
...@@ -51,7 +51,7 @@ int batadv_send_skb_packet(struct sk_buff *skb, struct hard_iface *hard_iface, ...@@ -51,7 +51,7 @@ int batadv_send_skb_packet(struct sk_buff *skb, struct hard_iface *hard_iface,
} }
/* push to the ethernet header. */ /* push to the ethernet header. */
if (my_skb_head_push(skb, ETH_HLEN) < 0) if (batadv_skb_head_push(skb, ETH_HLEN) < 0)
goto send_skb_err; goto send_skb_err;
skb_reset_mac_header(skb); skb_reset_mac_header(skb);
......
...@@ -61,7 +61,7 @@ static const struct ethtool_ops bat_ethtool_ops = { ...@@ -61,7 +61,7 @@ static const struct ethtool_ops bat_ethtool_ops = {
.get_sset_count = batadv_get_sset_count, .get_sset_count = batadv_get_sset_count,
}; };
int my_skb_head_push(struct sk_buff *skb, unsigned int len) int batadv_skb_head_push(struct sk_buff *skb, unsigned int len)
{ {
int result; int result;
...@@ -204,7 +204,7 @@ static int interface_tx(struct sk_buff *skb, struct net_device *soft_iface) ...@@ -204,7 +204,7 @@ static int interface_tx(struct sk_buff *skb, struct net_device *soft_iface)
if (!primary_if) if (!primary_if)
goto dropped; goto dropped;
if (my_skb_head_push(skb, sizeof(*bcast_packet)) < 0) if (batadv_skb_head_push(skb, sizeof(*bcast_packet)) < 0)
goto dropped; goto dropped;
bcast_packet = (struct bcast_packet *)skb->data; bcast_packet = (struct bcast_packet *)skb->data;
...@@ -256,7 +256,7 @@ static int interface_tx(struct sk_buff *skb, struct net_device *soft_iface) ...@@ -256,7 +256,7 @@ static int interface_tx(struct sk_buff *skb, struct net_device *soft_iface)
return NETDEV_TX_OK; return NETDEV_TX_OK;
} }
void interface_rx(struct net_device *soft_iface, void batadv_interface_rx(struct net_device *soft_iface,
struct sk_buff *skb, struct hard_iface *recv_if, struct sk_buff *skb, struct hard_iface *recv_if,
int hdr_size) int hdr_size)
{ {
...@@ -357,7 +357,7 @@ static void interface_setup(struct net_device *dev) ...@@ -357,7 +357,7 @@ static void interface_setup(struct net_device *dev)
memset(priv, 0, sizeof(*priv)); memset(priv, 0, sizeof(*priv));
} }
struct net_device *softif_create(const char *name) struct net_device *batadv_softif_create(const char *name)
{ {
struct net_device *soft_iface; struct net_device *soft_iface;
struct bat_priv *bat_priv; struct bat_priv *bat_priv;
...@@ -445,7 +445,7 @@ struct net_device *softif_create(const char *name) ...@@ -445,7 +445,7 @@ struct net_device *softif_create(const char *name)
return NULL; return NULL;
} }
void softif_destroy(struct net_device *soft_iface) void batadv_softif_destroy(struct net_device *soft_iface)
{ {
batadv_debugfs_del_meshif(soft_iface); batadv_debugfs_del_meshif(soft_iface);
batadv_sysfs_del_meshif(soft_iface); batadv_sysfs_del_meshif(soft_iface);
...@@ -453,7 +453,7 @@ void softif_destroy(struct net_device *soft_iface) ...@@ -453,7 +453,7 @@ void softif_destroy(struct net_device *soft_iface)
unregister_netdevice(soft_iface); unregister_netdevice(soft_iface);
} }
int softif_is_valid(const struct net_device *net_dev) int batadv_softif_is_valid(const struct net_device *net_dev)
{ {
if (net_dev->netdev_ops->ndo_start_xmit == interface_tx) if (net_dev->netdev_ops->ndo_start_xmit == interface_tx)
return 1; return 1;
......
...@@ -22,12 +22,11 @@ ...@@ -22,12 +22,11 @@
#ifndef _NET_BATMAN_ADV_SOFT_INTERFACE_H_ #ifndef _NET_BATMAN_ADV_SOFT_INTERFACE_H_
#define _NET_BATMAN_ADV_SOFT_INTERFACE_H_ #define _NET_BATMAN_ADV_SOFT_INTERFACE_H_
int my_skb_head_push(struct sk_buff *skb, unsigned int len); int batadv_skb_head_push(struct sk_buff *skb, unsigned int len);
void interface_rx(struct net_device *soft_iface, void batadv_interface_rx(struct net_device *soft_iface, struct sk_buff *skb,
struct sk_buff *skb, struct hard_iface *recv_if, struct hard_iface *recv_if, int hdr_size);
int hdr_size); struct net_device *batadv_softif_create(const char *name);
struct net_device *softif_create(const char *name); void batadv_softif_destroy(struct net_device *soft_iface);
void softif_destroy(struct net_device *soft_iface); int batadv_softif_is_valid(const struct net_device *net_dev);
int softif_is_valid(const struct net_device *net_dev);
#endif /* _NET_BATMAN_ADV_SOFT_INTERFACE_H_ */ #endif /* _NET_BATMAN_ADV_SOFT_INTERFACE_H_ */
...@@ -242,8 +242,8 @@ int frag_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv, ...@@ -242,8 +242,8 @@ int frag_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv,
memcpy(&tmp_uc, unicast_packet, uc_hdr_len); memcpy(&tmp_uc, unicast_packet, uc_hdr_len);
skb_split(skb, frag_skb, data_len / 2 + uc_hdr_len); skb_split(skb, frag_skb, data_len / 2 + uc_hdr_len);
if (my_skb_head_push(skb, ucf_hdr_len - uc_hdr_len) < 0 || if (batadv_skb_head_push(skb, ucf_hdr_len - uc_hdr_len) < 0 ||
my_skb_head_push(frag_skb, ucf_hdr_len) < 0) batadv_skb_head_push(frag_skb, ucf_hdr_len) < 0)
goto drop_frag; goto drop_frag;
frag1 = (struct unicast_frag_packet *)skb->data; frag1 = (struct unicast_frag_packet *)skb->data;
...@@ -314,7 +314,7 @@ int unicast_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv) ...@@ -314,7 +314,7 @@ int unicast_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv)
if (!neigh_node) if (!neigh_node)
goto out; goto out;
if (my_skb_head_push(skb, sizeof(*unicast_packet)) < 0) if (batadv_skb_head_push(skb, sizeof(*unicast_packet)) < 0)
goto out; goto out;
unicast_packet = (struct unicast_packet *)skb->data; unicast_packet = (struct unicast_packet *)skb->data;
......
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