diff options
-rw-r--r-- | net/ipv6/addrconf.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 524bffe62499..7a2a71536b5d 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -1842,6 +1842,7 @@ static int inet6_addr_add(int ifindex, struct in6_addr *pfx, int plen, | |||
1842 | struct inet6_dev *idev; | 1842 | struct inet6_dev *idev; |
1843 | struct net_device *dev; | 1843 | struct net_device *dev; |
1844 | int scope; | 1844 | int scope; |
1845 | u32 flags = RTF_EXPIRES; | ||
1845 | 1846 | ||
1846 | ASSERT_RTNL(); | 1847 | ASSERT_RTNL(); |
1847 | 1848 | ||
@@ -1857,9 +1858,10 @@ static int inet6_addr_add(int ifindex, struct in6_addr *pfx, int plen, | |||
1857 | 1858 | ||
1858 | scope = ipv6_addr_scope(pfx); | 1859 | scope = ipv6_addr_scope(pfx); |
1859 | 1860 | ||
1860 | if (valid_lft == INFINITY_LIFE_TIME) | 1861 | if (valid_lft == INFINITY_LIFE_TIME) { |
1861 | ifa_flags |= IFA_F_PERMANENT; | 1862 | ifa_flags |= IFA_F_PERMANENT; |
1862 | else if (valid_lft >= 0x7FFFFFFF/HZ) | 1863 | flags = 0; |
1864 | } else if (valid_lft >= 0x7FFFFFFF/HZ) | ||
1863 | valid_lft = 0x7FFFFFFF/HZ; | 1865 | valid_lft = 0x7FFFFFFF/HZ; |
1864 | 1866 | ||
1865 | if (prefered_lft == 0) | 1867 | if (prefered_lft == 0) |
@@ -1877,6 +1879,8 @@ static int inet6_addr_add(int ifindex, struct in6_addr *pfx, int plen, | |||
1877 | ifp->tstamp = jiffies; | 1879 | ifp->tstamp = jiffies; |
1878 | spin_unlock_bh(&ifp->lock); | 1880 | spin_unlock_bh(&ifp->lock); |
1879 | 1881 | ||
1882 | addrconf_prefix_route(&ifp->addr, ifp->prefix_len, dev, | ||
1883 | jiffies_to_clock_t(valid_lft * HZ), flags); | ||
1880 | addrconf_dad_start(ifp, 0); | 1884 | addrconf_dad_start(ifp, 0); |
1881 | in6_ifa_put(ifp); | 1885 | in6_ifa_put(ifp); |
1882 | addrconf_verify(0); | 1886 | addrconf_verify(0); |
@@ -2056,6 +2060,7 @@ static void addrconf_add_linklocal(struct inet6_dev *idev, struct in6_addr *addr | |||
2056 | 2060 | ||
2057 | ifp = ipv6_add_addr(idev, addr, 64, IFA_LINK, IFA_F_PERMANENT); | 2061 | ifp = ipv6_add_addr(idev, addr, 64, IFA_LINK, IFA_F_PERMANENT); |
2058 | if (!IS_ERR(ifp)) { | 2062 | if (!IS_ERR(ifp)) { |
2063 | addrconf_prefix_route(&ifp->addr, ifp->prefix_len, idev->dev, 0, 0); | ||
2059 | addrconf_dad_start(ifp, 0); | 2064 | addrconf_dad_start(ifp, 0); |
2060 | in6_ifa_put(ifp); | 2065 | in6_ifa_put(ifp); |
2061 | } | 2066 | } |
@@ -2470,10 +2475,6 @@ static void addrconf_dad_start(struct inet6_ifaddr *ifp, u32 flags) | |||
2470 | 2475 | ||
2471 | addrconf_join_solict(dev, &ifp->addr); | 2476 | addrconf_join_solict(dev, &ifp->addr); |
2472 | 2477 | ||
2473 | if (ifp->prefix_len != 128 && (ifp->flags&IFA_F_PERMANENT)) | ||
2474 | addrconf_prefix_route(&ifp->addr, ifp->prefix_len, dev, 0, | ||
2475 | flags); | ||
2476 | |||
2477 | net_srandom(ifp->addr.s6_addr32[3]); | 2478 | net_srandom(ifp->addr.s6_addr32[3]); |
2478 | 2479 | ||
2479 | read_lock_bh(&idev->lock); | 2480 | read_lock_bh(&idev->lock); |
@@ -2904,12 +2905,15 @@ inet6_rtm_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) | |||
2904 | static int inet6_addr_modify(struct inet6_ifaddr *ifp, u8 ifa_flags, | 2905 | static int inet6_addr_modify(struct inet6_ifaddr *ifp, u8 ifa_flags, |
2905 | u32 prefered_lft, u32 valid_lft) | 2906 | u32 prefered_lft, u32 valid_lft) |
2906 | { | 2907 | { |
2908 | u32 flags = RTF_EXPIRES; | ||
2909 | |||
2907 | if (!valid_lft || (prefered_lft > valid_lft)) | 2910 | if (!valid_lft || (prefered_lft > valid_lft)) |
2908 | return -EINVAL; | 2911 | return -EINVAL; |
2909 | 2912 | ||
2910 | if (valid_lft == INFINITY_LIFE_TIME) | 2913 | if (valid_lft == INFINITY_LIFE_TIME) { |
2911 | ifa_flags |= IFA_F_PERMANENT; | 2914 | ifa_flags |= IFA_F_PERMANENT; |
2912 | else if (valid_lft >= 0x7FFFFFFF/HZ) | 2915 | flags = 0; |
2916 | } else if (valid_lft >= 0x7FFFFFFF/HZ) | ||
2913 | valid_lft = 0x7FFFFFFF/HZ; | 2917 | valid_lft = 0x7FFFFFFF/HZ; |
2914 | 2918 | ||
2915 | if (prefered_lft == 0) | 2919 | if (prefered_lft == 0) |
@@ -2928,6 +2932,8 @@ static int inet6_addr_modify(struct inet6_ifaddr *ifp, u8 ifa_flags, | |||
2928 | if (!(ifp->flags&IFA_F_TENTATIVE)) | 2932 | if (!(ifp->flags&IFA_F_TENTATIVE)) |
2929 | ipv6_ifa_notify(0, ifp); | 2933 | ipv6_ifa_notify(0, ifp); |
2930 | 2934 | ||
2935 | addrconf_prefix_route(&ifp->addr, ifp->prefix_len, ifp->idev->dev, | ||
2936 | jiffies_to_clock_t(valid_lft * HZ), flags); | ||
2931 | addrconf_verify(0); | 2937 | addrconf_verify(0); |
2932 | 2938 | ||
2933 | return 0; | 2939 | return 0; |