Commit bba24896f022d4d239494bebf18e713cd8aec7a5

Authored by Jiri Pirko
Committed by David S. Miller
1 parent 1d4c8c2984

neigh: ipv6: respect default values set before an address is assigned to device

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>

Showing 3 changed files with 15 additions and 1 deletions Side-by-side Diff

include/net/addrconf.h
... ... @@ -248,6 +248,13 @@
248 248 return idev;
249 249 }
250 250  
  251 +static inline struct neigh_parms *__in6_dev_nd_parms_get_rcu(const struct net_device *dev)
  252 +{
  253 + struct inet6_dev *idev = __in6_dev_get(dev);
  254 +
  255 + return idev ? idev->nd_parms : NULL;
  256 +}
  257 +
251 258 void in6_dev_finish_destroy(struct inet6_dev *idev);
252 259  
253 260 static inline void in6_dev_put(struct inet6_dev *idev)
net/core/neighbour.c
... ... @@ -39,6 +39,7 @@
39 39 #include <linux/string.h>
40 40 #include <linux/log2.h>
41 41 #include <linux/inetdevice.h>
  42 +#include <net/addrconf.h>
42 43  
43 44 #define DEBUG
44 45 #define NEIGH_DEBUG 1
45 46  
... ... @@ -2819,8 +2820,12 @@
2819 2820 static struct neigh_parms *neigh_get_dev_parms_rcu(struct net_device *dev,
2820 2821 int family)
2821 2822 {
2822   - if (family == AF_INET)
  2823 + switch (family) {
  2824 + case AF_INET:
2823 2825 return __in_dev_arp_parms_get_rcu(dev);
  2826 + case AF_INET6:
  2827 + return __in6_dev_nd_parms_get_rcu(dev);
  2828 + }
2824 2829 return NULL;
2825 2830 }
2826 2831  
... ... @@ -834,6 +834,8 @@
834 834 goto out;
835 835 }
836 836  
  837 + neigh_parms_data_state_setall(idev->nd_parms);
  838 +
837 839 ifa->addr = *addr;
838 840 if (peer_addr)
839 841 ifa->peer_addr = *peer_addr;