* [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
* Re: [PATCH] trivial patch for if_indextoname()
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
0 siblings, 1 reply; 3+ messages in thread
From: David S. Miller @ 2004-05-26 22:17 UTC (permalink / raw)
To: David Stevens; +Cc: netdev
On Wed, 26 May 2004 16:15:07 -0600
David Stevens <dlstevens@us.ibm.com> wrote:
> 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.
How is the SIOCGIFNAME interface specified in this case?
(ie. what does BSD do?) I bet a bunch of stuff will
break if we change this.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] trivial patch for if_indextoname()
2004-05-26 22:17 ` David S. Miller
@ 2004-05-26 22:34 ` David Stevens
0 siblings, 0 replies; 3+ messages in thread
From: David Stevens @ 2004-05-26 22:34 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev
Dave Miller wrote on 05/26/2004 03:17:51 PM:
> How is the SIOCGIFNAME interface specified in this case?
> (ie. what does BSD do?) I bet a bunch of stuff will
> break if we change this.
I don't know if it exists in a standard; I'll see if I can
figure out what BSD is doing. The glibc code for
if_indextoname() appears to do the same thing for Linux
as BSD, so if BSD doesn't return ENXIO, it'd be broken
for RFC3493 too. But remapping it in glibc is safer I
suppose.
+-DLS
^ 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).