]> git.karo-electronics.de Git - linux-beck.git/commitdiff
neigh: ipv6: respect default values set before an address is assigned to device
authorJiri Pirko <jiri@resnulli.us>
Sat, 7 Dec 2013 18:26:57 +0000 (19:26 +0100)
committerDavid S. Miller <davem@davemloft.net>
Tue, 10 Dec 2013 01:56:12 +0000 (20:56 -0500)
Make the behaviour similar to ipv4. This will allow user to set sysctl
default neigh param values and these values will be respected even by
devices registered before (that ones what do not have address set yet).

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

index e70278eef12a79da44b5b5ebf1f50489406ce1c1..66c4a44d8f5cb22a6a9aca1454d422775fc67034 100644 (file)
@@ -248,6 +248,13 @@ static inline struct inet6_dev *in6_dev_get(const struct net_device *dev)
        return idev;
 }
 
+static inline struct neigh_parms *__in6_dev_nd_parms_get_rcu(const struct net_device *dev)
+{
+       struct inet6_dev *idev = __in6_dev_get(dev);
+
+       return idev ? idev->nd_parms : NULL;
+}
+
 void in6_dev_finish_destroy(struct inet6_dev *idev);
 
 static inline void in6_dev_put(struct inet6_dev *idev)
index c4a7879bfb150c9a005c4928cdad3e6833d72623..ce2b77515a9e38ec1fc8baed84ae12f40374b335 100644 (file)
@@ -39,6 +39,7 @@
 #include <linux/string.h>
 #include <linux/log2.h>
 #include <linux/inetdevice.h>
+#include <net/addrconf.h>
 
 #define DEBUG
 #define NEIGH_DEBUG 1
@@ -2819,8 +2820,12 @@ static int proc_unres_qlen(struct ctl_table *ctl, int write,
 static struct neigh_parms *neigh_get_dev_parms_rcu(struct net_device *dev,
                                                   int family)
 {
-       if (family == AF_INET)
+       switch (family) {
+       case AF_INET:
                return __in_dev_arp_parms_get_rcu(dev);
+       case AF_INET6:
+               return __in6_dev_nd_parms_get_rcu(dev);
+       }
        return NULL;
 }
 
index ea8a475fa8c5d4356a90338339c064d886c9e701..be4dbbd17d3be93a5689fa1a33842bee1095df1c 100644 (file)
@@ -834,6 +834,8 @@ ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr,
                goto out;
        }
 
+       neigh_parms_data_state_setall(idev->nd_parms);
+
        ifa->addr = *addr;
        if (peer_addr)
                ifa->peer_addr = *peer_addr;