pkgsrc-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: nmap not working?
I took a look at the nmap source and it is using SIOCGIFCONF
incorrectly. The following should help, but I'm running an old kernel
on my notebook and can't test it.
Basically, the rule for SIOCGIFCONF is that the next ifreq is right
after this one, unless the struct sockaddr_foo (by its length) is too
big to fit in the union that is supposed to hold the sockaddr. That
always used to be struct sockaddr, and now it's struct sockaddr_storage,
which by construction is supposed to be big enough.
--- tcpip.cc.~1~ 2006-12-07 22:01:19.000000000 -0500
+++ tcpip.cc 2007-11-09 14:59:06.000000000 -0500
@@ -2632,7 +2632,12 @@
/* On some platforms (such as FreeBSD), the length of each ifr changes
based on the sockaddr type used, so we get the next length now */
#if HAVE_SOCKADDR_SA_LEN
- len = ifr->ifr_addr.sa_len + sizeof(ifr->ifr_name);
+ len = ifr->ifr_addr.sa_len;
+ if (len < sizeof(ifr->ifr_ifru))
+ len = sizeof(ifr->ifr_ifru);
+
+ len += sizeof(ifr->ifr_name);
+ printf("sa_len %d len %d\n", ifr->ifr_addr.sa_len, len);
#endif
/* skip any device with no name */
Home |
Main Index |
Thread Index |
Old Index