1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-19 14:09:02 +00:00

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]
This commit is contained in:
david
2010-02-28 19:45:39 +00:00
parent 2e99f41bfd
commit d9fd52c194
3 changed files with 60 additions and 1 deletions

View File

@@ -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]

View File

@@ -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:

View File

@@ -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));
}