[netdevice] Limit MTU by hardware maximum frame length

Separate out the concept of "hardware maximum supported frame length"
and "configured link MTU", and limit the latter according to the
former.

In networks where the DHCP-supplied link MTU is inconsistent with the
hardware or driver capabilities (e.g. a network using jumbo frames),
this will result in iPXE advertising a TCP MSS consistent with a size
that can actually be received.

Note that the term "MTU" is typically used to refer to the maximum
length excluding the link-layer headers; we adopt this usage.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2017-01-25 14:48:24 +00:00
parent f450c75dad
commit 70fc25ad6e
5 changed files with 31 additions and 10 deletions

View File

@@ -663,6 +663,12 @@ int register_netdev ( struct net_device *netdev ) {
ll_protocol->init_addr ( netdev->hw_addr, netdev->ll_addr );
}
/* Set MTU, if not already set */
if ( ! netdev->mtu ) {
netdev->mtu = ( netdev->max_pkt_len -
ll_protocol->ll_header_len );
}
/* Reject network devices that are already available via a
* different hardware device.
*/