Skip to contentSkip to conversation

IPv6: Fix temporary address support (updated)

PATCH New Benoit Boissinot 3 participants 7 messages Apr 1, 2008 – Apr 2, 2008

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 IPv6: Fix temporary address support (updated)

This two patches are the patches Yoshfuji said he agreed, I fixed his comments.

regards,

Benoit

#1 lore raw

PATCH 1/1 IPv6: do not create temporary adresses with too short preferred lifetime

IPv6: do not create temporary adresses with too short preferred lifetime

Quoted 1 line

From RFC341:

A temporary address is created only if this calculated Preferred Lifetime is greater than REGEN_ADVANCE time units. In particular, an implementation must not create a temporary address with a zero Preferred Lifetime.

net/ipv6/addrconf.c +16 -0
diff -r 0c33481968e0 -r 00affc24c178 net/ipv6/addrconf.c
@@ -776,6 +776,7 @@
 	struct inet6_dev *idev = ifp->idev;
 	struct in6_addr addr, *tmpaddr;
 	unsigned long tmp_prefered_lft, tmp_valid_lft, tmp_cstamp, tmp_tstamp;
+	unsigned long regen_advance;
 	int tmp_plen;
 	int ret = 0;
 	int max_addresses;
@@ -836,7 +837,22 @@
 	tmp_tstamp = ifp->tstamp;
 	spin_unlock_bh(&ifp->lock);
 
+	regen_advance = idev->cnf.regen_max_retry *
+	                idev->cnf.dad_transmits *
+	                idev->nd_parms->retrans_time / HZ;
 	write_unlock(&idev->lock);
+
+	/* A temporary address is created only if this calculated Preferred
+	 * Lifetime is greater than REGEN_ADVANCE time units.  In particular,
+	 * an implementation must not create a temporary address with a zero
+	 * Preferred Lifetime.
+	 */
+	if (tmp_prefered_lft <= regen_advance) {
+		in6_ifa_put(ifp);
+		in6_dev_put(idev);
+		ret = -1;
+		goto out;
+	}
 
 	addr_flags = IFA_F_TEMPORARY;
 	/* set in addrconf_prefix_rcv() */
#2 lore raw

Re: [PATCH 2 of 2] IPv6: do not create temporary adresses with too short preferred lifetime

In article <00affc24c178e6da3a3b.1207091341@pirzuine> (at Wed, 02 Apr 2008 01:09:01 +0200), Benoit Boissinot <[email protected]> says:

Quoted 9 lines

IPv6: do not create temporary adresses with too short preferred lifetime

Quoted 1 line

From RFC341:

A temporary address is created only if this calculated Preferred Lifetime is greater than REGEN_ADVANCE time units. In particular, an implementation must not create a temporary address with a zero Preferred Lifetime.

Quoted 39 lines

diff -r 0c33481968e0 -r 00affc24c178 net/ipv6/addrconf.c

net/ipv6/addrconf.c +16 -1
@@ -776,6 +776,7 @@
 	struct inet6_dev *idev = ifp->idev;
 	struct in6_addr addr, *tmpaddr;
 	unsigned long tmp_prefered_lft, tmp_valid_lft, tmp_cstamp, tmp_tstamp;
+	unsigned long regen_advance;
 	int tmp_plen;
 	int ret = 0;
 	int max_addresses;
@@ -836,7 +837,22 @@
 	tmp_tstamp = ifp->tstamp;
 	spin_unlock_bh(&ifp->lock);
 
+	regen_advance = idev->cnf.regen_max_retry *
+	                idev->cnf.dad_transmits *
+	                idev->nd_parms->retrans_time / HZ;
 	write_unlock(&idev->lock);
