Nmap Development mailing list archives

Re: "dnet: Failed to open device" errors on AIX, as root


From: Ben Lentz <ben.lentz () gmail com>
Date: Thu, 07 Mar 2013 08:59:12 -0500

> It looks like you are still missing an important part of the patch. Please try this patch which adds padding to short packets. David Fifield

Applying this patch against the 6.01 source:

--- libdnet-stripped/src/eth-ndd.c
+++ libdnet-stripped/src/eth-ndd.c
@@ -42,7 +42,7 @@ eth_open(const char *device)
        sa.sndd_8022_family = AF_NDD;
         sa.sndd_8022_len = sizeof(sa);
        sa.sndd_8022_filtertype = NS_ETHERTYPE;
-       sa.sndd_8022_ethertype = ETH_TYPE_IP;
+       sa.sndd_8022_ethertype = 0;
        sa.sndd_8022_filterlen = sizeof(struct ns_8022);
strlcpy(sa.sndd_8022_nddname, device, sizeof(sa.sndd_8022_nddname));

@@ -60,7 +60,16 @@ eth_open(const char *device)
 ssize_t
 eth_send(eth_t *e, const void *buf, size_t len)
 {
-       return (write(e->fd, buf, len));
+       char bufc[60];
+       int result = 0;
+       if (len < 60) {
+               memset(bufc,0,sizeof(buf));
+               memcpy(bufc,buf,len);
+               result=write(e->fd,bufc, sizeof(bufc));
+               if (result == sizeof(bufc)) result = len;
+       }
+       else result=write(e->fd, buf, len);
+       return result;
 }

 eth_t *

Results in:

$ sudo /opt/local/nmap/bin/nmap -sS 10.0.17.1

Starting Nmap 6.01 ( http://nmap.org ) at 2013-03-07 08:53 EST
WARNING: eth_send of ARP packet returned -1 rather than expected 42 (errno=19: No such device) WARNING: eth_send of ARP packet returned -1 rather than expected 42 (errno=19: No such device) Note: Host seems down. If it is really up, but blocking our ping probes, try -Pn
Nmap done: 1 IP address (0 hosts up) scanned in 0.47 seconds

$ sudo /opt/local/nmap/bin/nmap -sS --route-dst 10.0.17.1
10.0.17.1
en2 en2 srcaddr 10.0.17.16 direct

Starting Nmap 6.01 ( http://nmap.org ) at 2013-03-07 08:56 EST
WARNING: No targets were specified, so 0 hosts scanned.
Nmap done: 0 IP addresses (0 hosts up) scanned in 0.07 seconds

Also, --send-ip now appears to be broken:

$ sudo /opt/local/nmap/bin/nmap -sS --send-ip 10.0.17.1

Starting Nmap 6.01 ( http://nmap.org ) at 2013-03-07 08:58 EST
Assertion failed: __EX, file  nsock_pool.c, line 287

With the other (incomplete) patch:

$ sudo /opt/local/nmap/bin/nmap -sS 10.0.17.1

Starting Nmap 6.01 ( http://nmap.org ) at 2013-03-07 08:50 EST
dnet: Failed to open device en2
QUITTING!


_______________________________________________
Sent through the dev mailing list
http://nmap.org/mailman/listinfo/dev
Archived at http://seclists.org/nmap-dev/


Current thread: