File vpnc-patch_send_twice.txt.diff of Package vpnc

Index: config.h
===================================================================
--- config.h	(revision 394)
+++ config.h	(working copy)
@@ -55,6 +55,7 @@
 	CONFIG_VENDOR,
 	CONFIG_NATT_MODE,
 	CONFIG_UDP_ENCAP_PORT,
+	CONFIG_SEND_TWICE,
 	CONFIG_DPD_IDLE,
 	CONFIG_AUTH_MODE,
 	CONFIG_CA_FILE,
Index: config.c
===================================================================
--- config.c	(revision 394)
+++ config.c	(working copy)
@@ -416,6 +416,14 @@
 		"It is especially not the cisco-tcp port.\n",
 		config_def_udp_port
 	}, {
+		CONFIG_SEND_TWICE, 0, 1,
+		"--send-twice",
+		"Send twice",
+		NULL,
+		"Send twice each IKE UDP packet. In case of high packet lost rate, this option\n"
+		"improves network performance during authentication.",
+		NULL
+	}, {
 		CONFIG_DPD_IDLE, 1, 1,
 		"--dpd-idle",
 		"DPD idle timeout (our side) ",
Index: vpnc.c
===================================================================
--- vpnc.c	(revision 394)
+++ vpnc.c	(working copy)
@@ -442,9 +442,13 @@
 	for (;;) {
 		int pollresult;
 
-		if (realtosend != NULL)
+		if (realtosend != NULL) {
 			if (write(s->ike_fd, realtosend, sendsize) != (int)sendsize)
-				error(1, errno, "can't send packet");
+				error(1, errno, "can't send packet [1]");
+			if (config[CONFIG_SEND_TWICE])
+				if (write(s->ike_fd, realtosend, sendsize) != (int)sendsize)
+					error(1, errno, "can't send packet [2]");
+		}
 		if (sendonly)
 			break;
 
openSUSE Build Service is sponsored by