]> git.ipfire.org Git - people/ms/ipfire-2.x.git/commitdiff
networking: Set configured MTU to all network zones
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 15 Jun 2020 15:32:41 +0000 (15:32 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 19 Jun 2020 17:14:58 +0000 (17:14 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/initscripts/networking/any
src/initscripts/networking/red

index 5609a9efe93271262fcd68561a2e94280a5c65bd..8d230095057e2a0ffe07b4f2129bd03556ab1e0f 100644 (file)
@@ -26,6 +26,7 @@ if [ "$(basename $0)" == "green" ]; then
        NETADDRESS="${GREEN_NETADDRESS}"
        NETMASK="${GREEN_NETMASK}"
        DEVICE="${GREEN_DEV}"
+       MTU="${GREEN_MTU}"
 elif [ "$(basename $0)" == "blue" ]; then
        DEVICE="${BLUE_DEV}"
        ADDRESS="${BLUE_ADDRESS}"
@@ -33,6 +34,7 @@ elif [ "$(basename $0)" == "blue" ]; then
        NETADDRESS="${BLUE_NETADDRESS}"
        NETMASK="${BLUE_NETMASK}"
        DEVICE="${BLUE_DEV}"
+       MTU="${GREEN_MTU}"
 elif [ "$(basename $0)" == "orange" ]; then
        DEVICE="${ORANGE_DEV}"
        ADDRESS="${ORANGE_ADDRESS}"
@@ -40,6 +42,7 @@ elif [ "$(basename $0)" == "orange" ]; then
        NETADDRESS="${ORANGE_NETADDRESS}"
        NETMASK="${ORANGE_NETMASK}"
        DEVICE="${ORANGE_DEV}"
+       MTU="${ORANGE_MTU}"
 fi
 
 if [ -z "${BROADCAST}" ]; then
@@ -77,6 +80,14 @@ case "${1}" in
                        exit 1
                fi
 
+               # Set the MTU
+               if [ -n "${MTU}" ]; then
+                       if ! ip link set dev "${DEVICE}" mtu "${MTU}" &>/dev/null; then
+                               boot_mesg "Could not set MTU of ${MTU} to ${DEVICE}..."
+                               echo_warning
+                       fi
+               fi
+
                # Create & Enable vnstat data collection
                /usr/bin/vnstat -u -i ${DEVICE} -r --enable --force > /dev/null 2>&1
                
index db4209b44083d3aded65743bd94a1cd6d3f46380..44e0daa68e986ef533ff2854f5169a34f08fb2ba 100644 (file)
@@ -54,11 +54,13 @@ if [ "${TYPE}" == "STATIC" ]; then
                BROADCAST="${RED_BROADCAST}"
                NETADDRESS="${RED_NETADDRESS}"
                NETMASK="${RED_NETMASK}"
+               MTU="${RED_MTU}"
        else
                ADDRESS="${GREEN_ADDRESS}"
                BROADCAST="${GREEN_BROADCAST}"
                NETADDRESS="${GREEN_NETADDRESS}"
                NETMASK="${GREEN_NETMASK}"
+               MTU="${GREEN_MTU}"
        fi
        GATEWAY="${DEFAULT_GATEWAY}"
        # DNS1
@@ -108,7 +110,14 @@ case "${1}" in
                /usr/bin/vnstat -u -i ${DEVICE} -r --enable --force > /dev/null 2>&1
                
                if [ "${TYPE}" == "STATIC" ]; then
-               
+                       # Set the MTU
+                       if [ -n "${MTU}" ]; then
+                               if ! ip link set dev "${DEVICE}" mtu "${MTU}" &>/dev/null; then
+                                       boot_mesg "Could not set MTU of ${MTU} to ${DEVICE}..."
+                                       echo_warning
+                               fi
+                       fi
+
                        if [ "$DEVICE" != "${GREEN_DEV}" ]; then
                                boot_mesg "Adding IPv4 address ${ADDRESS} to the ${DEVICE} interface..."
                                ip addr add ${args} dev ${DEVICE}