diff --git a/osscan2.cc b/osscan2.cc index 702117dde..a05d54c36 100644 --- a/osscan2.cc +++ b/osscan2.cc @@ -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 */ 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"); } 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 */ 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"); } else strcpy(AVs[current_testno].value, "N"); diff --git a/tcpip.cc b/tcpip.cc index 4cb567c9c..f3eca192d 100644 --- a/tcpip.cc +++ b/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, &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; if (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; /* 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); strncpy(sourcehost, inet_ntoa(bullshit), 16); 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; /* 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); strncpy(sourcehost, inet_ntoa(bullshit), 16); i = 4 * (ntohs(ip->ip_hl)) + 8;