From 4b1e5f10839f4c8188367ca1da86eeb72d989d8e Mon Sep 17 00:00:00 2001 From: teastep Date: Wed, 11 Apr 2007 20:51:36 +0000 Subject: [PATCH] Minor tweaks to mtu change git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@5899 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb --- Shorewall-common/lib.base | 5 +++-- Shorewall-perl/prog.functions | 12 +++++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Shorewall-common/lib.base b/Shorewall-common/lib.base index 13c3dab67..bb2f45dba 100644 --- a/Shorewall-common/lib.base +++ b/Shorewall-common/lib.base @@ -1352,7 +1352,7 @@ delete_tc1() } # -# Detect a device's MTU -- echos the passed device's MTU + 100 +# Detect a device's MTU -- echos the passed device's MTU # get_device_mtu() # $1 = device { @@ -1366,7 +1366,8 @@ get_device_mtu() # $1 = device } # -# Version of the above that doesn't generate any output for MTU 1500 +# Version of the above that doesn't generate any output for MTU 1500. +# Generates 'mtu ' otherwise, where is the device's MTU + 100 # get_device_mtu1() # $1 = device { diff --git a/Shorewall-perl/prog.functions b/Shorewall-perl/prog.functions index 36c71b063..f03c7e89d 100644 --- a/Shorewall-perl/prog.functions +++ b/Shorewall-perl/prog.functions @@ -150,6 +150,10 @@ restore_dynamic_rules() { fi } +# +# The following functions also appear in lib.base. They are duplicated here so that +# restore scripts from prior versions continue to work. +# get_device_mtu1() # $1 = device { local output="$(ip link ls dev $1 2> /dev/null)" # quotes required for /bin/ash @@ -157,11 +161,9 @@ get_device_mtu1() # $1 = device if [ -n "$output" ]; then mtu=$(find_mtu $output) - else - return + if [ -n "$mtu" ]; then + [ $mtu = 1500 ] || echo mtu $(($mtu + 100)) + fi fi - if [ -n "$mtu" ]; then - [ $mtu = 1500 ] || echo mtu $(($mtu + 100)) - fi }