From 23e47d52915c70515b8aa828e2ec3b2272a280d7 Mon Sep 17 00:00:00 2001 From: Pieter Willem Jordaan Date: Thu, 24 Sep 2015 07:10:58 +0000 Subject: [PATCH 1/2] Exponential backoff retransmits This commit fixes https://github.com/xelerance/xl2tpd/issues/76 --- network.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/network.c b/network.c index b1268c63..b840d302 100644 --- a/network.c +++ b/network.c @@ -30,6 +30,8 @@ #include "ipsecmast.h" #include "misc.h" /* for IPADDY macro */ +#include + char hostname[256]; struct sockaddr_in server, from; /* Server and transmitter structs */ int server_socket; /* Server socket */ @@ -264,9 +266,9 @@ void control_xmit (void *b) else { /* - * FIXME: How about adaptive timeouts? + * Adaptive timeout with exponential backoff */ - tv.tv_sec = 1; + tv.tv_sec = 1*pow(2, buf->retries-1); tv.tv_usec = 0; schedule (tv, control_xmit, buf); #ifdef DEBUG_CONTROL_XMIT From 64f8ad1ab68b4b12f848b2d995a8f5da2bf0c4f0 Mon Sep 17 00:00:00 2001 From: Pieter Willem Jordaan Date: Thu, 24 Sep 2015 07:12:57 +0000 Subject: [PATCH 2/2] libm needed in Makefile libm was added into the Makefile --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 5d6bed3c..4620a134 100644 --- a/Makefile +++ b/Makefile @@ -103,6 +103,7 @@ OBJS=xl2tpd.o pty.o misc.o control.o avp.o call.o network.o avpsend.o scheduler. SRCS=${OBJS:.o=.c} ${HDRS} CONTROL_SRCS=xl2tpd-control.c #LIBS= $(OSLIBS) # -lefence # efence for malloc checking +LDLIBS= -lm EXEC=xl2tpd CONTROL_EXEC=xl2tpd-control