batman-adv: Prefix soft-interface non-static functions with batadv_
authorSven Eckelmann <sven@narfation.org>
Sat, 12 May 2012 00:09:38 +0000 (02:09 +0200)
committerAntonio Quartulli <ordex@autistici.org>
Wed, 20 Jun 2012 20:15:28 +0000 (22:15 +0200)
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>
net/batman-adv/hard-interface.c
net/batman-adv/routing.c
net/batman-adv/send.c
net/batman-adv/soft-interface.c
net/batman-adv/soft-interface.h
net/batman-adv/unicast.c

index 7392ae28114d1e97d88868dd7409125f69f6fedc..93acf2be77597e9bdcf6587cc90c9e705198a4ec 100644 (file)
@@ -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);
index d7d05b22cc0db6ee08866d4e7f1c3fb67388633a..0e982218e6307db9572d801a8e99a14980c63e39 100644 (file)
@@ -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;
 
index bceb3d72e5c3585fc0e628b7fb78cdb9163dca73..8226b1cf05eb1d3ce6bb0ad8529e8edac7ba0c60 100644 (file)
@@ -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);
index e15d474bd0b06eacb8e457f4d9c04c016f4a5b6e..cbc36f0ec242dfbfbf31f8bd251adf97b333a704 100644 (file)
@@ -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 @@ end:
        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 @@ 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;
index 0203006738847b0795663848341360df6d507eb1..7e2bfafbcb7953bbb9281482cc5a29b9c81a1e88 100644 (file)
 #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_ */
index 6bb3bb9f843fffceaf4d4148cd876fb8519c9b23..52179c8ae9bd6688ba8d5ea2b5e7073732459f4a 100644 (file)
@@ -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 @@ find_router:
        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;