tools/hotplug: validate mtu read from xenstore against RFC 791 minimum

RFC 791 sets the minimum acceptable mtu to 68:

    Every internet module must be able to forward a datagram of 68
    octets without further fragmentation.  This is because an internet
    header may be up to 60 octets, and the minimum fragment is 8 octets.

In the Linux kernel source:

include/net/ip.h:#define IPV4_MIN_MTU           68              /* RFC 791 */

While there is no reason to expect a value <68 to be read from xenstore or
from the bridge make the value test require a number >= this minimum.

Signed-off-by: James Dingwall <james@dingwall.me.uk>
Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
This commit is contained in:
James Dingwall authored and Anthony PERARD committed 2026-10-12 17:31:39 +02:00
1 parent 26b1671a1c
commit 7d6c3308cb
1 file changed
+1 -1
+1 -1
View File
@@ -167,7 +167,7 @@ set_mtu () {
log debug "$bridge MTU is $mtu" log debug "$bridge MTU is $mtu"
fi fi
fi fi
if [ -n "$mtu" ] && [ "$mtu" -gt 0 ] if [ -n "$mtu" ] && [ "$mtu" -ge 68 ]
then then
log debug "setting $dev MTU to $mtu" log debug "setting $dev MTU to $mtu"
ip link set dev ${dev} mtu ${mtu} || : ip link set dev ${dev} mtu ${mtu} || :
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.