Commit bba24896f022d4d239494bebf18e713cd8aec7a5
Committed by
David S. Miller
1 parent
1d4c8c2984
Exists in
smarc-imx_3.14.28_1.0.0_ga
and in
1 other branch
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 |