mirror of
https://git.sr.ht/~thestr4ng3r/chiaki
synced 2025-08-20 05:23:12 -07:00
Disable Don't Fragment for StreamConnection
This commit is contained in:
parent
7481cd1bce
commit
5b705e9176
4 changed files with 18 additions and 11 deletions
|
@ -116,6 +116,7 @@ typedef struct chiaki_takion_connect_info_t
|
||||||
ChiakiLog *log;
|
ChiakiLog *log;
|
||||||
struct sockaddr *sa;
|
struct sockaddr *sa;
|
||||||
size_t sa_len;
|
size_t sa_len;
|
||||||
|
bool ip_dontfrag;
|
||||||
ChiakiTakionCallback cb;
|
ChiakiTakionCallback cb;
|
||||||
void *cb_user;
|
void *cb_user;
|
||||||
bool enable_crypt;
|
bool enable_crypt;
|
||||||
|
|
|
@ -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);
|
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));
|
err = set_port(takion_info.sa, htons(SENKUSHA_PORT));
|
||||||
assert(err == CHIAKI_ERR_SUCCESS);
|
assert(err == CHIAKI_ERR_SUCCESS);
|
||||||
|
takion_info.ip_dontfrag = true;
|
||||||
|
|
||||||
takion_info.enable_crypt = false;
|
takion_info.enable_crypt = false;
|
||||||
takion_info.protocol_version = 7;
|
takion_info.protocol_version = 7;
|
||||||
|
|
|
@ -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);
|
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));
|
err = set_port(takion_info.sa, htons(STREAM_CONNECTION_PORT));
|
||||||
assert(err == CHIAKI_ERR_SUCCESS);
|
assert(err == CHIAKI_ERR_SUCCESS);
|
||||||
|
takion_info.ip_dontfrag = false;
|
||||||
|
|
||||||
takion_info.enable_crypt = true;
|
takion_info.enable_crypt = true;
|
||||||
takion_info.protocol_version = 9;
|
takion_info.protocol_version = 9;
|
||||||
|
|
|
@ -245,6 +245,8 @@ CHIAKI_EXPORT ChiakiErrorCode chiaki_takion_connect(ChiakiTakion *takion, Chiaki
|
||||||
goto error_sock;
|
goto error_sock;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(info->ip_dontfrag)
|
||||||
|
{
|
||||||
#if __APPLE__
|
#if __APPLE__
|
||||||
CHIAKI_LOGW(takion->log, "Don't fragment is not supported on macOS, MTU values may be incorrect.");
|
CHIAKI_LOGW(takion->log, "Don't fragment is not supported on macOS, MTU values may be incorrect.");
|
||||||
#else
|
#else
|
||||||
|
@ -261,7 +263,9 @@ CHIAKI_EXPORT ChiakiErrorCode chiaki_takion_connect(ChiakiTakion *takion, Chiaki
|
||||||
ret = CHIAKI_ERR_NETWORK;
|
ret = CHIAKI_ERR_NETWORK;
|
||||||
goto error_sock;
|
goto error_sock;
|
||||||
}
|
}
|
||||||
|
CHIAKI_LOGI(takion->log, "Takion enabled Don't Fragment Bit");
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
r = connect(takion->sock, info->sa, info->sa_len);
|
r = connect(takion->sock, info->sa, info->sa_len);
|
||||||
if(r < 0)
|
if(r < 0)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue