Dynamically configuring the network stack
Dynamically configuring the network stack
To change the default network stack parameters, use the sysctl()
function or sysctlbyname()
function that are declared in the header file sysroot-*-kos/include/sys/sysctl.h
from the KasperskyOS SDK. The parameters that can be changed are presented in the table below.
Configurable network stack parameters
MSS configuration example:
static const int mss_max = 1460;
static const int mss_min = 100;
static const char* mss_max_opt_name = "net.inet.tcp.mssdflt";
static const char* mss_min_opt_name = "net.inet.tcp.minmss";
int main(void)
{
...
if ((sysctlbyname(mss_max_opt_name, NULL, NULL, &mss_max, sizeof(mss_max)) != 0) ||
(sysctlbyname(mss_min_opt_name, NULL, NULL, &mss_min, sizeof(mss_min)) != 0))
{
ERROR(START, "Can't set tcp default maximum/minimum MSS value.");
return EXIT_FAILURE;
}
}
Did you find this article helpful?
What can we do better?
Thank you for your feedback! You're helping us improve.
Thank you for your feedback! You're helping us improve.