From 2c7e3f31decf544c4b1b12add4d8790ad4da7d42 Mon Sep 17 00:00:00 2001 From: david Date: Sat, 17 Mar 2012 12:06:27 +0000 Subject: [PATCH] Try /dev/net/ after /dev/ with DLPI. This appears to be a new place on Solaris 11. WIthout this, I get a MAC address of 00:00:00:00:00:00 from --iflist for example. --- libdnet-stripped/src/eth-dlpi.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/libdnet-stripped/src/eth-dlpi.c b/libdnet-stripped/src/eth-dlpi.c index d12f09b28..dc7b8c932 100644 --- a/libdnet-stripped/src/eth-dlpi.c +++ b/libdnet-stripped/src/eth-dlpi.c @@ -114,10 +114,10 @@ eth_match_ppa(eth_t *e, const char *device) return (ppa); } #else -static int -dev_find_ppa(const char *dev) +static char * +dev_find_ppa(char *dev) { - const char *p; + char *p; p = dev + strlen(dev); while (p > dev && strchr("0123456789", *(p - 1)) != NULL) @@ -161,8 +161,11 @@ eth_open(const char *device) if ((e->fd = open(dev, O_RDWR)) < 0) { snprintf(dev, sizeof(dev), "/dev/%s", device); - if ((e->fd = open(dev, O_RDWR)) < 0) - return (eth_close(e)); + if ((e->fd = open(dev, O_RDWR)) < 0) { + snprintf(dev, sizeof(dev), "/dev/net/%s", device); + if ((e->fd = open(dev, O_RDWR)) < 0) + return (eth_close(e)); + } } #endif dlp = (union DL_primitives *)buf;