Disable Don't Fragment for StreamConnection

This commit is contained in:
Florian Märkl 2019-08-20 17:56:24 +02:00
commit 5b705e9176
No known key found for this signature in database
GPG key ID: 125BC8A5A6A1E857
4 changed files with 18 additions and 11 deletions

View file

@ -116,6 +116,7 @@ typedef struct chiaki_takion_connect_info_t
ChiakiLog *log;
struct sockaddr *sa;
size_t sa_len;
bool ip_dontfrag;
ChiakiTakionCallback cb;
void *cb_user;
bool enable_crypt;

View file

@ -151,6 +151,7 @@ CHIAKI_EXPORT ChiakiErrorCode chiaki_senkusha_run(ChiakiSenkusha *senkusha, uint
memcpy(takion_info.sa, session->connect_info.host_addrinfo_selected->ai_addr, takion_info.sa_len);
err = set_port(takion_info.sa, htons(SENKUSHA_PORT));
assert(err == CHIAKI_ERR_SUCCESS);
takion_info.ip_dontfrag = true;
takion_info.enable_crypt = false;
takion_info.protocol_version = 7;

View file

@ -142,6 +142,7 @@ CHIAKI_EXPORT ChiakiErrorCode chiaki_stream_connection_run(ChiakiStreamConnectio
memcpy(takion_info.sa, session->connect_info.host_addrinfo_selected->ai_addr, takion_info.sa_len);
err = set_port(takion_info.sa, htons(STREAM_CONNECTION_PORT));
assert(err == CHIAKI_ERR_SUCCESS);
takion_info.ip_dontfrag = false;
takion_info.enable_crypt = true;
takion_info.protocol_version = 9;

View file

@ -245,6 +245,8 @@ CHIAKI_EXPORT ChiakiErrorCode chiaki_takion_connect(ChiakiTakion *takion, Chiaki
goto error_sock;
}
if(info->ip_dontfrag)
{
#if __APPLE__
CHIAKI_LOGW(takion->log, "Don't fragment is not supported on macOS, MTU values may be incorrect.");
#else
@ -261,7 +263,9 @@ CHIAKI_EXPORT ChiakiErrorCode chiaki_takion_connect(ChiakiTakion *takion, Chiaki
ret = CHIAKI_ERR_NETWORK;
goto error_sock;
}
CHIAKI_LOGI(takion->log, "Takion enabled Don't Fragment Bit");
#endif
}
r = connect(takion->sock, info->sa, info->sa_len);
if(r < 0)