Author: Antonio Borneo
Date: Sat Jan 14 08:55:39 2012
New Revision: 494
Log:
vpnc-script: prevent negative MTU
We can't be sure that the route shown by 'ip route get' will return
anything. Restructure the logic to only perform the subtraction if it
does. Otherwise, fall back to the default 1412.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Modified:
branches/vpnc-nortel/vpnc-script
trunk/vpnc-script
Modified: branches/vpnc-nortel/vpnc-script
==============================================================================
--- branches/vpnc-nortel/vpnc-script (original)
+++ branches/vpnc-nortel/vpnc-script Sat Jan 14 08:55:39 2012
@@ -96,8 +96,13 @@
if [ -n "$INTERNAL_IP4_MTU" ]; then
MTU=$INTERNAL_IP4_MTU
elif [ -n "$IPROUTE" ]; then
- MTU=$(($($IPROUTE route get "$VPNGATEWAY" | sed -ne 's/^.*mtu \([[:digit:]]\+\).*$/\1/p') - 88))
- else
+ MTU=$($IPROUTE route get "$VPNGATEWAY" | sed -ne 's/^.*mtu \([[:digit:]]\+\).*$/\1/p')
+ if [ -n "$MTU" ]; then
+ MTU=$(( "$MTU" - 88 ))
+ fi
+ fi
+
+ if [ -z "$MTU" ]; then
MTU=1412
fi
Modified: trunk/vpnc-script
==============================================================================
--- trunk/vpnc-script (original)
+++ trunk/vpnc-script Sat Jan 14 08:55:39 2012
@@ -96,8 +96,13 @@
if [ -n "$INTERNAL_IP4_MTU" ]; then
MTU=$INTERNAL_IP4_MTU
elif [ -n "$IPROUTE" ]; then
- MTU=$(($($IPROUTE route get "$VPNGATEWAY" | sed -ne 's/^.*mtu \([[:digit:]]\+\).*$/\1/p') - 88))
- else
+ MTU=$($IPROUTE route get "$VPNGATEWAY" | sed -ne 's/^.*mtu \([[:digit:]]\+\).*$/\1/p')
+ if [ -n "$MTU" ]; then
+ MTU=$(( "$MTU" - 88 ))
+ fi
+ fi
+
+ if [ -z "$MTU" ]; then
MTU=1412
fi
_______________________________________________
vpnc-devel mailing list
vpnc-devel@unix-ag.uni-kl.de
https://lists.unix-ag.uni-kl.de/mailman/listinfo/vpnc-devel
http://www.unix-ag.uni-kl.de/~massar/vpnc/
Date: Sat Jan 14 08:55:39 2012
New Revision: 494
Log:
vpnc-script: prevent negative MTU
We can't be sure that the route shown by 'ip route get' will return
anything. Restructure the logic to only perform the subtraction if it
does. Otherwise, fall back to the default 1412.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Modified:
branches/vpnc-nortel/vpnc-script
trunk/vpnc-script
Modified: branches/vpnc-nortel/vpnc-script
==============================================================================
--- branches/vpnc-nortel/vpnc-script (original)
+++ branches/vpnc-nortel/vpnc-script Sat Jan 14 08:55:39 2012
@@ -96,8 +96,13 @@
if [ -n "$INTERNAL_IP4_MTU" ]; then
MTU=$INTERNAL_IP4_MTU
elif [ -n "$IPROUTE" ]; then
- MTU=$(($($IPROUTE route get "$VPNGATEWAY" | sed -ne 's/^.*mtu \([[:digit:]]\+\).*$/\1/p') - 88))
- else
+ MTU=$($IPROUTE route get "$VPNGATEWAY" | sed -ne 's/^.*mtu \([[:digit:]]\+\).*$/\1/p')
+ if [ -n "$MTU" ]; then
+ MTU=$(( "$MTU" - 88 ))
+ fi
+ fi
+
+ if [ -z "$MTU" ]; then
MTU=1412
fi
Modified: trunk/vpnc-script
==============================================================================
--- trunk/vpnc-script (original)
+++ trunk/vpnc-script Sat Jan 14 08:55:39 2012
@@ -96,8 +96,13 @@
if [ -n "$INTERNAL_IP4_MTU" ]; then
MTU=$INTERNAL_IP4_MTU
elif [ -n "$IPROUTE" ]; then
- MTU=$(($($IPROUTE route get "$VPNGATEWAY" | sed -ne 's/^.*mtu \([[:digit:]]\+\).*$/\1/p') - 88))
- else
+ MTU=$($IPROUTE route get "$VPNGATEWAY" | sed -ne 's/^.*mtu \([[:digit:]]\+\).*$/\1/p')
+ if [ -n "$MTU" ]; then
+ MTU=$(( "$MTU" - 88 ))
+ fi
+ fi
+
+ if [ -z "$MTU" ]; then
MTU=1412
fi
_______________________________________________
vpnc-devel mailing list
vpnc-devel@unix-ag.uni-kl.de
https://lists.unix-ag.uni-kl.de/mailman/listinfo/vpnc-devel
http://www.unix-ag.uni-kl.de/~massar/vpnc/