Add OpenBSD Support (#212)

* Add OpenBSD Sourcehut Job
* Fix Code for OpenBSD
This commit is contained in:
Florian Märkl 2020-04-26 15:53:41 +02:00 committed by GitHub
commit 4ac29127cc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 33 additions and 4 deletions

25
.builds/openbsd.yml Normal file
View file

@ -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

View file

@ -23,6 +23,7 @@
#include <openssl/ec.h>
#include <openssl/hmac.h>
#include <openssl/bn.h>
#include <openssl/ecdh.h>
#include <string.h>

View file

@ -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));