[PATCH 2/2] tools/hotplug: validate mtu read from xenstore against RFC 791 minimum

James Dingwall <[email protected]>
Newsgroups org.xenproject.lists.xen-devel
Message-ID <[email protected]>
From: James Dingwall <[email protected]>

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 <[email protected]>
---
 tools/hotplug/Linux/xen-network-common.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/hotplug/Linux/xen-network-common.sh b/tools/hotplug/Linux/xen-network-common.sh
index f83eeef030..344730cb42 100644
--- a/tools/hotplug/Linux/xen-network-common.sh
+++ b/tools/hotplug/Linux/xen-network-common.sh
@@ -167,7 +167,7 @@ set_mtu () {
             log debug "$bridge MTU is $mtu"
         fi
     fi
-    if [ -n "$mtu" ] && [ "$mtu" -gt 0 ]
+    if [ -n "$mtu" ] && [ "$mtu" -ge 68 ]
     then
         log debug "setting $dev MTU to $mtu"
         ip link set dev ${dev} mtu ${mtu} || :
-- 
2.55.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.