diff --git a/global_structures.h b/global_structures.h index 3ba22d43e..2b669cf12 100644 --- a/global_structures.h +++ b/global_structures.h @@ -316,9 +316,9 @@ struct seq_info { /* Different kinds of Ipids. */ struct ipid_info { - int tcp_ipids[NUM_SEQ_SAMPLES]; - int tcp_closed_ipids[NUM_SEQ_SAMPLES]; - int icmp_ipids[NUM_SEQ_SAMPLES]; + u32 tcp_ipids[NUM_SEQ_SAMPLES]; + u32 tcp_closed_ipids[NUM_SEQ_SAMPLES]; + u32 icmp_ipids[NUM_SEQ_SAMPLES]; }; /* The various kinds of port/protocol scans we can have diff --git a/idle_scan.cc b/idle_scan.cc index e5b98b6e5..56b4ce6e6 100644 --- a/idle_scan.cc +++ b/idle_scan.cc @@ -552,7 +552,7 @@ static void initialize_idleproxy(struct idle_proxy_info *proxy, char *proxyName, struct ip *ip; struct tcp_hdr *tcp; int distance; - int ipids[NUM_IPID_PROBES]; + u32 ipids[NUM_IPID_PROBES]; u8 probe_returned[NUM_IPID_PROBES]; struct route_nfo rnfo; assert(proxyName); diff --git a/osscan2.cc b/osscan2.cc index eb3b76276..6096dee38 100644 --- a/osscan2.cc +++ b/osscan2.cc @@ -193,7 +193,7 @@ struct scan_performance_vars perf; test result should be omitted, the function returns NULL and doesn't modify *av. Otherwise, it returns av after filling in the information. */ static struct AVal *make_aval_ipid_seq(struct AVal *av, const char *attribute, - int ipid_seqclass, int ipids[NUM_SEQ_SAMPLES]) { + int ipid_seqclass, u32 ipids[NUM_SEQ_SAMPLES]) { switch (ipid_seqclass) { case IPID_SEQ_CONSTANT: av->value = string_pool_sprintf("%X", ipids[0]); @@ -332,7 +332,7 @@ int identify_sequence(int numSamples, u32 *ipid_diffs, int islocalhost, int alli /* Calculate the distances between the ipids and write them into the ipid_diffs array */ -int get_diffs(u32 *ipid_diffs, int numSamples, int *ipids, int islocalhost) { +int get_diffs(u32 *ipid_diffs, int numSamples, u32 *ipids, int islocalhost) { int i; int allipideqz = 1; @@ -343,11 +343,7 @@ int get_diffs(u32 *ipid_diffs, int numSamples, int *ipids, int islocalhost) { if (ipids[i - 1] != 0 || ipids[i] != 0) allipideqz = 0; /* All IP.ID values do *NOT* equal zero */ - if (ipids[i - 1] <= ipids[i]) { - ipid_diffs[i - 1] = ipids[i] - ipids[i - 1]; - } else { - ipid_diffs[i - 1] = (u32) (ipids[i] - ipids[i - 1] + 4294967296); - } + ipid_diffs[i - 1] = ipids[i] - ipids[i - 1]; /* Random */ if (numSamples > 2 && ipid_diffs[i - 1] > 20000) @@ -359,7 +355,7 @@ int get_diffs(u32 *ipid_diffs, int numSamples, int *ipids, int islocalhost) { } /* Indentify the ipid sequence for 32-bit IPID values (IPv6) */ -int get_ipid_sequence_32(int numSamples, int *ipids, int islocalhost) { +int get_ipid_sequence_32(int numSamples, u32 *ipids, int islocalhost) { int allipideqz=1; u32 ipid_diffs[32]; assert(numSamples < (int) (sizeof(ipid_diffs) / 2)); @@ -368,7 +364,7 @@ int get_ipid_sequence_32(int numSamples, int *ipids, int islocalhost) { } /* Indentify the ipid sequence for 16-bit IPID values (IPv4) */ -int get_ipid_sequence_16(int numSamples, int *ipids, int islocalhost) { +int get_ipid_sequence_16(int numSamples, u32 *ipids, int islocalhost) { int i; int allipideqz=1; u32 ipid_diffs[32]; @@ -2390,21 +2386,21 @@ void HostOsScan::makeTSeqFP(HostOsScanStats *hss) { good_icmp_ipid_num = 0; for (i = 0; i < NUM_SEQ_SAMPLES; i++) { - if (hss->ipid.tcp_ipids[i] != -1) { + if (hss->ipid.tcp_ipids[i] != 0xffffffff) { if (good_tcp_ipid_num < i) { hss->ipid.tcp_ipids[good_tcp_ipid_num] = hss->ipid.tcp_ipids[i]; } good_tcp_ipid_num++; } - if (hss->ipid.tcp_closed_ipids[i] != -1) { + if (hss->ipid.tcp_closed_ipids[i] != 0xffffffff) { if (good_tcp_closed_ipid_num < i) { hss->ipid.tcp_closed_ipids[good_tcp_closed_ipid_num] = hss->ipid.tcp_closed_ipids[i]; } good_tcp_closed_ipid_num++; } - if (hss->ipid.icmp_ipids[i] != -1) { + if (hss->ipid.icmp_ipids[i] != 0xffffffff) { if (good_icmp_ipid_num < i) { hss->ipid.icmp_ipids[good_icmp_ipid_num] = hss->ipid.icmp_ipids[i]; } @@ -2450,7 +2446,7 @@ void HostOsScan::makeTSeqFP(HostOsScanStats *hss) { /* Both are incremental. Thus we have "SS" test. Check if they are in the same sequence. */ AV.attribute = "SS"; - int avg = (hss->ipid.tcp_ipids[good_tcp_ipid_num - 1] - hss->ipid.tcp_ipids[0]) / (good_tcp_ipid_num - 1); + u32 avg = (hss->ipid.tcp_ipids[good_tcp_ipid_num - 1] - hss->ipid.tcp_ipids[0]) / (good_tcp_ipid_num - 1); if ( hss->ipid.icmp_ipids[0] < hss->ipid.tcp_ipids[good_tcp_ipid_num - 1] + 3 * avg) { AV.value = "S"; } else { diff --git a/osscan2.h b/osscan2.h index e5a273192..9154a7ec2 100644 --- a/osscan2.h +++ b/osscan2.h @@ -189,9 +189,9 @@ void os_scan2(std::vector &Targets); int get_initial_ttl_guess(u8 ttl); int identify_sequence(int numSamples, u32 *ipid_diffs, int islocalhost, int allipideqz); -int get_diffs(u32 *ipid_diffs, int numSamples, int *ipids, int islocalhost); -int get_ipid_sequence_16(int numSamples, int *ipids, int islocalhost); -int get_ipid_sequence_32(int numSamples, int *ipids, int islocalhost); +int get_diffs(u32 *ipid_diffs, int numSamples, u32 *ipids, int islocalhost); +int get_ipid_sequence_16(int numSamples, u32 *ipids, int islocalhost); +int get_ipid_sequence_32(int numSamples, u32 *ipids, int islocalhost); /****************************************************************************** * CLASS DEFINITIONS *