public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: YOSHIFUJI Hideaki <hideaki.yoshifuji@miraclelinux•com>
To: Hajime Tazaki <thehajime@gmail•com>, ek@google•com
Cc: hideaki.yoshifuji@miraclelinux•com, davem@davemloft•net,
	netdev@vger•kernel.org, hannes@stressinduktion•org,
	lorenzo@google•com
Subject: Re: [PATCH net-next v2] ipv6: Do not iterate over all interfaces when finding source address on specific interface.
Date: Mon, 13 Jul 2015 22:49:33 +0900	[thread overview]
Message-ID: <55A3C1ED.5070304@miraclelinux.com> (raw)
In-Reply-To: <m2h9p85ntc.wl@gmail.com>

Hi,

Hajime Tazaki wrote:
> 
> Yoshifuji-san,
> 
> At Mon, 13 Jul 2015 17:38:48 +0900,
> Erik Kline wrote:
>>
>> On 13 July 2015 at 15:32, YOSHIFUJI Hideaki
>> <hideaki.yoshifuji@miraclelinux•com> wrote:
>>> Hi,
>>>
>>> Erik Kline wrote:
>>>> Hmm, when I run a UML linux with this patch (which, I'm ashamed to
>>>> say, I failed to do before) I get these kinds of errors:
>>>>
>>>>     unregister_netdevice: waiting for <TAPdevice> to become free.
>>>> Usage count = 1
>>>>     unregister_netdevice: waiting for <TAPdevice> to become free.
>>>> Usage count = 1
>>>>
>>>> Perhaps they're unrelated... I'm still investigating.
>>>
>>> Would you test attached patch please?
>>
>> That does look logically correct, so +1 to it regardless, but it does
>> not seem to have fixed the issue I'm seeing.
>>
>> I still haven't produced the smallest possible demo test program.
> 
> sorry to jump-in, but there is a side-effect with this
> patch, which my tcp and dccp tests (ipv6) are failed.
> 
> because newly added function (__ipv6_dev_get_saddr) won't
> update a variable 'hiscore' (it swaps with 'score' in some
> case), the caller (ipv6_dev_get_saddr) can't fill an
> appropriate saddr in the end.
> 
> I don't know if this is a good patch but the following diff
> makes my test happy.

We should update score as well...

> 
> -- Hajime
> 
> diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
> index 4ab74d5..c4e9416 100644
> --- a/net/ipv6/addrconf.c
> +++ b/net/ipv6/addrconf.c
> @@ -1363,7 +1363,8 @@ static void __ipv6_dev_get_saddr(struct net *net,
>  				 unsigned int prefs,
>  				 const struct in6_addr *saddr,
>  				 struct inet6_dev *idev,
> -				 struct ipv6_saddr_score *scores)
> +				 struct ipv6_saddr_score *scores,
> +				 struct ipv6_saddr_score **in_hiscore)
>  {
>  	struct ipv6_saddr_score *score = &scores[0], *hiscore = &scores[1];
>  
> @@ -1424,6 +1425,7 @@ static void __ipv6_dev_get_saddr(struct net *net,
>  				in6_ifa_hold(score->ifa);
>  
>  				swap(hiscore, score);
> +				*in_hiscore = hiscore;
>  
>  				/* restore our iterator */
>  				score->ifa = hiscore->ifa;
> @@ -1480,13 +1482,15 @@ int ipv6_dev_get_saddr(struct net *net, const struct net_device *dst_dev,
>  	}
>  
>  	if (use_oif_addr) {
> -		__ipv6_dev_get_saddr(net, &dst, prefs, saddr, idev, scores);
> +		__ipv6_dev_get_saddr(net, &dst, prefs, saddr, idev,
> +				     scores, &hiscore);
>  	} else {
>  		for_each_netdev_rcu(net, dev) {
>  			idev = __in6_dev_get(dev);
>  			if (!idev)
>  				continue;
> -			__ipv6_dev_get_saddr(net, &dst, prefs, saddr, idev, scores);
> +			__ipv6_dev_get_saddr(net, &dst, prefs, saddr, idev,
> +					     scores, &hiscore);
>  		}
>  	}
>  	rcu_read_unlock();
> 

-- 
Hideaki Yoshifuji <hideaki.yoshifuji@miraclelinux•com>
Technical Division, MIRACLE LINUX CORPORATION

      reply	other threads:[~2015-07-13 13:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-10  7:58 [PATCH net-next v2] ipv6: Do not iterate over all interfaces when finding source address on specific interface YOSHIFUJI Hideaki/吉藤英明
2015-07-11  6:19 ` David Miller
2015-07-11  9:21   ` Erik Kline
2015-07-13  6:32     ` YOSHIFUJI Hideaki
2015-07-13  8:38       ` Erik Kline
2015-07-13 10:55         ` Hajime Tazaki
2015-07-13 13:49           ` YOSHIFUJI Hideaki [this message]

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=55A3C1ED.5070304@miraclelinux.com \
    --to=hideaki.yoshifuji@miraclelinux$(echo .)com \
    --cc=davem@davemloft$(echo .)net \
    --cc=ek@google$(echo .)com \
    --cc=hannes@stressinduktion$(echo .)org \
    --cc=lorenzo@google$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=thehajime@gmail$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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