mirror of https://gitee.com/openkylin/linux.git
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: David Miller <davem@davemloft.net> Signed-off-by: Sven Eckelmann <sven@narfation.org>
This commit is contained in:
parent
9455e34cb2
commit
04b482a21a
|
@ -71,7 +71,7 @@ static int is_valid_iface(const struct net_device *net_dev)
|
|||
return 0;
|
||||
|
||||
/* no batman over batman */
|
||||
if (softif_is_valid(net_dev))
|
||||
if (batadv_softif_is_valid(net_dev))
|
||||
return 0;
|
||||
|
||||
/* Device is being bridged */
|
||||
|
@ -284,7 +284,7 @@ int batadv_hardif_enable_interface(struct hard_iface *hard_iface,
|
|||
soft_iface = dev_get_by_name(&init_net, iface_name);
|
||||
|
||||
if (!soft_iface) {
|
||||
soft_iface = softif_create(iface_name);
|
||||
soft_iface = batadv_softif_create(iface_name);
|
||||
|
||||
if (!soft_iface) {
|
||||
ret = -ENOMEM;
|
||||
|
@ -295,7 +295,7 @@ int batadv_hardif_enable_interface(struct hard_iface *hard_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",
|
||||
soft_iface->name);
|
||||
ret = -EINVAL;
|
||||
|
@ -396,7 +396,7 @@ void batadv_hardif_disable_interface(struct hard_iface *hard_iface)
|
|||
|
||||
/* nobody uses this interface anymore */
|
||||
if (!bat_priv->num_ifaces)
|
||||
softif_destroy(hard_iface->soft_iface);
|
||||
batadv_softif_destroy(hard_iface->soft_iface);
|
||||
|
||||
hard_iface->soft_iface = NULL;
|
||||
hardif_free_ref(hard_iface);
|
||||
|
|
|
@ -982,7 +982,8 @@ int batadv_recv_unicast_packet(struct sk_buff *skb, struct hard_iface *recv_if)
|
|||
|
||||
/* packet for me */
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -1018,8 +1019,8 @@ int batadv_recv_ucast_frag_packet(struct sk_buff *skb,
|
|||
if (!new_skb)
|
||||
return NET_RX_SUCCESS;
|
||||
|
||||
interface_rx(recv_if->soft_iface, new_skb, recv_if,
|
||||
sizeof(struct unicast_packet));
|
||||
batadv_interface_rx(recv_if->soft_iface, new_skb, recv_if,
|
||||
sizeof(struct unicast_packet));
|
||||
return NET_RX_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -1104,7 +1105,7 @@ int batadv_recv_bcast_packet(struct sk_buff *skb, struct hard_iface *recv_if)
|
|||
goto out;
|
||||
|
||||
/* 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;
|
||||
goto out;
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ int batadv_send_skb_packet(struct sk_buff *skb, struct hard_iface *hard_iface,
|
|||
}
|
||||
|
||||
/* 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;
|
||||
|
||||
skb_reset_mac_header(skb);
|
||||
|
|
|
@ -61,7 +61,7 @@ static const struct ethtool_ops bat_ethtool_ops = {
|
|||
.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;
|
||||
|
||||
|
@ -204,7 +204,7 @@ static int interface_tx(struct sk_buff *skb, struct net_device *soft_iface)
|
|||
if (!primary_if)
|
||||
goto dropped;
|
||||
|
||||
if (my_skb_head_push(skb, sizeof(*bcast_packet)) < 0)
|
||||
if (batadv_skb_head_push(skb, sizeof(*bcast_packet)) < 0)
|
||||
goto dropped;
|
||||
|
||||
bcast_packet = (struct bcast_packet *)skb->data;
|
||||
|
@ -256,9 +256,9 @@ static int interface_tx(struct sk_buff *skb, struct net_device *soft_iface)
|
|||
return NETDEV_TX_OK;
|
||||
}
|
||||
|
||||
void interface_rx(struct net_device *soft_iface,
|
||||
struct sk_buff *skb, struct hard_iface *recv_if,
|
||||
int hdr_size)
|
||||
void batadv_interface_rx(struct net_device *soft_iface,
|
||||
struct sk_buff *skb, struct hard_iface *recv_if,
|
||||
int hdr_size)
|
||||
{
|
||||
struct bat_priv *bat_priv = netdev_priv(soft_iface);
|
||||
struct ethhdr *ethhdr;
|
||||
|
@ -357,7 +357,7 @@ static void interface_setup(struct net_device *dev)
|
|||
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 bat_priv *bat_priv;
|
||||
|
@ -445,7 +445,7 @@ struct net_device *softif_create(const char *name)
|
|||
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_sysfs_del_meshif(soft_iface);
|
||||
|
@ -453,7 +453,7 @@ void softif_destroy(struct net_device *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)
|
||||
return 1;
|
||||
|
|
|
@ -22,12 +22,11 @@
|
|||
#ifndef _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);
|
||||
void interface_rx(struct net_device *soft_iface,
|
||||
struct sk_buff *skb, struct hard_iface *recv_if,
|
||||
int hdr_size);
|
||||
struct net_device *softif_create(const char *name);
|
||||
void softif_destroy(struct net_device *soft_iface);
|
||||
int softif_is_valid(const struct net_device *net_dev);
|
||||
int batadv_skb_head_push(struct sk_buff *skb, unsigned int len);
|
||||
void batadv_interface_rx(struct net_device *soft_iface, struct sk_buff *skb,
|
||||
struct hard_iface *recv_if, int hdr_size);
|
||||
struct net_device *batadv_softif_create(const char *name);
|
||||
void batadv_softif_destroy(struct net_device *soft_iface);
|
||||
int batadv_softif_is_valid(const struct net_device *net_dev);
|
||||
|
||||
#endif /* _NET_BATMAN_ADV_SOFT_INTERFACE_H_ */
|
||||
|
|
|
@ -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);
|
||||
skb_split(skb, frag_skb, data_len / 2 + uc_hdr_len);
|
||||
|
||||
if (my_skb_head_push(skb, ucf_hdr_len - uc_hdr_len) < 0 ||
|
||||
my_skb_head_push(frag_skb, ucf_hdr_len) < 0)
|
||||
if (batadv_skb_head_push(skb, ucf_hdr_len - uc_hdr_len) < 0 ||
|
||||
batadv_skb_head_push(frag_skb, ucf_hdr_len) < 0)
|
||||
goto drop_frag;
|
||||
|
||||
frag1 = (struct unicast_frag_packet *)skb->data;
|
||||
|
@ -314,7 +314,7 @@ int unicast_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv)
|
|||
if (!neigh_node)
|
||||
goto out;
|
||||
|
||||
if (my_skb_head_push(skb, sizeof(*unicast_packet)) < 0)
|
||||
if (batadv_skb_head_push(skb, sizeof(*unicast_packet)) < 0)
|
||||
goto out;
|
||||
|
||||
unicast_packet = (struct unicast_packet *)skb->data;
|
||||
|
|
Loading…
Reference in New Issue