]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
ipv6: introduce IFA_F_STABLE_PRIVACY flag
authorHannes Frederic Sowa <hannes@stressinduktion.org>
Mon, 23 Mar 2015 22:36:02 +0000 (23:36 +0100)
committerDavid S. Miller <davem@davemloft.net>
Tue, 24 Mar 2015 02:12:09 +0000 (22:12 -0400)
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>
include/uapi/linux/if_addr.h
net/ipv6/addrconf.c

index 40fdfea39714cd0365037dc462b86165da7f4cea..4318ab1635cedfc65a14f969fdb0077e4b984f74 100644 (file)
@@ -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;
index 6813268ce8b8adea80cd5a6a53fda6cecf7dc9b8..c2357b6f62ddfdd13bb197fbad293e37fd3b86b8 100644 (file)
@@ -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);
        }