From 4ac29127cca6ee3de954b4209e0e799904074ca1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=A4rkl?= Date: Sun, 26 Apr 2020 15:53:41 +0200 Subject: [PATCH] Add OpenBSD Support (#212) * Add OpenBSD Sourcehut Job * Fix Code for OpenBSD --- .builds/openbsd.yml | 25 +++++++++++++++++++++++++ lib/src/ecdh.c | 1 + lib/src/takion.c | 11 +++++++---- 3 files changed, 33 insertions(+), 4 deletions(-) create mode 100644 .builds/openbsd.yml diff --git a/.builds/openbsd.yml b/.builds/openbsd.yml new file mode 100644 index 0000000..b384168 --- /dev/null +++ b/.builds/openbsd.yml @@ -0,0 +1,25 @@ + +image: openbsd/latest + +sources: + - https://github.com/thestr4ng3r/chiaki + +packages: + - cmake + - protobuf + - py3-protobuf + - opus + - qtbase + - qtsvg + - qtmultimedia + - ffmpeg + - sdl2 + +tasks: + - build: | + cd chiaki + mkdir build && cd build + cmake -DCMAKE_PREFIX_PATH="/usr/local/lib;/usr/local/lib/qt5/cmake" .. + make -j4 + test/chiaki-unit + diff --git a/lib/src/ecdh.c b/lib/src/ecdh.c index 3ae49e1..ad07515 100644 --- a/lib/src/ecdh.c +++ b/lib/src/ecdh.c @@ -23,6 +23,7 @@ #include #include #include +#include #include diff --git a/lib/src/takion.c b/lib/src/takion.c index 64e4c69..89dbfda 100644 --- a/lib/src/takion.c +++ b/lib/src/takion.c @@ -249,19 +249,22 @@ CHIAKI_EXPORT ChiakiErrorCode chiaki_takion_connect(ChiakiTakion *takion, Chiaki if(info->ip_dontfrag) { -#if __APPLE__ - CHIAKI_LOGW(takion->log, "Don't fragment is not supported on macOS, MTU values may be incorrect."); -#else #if defined(_WIN32) const DWORD dontfragment_val = 1; r = setsockopt(takion->sock, IPPROTO_IP, IP_DONTFRAGMENT, (const void *)&dontfragment_val, sizeof(dontfragment_val)); #elif defined(__FreeBSD__) const int dontfrag_val = 1; r = setsockopt(takion->sock, IPPROTO_IP, IP_DONTFRAG, (const void *)&dontfrag_val, sizeof(dontfrag_val)); -#else +#elif defined(IP_PMTUDISC_DO) const int mtu_discover_val = IP_PMTUDISC_DO; r = setsockopt(takion->sock, IPPROTO_IP, IP_MTU_DISCOVER, (const void *)&mtu_discover_val, sizeof(mtu_discover_val)); +#else + // macOS and OpenBSD + CHIAKI_LOGW(takion->log, "Don't fragment is not supported on this platform, MTU values may be incorrect."); +#define NO_DONTFRAG #endif + +#ifndef NO_DONTFRAG if(r < 0) { CHIAKI_LOGE(takion->log, "Takion failed to setsockopt IP_MTU_DISCOVER: %s", strerror(errno));