1
0
mirror of https://github.com/nmap/nmap.git synced 2026-01-20 21:29:06 +00:00

potential fix to kx-reported problem

This commit is contained in:
fyodor
2005-12-28 09:12:49 +00:00
parent d8ce1cfe41
commit 4a3a773963

View File

@@ -2571,7 +2571,22 @@ bool route_dst(const struct sockaddr_storage *const dst, struct route_nfo *rnfo)
ifsin = (struct sockaddr_in *) &(iface->addr);
if ((ifsin->sin_addr.s_addr & mask) == (dstsin->sin_addr.s_addr & mask))
rnfo->direct_connect = 1;
else rnfo->direct_connect = 0;
else {
rnfo->direct_connect = 0;
/* must find the next hop by checking route table ... */
routes = getsysroutes(&numroutes);
/* Now we simply go through the list and take the first match */
for(i=0; i < numroutes; i++) {
if (strcmp(routes[i].device->devname, iface->devname) == 0 &&
(routes[i].dest & routes[i].netmask) ==
(dstsin->sin_addr.s_addr & routes[i].netmask)) {
/* Yay, found a matching route. */
ifsin = (struct sockaddr_in *) &rnfo->nexthop;
ifsin->sin_family = AF_INET;
ifsin->sin_addr.s_addr = routes[i].gw.s_addr;
}
}
}
memcpy(&rnfo->ii, iface, sizeof(rnfo->ii));
if (o.spoofsource)
memcpy(&rnfo->srcaddr, &spoofss, sizeof(rnfo->srcaddr));