mirror of
https://github.com/nmap/nmap.git
synced 2025-12-22 07:29:01 +00:00
Use the preprocessor defines IP_DF and IP_OFFMASK instead of literal
0x4000 and 8191.
This commit is contained in:
@@ -2303,7 +2303,7 @@ bool HostOsScan::processT1_7Resp(HostOsScanStats *hss, struct ip *ip, int replyN
|
|||||||
|
|
||||||
/* Next we check whether the Don't Fragment bit is set */
|
/* Next we check whether the Don't Fragment bit is set */
|
||||||
AVs[current_testno].attribute = (char*)"DF";
|
AVs[current_testno].attribute = (char*)"DF";
|
||||||
if(ntohs(ip->ip_off) & 0x4000) {
|
if(ntohs(ip->ip_off) & IP_DF) {
|
||||||
strcpy(AVs[current_testno].value,"Y");
|
strcpy(AVs[current_testno].value,"Y");
|
||||||
} else strcpy(AVs[current_testno].value, "N");
|
} else strcpy(AVs[current_testno].value, "N");
|
||||||
|
|
||||||
@@ -2486,7 +2486,7 @@ bool HostOsScan::processTUdpResp(HostOsScanStats *hss, struct ip *ip) {
|
|||||||
|
|
||||||
/* Now let us do an easy one, Don't fragment */
|
/* Now let us do an easy one, Don't fragment */
|
||||||
AVs[current_testno].attribute = (char*)"DF";
|
AVs[current_testno].attribute = (char*)"DF";
|
||||||
if(ntohs(ip->ip_off) & 0x4000) {
|
if(ntohs(ip->ip_off) & IP_DF) {
|
||||||
strcpy(AVs[current_testno].value,"Y");
|
strcpy(AVs[current_testno].value,"Y");
|
||||||
} else strcpy(AVs[current_testno].value, "N");
|
} else strcpy(AVs[current_testno].value, "N");
|
||||||
|
|
||||||
|
|||||||
6
tcpip.cc
6
tcpip.cc
@@ -448,7 +448,7 @@ static const char *ippackethdrinfo(const u8 *packet, u32 len) {
|
|||||||
inet_ntop(AF_INET, &saddr, srchost, sizeof(srchost));
|
inet_ntop(AF_INET, &saddr, srchost, sizeof(srchost));
|
||||||
inet_ntop(AF_INET, &daddr, dsthost, sizeof(dsthost));
|
inet_ntop(AF_INET, &daddr, dsthost, sizeof(dsthost));
|
||||||
|
|
||||||
frag_off = 8 * (ntohs(ip->ip_off) & 8191) /* 2^13 - 1 */;
|
frag_off = 8 * (ntohs(ip->ip_off) & IP_OFFMASK);
|
||||||
more_fragments = ntohs(ip->ip_off) & IP_MF;
|
more_fragments = ntohs(ip->ip_off) & IP_MF;
|
||||||
if (frag_off || more_fragments) {
|
if (frag_off || more_fragments) {
|
||||||
Snprintf(fragnfo, sizeof(fragnfo), " frag offset=%d%s", frag_off, more_fragments ? "+" : "");
|
Snprintf(fragnfo, sizeof(fragnfo), " frag offset=%d%s", frag_off, more_fragments ? "+" : "");
|
||||||
@@ -1591,7 +1591,7 @@ if (!packet) {
|
|||||||
|
|
||||||
bullshit.s_addr = ip->ip_src.s_addr; bullshit2.s_addr = ip->ip_dst.s_addr;
|
bullshit.s_addr = ip->ip_src.s_addr; bullshit2.s_addr = ip->ip_dst.s_addr;
|
||||||
/* this is gay */
|
/* this is gay */
|
||||||
realfrag = htons(ntohs(ip->ip_off) & 8191 /* 2^13 - 1 */);
|
realfrag = htons(ntohs(ip->ip_off) & IP_OFFMASK);
|
||||||
tot_len = htons(ip->ip_len);
|
tot_len = htons(ip->ip_len);
|
||||||
strncpy(sourcehost, inet_ntoa(bullshit), 16);
|
strncpy(sourcehost, inet_ntoa(bullshit), 16);
|
||||||
i = 4 * (ntohs(ip->ip_hl) + ntohs(tcp->th_off));
|
i = 4 * (ntohs(ip->ip_hl) + ntohs(tcp->th_off));
|
||||||
@@ -1650,7 +1650,7 @@ if (!packet) {
|
|||||||
|
|
||||||
bullshit.s_addr = ip->ip_src.s_addr; bullshit2.s_addr = ip->ip_dst.s_addr;
|
bullshit.s_addr = ip->ip_src.s_addr; bullshit2.s_addr = ip->ip_dst.s_addr;
|
||||||
/* this is gay */
|
/* this is gay */
|
||||||
realfrag = htons(ntohs(ip->ip_off) & 8191 /* 2^13 - 1 */);
|
realfrag = htons(ntohs(ip->ip_off) & IP_OFFMASK);
|
||||||
tot_len = htons(ip->ip_len);
|
tot_len = htons(ip->ip_len);
|
||||||
strncpy(sourcehost, inet_ntoa(bullshit), 16);
|
strncpy(sourcehost, inet_ntoa(bullshit), 16);
|
||||||
i = 4 * (ntohs(ip->ip_hl)) + 8;
|
i = 4 * (ntohs(ip->ip_hl)) + 8;
|
||||||
|
|||||||
Reference in New Issue
Block a user