mirror of
https://git.sr.ht/~thestr4ng3r/chiaki
synced 2025-08-21 14:03:11 -07:00
Add OpenBSD Support (#212)
* Add OpenBSD Sourcehut Job * Fix Code for OpenBSD
This commit is contained in:
parent
509f312a6a
commit
4ac29127cc
3 changed files with 33 additions and 4 deletions
|
@ -23,6 +23,7 @@
|
|||
#include <openssl/ec.h>
|
||||
#include <openssl/hmac.h>
|
||||
#include <openssl/bn.h>
|
||||
#include <openssl/ecdh.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
|
|
@ -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));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue