netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] trivial patch for if_indextoname()
@ 2004-05-26 22:15 David Stevens
  2004-05-26 22:17 ` David S. Miller
  0 siblings, 1 reply; 3+ messages in thread
From: David Stevens @ 2004-05-26 22:15 UTC (permalink / raw)
  To: davem; +Cc: netdev

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

RFC3493 (section 4.2) specifies that an invalid interface name
passed to if_indextoname() should return NULL with errno of ENXIO.
The current code sets errno to ENODEV for this case.

This could be remapped in glibc, but since the comment for
kernel function dev_ifname() says it's specifically for
if_indextoname(), maybe it should be fixed here.

                                        +-DLS

--- net/core/dev.c.orig 2004-05-09 19:32:37.000000000 -0700
+++ net/core/dev.c      2004-05-26 14:54:37.378210416 -0700
@@ -1927,7 +1927,7 @@
        dev = __dev_get_by_index(ifr.ifr_ifindex);
        if (!dev) {
                read_unlock(&dev_base_lock);
-               return -ENODEV;
+               return -ENXIO;
        }
 
        strcpy(ifr.ifr_name, dev->name);


[-- Attachment #2: if_indextoname.patch --]
[-- Type: application/octet-stream, Size: 306 bytes --]

--- net/core/dev.c.orig	2004-05-09 19:32:37.000000000 -0700
+++ net/core/dev.c	2004-05-26 14:54:37.378210416 -0700
@@ -1927,7 +1927,7 @@
 	dev = __dev_get_by_index(ifr.ifr_ifindex);
 	if (!dev) {
 		read_unlock(&dev_base_lock);
-		return -ENODEV;
+		return -ENXIO;
 	}
 
 	strcpy(ifr.ifr_name, dev->name);

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-05-26 22:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-05-26 22:15 [PATCH] trivial patch for if_indextoname() David Stevens
2004-05-26 22:17 ` David S. Miller
2004-05-26 22:34   ` David Stevens

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).