netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Serhey Popovych <serhe.popovych@gmail.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH 2/3] dev: Avoid infinite loop on network device index exhaustion
Date: Fri, 16 Jun 2017 19:32:53 +0300	[thread overview]
Message-ID: <84cff1ae-94f8-dfbe-fbea-3bd9cbc8663a@gmail.com> (raw)
In-Reply-To: <20170616091659.3361b5d0@xeon-e3>


> On Fri, 16 Jun 2017 17:23:52 +0300
> Serhey Popovych <serhe.popovych@gmail.com> wrote:
> 
>> If network device indexes exhaust in namespace dev_new_index()
>> can loop indefinitely since there is no condition to exit
>> except case where free index is found.
>>
>> Since all it's caller hold RTNL mutex this may completely
>> lock down network subsystem configuration operations.
>>
>> Instead of retrying with ifindex == 1 (LOOPBACK_IFINDEX)
>> in dev_new_index() we should fail and return invalid
>> index value (0).
>>
>> Adjust callers to correctly handle error case of dev_new_index().
>>
>> Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
>  
> This breaks existing semantics.
> 
> Today on Linux the ifindex allocator intentionally wraps around back to 1.
> This is to handle the case of long running system with things like VPN's
> that create and destroy lots of devices.
> 
Ok, got it. Maybe we can change allocation mechanism?

That what actually I did.
What do you think?

I will show POC patch doing this.

-- 
Thanks, Serhey

  reply	other threads:[~2017-06-16 16:32 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-16 14:23 [PATCH 0/3] dev: Fix network device ifindex allocation Serhey Popovych
2017-06-16 14:23 ` [PATCH 1/3] dev: Prevent creating network devices with negative ifindex Serhey Popovych
2017-06-16 16:18   ` Stephen Hemminger
2017-06-16 16:44     ` Serhey Popovych
2017-06-16 17:25       ` Stephen Hemminger
2017-06-16 18:14         ` Serhey Popovych
2017-06-16 14:23 ` [PATCH 2/3] dev: Avoid infinite loop on network device index exhaustion Serhey Popovych
2017-06-16 16:16   ` Stephen Hemminger
2017-06-16 16:32     ` Serhey Popovych [this message]
2017-06-16 16:39     ` dev: Reclaim network device indexes Serhey Popovych
2017-06-20 16:42       ` David Miller
2017-06-16 14:23 ` [PATCH 3/3] veth: Set ifindex only if given and not negative Serhey Popovych

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=84cff1ae-94f8-dfbe-fbea-3bd9cbc8663a@gmail.com \
    --to=serhe.popovych@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.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).