diff options
author | Yasushi Asano <yasushi.asano@jp.fujitsu.com> | 2013-12-30 22:04:19 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-01-02 19:34:40 -0500 |
commit | fad8da3e085ddf5e661090033287f1a5d62858fc (patch) | |
tree | 0fe549cf177e560ace8ae557fc138d6355726803 | |
parent | 4d231b76eef6c4a6bd9c96769e191517765942cb (diff) |
ipv6 addrconf: fix preferred lifetime state-changing behavior while valid_lft is infinity
Fixed a problem with setting the lifetime of an IPv6
address. When setting preferred_lft to a value not zero or
infinity, while valid_lft is infinity(0xffffffff) preferred
lifetime is set to forever and does not update. Therefore
preferred lifetime never becomes deprecated. valid lifetime
and preferred lifetime should be set independently, even if
valid lifetime is infinity, preferred lifetime must expire
correctly (meaning it must eventually become deprecated)
Signed-off-by: Yasushi Asano <yasushi.asano@jp.fujitsu.com>
Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/ipv6/addrconf.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index d5fa5b8c443e..1a341f74aa3f 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -3456,7 +3456,12 @@ restart: | |||
3456 | &inet6_addr_lst[i], addr_lst) { | 3456 | &inet6_addr_lst[i], addr_lst) { |
3457 | unsigned long age; | 3457 | unsigned long age; |
3458 | 3458 | ||
3459 | if (ifp->flags & IFA_F_PERMANENT) | 3459 | /* When setting preferred_lft to a value not zero or |
3460 | * infinity, while valid_lft is infinity | ||
3461 | * IFA_F_PERMANENT has a non-infinity life time. | ||
3462 | */ | ||
3463 | if ((ifp->flags & IFA_F_PERMANENT) && | ||
3464 | (ifp->prefered_lft == INFINITY_LIFE_TIME)) | ||
3460 | continue; | 3465 | continue; |
3461 | 3466 | ||
3462 | spin_lock(&ifp->lock); | 3467 | spin_lock(&ifp->lock); |
@@ -3481,7 +3486,8 @@ restart: | |||
3481 | ifp->flags |= IFA_F_DEPRECATED; | 3486 | ifp->flags |= IFA_F_DEPRECATED; |
3482 | } | 3487 | } |
3483 | 3488 | ||
3484 | if (time_before(ifp->tstamp + ifp->valid_lft * HZ, next)) | 3489 | if ((ifp->valid_lft != INFINITY_LIFE_TIME) && |
3490 | (time_before(ifp->tstamp + ifp->valid_lft * HZ, next))) | ||
3485 | next = ifp->tstamp + ifp->valid_lft * HZ; | 3491 | next = ifp->tstamp + ifp->valid_lft * HZ; |
3486 | 3492 | ||
3487 | spin_unlock(&ifp->lock); | 3493 | spin_unlock(&ifp->lock); |
@@ -3761,7 +3767,8 @@ static int inet6_fill_ifaddr(struct sk_buff *skb, struct inet6_ifaddr *ifa, | |||
3761 | put_ifaddrmsg(nlh, ifa->prefix_len, ifa->flags, rt_scope(ifa->scope), | 3767 | put_ifaddrmsg(nlh, ifa->prefix_len, ifa->flags, rt_scope(ifa->scope), |
3762 | ifa->idev->dev->ifindex); | 3768 | ifa->idev->dev->ifindex); |
3763 | 3769 | ||
3764 | if (!(ifa->flags&IFA_F_PERMANENT)) { | 3770 | if (!((ifa->flags&IFA_F_PERMANENT) && |
3771 | (ifa->prefered_lft == INFINITY_LIFE_TIME))) { | ||
3765 | preferred = ifa->prefered_lft; | 3772 | preferred = ifa->prefered_lft; |
3766 | valid = ifa->valid_lft; | 3773 | valid = ifa->valid_lft; |
3767 | if (preferred != INFINITY_LIFE_TIME) { | 3774 | if (preferred != INFINITY_LIFE_TIME) { |