mirror of
https://github.com/nmap/nmap.git
synced 2025-12-08 13:41:29 +00:00
Mostly seems to be working on Solaris, though I am having some problems with libpcap not timing out
This commit is contained in:
13
CHANGELOG
13
CHANGELOG
@@ -2,6 +2,19 @@
|
|||||||
|
|
||||||
UNRELEASED
|
UNRELEASED
|
||||||
|
|
||||||
|
o Fixed a problem where Nmap compilation would use header files from
|
||||||
|
the libpcap included with Nmap even when it was linking to a system
|
||||||
|
libpcap. Thanks to Solar Designer (solar(a)openwall.com) and Okan
|
||||||
|
Demirmen (okan(a)demirmen.com) for reporting the problem.
|
||||||
|
|
||||||
|
o Added configure option --with-libpcap=included to tell Nmap to use
|
||||||
|
the version of libpcap it ships with rather than any that may already be
|
||||||
|
installed on the system. You can still use --with-libpcap=[dir] to
|
||||||
|
specify that a system libpcap be installed rather than the shipped
|
||||||
|
one. By default, Nmap looks at both and decides which one is likely
|
||||||
|
to work best. If you are having problems on Solaris, try
|
||||||
|
--with-libpcap=included .
|
||||||
|
|
||||||
o Changed the --no-stylesheet option to --no_stylesheet to be
|
o Changed the --no-stylesheet option to --no_stylesheet to be
|
||||||
consistant with all of the other Nmap options. Though I'm starting to
|
consistant with all of the other Nmap options. Though I'm starting to
|
||||||
like hyphens a bit better than underscores and may change all of the
|
like hyphens a bit better than underscores and may change all of the
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ PYTHON_FALSE =
|
|||||||
PYTHON_TRUE = #
|
PYTHON_TRUE = #
|
||||||
RANLIB = ranlib
|
RANLIB = ranlib
|
||||||
SET_MAKE =
|
SET_MAKE =
|
||||||
SHELL = /bin/sh
|
SHELL = /bin/bash
|
||||||
STRIP = strip
|
STRIP = strip
|
||||||
TCLINC =
|
TCLINC =
|
||||||
TCLLIB =
|
TCLLIB =
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ PYTHON_FALSE =
|
|||||||
PYTHON_TRUE = #
|
PYTHON_TRUE = #
|
||||||
RANLIB = ranlib
|
RANLIB = ranlib
|
||||||
SET_MAKE =
|
SET_MAKE =
|
||||||
SHELL = /bin/sh
|
SHELL = /bin/bash
|
||||||
STRIP = strip
|
STRIP = strip
|
||||||
TCLINC =
|
TCLINC =
|
||||||
TCLLIB =
|
TCLLIB =
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ PYTHON_FALSE =
|
|||||||
PYTHON_TRUE = #
|
PYTHON_TRUE = #
|
||||||
RANLIB = ranlib
|
RANLIB = ranlib
|
||||||
SET_MAKE =
|
SET_MAKE =
|
||||||
SHELL = /bin/sh
|
SHELL = /bin/bash
|
||||||
STRIP = strip
|
STRIP = strip
|
||||||
TCLINC =
|
TCLINC =
|
||||||
TCLLIB =
|
TCLLIB =
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#! /bin/sh
|
#! /bin/bash
|
||||||
|
|
||||||
# libtoolT - Provide generalized library-building support services.
|
# libtoolT - Provide generalized library-building support services.
|
||||||
# Generated automatically by (GNU libdnet 1.10)
|
# Generated automatically by (GNU libdnet 1.10)
|
||||||
@@ -47,7 +47,7 @@ available_tags="available_tags= CXX F77"
|
|||||||
# Libtool was configured on host ultra:
|
# Libtool was configured on host ultra:
|
||||||
|
|
||||||
# Shell to use when invoking shell scripts.
|
# Shell to use when invoking shell scripts.
|
||||||
SHELL="/bin/sh"
|
SHELL="/bin/bash"
|
||||||
|
|
||||||
# Whether or not to build shared libraries.
|
# Whether or not to build shared libraries.
|
||||||
build_libtool_libs=yes
|
build_libtool_libs=yes
|
||||||
@@ -6766,7 +6766,7 @@ build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac`
|
|||||||
# Libtool was configured on host ultra:
|
# Libtool was configured on host ultra:
|
||||||
|
|
||||||
# Shell to use when invoking shell scripts.
|
# Shell to use when invoking shell scripts.
|
||||||
SHELL="/bin/sh"
|
SHELL="/bin/bash"
|
||||||
|
|
||||||
# Whether or not to build shared libraries.
|
# Whether or not to build shared libraries.
|
||||||
build_libtool_libs=yes
|
build_libtool_libs=yes
|
||||||
@@ -7063,7 +7063,7 @@ include_expsyms=""
|
|||||||
# Libtool was configured on host ultra:
|
# Libtool was configured on host ultra:
|
||||||
|
|
||||||
# Shell to use when invoking shell scripts.
|
# Shell to use when invoking shell scripts.
|
||||||
SHELL="/bin/sh"
|
SHELL="/bin/bash"
|
||||||
|
|
||||||
# Whether or not to build shared libraries.
|
# Whether or not to build shared libraries.
|
||||||
build_libtool_libs=yes
|
build_libtool_libs=yes
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ PYTHON_FALSE =
|
|||||||
PYTHON_TRUE = #
|
PYTHON_TRUE = #
|
||||||
RANLIB = ranlib
|
RANLIB = ranlib
|
||||||
SET_MAKE =
|
SET_MAKE =
|
||||||
SHELL = /bin/sh
|
SHELL = /bin/bash
|
||||||
STRIP = strip
|
STRIP = strip
|
||||||
TCLINC =
|
TCLINC =
|
||||||
TCLLIB =
|
TCLLIB =
|
||||||
|
|||||||
86
tcpip.cc
86
tcpip.cc
@@ -1720,7 +1720,7 @@ int read_arp_reply_pcap(pcap_t *pd, u8 *sendermac, struct in_addr *senderIP,
|
|||||||
if (memcmp(p + 12, "\x08\x06\x00\x01\x08\x00\x06\x04\x00\x02", 10) == 0) {
|
if (memcmp(p + 12, "\x08\x06\x00\x01\x08\x00\x06\x04\x00\x02", 10) == 0) {
|
||||||
memcpy(sendermac, p + 22, 6);
|
memcpy(sendermac, p + 22, 6);
|
||||||
/* I think alignment should allow this ... */
|
/* I think alignment should allow this ... */
|
||||||
senderIP->s_addr = *(u32 *) (p + 28) ;
|
memcpy(&senderIP->s_addr, p+28, 4);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2246,6 +2246,64 @@ struct interface_info *getinterfaces(int *howmany) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
struct dnet_collector_route_nfo {
|
||||||
|
struct sys_route *routes;
|
||||||
|
int numroutes;
|
||||||
|
int route_capacity;
|
||||||
|
struct interface_info *ifaces;
|
||||||
|
int numifaces;
|
||||||
|
};
|
||||||
|
|
||||||
|
int collect_dnet_routes(const struct route_entry *entry, void *arg) {
|
||||||
|
struct dnet_collector_route_nfo *dcrn = (struct dnet_collector_route_nfo *) arg;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
/* Make sure that it is the proper type of route ... */
|
||||||
|
if (entry->route_dst.addr_type != ADDR_TYPE_IP || entry->route_gw.addr_type != ADDR_TYPE_IP)
|
||||||
|
return 0; /* Not interested in IPv6 routes at the moment ... */
|
||||||
|
|
||||||
|
/* Make sure we have room for the new route */
|
||||||
|
if (dcrn->numroutes >= dcrn->route_capacity) {
|
||||||
|
dcrn->route_capacity <<= 2;
|
||||||
|
dcrn->routes = (struct sys_route *) realloc(dcrn->routes,
|
||||||
|
dcrn->route_capacity * sizeof(struct sys_route));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Now for the important business */
|
||||||
|
dcrn->routes[dcrn->numroutes].dest = entry->route_dst.addr_ip;
|
||||||
|
addr_btom(entry->route_dst.addr_bits, &dcrn->routes[dcrn->numroutes].netmask, sizeof(dcrn->routes[dcrn->numroutes].netmask));
|
||||||
|
dcrn->routes[dcrn->numroutes].gw.s_addr = entry->route_gw.addr_ip;
|
||||||
|
/* Now determine which interface the route relates to */
|
||||||
|
u32 mask;
|
||||||
|
struct sockaddr_in *sin;
|
||||||
|
for(i = 0; i < dcrn->numifaces; i++) {
|
||||||
|
sin = (struct sockaddr_in *) &dcrn->ifaces[i].addr;
|
||||||
|
mask = htonl((unsigned long) (0-1) << (32 - dcrn->ifaces[i].netmask_bits));
|
||||||
|
if ((sin->sin_addr.s_addr & mask) == (entry->route_gw.addr_ip & mask)) {
|
||||||
|
dcrn->routes[dcrn->numroutes].device = &dcrn->ifaces[i];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (i == dcrn->numifaces) {
|
||||||
|
error("WARNING: Unable to find appropriate interface for system route to %s\n", addr_ntoa(&entry->route_gw));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
dcrn->numroutes++;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* A trivial function used with qsort to sort the routes by netmask */
|
||||||
|
static int nmaskcmp(const void *a, const void *b) {
|
||||||
|
struct sys_route *r1 = (struct sys_route *) a;
|
||||||
|
struct sys_route *r2 = (struct sys_route *) b;
|
||||||
|
if (r1->netmask == r2->netmask)
|
||||||
|
return 0;
|
||||||
|
if (ntohl(r1->netmask) > ntohl(r2->netmask))
|
||||||
|
return -1;
|
||||||
|
else return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* Parse the system routing table, converting each route into a
|
/* Parse the system routing table, converting each route into a
|
||||||
sys_route entry. Returns an array of sys_routes. numroutes is set
|
sys_route entry. Returns an array of sys_routes. numroutes is set
|
||||||
to the number of routes in the array. The routing table is only
|
to the number of routes in the array. The routing table is only
|
||||||
@@ -2354,12 +2412,34 @@ struct sys_route *getsysroutes(int *howmany) {
|
|||||||
routes = (struct sys_route *) realloc(routes, route_capacity * sizeof(struct sys_route));
|
routes = (struct sys_route *) realloc(routes, route_capacity * sizeof(struct sys_route));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else fatal("Need to write portable route gathering code");
|
} else {
|
||||||
|
struct dnet_collector_route_nfo dcrn;
|
||||||
|
dcrn.routes = routes;
|
||||||
|
dcrn.numroutes = numroutes;
|
||||||
|
dcrn.route_capacity = route_capacity;
|
||||||
|
dcrn.ifaces = ifaces;
|
||||||
|
dcrn.numifaces = numifaces;
|
||||||
|
route_t *dr = route_open();
|
||||||
|
if (!dr) fatal("%s: route_open() failed", __FUNCTION__);
|
||||||
|
if (route_loop(dr, collect_dnet_routes, &dcrn) != 0) {
|
||||||
|
fatal("%s: route_loop() failed", __FUNCTION__);
|
||||||
|
}
|
||||||
|
route_close(dr);
|
||||||
|
/* These values could have changed in the callback */
|
||||||
|
route_capacity = dcrn.route_capacity;
|
||||||
|
numroutes = dcrn.numroutes;
|
||||||
|
routes = dcrn.routes;
|
||||||
|
}
|
||||||
|
|
||||||
/* Ensure that the route array is sorted by netmask */
|
/* Ensure that the route array is sorted by netmask */
|
||||||
for(i=1; i < numroutes; i++) {
|
for(i=1; i < numroutes; i++) {
|
||||||
if (ntohl(routes[i].netmask) > ntohl(routes[i-1].netmask))
|
if (ntohl(routes[i].netmask) > ntohl(routes[i-1].netmask))
|
||||||
fatal("Uh-oh -- your route list isn't sorted by Netmask. Please notify fyodor@insecure.org\n");
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i < numroutes) {
|
||||||
|
/* they're not sorted ... better take care of that */
|
||||||
|
qsort(routes, numroutes, sizeof(routes[0]), nmaskcmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!howmany) fatal("NULL howmany ptr passed to getsysroutes()");
|
if (!howmany) fatal("NULL howmany ptr passed to getsysroutes()");
|
||||||
|
|||||||
Reference in New Issue
Block a user