Skip to content

Commit 96ca13b

Browse files
committed
Merge pull request #6 from clevertension/master
fix the code to support mac
2 parents 7257579 + 2606957 commit 96ca13b

File tree

5 files changed

+7
-9
lines changed

5 files changed

+7
-9
lines changed

ars.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -914,7 +914,7 @@ int ars_bsd_fix(struct ars_packet *pkt, unsigned char *packet, size_t size)
914914
return -ARS_INVALID;
915915
}
916916
ip = (struct ars_iphdr*) packet;
917-
#if defined OSTYPE_FREEBSD || defined OSTYPE_NETBSD || defined OSTYPE_BSDI
917+
#if defined OSTYPE_DARWIN || defined OSTYPE_FREEBSD || defined OSTYPE_NETBSD || defined OSTYPE_BSDI
918918
ip->tot_len = ntohs(ip->tot_len);
919919
ip->frag_off = ntohs(ip->frag_off);
920920
#endif

gethostname.c

+2-4
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
#include <arpa/inet.h>
1919
#include <string.h>
2020

21-
size_t strlcpy(char *dst, const char *src, size_t siz);
22-
2321
char *get_hostname(char* addr)
2422
{
2523
static char answer[1024];
@@ -36,7 +34,7 @@ char *get_hostname(char* addr)
3634
if (!strcmp(addr, lastreq))
3735
return last_answerp;
3836

39-
strlcpy(lastreq, addr, 1024);
37+
strncpy(lastreq, addr, 1024);
4038
inet_aton(addr, &naddr);
4139
he = gethostbyaddr((char*)&naddr, 4, AF_INET);
4240

@@ -45,7 +43,7 @@ char *get_hostname(char* addr)
4543
return NULL;
4644
}
4745

48-
strlcpy(answer, he->h_name, 1024);
46+
strncpy(answer, he->h_name, 1024);
4947
last_answerp = answer;
5048

5149
return answer;

libpcap_stuff.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
#include <string.h>
1717
#include <stdlib.h>
1818
#include <sys/ioctl.h>
19-
#include <pcap.h>
2019
#include <net/bpf.h>
20+
#include <pcap.h>
2121

2222
#include "globals.h"
2323

script.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
#include <sched.h>
2424

2525
#include <sys/ioctl.h>
26-
#include <pcap.h>
2726
#include <net/bpf.h>
27+
#include <pcap.h>
2828

2929
#include "release.h"
3030
#include "hping2.h"

sendip.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ void send_ip (char* src, char *dst, char *data, unsigned int datalen,
4848
ip->ihl = (IPHDR_SIZE + optlen + 3) >> 2;
4949
ip->tos = ip_tos;
5050

51-
#if defined OSTYPE_FREEBSD || defined OSTYPE_NETBSD || defined OSTYPE_BSDI
51+
#if defined OSTYPE_DARWIN || defined OSTYPE_FREEBSD || defined OSTYPE_NETBSD || defined OSTYPE_BSDI
5252
/* FreeBSD */
5353
/* NetBSD */
5454
ip->tot_len = packetsize;
@@ -73,7 +73,7 @@ void send_ip (char* src, char *dst, char *data, unsigned int datalen,
7373
htons((unsigned short) src_id);
7474
}
7575

76-
#if defined OSTYPE_FREEBSD || defined OSTYPE_NETBSD | defined OSTYPE_BSDI
76+
#if defined OSTYPE_DARWIN || defined OSTYPE_FREEBSD || defined OSTYPE_NETBSD | defined OSTYPE_BSDI
7777
/* FreeBSD */
7878
/* NetBSD */
7979
ip->frag_off |= more_fragments;

0 commit comments

Comments
 (0)