tfSetIfMtu
Table of Contents >> Programmer's Reference
| #include <trsocket.h> |
| int tfSetIfMtu | ( |
| ttUserInterface interfaceId, | |
| int ifMtu | |
| ); |
Contents
Function Description
This function is used to set the Maximum Transmission Unit (MTU) for a device. For Ethernet and PPP, this is typically set to 1500 bytes. The link MTU is always the size of the largest IP packet which can be sent unfragmented over the link, which is the maximum link-layer frame size minus any link-layer header and trailer overhead. For PPP and Ethernet, this value can be changed via Path MTU Discovery to allow larger frames and to prevent IP datagram fragmentation.
Parameters
- interfaceHandle
- The interface handle of the device we wish to set the MTU on.
- ifMtu
- The MTU for the device.
Returns
- TM_ENOERROR
- Success.
- TM_EINVAL
- One of the parameters is invalid.
Turning off the path MTU discovery mechanism with setsockopt()
If the path MTU discovery code has been compiled in, and there is a need to disable path MTU discovery on a given connection, the user can call the Berkeley socket API setsockopt() on the connection or listening socket prior to the connection establishment, with the IP_PROTOTCP protocol level and TCP_MAXSEG option name. If the option value is less than 64 bytes, then the Treck stack will set the TCP MSS to the default value, which is the outgoing device IP MTU minus 40 bytes.
Turning off the path MTU discovery mechanism wtih tfDisablePathMtuDisc()
Another way of turning off the Path MTU discovery mechanism for a given destination IP address is to use the new API tfDisablePathMtuDisc(). This function will disable path MTU discovery for the route to the given destination IP address.
Path MTU estimates timeout values
When Path MTU discovery is enabled for an indirect TCP destination IP address, the Treck stack will try to increase the path MTU estimate (up to the device IP MTU) after the current path MTU estimate times out. Two new options have been added to tfSetTreckOptions() to allow the user to change the default timeout values for path MTU estimates.