diff --git a/CHANGELOG b/CHANGELOG index 91c255db8..dcaa08b70 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -2,6 +2,12 @@ [NOT YET RELEASED] +o Fixed the parsing of libdnet DLPI interface names that contain more + than one string of digits. Joe Dietz reported that an interface with + the name e1000g0 was causing the error message + Warning: Unable to open interface e1000g0 -- skipping it. + on Solaris 9. [David] + o [NSE] Raw packet sending at the IP layer is now supported, in addition to the Ethernet sending functionality. Packets to send start with an IPv4 header and can be sent to arbitrary hosts. [Kris] diff --git a/libdnet-stripped/NMAP_MODIFICATIONS b/libdnet-stripped/NMAP_MODIFICATIONS index f38306cd4..45d735b96 100644 --- a/libdnet-stripped/NMAP_MODIFICATIONS +++ b/libdnet-stripped/NMAP_MODIFICATIONS @@ -214,6 +214,45 @@ Index: libdnet-stripped/src/intf-win32.c } else return (-1); +Changed the PPA extraction from DLPI interface names to use the last +string of digits, not the first. It was being fooled by the name +e1000g0, thinking the PPA was 1000. + +Index: src/eth-dlpi.c +=================================================================== +--- src/eth-dlpi.c (revision 16878) ++++ src/eth-dlpi.c (working copy) +@@ -113,6 +113,20 @@ + } + return (ppa); + } ++#else ++static int ++dev_find_ppa(const char *dev) ++{ ++ const char *p; ++ ++ p = dev + strlen(dev); ++ while (p > dev && strchr("0123456789", *(p - 1)) != NULL) ++ p--; ++ if (*p == '\0') ++ return NULL; ++ ++ return p; ++} + #endif + + eth_t * +@@ -138,7 +152,7 @@ + #else + e->fd = -1; + snprintf(dev, sizeof(dev), "/dev/%s", device); +- if ((p = strpbrk(dev, "0123456789")) == NULL) { ++ if ((p = dev_find_ppa(dev)) == NULL) { + errno = EINVAL; + return (eth_close(e)); + } + ===CHANGES ALREADY MERGED TO UPSTREAM LIBDNET GO BELOW THIS LINE=== o Made some code changes to intf.c (the patch below). This does the following: diff --git a/libdnet-stripped/src/eth-dlpi.c b/libdnet-stripped/src/eth-dlpi.c index 8e28ddca4..d12f09b28 100644 --- a/libdnet-stripped/src/eth-dlpi.c +++ b/libdnet-stripped/src/eth-dlpi.c @@ -113,6 +113,20 @@ eth_match_ppa(eth_t *e, const char *device) } return (ppa); } +#else +static int +dev_find_ppa(const char *dev) +{ + const char *p; + + p = dev + strlen(dev); + while (p > dev && strchr("0123456789", *(p - 1)) != NULL) + p--; + if (*p == '\0') + return NULL; + + return p; +} #endif eth_t * @@ -138,7 +152,7 @@ eth_open(const char *device) #else e->fd = -1; snprintf(dev, sizeof(dev), "/dev/%s", device); - if ((p = strpbrk(dev, "0123456789")) == NULL) { + if ((p = dev_find_ppa(dev)) == NULL) { errno = EINVAL; return (eth_close(e)); }