A client requested that the MTU limit should be 1492.
Is there a way to do it in the source code (program in C)?
Is there any other way to do it in general? (if
Programmaticaly way using C:
int sock = socket(AF_INET, SOCK_STREAM, IPPROTO_IP);
struct ifreq ifr;
strcpy(ifr.ifr_name, "eth0");
if(!ioctl(sock, SIOCGIFMTU, &ifr)) {
ifr.ifr_mtu // Contains current mtu value
}
ifr.ifr_mtu = ... // Change value if it needed
if(!ioctl(sock, SIOCSIFMTU, &ifr)) {
// Mtu changed successfully
}
It works at least on Ubuntu, see man netdevice.