neigh: use NEIGH_VAR_INIT in ndo_neigh_setup functions.
authorJiri Pirko <jiri@resnulli.us>
Thu, 9 Jan 2014 13:13:47 +0000 (14:13 +0100)
committerDavid S. Miller <davem@davemloft.net>
Thu, 16 Jan 2014 19:31:58 +0000 (11:31 -0800)
When ndo_neigh_setup is called, the bitfield used by NEIGH_VAR_SET is
not initialized yet. This might cause confusion for the people who use
NEIGH_VAR_SET in ndo_neigh_setup. So rather introduce NEIGH_VAR_INIT for
usage in ndo_neigh_setup.

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/neighbour.h
net/802/hippi.c

index 4c09bd23b8329bd2abad4c6e317d54ebba92d8bb..7277caf3743d269b8e547178c3ae7f58fbbd28e0 100644 (file)
@@ -92,6 +92,11 @@ static inline void neigh_var_set(struct neigh_parms *p, int index, int val)
 }
 
 #define NEIGH_VAR(p, attr) ((p)->data[NEIGH_VAR_ ## attr])
+
+/* In ndo_neigh_setup, NEIGH_VAR_INIT should be used.
+ * In other cases, NEIGH_VAR_SET should be used.
+ */
+#define NEIGH_VAR_INIT(p, attr, val) (NEIGH_VAR(p, attr) = val)
 #define NEIGH_VAR_SET(p, attr, val) neigh_var_set(p, NEIGH_VAR_ ## attr, val)
 
 static inline void neigh_parms_data_state_setall(struct neigh_parms *p)
index a97a3bde77bb8b8d6a83c7c5407343553db36f7f..5ff2a718ddcac1624809f563f5dfc12d5cad46f9 100644 (file)
@@ -172,14 +172,14 @@ EXPORT_SYMBOL(hippi_mac_addr);
 int hippi_neigh_setup_dev(struct net_device *dev, struct neigh_parms *p)
 {
        /* Never send broadcast/multicast ARP messages */
-       NEIGH_VAR_SET(p, MCAST_PROBES, 0);
+       NEIGH_VAR_INIT(p, MCAST_PROBES, 0);
 
        /* In IPv6 unicast probes are valid even on NBMA,
        * because they are encapsulated in normal IPv6 protocol.
        * Should be a generic flag.
        */
        if (p->tbl->family != AF_INET6)
-               NEIGH_VAR_SET(p, UCAST_PROBES, 0);
+               NEIGH_VAR_INIT(p, UCAST_PROBES, 0);
        return 0;
 }
 EXPORT_SYMBOL(hippi_neigh_setup_dev);