[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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



From: James Dingwall <james@xxxxxxxxxxxxxx>

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@xxxxxxxxxxxxxx>
---
 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




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.