diff --git a/nmap.h b/nmap.h index 4c3a8868d..eb15b14db 100644 --- a/nmap.h +++ b/nmap.h @@ -395,16 +395,6 @@ void *realloc(); #define MAXHOSTNAMELEN 64 #endif -#ifndef BSDFIX -#if FREEBSD || BSDI || NETBSD -#define BSDFIX(x) x -#define BSDUFIX(x) x -#else -#define BSDFIX(x) htons(x) -#define BSDUFIX(x) ntohs(x) -#endif -#endif /* BSDFIX */ - #ifndef recvfrom6_t # define recvfrom6_t int #endif diff --git a/tcpip.cc b/tcpip.cc index 2f8755dea..9d1e58642 100644 --- a/tcpip.cc +++ b/tcpip.cc @@ -968,8 +968,11 @@ int send_ip_packet(int sd, struct eth_nfo *eth, u8 *packet, unsigned int packetl must deal with it here rather than when building the packet, because they should be in NBO when I'm sending over raw ethernet */ - ip->ip_len = BSDFIX(ip->ip_len); - ip->ip_off = BSDFIX(ip->ip_off); +#if FREEBSD || BSDI || NETBSD || DEC + ip->ip_len = ntohs(ip->ip_len); + ip->ip_off = ntohs(ip->ip_off); +#endif + res = Sendto("send_ip_packet", sd, packet, packetlen, 0, (struct sockaddr *)&sock, (int)sizeof(struct sockaddr_in)); return res; @@ -2707,7 +2710,8 @@ do { error("sendto in %s: sendto(%d, packet, %d, 0, %s, %d) => %s", functionname, sd, len, inet_ntoa(sin->sin_addr), tolen, strerror(err)); - if (retries > 2 || err == EPERM || err == EACCES || err == EADDRNOTAVAIL) + if (retries > 2 || err == EPERM || err == EACCES || err == EADDRNOTAVAIL + || err == EINVAL) return -1; sleeptime = 15 * (1 << (2 * retries)); error("Sleeping %d seconds then retrying", sleeptime); diff --git a/tcpip.h b/tcpip.h index 96c5a619d..d21101bc0 100644 --- a/tcpip.h +++ b/tcpip.h @@ -248,16 +248,6 @@ typedef enum { devt_ethernet, devt_loopback, devt_p2p, devt_other } devtype; #define TCPIP_DEBUGGING 0 #endif -#ifndef BSDFIX -#if FREEBSD || BSDI || NETBSD || DEC -#define BSDFIX(x) x -#define BSDUFIX(x) x -#else -#define BSDFIX(x) htons(x) -#define BSDUFIX(x) ntohs(x) -#endif -#endif - /* Explicit Congestion Notification (rfc 2481/3168) */ #ifndef TH_ECE #define TH_ECE 0x40