Netdev List
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: "Erich E. Hoover" <ehoover@mines.edu>
Cc: Linux Netdev <netdev@vger.kernel.org>
Subject: Re: [PATCH v2] Implement IP_UNICAST_IF socket option.
Date: Fri, 03 Feb 2012 11:01:18 +0100	[thread overview]
Message-ID: <1328263278.2157.5.camel@edumazet-HP-Compaq-6005-Pro-SFF-PC> (raw)
In-Reply-To: <CAEU2+vrtwSUKgY1f44h8btcKnhvhBHUU-d_BkkyYx+E1KViQ+g@mail.gmail.com>

Le jeudi 02 février 2012 à 18:22 -0700, Erich E. Hoover a écrit :

> I though I should double check this, and apparently I missed that
> there's an equivalent IPV6_UNICAST_IF on "other OS".  Should that be a
> patch 2 or should it be included in this one?

Do as you prefer.

BTW, do we really want the htonl() thing, and force device indexes in
2^24 range ? This seems odd anyway.

If yes, following patch is needed :

diff --git a/net/core/dev.c b/net/core/dev.c
index f124947..ce7ebde 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -5193,7 +5193,10 @@ static int dev_new_index(struct net *net)
 {
 	static int ifindex;
 	for (;;) {
-		if (++ifindex <= 0)
+		/* Because of IP_UNICAST_IF support, we must limit indexes
+		 * to 24 bits. Zero value is also reserved.
+		 */
+		if (++ifindex >= (1<<24))
 			ifindex = 1;
 		if (!__dev_get_by_index(net, ifindex))
 			return ifindex;

  parent reply	other threads:[~2012-02-03 10:01 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-02 21:36 [PATCH v2] Implement IP_UNICAST_IF socket option Erich E. Hoover
2012-02-02 21:57 ` Eric Dumazet
2012-02-02 22:29   ` Erich E. Hoover
2012-02-02 22:45     ` Eric Dumazet
2012-02-03  1:22       ` Erich E. Hoover
2012-02-03  1:51         ` David Miller
2012-02-03 10:01         ` Eric Dumazet [this message]
2012-02-03 15:21           ` Erich E. Hoover
2012-02-03 15:43             ` Eric Dumazet
2012-02-03  1:19     ` Xiaochun Lu
2012-02-03  1:38       ` Erich E. Hoover
2012-02-03  2:15         ` Xiaochun Lu
2012-02-03  1:50       ` David Miller

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=1328263278.2157.5.camel@edumazet-HP-Compaq-6005-Pro-SFF-PC \
    --to=eric.dumazet@gmail.com \
    --cc=ehoover@mines.edu \
    --cc=netdev@vger.kernel.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