Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix the code to support mac #6

Merged
merged 1 commit into from
Dec 26, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ars.c
Original file line number Diff line number Diff line change
Expand Up @@ -914,7 +914,7 @@ int ars_bsd_fix(struct ars_packet *pkt, unsigned char *packet, size_t size)
return -ARS_INVALID;
}
ip = (struct ars_iphdr*) packet;
#if defined OSTYPE_FREEBSD || defined OSTYPE_NETBSD || defined OSTYPE_BSDI
#if defined OSTYPE_DARWIN || defined OSTYPE_FREEBSD || defined OSTYPE_NETBSD || defined OSTYPE_BSDI
ip->tot_len = ntohs(ip->tot_len);
ip->frag_off = ntohs(ip->frag_off);
#endif
Expand Down
6 changes: 2 additions & 4 deletions gethostname.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
#include <arpa/inet.h>
#include <string.h>

size_t strlcpy(char *dst, const char *src, size_t siz);

char *get_hostname(char* addr)
{
static char answer[1024];
Expand All @@ -36,7 +34,7 @@ char *get_hostname(char* addr)
if (!strcmp(addr, lastreq))
return last_answerp;

strlcpy(lastreq, addr, 1024);
strncpy(lastreq, addr, 1024);
inet_aton(addr, &naddr);
he = gethostbyaddr((char*)&naddr, 4, AF_INET);

Expand All @@ -45,7 +43,7 @@ char *get_hostname(char* addr)
return NULL;
}

strlcpy(answer, he->h_name, 1024);
strncpy(answer, he->h_name, 1024);
last_answerp = answer;

return answer;
Expand Down
2 changes: 1 addition & 1 deletion libpcap_stuff.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
#include <string.h>
#include <stdlib.h>
#include <sys/ioctl.h>
#include <pcap.h>
#include <net/bpf.h>
#include <pcap.h>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


#include "globals.h"

Expand Down
2 changes: 1 addition & 1 deletion script.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
#include <sched.h>

#include <sys/ioctl.h>
#include <pcap.h>
#include <net/bpf.h>
#include <pcap.h>

#include "release.h"
#include "hping2.h"
Expand Down
4 changes: 2 additions & 2 deletions sendip.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ void send_ip (char* src, char *dst, char *data, unsigned int datalen,
ip->ihl = (IPHDR_SIZE + optlen + 3) >> 2;
ip->tos = ip_tos;

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

#if defined OSTYPE_FREEBSD || defined OSTYPE_NETBSD | defined OSTYPE_BSDI
#if defined OSTYPE_DARWIN || defined OSTYPE_FREEBSD || defined OSTYPE_NETBSD | defined OSTYPE_BSDI
/* FreeBSD */
/* NetBSD */
ip->frag_off |= more_fragments;
Expand Down