Skip to contentSkip to conversation

ipv6 addrconf: Ignore requests to set NODAD flag when changing addresses

PATCH In review Thomas Graf 2 participants 5 messages Jun 4, 2008 – Jun 5, 2008

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

PATCH 1/1 ipv6 addrconf: Ignore requests to set NODAD flag when changing addresses

The decision to run DAD has already been made at the time the address was added. Changing the flag later on does not have any effect and is only confusing.

net/ipv6/addrconf.c +4 -1
Index: net-2.6/net/ipv6/addrconf.c
===================================================================
@@ -3200,7 +3200,7 @@
 	}
 
 	spin_lock_bh(&ifp->lock);
-	ifp->flags = (ifp->flags & ~(IFA_F_DEPRECATED | IFA_F_PERMANENT | IFA_F_NODAD | IFA_F_HOMEADDRESS)) | ifa_flags;
+	ifp->flags = (ifp->flags & ~(IFA_F_DEPRECATED | IFA_F_PERMANENT | IFA_F_HOMEADDRESS)) | ifa_flags;
 	ifp->tstamp = jiffies;
 	ifp->valid_lft = valid_lft;
 	ifp->prefered_lft = prefered_lft;
@@ -3267,6 +3267,9 @@
 				      preferred_lft, valid_lft);
 	}
 
+	/* It's too late to disable DOD now, ignore the flag */
+	ifa_flags &= ~IFA_F_NODAD;
+
 	if (nlh->nlmsg_flags & NLM_F_EXCL ||
 	    !(nlh->nlmsg_flags & NLM_F_REPLACE))
 		err = -EEXIST;
#1 lore raw

In article <[email protected]> (at Thu, 5 Jun 2008 01:47:51 +0200), Thomas Graf <[email protected]> says:

Quoted 5 lines

The decision to run DAD has already been made at the time the address was added. Changing the flag later on does not have any effect and is only confusing.

I need let MIP team check this but anyway....

If the NODAD flag change is confusing, just clear that flag in the caller.

And well, it does not take effect so far, but DAD after link failure logic is planned in long term. So current code is okay to me.

net/ipv6/addrconf.c +2 -2
index 3a83557..05dcfd8 100644
@@ -3191,7 +3191,7 @@ static int inet6_addr_modify(struct inet6_ifaddr *ifp, u8 ifa_flags,
 		prefered_lft = 0x7FFFFFFF/HZ;
 
 	spin_lock_bh(&ifp->lock);
-	ifp->flags = (ifp->flags & ~(IFA_F_DEPRECATED | IFA_F_PERMANENT | IFA_F_NODAD | IFA_F_HOMEADDRESS)) | ifa_flags;
+	ifp->flags = (ifp->flags & ~(IFA_F_DEPRECATED | IFA_F_PERMANENT | IFA_F_HOMEADDRESS)) | ifa_flags;
 	ifp->tstamp = jiffies;
 	ifp->valid_lft = valid_lft;
 	ifp->prefered_lft = prefered_lft;
@@ -3245,7 +3245,7 @@ inet6_rtm_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
 		return -ENODEV;
 
 	/* We ignore other flags so far. */
-	ifa_flags = ifm->ifa_flags & (IFA_F_NODAD | IFA_F_HOMEADDRESS);
+	ifa_flags = ifm->ifa_flags & IFA_F_HOMEADDRESS;
 
 	ifa = ipv6_get_ifaddr(net, pfx, dev, 1);
 	if (ifa == NULL) {

--yoshfuji

#2 lore raw

* YOSHIFUJI Hideaki / ?$B5HF#1QL@ <[email protected]> 2008-06-05 11:53

Quoted 3 lines

And well, it does not take effect so far, but DAD after link failure logic is planned in long term. So current code is okay to me.

Alright, that makes sense if that code ever is written.

I'm not sure I understand your new patch though, why do you want to disable setting the nodad flag for new addresses nowW?

Quoted 28 lines
net/ipv6/addrconf.c +2 -3
index 3a83557..05dcfd8 100644
@@ -3191,7 +3191,7 @@ static int inet6_addr_modify(struct inet6_ifaddr *ifp, u8 ifa_flags,
 		prefered_lft = 0x7FFFFFFF/HZ;
 
 	spin_lock_bh(&ifp->lock);
-	ifp->flags = (ifp->flags & ~(IFA_F_DEPRECATED | IFA_F_PERMANENT | IFA_F_NODAD | IFA_F_HOMEADDRESS)) | ifa_flags;
+	ifp->flags = (ifp->flags & ~(IFA_F_DEPRECATED | IFA_F_PERMANENT | IFA_F_HOMEADDRESS)) | ifa_flags;
 	ifp->tstamp = jiffies;
 	ifp->valid_lft = valid_lft;
 	ifp->prefered_lft = prefered_lft;
@@ -3245,7 +3245,7 @@ inet6_rtm_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
 		return -ENODEV;
 
 	/* We ignore other flags so far. */
-	ifa_flags = ifm->ifa_flags & (IFA_F_NODAD | IFA_F_HOMEADDRESS);
+	ifa_flags = ifm->ifa_flags & IFA_F_HOMEADDRESS;
 
 	ifa = ipv6_get_ifaddr(net, pfx, dev, 1);
 	if (ifa == NULL) {
 
--yoshfuji
#3 lore raw

In article <[email protected]> (at Thu, 5 Jun 2008 11:04:47 +0200), Thomas Graf <[email protected]> says:

Quoted 9 lines

* YOSHIFUJI Hideaki <[email protected]> 2008-06-05 11:53

Quoted 3 lines

And well, it does not take effect so far, but DAD after link failure logic is planned in long term. So current code is okay to me.

Alright, that makes sense if that code ever is written.

I'm not sure I understand your new patch though, why do you want to disable setting the nodad flag for new addresses nowW?

If we should really need to avoid the confusion, we have an option to disallow modification of NODAD flag so far with the patch I've posted. But anyway, I'm going to leave it as-is if you are okay.

--yoshfuji

#4 lore raw

* YOSHIFUJI Hideaki / ?$B5HF#1QL@ <[email protected]> 2008-06-05 23:32

Quoted 7 lines

In article <[email protected]> (at Thu, 5 Jun 2008 11:04:47 +0200), Thomas Graf <[email protected]> says:

Quoted 5 lines

* YOSHIFUJI Hideaki <[email protected]> 2008-06-05 11:53

Quoted 3 lines

And well, it does not take effect so far, but DAD after link failure logic is planned in long term. So current code is okay to me.

Quoted 8 lines
Quoted 4 lines

Alright, that makes sense if that code ever is written.

I'm not sure I understand your new patch though, why do you want to disable setting the nodad flag for new addresses nowW?

If we should really need to avoid the confusion, we have an option to disallow modification of NODAD flag so far with the patch I've posted. But anyway, I'm going to leave it as-is if you are okay.

Your patch would have disabled the ability to even add new addresses with the NODAD flag set, that's what confused me. I'm fine with leaving everything as-is since you explained that DAD will be done after link failures in the future.