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

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
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -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);
+5 −4
Original line number Diff line number Diff line
@@ -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,7 +1019,7 @@ 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,
		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;

+1 −1
Original line number Diff line number Diff line
@@ -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);
+8 −8
Original line number Diff line number Diff line
@@ -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,7 +256,7 @@ end:
	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,
			 int hdr_size)
{
@@ -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 @@ out:
	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;
+6 −7
Original line number Diff line number Diff line
@@ -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_ */
Loading