diff -Nru ethtool-2/ethtool.8 ethtool-2-ifname/ethtool.8 --- ethtool-2/ethtool.8 2003-08-30 11:29:21.000000000 +0200 +++ ethtool-2-ifname/ethtool.8 2004-08-17 21:51:37.000000000 +0200 @@ -376,7 +376,8 @@ Jakub Jelinek, Andre Majorel, Eli Kupermann, -Scott Feldman. +Scott Feldman, +Magnus Boden. .SH AVAILABILITY .B ethtool is available over the Web on the SourceForge site at diff -Nru ethtool-2/ethtool.c ethtool-2-ifname/ethtool.c --- ethtool-2/ethtool.c 2004-07-02 17:28:48.000000000 +0200 +++ ethtool-2-ifname/ethtool.c 2004-08-17 21:54:35.000000000 +0200 @@ -32,6 +32,7 @@ #include #include #include +#include #include #include "ethtool-util.h" @@ -417,7 +418,8 @@ static void parse_cmdline(int argc, char **argp) { - int i; + int i, sockfd; + struct ifreq ifr; for (i = 1; i < argc; i++) { switch (i) { @@ -693,6 +695,24 @@ if (devname == NULL) { show_usage(1); } + + sockfd = socket(AF_INET, SOCK_DGRAM, 0); + if (sockfd == -1) { + fprintf(stderr, "socket() failed..\n"); + exit(1); + } + + strncpy(ifr.ifr_name, devname, IF_NAMESIZE); + if (ioctl(sockfd, SIOCGIFHWADDR, &ifr) < 0) { + fprintf(stderr, "SIOCGIFHWADDR failed...\n"); + exit(1); + } + /* I don't know if this covers the usb interface */ + if (ifr.ifr_hwaddr.sa_family != ARPHRD_ETHER) { + fprintf(stderr, "%s does not appear to be an ethernet device\n", + devname); + exit(1); + } } static void dump_supported(struct ethtool_cmd *ep)