diff --git a/luabridge.cc b/luabridge.cc index 2514f77..b18de3b 100644 --- a/luabridge.cc +++ b/luabridge.cc @@ -2,6 +2,21 @@ #include "simplomon.hh" #include "sol/sol.hpp" #include + +#ifdef __FreeBSD__ + +#include + +#ifndef HOST_NAME_MAX +#ifdef _POSIX_HOST_NAME_MAX +#define HOST_NAME_MAX _POSIX_HOST_NAME_MAX +#else +#define HOST_NAME_MAX 255 +#endif +#endif + +#endif + using namespace std; sol::state g_lua; diff --git a/netmon.cc b/netmon.cc index 76a6280..7a5aa94 100644 --- a/netmon.cc +++ b/netmon.cc @@ -7,11 +7,14 @@ #include "minicurl.hh" #include "httplib.h" #include -#include #include -#include #include "support.hh" +#ifndef __FreeBSD__ +#include +#include +#endif + using namespace std; TCPPortClosedChecker::TCPPortClosedChecker(sol::table data) : Checker(data) @@ -308,7 +311,7 @@ HTTPRedirChecker::HTTPRedirChecker(sol::table data) : Checker(data) d_fromhostpart = fromurl; else { d_fromhostpart = fromurl.substr(0, pos); - d_frompath = fromurl.substr(pos+1); + d_frompath = fromurl.substr(pos); } d_tourl = data.get("toUrl"); @@ -337,11 +340,13 @@ CheckResult HTTPRedirChecker::perform() namespace { +#ifndef __FreeBSD__ struct icmppacket { struct icmphdr hdr; char msg[]; }; +#endif } /*--------------------------------------------------------------------*/ /*--- checksum - standard 1s complement checksum ---*/ @@ -361,6 +366,7 @@ static unsigned short internetchecksum(void *b, int len) return result; } +#ifndef __FreeBSD__ static std::string makeICMPQuery(int family, uint16_t id, uint16_t seq, size_t psize) { if(family==AF_INET) { @@ -417,6 +423,7 @@ static void fillMSGHdr(struct msghdr* msgh, struct iovec* iov, char* cbuf, int b msgh->msg_iovlen = 1; msgh->msg_flags = 0; } +#endif /* @@ -428,6 +435,7 @@ msg_control=[ msg_controllen=56, msg_flags=0}, 0) = 64 */ +#ifndef __FreeBSD__ bool HarvestTTL(struct msghdr* msgh, int* ttl) { struct cmsghdr *cmsg; @@ -440,6 +448,7 @@ bool HarvestTTL(struct msghdr* msgh, int* ttl) } return false; } +#endif PINGChecker::PINGChecker(sol::table data) : Checker(data, 2) @@ -474,6 +483,12 @@ PINGChecker::PINGChecker(sol::table data) : Checker(data, 2) } } +#ifdef __FreeBSD__ +CheckResult PINGChecker::perform() +{ + return CheckResult(); +} +#else CheckResult PINGChecker::perform() { d_results.clear(); @@ -531,3 +546,4 @@ CheckResult PINGChecker::perform() } return ret; } +#endif