netdev
[Top] [All Lists]

[PATCH] trivial patch for if_indextoname()

To: davem@xxxxxxxxxx
Subject: [PATCH] trivial patch for if_indextoname()
From: David Stevens <dlstevens@xxxxxxxxxx>
Date: Wed, 26 May 2004 16:15:07 -0600
Cc: netdev@xxxxxxxxxxx
Sender: netdev-bounce@xxxxxxxxxxx
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: if_indextoname.patch
Description: Binary data

<Prev in Thread] Current Thread [Next in Thread>