+
+	/* A temporary address is created only if this calculated Preferred
+	 * Lifetime is greater than REGEN_ADVANCE time units.  In particular,
+	 * an implementation must not create a temporary address with a zero
+	 * Preferred Lifetime.
+	 */
+	if (tmp_prefered_lft <= regen_advance) {
+		in6_ifa_put(ifp);
+		in6_dev_put(idev);
+		ret = -1;
+		goto out;
+	}
 
 	addr_flags = IFA_F_TEMPORARY;
 	/* set in addrconf_prefix_rcv() */
--

To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

maintainer Applied
#3 lore raw

Re: [PATCH 2 of 2] IPv6: do not create temporary adresses with too short preferred lifetime

From: YOSHIFUJI Hideaki / 吉藤英明 <[email protected]>
Date: Wed, 02 Apr 2008 08:50:11 +0900 (JST)

Quoted 5 lines

In article <00affc24c178e6da3a3b.1207091341@pirzuine> (at Wed, 02 Apr 2008 01:09:01 +0200), Benoit Boissinot <[email protected]> says:

Quoted 3 lines

IPv6: do not create temporary adresses with too short preferred lifetime

Quoted 1 line

From RFC341:

Quoted 8 lines
Quoted 6 lines

A temporary address is created only if this calculated Preferred Lifetime is greater than REGEN_ADVANCE time units. In particular, an implementation must not create a temporary address with a zero Preferred Lifetime.

Applied.

#4 lore raw

PATCH 1/1 IPv6: only update the lifetime of the relevant temporary address

In reply to Benoit Boissinot

IPv6: only update the lifetime of the relevant temporary address

When receiving a prefix information from a routeur, only update the lifetimes of the temporary address associated with that prefix.
Otherwise if one deprecated prefix is advertized, all your temporary addresses will become deprecated.

net/ipv6/addrconf.c +3 -0
diff -r a3c03e70c69f -r 0c33481968e0 net/ipv6/addrconf.c
@@ -1831,6 +1831,9 @@
 				 * lifetimes of an existing temporary address
 				 * when processing a Prefix Information Option.
 				 */
+				if (ifp != ift->ifpub)
+					continue;
+
 				spin_lock(&ift->lock);
 				flags = ift->flags;
 				if (ift->valid_lft > valid_lft &&
#5 lore raw

Re: [PATCH 1 of 2] IPv6: only update the lifetime of the relevant temporary address

In article <0c33481968e0b6b8efd7.1207091340@pirzuine> (at Wed, 02 Apr 2008 01:09:00 +0200), Benoit Boissinot <[email protected]> says:

Quoted 8 lines

IPv6: only update the lifetime of the relevant temporary address

When receiving a prefix information from a routeur, only update the lifetimes of the temporary address associated with that prefix.
Otherwise if one deprecated prefix is advertized, all your temporary addresses will become deprecated.

Quoted 18 lines

diff -r a3c03e70c69f -r 0c33481968e0 net/ipv6/addrconf.c

net/ipv6/addrconf.c +3 -1
@@ -1831,6 +1831,9 @@
 				 * lifetimes of an existing temporary address
 				 * when processing a Prefix Information Option.
 				 */
+				if (ifp != ift->ifpub)
+					continue;
+
 				spin_lock(&ift->lock);
 				flags = ift->flags;
 				if (ift->valid_lft > valid_lft &&
--

To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

maintainer Applied
#6 lore raw

Re: [PATCH 1 of 2] IPv6: only update the lifetime of the relevant temporary address

From: YOSHIFUJI Hideaki / 吉藤英明 <[email protected]>
Date: Wed, 02 Apr 2008 08:48:36 +0900 (JST)

Quoted 4 lines

In article <0c33481968e0b6b8efd7.1207091340@pirzuine> (at Wed, 02 Apr 2008 01:09:00 +0200), Benoit Boissinot <[email protected]> says:

Quoted 2 lines

IPv6: only update the lifetime of the relevant temporary address

Quoted 8 lines
Quoted 6 lines

When receiving a prefix information from a routeur, only update the lifetimes of the temporary address associated with that prefix.
Otherwise if one deprecated prefix is advertized, all your temporary addresses will become deprecated.

Applied.