[vpnc-devel] svn commit: vpnc r294 - /trunk/vpnc-script.in
vpnc at unix-ag.uni-kl.de
vpnc at unix-ag.uni-kl.de
Thu Jun 12 21:09:21 CEST 2008
Author: Joerg Mayer
Date: Thu Jun 12 21:09:20 2008
New Revision: 294
Log:
Tomas Mraz <tmraz at redhat.com>
This patch modifies vpnc-script so it doesn't hardcode the MTU on tun
device but computes it based on the MTU of the default route device
instead. It will do this only when ip command is available otherwise
stays with the hardcoded value.
Me: I'm not sure that this patch doesn't contain any bash'isms, but
that shouldn't matter as it's inside a Linux only path.
Modified:
trunk/vpnc-script.in
Modified: trunk/vpnc-script.in
==============================================================================
--- trunk/vpnc-script.in (original)
+++ trunk/vpnc-script.in Thu Jun 12 21:09:20 2008
@@ -84,7 +84,14 @@
# =========== tunnel interface handling ====================================
do_ifconfig() {
- ifconfig "$TUNDEV" inet "$INTERNAL_IP4_ADDRESS" $ifconfig_syntax_ptp "$INTERNAL_IP4_ADDRESS" netmask ${INTERNAL_IP4_NETMASK:-255.255.255.255} mtu 1412 up
+ if [ -n "$IPROUTE" ]; then
+ DEV=$($IPROUTE route | grep ^default | sed 's/^.* dev \([[:alnum:]-]\+\).*$/\1/')
+ MTU=$(($($IPROUTE link show "$DEV" | grep mtu | sed 's/^.* mtu \([[:digit:]]\+\).*$/\1/') - 88))
+ else
+ MTU=1412
+ fi
+
+ ifconfig "$TUNDEV" inet "$INTERNAL_IP4_ADDRESS" $ifconfig_syntax_ptp "$INTERNAL_IP4_ADDRESS" netmask ${INTERNAL_IP4_NETMASK:-255.255.255.255} mtu ${MTU} up
}
destroy_tun_device() {
More information about the vpnc-devel
mailing list