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

Do the same thing as r16000 (IP ID matching only after other tests pass)

for ping probe replies too.
This commit is contained in:
david
2009-11-04 21:37:02 +00:00
parent af8f151972
commit 7399cd7fec

View File

@@ -4577,13 +4577,13 @@ static int get_ping_pcap_result(UltraScanInfo *USI, struct timeval *stime) {
if (o.af() != AF_INET || probe->protocol() != IPPROTO_ICMP) if (o.af() != AF_INET || probe->protocol() != IPPROTO_ICMP)
continue; continue;
if (!allow_ipid_match(probe->ipid(), ntohs(ip2->ip_id)))
continue;
/* Ensure the connection info matches. */ /* Ensure the connection info matches. */
if (hss->target->v4sourceip()->s_addr != ip->ip_dst.s_addr) if (hss->target->v4sourceip()->s_addr != ip->ip_dst.s_addr)
continue; continue;
if (!allow_ipid_match(probe->ipid(), ntohs(ip2->ip_id)))
continue;
/* If we made it this far, we found it. We don't yet know if it's /* If we made it this far, we found it. We don't yet know if it's
going to change a host state (goodone) or not. */ going to change a host state (goodone) or not. */
break; break;
@@ -4612,9 +4612,6 @@ static int get_ping_pcap_result(UltraScanInfo *USI, struct timeval *stime) {
if (o.af() != AF_INET || probe->protocol() != IPPROTO_TCP) if (o.af() != AF_INET || probe->protocol() != IPPROTO_TCP)
continue; continue;
if (!allow_ipid_match(probe->ipid(), ntohs(ip2->ip_id)))
continue;
/* Ensure the connection info matches. */ /* Ensure the connection info matches. */
if (probe->dport() != ntohs(tcp->th_dport) if (probe->dport() != ntohs(tcp->th_dport)
|| probe->sport() != ntohs(tcp->th_sport) || probe->sport() != ntohs(tcp->th_sport)
@@ -4622,6 +4619,9 @@ static int get_ping_pcap_result(UltraScanInfo *USI, struct timeval *stime) {
|| hss->target->v4sourceip()->s_addr != ip->ip_dst.s_addr) || hss->target->v4sourceip()->s_addr != ip->ip_dst.s_addr)
continue; continue;
if (!allow_ipid_match(probe->ipid(), ntohs(ip2->ip_id)))
continue;
/* If we made it this far, we found it. We don't yet know if it's /* If we made it this far, we found it. We don't yet know if it's
going to change a host state (goodone) or not. */ going to change a host state (goodone) or not. */
break; break;
@@ -4651,9 +4651,6 @@ static int get_ping_pcap_result(UltraScanInfo *USI, struct timeval *stime) {
if (o.af() != AF_INET || probe->protocol() != IPPROTO_UDP) if (o.af() != AF_INET || probe->protocol() != IPPROTO_UDP)
continue; continue;
if (!allow_ipid_match(probe->ipid(), ntohs(ip2->ip_id)))
continue;
/* Ensure the connection info matches. */ /* Ensure the connection info matches. */
if (probe->dport() != ntohs(udp->uh_dport) || if (probe->dport() != ntohs(udp->uh_dport) ||
probe->sport() != ntohs(udp->uh_sport) || probe->sport() != ntohs(udp->uh_sport) ||
@@ -4668,6 +4665,9 @@ static int get_ping_pcap_result(UltraScanInfo *USI, struct timeval *stime) {
probe->ipid() == ntohs(ip->ip_id)) probe->ipid() == ntohs(ip->ip_id))
continue; /* We saw the packet we ourselves sent */ continue; /* We saw the packet we ourselves sent */
if (!allow_ipid_match(probe->ipid(), ntohs(ip2->ip_id)))
continue;
/* If we made it this far, we found it. We don't yet know if it's /* If we made it this far, we found it. We don't yet know if it's
going to change a host state (goodone) or not. */ going to change a host state (goodone) or not. */
break; break;
@@ -4697,9 +4697,6 @@ static int get_ping_pcap_result(UltraScanInfo *USI, struct timeval *stime) {
if (o.af() != AF_INET || probe->protocol() != IPPROTO_SCTP) if (o.af() != AF_INET || probe->protocol() != IPPROTO_SCTP)
continue; continue;
if (!allow_ipid_match(probe->ipid(), ntohs(ip2->ip_id)))
continue;
/* Ensure the connection info matches. */ /* Ensure the connection info matches. */
if (probe->dport() != ntohs(sctp->sh_dport) || if (probe->dport() != ntohs(sctp->sh_dport) ||
probe->sport() != ntohs(sctp->sh_sport) || probe->sport() != ntohs(sctp->sh_sport) ||
@@ -4714,6 +4711,9 @@ static int get_ping_pcap_result(UltraScanInfo *USI, struct timeval *stime) {
probe->ipid() == ntohs(ip->ip_id)) probe->ipid() == ntohs(ip->ip_id))
continue; /* We saw the packet we ourselves sent */ continue; /* We saw the packet we ourselves sent */
if (!allow_ipid_match(probe->ipid(), ntohs(ip2->ip_id)))
continue;
/* If we made it this far, we found it. We don't yet know if it's /* If we made it this far, we found it. We don't yet know if it's
going to change a host state (goodone) or not. */ going to change a host state (goodone) or not. */
break; break;
@@ -4745,13 +4745,13 @@ static int get_ping_pcap_result(UltraScanInfo *USI, struct timeval *stime) {
if (o.af() != AF_INET || probe->protocol() != ip2->ip_p) if (o.af() != AF_INET || probe->protocol() != ip2->ip_p)
continue; continue;
if (!allow_ipid_match(probe->ipid(), ntohs(ip2->ip_id)))
continue;
/* Ensure the connection info matches. */ /* Ensure the connection info matches. */
if (hss->target->v4sourceip()->s_addr != ip->ip_dst.s_addr) if (hss->target->v4sourceip()->s_addr != ip->ip_dst.s_addr)
continue; continue;
if (!allow_ipid_match(probe->ipid(), ntohs(ip2->ip_id)))
continue;
/* If we made it this far, we found it. We don't yet know if it's /* If we made it this far, we found it. We don't yet know if it's
going to change a host state (goodone) or not. */ going to change a host state (goodone) or not. */
break; break;