mirror of
https://github.com/torvalds/linux.git
synced 2024-11-12 07:01:57 +00:00
ipv6: introduce IFA_F_STABLE_PRIVACY flag
We need to mark appropriate addresses so we can do retries in case their DAD failed. Cc: Erik Kline <ek@google.com> Cc: Fernando Gont <fgont@si6networks.com> Cc: Lorenzo Colitti <lorenzo@google.com> Cc: YOSHIFUJI Hideaki/吉藤英明 <hideaki.yoshifuji@miraclelinux.com> Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
622c81d57b
commit
64236f3f3d
@ -51,6 +51,7 @@ enum {
|
||||
#define IFA_F_MANAGETEMPADDR 0x100
|
||||
#define IFA_F_NOPREFIXROUTE 0x200
|
||||
#define IFA_F_MCAUTOJOIN 0x400
|
||||
#define IFA_F_STABLE_PRIVACY 0x800
|
||||
|
||||
struct ifa_cacheinfo {
|
||||
__u32 ifa_prefered;
|
||||
|
@ -2199,6 +2199,7 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len, bool sllao)
|
||||
__u32 valid_lft;
|
||||
__u32 prefered_lft;
|
||||
int addr_type;
|
||||
u32 addr_flags = 0;
|
||||
struct inet6_dev *in6_dev;
|
||||
struct net *net = dev_net(dev);
|
||||
|
||||
@ -2309,6 +2310,7 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len, bool sllao)
|
||||
IN6_ADDR_GEN_MODE_STABLE_PRIVACY &&
|
||||
!ipv6_generate_stable_address(&addr, 0,
|
||||
in6_dev)) {
|
||||
addr_flags |= IFA_F_STABLE_PRIVACY;
|
||||
goto ok;
|
||||
} else if (ipv6_generate_eui64(addr.s6_addr + 8, dev) &&
|
||||
ipv6_inherit_eui64(addr.s6_addr + 8, in6_dev)) {
|
||||
@ -2328,7 +2330,6 @@ ok:
|
||||
|
||||
if (ifp == NULL && valid_lft) {
|
||||
int max_addresses = in6_dev->cnf.max_addresses;
|
||||
u32 addr_flags = 0;
|
||||
|
||||
#ifdef CONFIG_IPV6_OPTIMISTIC_DAD
|
||||
if (in6_dev->cnf.optimistic_dad &&
|
||||
@ -2807,10 +2808,11 @@ static void init_loopback(struct net_device *dev)
|
||||
}
|
||||
}
|
||||
|
||||
static void addrconf_add_linklocal(struct inet6_dev *idev, const struct in6_addr *addr)
|
||||
static void addrconf_add_linklocal(struct inet6_dev *idev,
|
||||
const struct in6_addr *addr, u32 flags)
|
||||
{
|
||||
struct inet6_ifaddr *ifp;
|
||||
u32 addr_flags = IFA_F_PERMANENT;
|
||||
u32 addr_flags = flags | IFA_F_PERMANENT;
|
||||
|
||||
#ifdef CONFIG_IPV6_OPTIMISTIC_DAD
|
||||
if (idev->cnf.optimistic_dad &&
|
||||
@ -2818,7 +2820,6 @@ static void addrconf_add_linklocal(struct inet6_dev *idev, const struct in6_addr
|
||||
addr_flags |= IFA_F_OPTIMISTIC;
|
||||
#endif
|
||||
|
||||
|
||||
ifp = ipv6_add_addr(idev, addr, NULL, 64, IFA_LINK, addr_flags,
|
||||
INFINITY_LIFE_TIME, INFINITY_LIFE_TIME);
|
||||
if (!IS_ERR(ifp)) {
|
||||
@ -2916,7 +2917,8 @@ static void addrconf_addr_gen(struct inet6_dev *idev, bool prefix_route)
|
||||
|
||||
if (idev->addr_gen_mode == IN6_ADDR_GEN_MODE_STABLE_PRIVACY) {
|
||||
if (!ipv6_generate_stable_address(&addr, 0, idev))
|
||||
addrconf_add_linklocal(idev, &addr);
|
||||
addrconf_add_linklocal(idev, &addr,
|
||||
IFA_F_STABLE_PRIVACY);
|
||||
else if (prefix_route)
|
||||
addrconf_prefix_route(&addr, 64, idev->dev, 0, 0);
|
||||
} else if (idev->addr_gen_mode == IN6_ADDR_GEN_MODE_EUI64) {
|
||||
@ -2925,7 +2927,7 @@ static void addrconf_addr_gen(struct inet6_dev *idev, bool prefix_route)
|
||||
* couldn't generate one.
|
||||
*/
|
||||
if (ipv6_generate_eui64(addr.s6_addr + 8, idev->dev) == 0)
|
||||
addrconf_add_linklocal(idev, &addr);
|
||||
addrconf_add_linklocal(idev, &addr, 0);
|
||||
else if (prefix_route)
|
||||
addrconf_prefix_route(&addr, 64, idev->dev, 0, 0);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user