Re: [PATCH] ethtool: add get permanent address option
From: Ben Hutchings <hidden>
Date: 2010-10-18 19:52:24
On Mon, 2010-10-18 at 11:41 -0700, Stephen Hemminger wrote:
Add command level support for showing permanent address. The ioctl has been around for a long time but there was no option to display it. Note: MAX_ADDR_LEN is defined in netdevice.h but including netdevice.h leads to multiple definition errors with if.h.
[...]
quoted hunk ↗ jump to hunk
@@ -2950,6 +2961,29 @@ static int do_flash(int fd, struct ifreq *ifr) return err; } +static int do_permaddr(int fd, struct ifreq *ifr) +{ + int i, err; + struct ethtool_perm_addr *epaddr; + + epaddr = malloc(sizeof(struct ethtool_perm_addr) + MAX_ADDR_LEN); + epaddr->cmd = ETHTOOL_GPERMADDR; + epaddr->size = MAX_ADDR_LEN; + ifr->ifr_data = (caddr_t)epaddr; + + err = send_ioctl(fd, ifr); + if (err < 0) + perror("Cannot read permanent address\n");
[...] Don't include a newline in the argument to perror(). Ben. -- Ben Hutchings, Senior Software Engineer, Solarflare Communications Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.