netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Brian Haley <brian.haley@hp.com>
To: Neil Horman <nhorman@tuxdriver.com>
Cc: Vlad Yasevich <vladislav.yasevich@hp.com>,
	YOSHIFUJI Hideaki / ???? <yoshfuji@linux-ipv6.org>,
	sri@us.ibm.com, davem@davemloft.net, kuznet@ms2.inr.ac.ru,
	pekkas@netcore.fi, jmorris@namei.org, kaber@coreworks.de,
	netdev@vger.kernel.org
Subject: Re: [PATCH] IPv6: Implement RFC 4429 Optimistic Duplicate Address Detection
Date: Mon, 05 Feb 2007 12:33:55 -0500	[thread overview]
Message-ID: <45C76A83.5070608@hp.com> (raw)
In-Reply-To: <20070203150536.GB32659@hmsreliant.homelinux.net>

[-- Attachment #1: Type: text/plain, Size: 373 bytes --]

> Please, if you think you can find a way for us to do optimistic dad flags as
> opt-in, rather than masked out, I'm all for it.  Thanks!

This patch should apply on-top of yours, if you want I can send the 
whole thing out too.  I've only compile-tested it, so don't know if it 
behaves the same as your original.

-Brian


Signed-off-by: Brian Haley <brian.haley@hp.com>

[-- Attachment #2: opti.patch --]
[-- Type: text/x-patch, Size: 2930 bytes --]

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index c341371..ddac8b0 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -593,13 +593,8 @@ ipv6_add_addr(struct inet6_dev *idev, co
 	ifa->cstamp = ifa->tstamp = jiffies;
 
 	ifa->rt = rt;
-#ifdef CONFIG_IPV6_OPTIMISTIC_DAD
-	if (!idev->cnf.optimistic_dad || ipv6_devconf.forwarding ||
-	   (ifa->rt->rt6i_nexthop == NULL))
+	if (rt->rt6i_nexthop == NULL)
 		ifa->flags &= ~IFA_F_OPTIMISTIC;
-#else
-	ifa->flags &= ~IFA_F_OPTIMISTIC;
-#endif
 	ifa->idev = idev;
 	in6_dev_hold(idev);
 	/* For caller */
@@ -776,6 +771,7 @@ static int ipv6_create_tempaddr(struct i
 	int tmp_plen;
 	int ret = 0;
 	int max_addresses;
+	u32 addr_flags;
 
 	write_lock(&idev->lock);
 	if (ift) {
@@ -833,11 +829,17 @@ retry:
 	spin_unlock_bh(&ifp->lock);
 
 	write_unlock(&idev->lock);
+
+	addr_flags = IFA_F_TEMPORARY;
+	/* set in addrconf_prefix_rcv() */
+	if (ifp->flags & IFA_F_OPTIMISTIC)
+		addr_flags |= IFA_F_OPTIMISTIC;
+
 	ift = !max_addresses ||
 	      ipv6_count_addresses(idev) < max_addresses ? 
 		ipv6_add_addr(idev, &addr, tmp_plen,
 			      ipv6_addr_type(&addr)&IPV6_ADDR_SCOPE_MASK, 
-			      IFA_F_TEMPORARY|IFA_F_OPTIMISTIC) : NULL;
+			      addr_flags) : NULL;
 	if (!ift || IS_ERR(ift)) {
 		in6_ifa_put(ifp);
 		in6_dev_put(idev);
@@ -1746,6 +1748,13 @@ 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 &&
+			    !ipv6_devconf.forwarding)
+				addr_flags = IFA_F_OPTIMISTIC;
+#endif
 
 			/* Do not allow to create too much of autoconfigured
 			 * addresses; this would be too easy way to crash kernel.
@@ -1753,7 +1762,8 @@ ok:
 			if (!max_addresses ||
 			    ipv6_count_addresses(in6_dev) < max_addresses)
 				ifp = ipv6_add_addr(in6_dev, &addr, pinfo->prefix_len,
-						    addr_type&IPV6_ADDR_SCOPE_MASK, 0);
+						    addr_type&IPV6_ADDR_SCOPE_MASK,
+						    addr_flags);
 
 			if (!ifp || IS_ERR(ifp)) {
 				in6_dev_put(in6_dev);
@@ -1762,10 +1772,6 @@ ok:
 
 			update_lft = create = 1;
 			ifp->cstamp = jiffies;
-#ifdef CONFIG_IPV6_OPTIMISTIC_DAD
-			if (ifp->idev->cnf.optimistic_dad)
-				ifp->flags |= IFA_F_OPTIMISTIC;
-#endif
 			addrconf_dad_start(ifp, RTF_ADDRCONF|RTF_PREFIX_RT);
 		}
 
@@ -2141,9 +2147,16 @@ static void init_loopback(struct net_dev
 static void addrconf_add_linklocal(struct inet6_dev *idev, struct in6_addr *addr)
 {
 	struct inet6_ifaddr * ifp;
+	u32 addr_flags = IFA_F_PERMANENT;
+
+#ifdef CONFIG_IPV6_OPTIMISTIC_DAD
+	if (idev->cnf.optimistic_dad &&
+	    !ipv6_devconf.forwarding)
+		addr_flags |= IFA_F_OPTIMISTIC;
+#endif
+
 
-	ifp = ipv6_add_addr(idev, addr, 64, IFA_LINK, 
-		            IFA_F_PERMANENT|IFA_F_OPTIMISTIC);
+	ifp = ipv6_add_addr(idev, addr, 64, IFA_LINK, addr_flags);
 	if (!IS_ERR(ifp)) {
 		addrconf_dad_start(ifp, 0);
 		in6_ifa_put(ifp);

  reply	other threads:[~2007-02-05 17:34 UTC|newest]

Thread overview: 71+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-19 21:23 [PATCH] IPv6: Implement RFC 4429 Optimistic Duplicate Address Detection Neil Horman
2007-01-19 23:05 ` YOSHIFUJI Hideaki / 吉藤英明
2007-01-20  1:41   ` Neil Horman
2007-01-22 18:15   ` Neil Horman
2007-01-22 18:39     ` Mika Penttilä
2007-01-22 19:45       ` Neil Horman
2007-01-22 20:25         ` Vlad Yasevich
2007-01-23 18:36           ` Neil Horman
2007-01-23 19:27             ` Vlad Yasevich
2007-01-23  0:18     ` YOSHIFUJI Hideaki / 吉藤英明
2007-01-23 20:51       ` Neil Horman
2007-01-25  1:54         ` Sridhar Samudrala
2007-01-25 13:33           ` Neil Horman
2007-01-25 17:16             ` Vlad Yasevich
2007-01-25 19:45               ` Neil Horman
2007-01-25 20:18                 ` Vlad Yasevich
2007-01-25 21:26                   ` Neil Horman
2007-01-25 22:13                     ` Vlad Yasevich
2007-01-26 14:27                       ` Neil Horman
2007-01-26 15:44                         ` YOSHIFUJI Hideaki / 吉藤英明
2007-01-26 19:03                           ` Neil Horman
2007-01-25 22:34                     ` Vlad Yasevich
2007-01-26  0:13                 ` YOSHIFUJI Hideaki / 吉藤英明
2007-01-26 14:20                   ` Vlad Yasevich
2007-01-26 19:18                   ` Neil Horman
2007-01-26 20:28                     ` Vlad Yasevich
2007-01-26 21:35                       ` Neil Horman
2007-01-26 21:42                         ` Vlad Yasevich
2007-01-29 16:34                           ` Neil Horman
2007-01-29 21:30                             ` Neil Horman
2007-01-29 22:25                               ` YOSHIFUJI Hideaki / 吉藤英明
2007-01-30 13:02                                 ` Neil Horman
2007-01-30 16:16                                   ` YOSHIFUJI Hideaki / 吉藤英明
2007-01-31 20:54                                     ` Neil Horman
2007-02-02 19:06                                       ` Neil Horman
2007-02-02 19:46                                         ` David Miller
2007-02-02 20:13                                           ` Neil Horman
2007-02-02 22:22                                             ` Vlad Yasevich
2007-02-03 15:06                                               ` Neil Horman
2007-02-02 21:28                                         ` Brian Haley
2007-02-02 22:05                                           ` Vlad Yasevich
2007-02-02 23:57                                             ` Brian Haley
2007-02-03 15:05                                               ` Neil Horman
2007-02-05 17:33                                                 ` Brian Haley [this message]
2007-02-05 18:37                                                   ` Neil Horman
2007-02-02 21:50                                         ` Vlad Yasevich
2007-02-03 15:03                                           ` Neil Horman
     [not found]                                             ` <20070205205651.GB484@hmsreliant.homelinux.net>
2007-02-06  1:24                                               ` YOSHIFUJI Hideaki / 吉藤英明
2007-02-06  1:32                                                 ` David Miller
2007-02-06  1:44                                                   ` YOSHIFUJI Hideaki / 吉藤英明
2007-02-06  1:43                                                     ` David Miller
2007-02-06 12:51                                                 ` Neil Horman
2007-02-06 20:09                                                   ` Neil Horman
2007-02-06 21:13                                                     ` Vlad Yasevich
2007-02-07 20:55                                                       ` Neil Horman
2007-02-07 21:19                                                         ` Vlad Yasevich
2007-02-07 21:52                                                         ` YOSHIFUJI Hideaki / 吉藤英明
2007-02-08 13:07                                                           ` Neil Horman
2007-02-12 23:27                                                             ` YOSHIFUJI Hideaki / 吉藤英明
2007-02-13 18:22                                                               ` Neil Horman
2007-02-07 22:26                                                         ` YOSHIFUJI Hideaki / 吉藤英明
2007-02-08 16:41                                                           ` Neil Horman
2007-02-08 17:10                                                             ` YOSHIFUJI Hideaki / 吉藤英明
2007-02-08 19:32                                                               ` Neil Horman
2007-02-12 21:20                                                                 ` Neil Horman
2007-02-13 20:45                                                                   ` Neil Horman
2007-02-13 21:46                                                                     ` YOSHIFUJI Hideaki / 吉藤英明
2007-02-13 21:53                                                                       ` David Miller
     [not found]                                                                       ` <20070221.040259.60395625.yoshfuji@linux-ipv6.org>
     [not found]                                                                         ` <20070221.000222.71087924.davem@davemloft.net>
2007-02-21  8:15                                                                           ` YOSHIFUJI Hideaki / 吉藤英明
2007-02-21  9:30                                                                             ` David Miller
2007-02-21 13:37                                                                               ` Neil Horman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=45C76A83.5070608@hp.com \
    --to=brian.haley@hp.com \
    --cc=davem@davemloft.net \
    --cc=jmorris@namei.org \
    --cc=kaber@coreworks.de \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=netdev@vger.kernel.org \
    --cc=nhorman@tuxdriver.com \
    --cc=pekkas@netcore.fi \
    --cc=sri@us.ibm.com \
    --cc=vladislav.yasevich@hp.com \
    --cc=yoshfuji@linux-ipv6.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).