aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/addrconf.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv6/addrconf.c')
-rw-r--r--net/ipv6/addrconf.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 5ab9973571ef..87f688857ade 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -776,6 +776,7 @@ static int ipv6_create_tempaddr(struct inet6_ifaddr *ifp, struct inet6_ifaddr *i
776 struct inet6_dev *idev = ifp->idev; 776 struct inet6_dev *idev = ifp->idev;
777 struct in6_addr addr, *tmpaddr; 777 struct in6_addr addr, *tmpaddr;
778 unsigned long tmp_prefered_lft, tmp_valid_lft, tmp_cstamp, tmp_tstamp; 778 unsigned long tmp_prefered_lft, tmp_valid_lft, tmp_cstamp, tmp_tstamp;
779 unsigned long regen_advance;
779 int tmp_plen; 780 int tmp_plen;
780 int ret = 0; 781 int ret = 0;
781 int max_addresses; 782 int max_addresses;
@@ -836,8 +837,23 @@ retry:
836 tmp_tstamp = ifp->tstamp; 837 tmp_tstamp = ifp->tstamp;
837 spin_unlock_bh(&ifp->lock); 838 spin_unlock_bh(&ifp->lock);
838 839
840 regen_advance = idev->cnf.regen_max_retry *
841 idev->cnf.dad_transmits *
842 idev->nd_parms->retrans_time / HZ;
839 write_unlock(&idev->lock); 843 write_unlock(&idev->lock);
840 844
845 /* A temporary address is created only if this calculated Preferred
846 * Lifetime is greater than REGEN_ADVANCE time units. In particular,
847 * an implementation must not create a temporary address with a zero
848 * Preferred Lifetime.
849 */
850 if (tmp_prefered_lft <= regen_advance) {
851 in6_ifa_put(ifp);
852 in6_dev_put(idev);
853 ret = -1;
854 goto out;
855 }
856
841 addr_flags = IFA_F_TEMPORARY; 857 addr_flags = IFA_F_TEMPORARY;
842 /* set in addrconf_prefix_rcv() */ 858 /* set in addrconf_prefix_rcv() */
843 if (ifp->flags & IFA_F_OPTIMISTIC) 859 if (ifp->flags & IFA_F_OPTIMISTIC)
@@ -1834,6 +1850,9 @@ ok:
1834 * lifetimes of an existing temporary address 1850 * lifetimes of an existing temporary address
1835 * when processing a Prefix Information Option. 1851 * when processing a Prefix Information Option.
1836 */ 1852 */
1853 if (ifp != ift->ifpub)
1854 continue;
1855
1837 spin_lock(&ift->lock); 1856 spin_lock(&ift->lock);
1838 flags = ift->flags; 1857 flags = ift->flags;
1839 if (ift->valid_lft > valid_lft && 1858 if (ift->valid_lft > valid_lft &&