Skip to content
Draft
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
15 changes: 15 additions & 0 deletions luabridge.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@
#include "simplomon.hh"
#include "sol/sol.hpp"
#include <fmt/chrono.h>

#ifdef __FreeBSD__

#include <limits.h>

#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;
Expand Down
22 changes: 19 additions & 3 deletions netmon.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@
#include "minicurl.hh"
#include "httplib.h"
#include <netinet/in.h>
#include <netinet/ip_icmp.h>
#include <netinet/ip6.h>
#include <netinet/icmp6.h>
#include "support.hh"

#ifndef __FreeBSD__
#include <netinet/ip_icmp.h>
#include <netinet/icmp6.h>
#endif

using namespace std;

TCPPortClosedChecker::TCPPortClosedChecker(sol::table data) : Checker(data)
Expand Down Expand Up @@ -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<string>("toUrl");
Expand Down Expand Up @@ -337,11 +340,13 @@ CheckResult HTTPRedirChecker::perform()


namespace {
#ifndef __FreeBSD__
struct icmppacket
{
struct icmphdr hdr;
char msg[];
};
#endif
}
/*--------------------------------------------------------------------*/
/*--- checksum - standard 1s complement checksum ---*/
Expand All @@ -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) {
Expand Down Expand Up @@ -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


/*
Expand All @@ -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;
Expand All @@ -440,6 +448,7 @@ bool HarvestTTL(struct msghdr* msgh, int* ttl)
}
return false;
}
#endif


PINGChecker::PINGChecker(sol::table data) : Checker(data, 2)
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -531,3 +546,4 @@ CheckResult PINGChecker::perform()
}
return ret;
}
#endif