diff -uNr net-tools-1.60/Makefile net-tools-1.60-new/Makefile --- net-tools-1.60/Makefile 2009-10-08 13:00:54.000000000 +0530 +++ net-tools-1.60-new/Makefile 2009-10-08 13:13:03.000000000 +0530 @@ -120,7 +120,7 @@ endif CFLAGS += $(COPTS) -I. -idirafter ./include/ -I$(NET_LIB_PATH) -LDFLAGS += $(LOPTS) -L$(NET_LIB_PATH) +LDFLAGS += $(LOPTS) -L$(NET_LIB_PATH) -lnetdevname SUBDIRS = man/ $(NET_LIB_PATH)/ diff -uNr net-tools-1.60/ether-wake.c net-tools-1.60-new/ether-wake.c --- net-tools-1.60/ether-wake.c 2009-10-08 13:00:54.000000000 +0530 +++ net-tools-1.60-new/ether-wake.c 2009-10-10 01:52:51.000000000 +0530 @@ -88,6 +88,7 @@ #endif #include #include +#include /* Grrr, no consistency between include versions. Enable this if setsockopt() isn't declared with your library. */ @@ -113,6 +114,7 @@ int main(int argc, char *argv[]) { char *ifname = "eth0"; + char mapped_ifname[IFNAMSIZ]; int one = 1; /* True, for socket options. */ int s; /* Raw socket */ int errflag = 0, verbose = 0, do_version = 0; @@ -137,6 +139,10 @@ case '?': errflag++; } + if (netdev_pathname_to_name(ifname,mapped_ifname) < 0) { + show_pathname_usage(); + } + strncpy(ifname, mapped_ifname, IFNAMSIZ); if (verbose || do_version) printf("%s\n", version_msg); if (errflag) { diff -uNr net-tools-1.60/ifconfig.c net-tools-1.60-new/ifconfig.c --- net-tools-1.60/ifconfig.c 2009-10-08 13:00:54.000000000 +0530 +++ net-tools-1.60-new/ifconfig.c 2009-10-10 01:18:32.000000000 +0530 @@ -49,6 +49,7 @@ /* Ugh. But libc5 doesn't provide POSIX types. */ #include +#include #ifdef HAVE_HWSLIP @@ -289,6 +290,7 @@ int goterr = 0, didnetmask = 0, donetmask = 0, dobcast = 1; char **spp; int fd; + char kernel_name[IFNAMSIZ]; #if HAVE_AFINET6 extern struct aftype inet6_aftype; struct sockaddr_in6 sa6; @@ -352,7 +354,10 @@ } /* No. Fetch the interface name. */ spp = argv; - safe_strncpy(ifr.ifr_name, *spp++, IFNAMSIZ); + if ((netdev_pathname_to_name(*spp, kernel_name)) < 0) + show_pathname_usage(); + safe_strncpy(ifr.ifr_name, kernel_name, IFNAMSIZ); + *spp++; if (*spp == (char *) NULL) { int err = if_print(ifr.ifr_name); (void) close(skfd); diff -uNr net-tools-1.60/mii-diag.c net-tools-1.60-new/mii-diag.c --- net-tools-1.60/mii-diag.c 2009-10-08 13:00:54.000000000 +0530 +++ net-tools-1.60-new/mii-diag.c 2009-10-10 01:35:23.000000000 +0530 @@ -91,6 +91,7 @@ #include #include #include +#include #ifdef use_linux_libc5 #include #include @@ -175,8 +176,11 @@ main(int argc, char **argv) { int c, errflag = 0; - char **spp, *ifname; + char **spp; + char *ifname="eth0"; + char netdevname[IFNAMSIZ]; char *progname = rindex(argv[0], '/') ? rindex(argv[0], '/')+1 : argv[0]; + char mapped_ifname[IFNAMSIZ]; while ((c = getopt_long(argc, argv, shortopts, longopts, 0)) != EOF) switch (c) { @@ -229,8 +233,14 @@ } else { /* Copy the interface name. */ spp = argv + optind; - ifname = *spp++; - } + if (netdev_pathname_to_name(*spp,mapped_ifname)< 0) { + show_pathname_usage(); + ifname = *spp++; + }else { + strncpy(netdevname, mapped_ifname, IFNAMSIZ); + ifname=(char *)netdevname; + *spp++; + } if (ifname == NULL) { ifname = "eth0"; diff -uNr net-tools-1.60/mii-tool.c net-tools-1.60-new/mii-tool.c --- net-tools-1.60/mii-tool.c 2009-10-08 13:00:54.000000000 +0530 +++ net-tools-1.60-new/mii-tool.c 2009-10-10 01:27:07.000000000 +0530 @@ -46,6 +46,7 @@ #include #include #include +#include #ifndef __GLIBC__ #include #include @@ -396,6 +397,7 @@ { int i, c, ret, errflag = 0; char s[6]; + char mapped_ifname[IFNAMSIZ]; while ((c = getopt_long(argc, argv, "A:F:p:lrRvVw?", longopts, 0)) != EOF) switch (c) { @@ -439,6 +441,11 @@ } else { ret = 0; for (i = optind; i < argc; i++) { + if (strstr(argv[i],"/dev/net/")) { + if (!netdev_pathname_to_name(argv[i],mapped_ifname)) { + strncpy(argv[i],mapped_ifname,IFNAMSIZ); + } + } ret |= do_one_xcvr(skfd, argv[i], 0); } } diff -uNr net-tools-1.60/netstat.c net-tools-1.60-new/netstat.c --- net-tools-1.60/netstat.c 2009-10-08 13:00:54.000000000 +0530 +++ net-tools-1.60-new/netstat.c 2009-10-10 01:26:39.000000000 +0530 @@ -85,6 +85,7 @@ #include #include #include +#include #include #if HAVE_SELINUX @@ -2094,6 +2095,7 @@ int i; int lop; int reptimer = 1; + char mapped_ifname[IFNAMSIZ]; struct option longopts[] = { AFTRANS_OPTS, @@ -2266,6 +2268,10 @@ break; } + if (netdev_pathname_to_name(flag_int_name,mapped_ifname) < 0) { + show_pathname_usage(); + } + strncpy(flag_int_name,mapped_ifname,IFNAMSIZ); if(argc == optind + 1) { if((reptimer = atoi(argv[optind])) <= 0) usage();