Mailing List Archive

svn commit: vpnc r510 - /branches/vpnc-nortel/config.c /branches/vpnc-nortel/config.h /branches/vpnc-nortel/vpnc.c /trunk/config.c /trunk/config.h /trunk/vpnc.c
Author: Antonio Borneo
Date: Sat Jan 14 08:57:39 2012
New Revision: 510

Log:
Config option to set MTU

vpnc-script can skip computing MTU value and directly use value
INTERNAL_IP4_MTU passed in environment.
Add configuration option to set MTU.

Modified:
branches/vpnc-nortel/config.c
branches/vpnc-nortel/config.h
branches/vpnc-nortel/vpnc.c
trunk/config.c
trunk/config.h
trunk/vpnc.c

Modified: branches/vpnc-nortel/config.c
==============================================================================
--- branches/vpnc-nortel/config.c (original)
+++ branches/vpnc-nortel/config.c Sat Jan 14 08:57:39 2012
@@ -387,6 +387,13 @@
" * tun: virtual point to point interface (default)\n"
" * tap: virtual ethernet interface\n",
config_def_if_mode
+ }, {
+ CONFIG_IF_MTU, 1, 1,
+ "--ifmtu",
+ "Interface MTU ",
+ "<0-65535>",
+ "Set MTU for TUN/TAP interface (default 0 == automatic detect)",
+ NULL
}, {
CONFIG_DEBUG, 1, 1,
"--debug",

Modified: branches/vpnc-nortel/config.h
==============================================================================
--- branches/vpnc-nortel/config.h (original)
+++ branches/vpnc-nortel/config.h Sat Jan 14 08:57:39 2012
@@ -41,6 +41,7 @@
CONFIG_VERSION,
CONFIG_IF_NAME,
CONFIG_IF_MODE,
+ CONFIG_IF_MTU,
CONFIG_IKE_DH,
CONFIG_IPSEC_PFS,
CONFIG_IPSEC_GATEWAY,

Modified: branches/vpnc-nortel/vpnc.c
==============================================================================
--- branches/vpnc-nortel/vpnc.c (original)
+++ branches/vpnc-nortel/vpnc.c Sat Jan 14 08:57:39 2012
@@ -375,6 +375,23 @@
error(1, errno, "can't get tunnel HW address");
}
hex_dump("interface HW addr", s->tun_hwaddr, ETH_ALEN, NULL);
+ }
+
+ unsetenv("INTERNAL_IP4_MTU");
+ if (config[CONFIG_IF_MTU]) {
+ int mtu;
+
+ mtu = atoi(config[CONFIG_IF_MTU]);
+ if (mtu < 0 || mtu > 65535) {
+ DEBUG(1, printf("ignore MTU option. Use automatic detection\n"));
+ mtu = 0;
+ }
+ if (mtu > 0) {
+ char *strbuf;
+ asprintf(&strbuf, "%d", mtu);
+ setenv("INTERNAL_IP4_MTU", strbuf, 1);
+ free(strbuf);
+ }
}
}


Modified: trunk/config.c
==============================================================================
--- trunk/config.c (original)
+++ trunk/config.c Sat Jan 14 08:57:39 2012
@@ -365,6 +365,13 @@
" * tun: virtual point to point interface (default)\n"
" * tap: virtual ethernet interface\n",
config_def_if_mode
+ }, {
+ CONFIG_IF_MTU, 1, 1,
+ "--ifmtu",
+ "Interface MTU ",
+ "<0-65535>",
+ "Set MTU for TUN/TAP interface (default 0 == automatic detect)",
+ NULL
}, {
CONFIG_DEBUG, 1, 1,
"--debug",

Modified: trunk/config.h
==============================================================================
--- trunk/config.h (original)
+++ trunk/config.h Sat Jan 14 08:57:39 2012
@@ -40,6 +40,7 @@
CONFIG_VERSION,
CONFIG_IF_NAME,
CONFIG_IF_MODE,
+ CONFIG_IF_MTU,
CONFIG_IKE_DH,
CONFIG_IPSEC_PFS,
CONFIG_IPSEC_GATEWAY,

Modified: trunk/vpnc.c
==============================================================================
--- trunk/vpnc.c (original)
+++ trunk/vpnc.c Sat Jan 14 08:57:39 2012
@@ -353,6 +353,23 @@
error(1, errno, "can't get tunnel HW address");
}
hex_dump("interface HW addr", s->tun_hwaddr, ETH_ALEN, NULL);
+ }
+
+ unsetenv("INTERNAL_IP4_MTU");
+ if (config[CONFIG_IF_MTU]) {
+ int mtu;
+
+ mtu = atoi(config[CONFIG_IF_MTU]);
+ if (mtu < 0 || mtu > 65535) {
+ DEBUG(1, printf("ignore MTU option. Use automatic detection\n"));
+ mtu = 0;
+ }
+ if (mtu > 0) {
+ char *strbuf;
+ asprintf(&strbuf, "%d", mtu);
+ setenv("INTERNAL_IP4_MTU", strbuf, 1);
+ free(strbuf);
+ }
}
}


_______________________________________________
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/