Hi, so it seems xl2tpd is now developed again by xelarance, and there's a 1.3.8 release on github which seems to incorporate most of the patches we ship. I had never been able to make 1.3.1 work, but with this update i finally managed to connect against an isakmpd server, so for me it's a huge improvement. Please test it in your configurations...
for the record, 1.3.1 failed for me when connecting with: xl2tpd[6600]: control_finish: sending SCCRQ xl2tpd[6600]: udp_xmit failed to remote.host.ip:1701 with err=-1:Invalid argument Landry
? Makefile.debug ? patch-network_c Index: Makefile =================================================================== RCS file: /cvs/ports/net/xl2tpd/Makefile,v retrieving revision 1.9 diff -u -r1.9 Makefile --- Makefile 19 Jun 2015 16:34:41 -0000 1.9 +++ Makefile 10 Nov 2016 11:32:19 -0000 @@ -2,8 +2,10 @@ COMMENT= l2tp client/server -DISTNAME= xl2tpd-1.3.1 -REVISION= 6 +DISTNAME= xl2tpd-1.3.8 +GH_ACCOUNT= xelerance +GH_PROJECT= xl2tpd +GH_COMMIT= cec1ebe1523bf248f134647dd6030a333d93e19b CATEGORIES= net @@ -14,10 +16,7 @@ # GPLv2 PERMIT_PACKAGE_CDROM= Yes -WANTLIB += c util - -# https://github.com/xelerance/xl2tpd/ -MASTER_SITES= http://download.openswan.org/xl2tpd/ +WANTLIB += c m util FAKE_FLAGS= DESTDIR= MANDIR=${WRKINST}${PREFIX}/man NO_TEST= Yes Index: distinfo =================================================================== RCS file: /cvs/ports/net/xl2tpd/distinfo,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 distinfo --- distinfo 15 Jan 2013 23:02:19 -0000 1.1.1.1 +++ distinfo 10 Nov 2016 11:32:19 -0000 @@ -1,2 +1,2 @@ -SHA256 (xl2tpd-1.3.1.tar.gz) = kSpAvPi4NAfLpMMVaH5Lj7NlYsHG00ermGQeY9CqxCg= -SIZE (xl2tpd-1.3.1.tar.gz) = 552100 +SHA256 (xl2tpd-1.3.8.tar.gz) = f3dcnKvQFbMPkfFr8V8SKjpVj7Mify/87NFQ9+mA9tI= +SIZE (xl2tpd-1.3.8.tar.gz) = 510024 Index: patches/patch-Makefile =================================================================== RCS file: /cvs/ports/net/xl2tpd/patches/patch-Makefile,v retrieving revision 1.2 diff -u -r1.2 patch-Makefile --- patches/patch-Makefile 18 Jan 2013 22:36:44 -0000 1.2 +++ patches/patch-Makefile 10 Nov 2016 11:32:19 -0000 @@ -1,6 +1,6 @@ $OpenBSD: patch-Makefile,v 1.2 2013/01/18 22:36:44 sthen Exp $ ---- Makefile.orig Thu Oct 6 20:22:05 2011 -+++ Makefile Fri Jan 18 22:25:27 2013 +--- Makefile.orig Fri Aug 12 02:56:53 2016 ++++ Makefile Thu Nov 10 12:14:31 2016 @@ -53,8 +53,8 @@ DFLAGS?= -DDEBUG_PPPD -DTRUST_PPPD_TO_DIE # but we use a local copy if we don't find it. # @@ -12,7 +12,16 @@ # # Uncomment the following to use the kernel interface under Linux # This requires the pppol2tp-linux-2.4.27.patch patch from contrib -@@ -80,8 +80,8 @@ OSFLAGS?= -DLINUX -I$(KERNELSRC)/include/ +@@ -62,7 +62,7 @@ OSFLAGS?= -DLINUX -I$(KERNELSRC)/include/ + # are packages seperately (eg kernel-headers on Fedora) + # Note: 2.6.23+ support still needs some changes in the xl2tpd source + # +-OSFLAGS+= -DUSE_KERNEL ++#OSFLAGS+= -DUSE_KERNEL + # + # + # Uncomment the next line for FreeBSD +@@ -87,8 +87,8 @@ OSFLAGS+= -DUSE_KERNEL # Uncomment the next two lines for OpenBSD # @@ -23,19 +32,3 @@ # Feature flags # -@@ -108,13 +108,13 @@ MANDIR?=$(DESTDIR)${PREFIX}/share/man - all: $(EXEC) pfc $(CONTROL_EXEC) - - clean: -- rm -f $(OBJS) $(EXEC) pfc.o pfc $(CONTROL_EXEC) -+ rm -f $(OBJS) $(EXEC) $(CONTROL_EXEC) - - $(EXEC): $(OBJS) $(HDRS) - $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LDLIBS) - - $(CONTROL_EXEC): $(CONTROL_SRCS) -- $(CC) $(CONTROL_SRCS) -o $@ -+ $(CC) $(CFLAGS) $(LDFLAGS) $(CONTROL_SRCS) -o $@ - - pfc: - $(CC) $(CFLAGS) -c contrib/pfc.c Index: patches/patch-call_c =================================================================== RCS file: patches/patch-call_c diff -N patches/patch-call_c --- patches/patch-call_c 19 Jun 2015 16:34:41 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,161 +0,0 @@ ---- call.c.orig Tue Jun 16 02:19:47 2015 -+++ call.c Tue Jun 16 02:20:29 2015 -@@ -88,33 +88,30 @@ void add_payload_hdr (struct tunnel *t, struct call *c - /* c->rbit=0; */ - } - --int read_packet (struct buffer *buf, int fd, int convert) -+int read_packet (struct call *c) - { -- unsigned char c; -+ struct buffer *buf = c->ppp_buf; -+ unsigned char ch; - unsigned char escape = 0; - unsigned char *p; -- static unsigned char rbuf[MAX_RECV_SIZE]; -- static int pos = 0; -- static int max = 0; - int res; - int errors = 0; - -- /* Read a packet, doing async->sync conversion if necessary */ -- p = buf->start; -+ p = buf->start + buf->len; - while (1) - { -- if (pos >= max) -+ if (c->rbuf_pos >= c->rbuf_max) - { -- max = read(fd, rbuf, sizeof (rbuf)); -- res = max; -- pos = 0; -+ c->rbuf_max = read(c->fd, c->rbuf, sizeof (c->rbuf)); -+ res = c->rbuf_max; -+ c->rbuf_pos = 0; - } - else - { - res = 1; - } - -- c = rbuf[pos++]; -+ ch = c->rbuf[c->rbuf_pos++]; - - /* if there was a short read, then see what is about */ - if (res < 1) -@@ -145,75 +142,59 @@ int read_packet (struct buffer *buf, int fd, int conve - l2tp_log (LOG_DEBUG, - "%s: Too many errors. Declaring call dead.\n", - __FUNCTION__); -- pos=0; -- max=0; -+ c->rbuf_pos=0; -+ c->rbuf_max=0; - return -errno; - } - continue; - } - -- switch (c) -+ switch (ch) - { - case PPP_FLAG: - if (escape) - { - l2tp_log (LOG_DEBUG, "%s: got an escaped PPP_FLAG\n", - __FUNCTION__); -- pos=0; -- max=0; -+ c->rbuf_pos=0; -+ c->rbuf_max=0; - return -EINVAL; - } - -- if (convert) -- { -- if (buf->len >= 2) { -- /* must be the end, drop the FCS */ -- buf->len -= 2; -- } -- else if (buf->len == 1) { -- /* Do nothing, just return the single character*/ -- } -- else { -- /* if the buffer is empty, then we have the beginning -- * of a packet, not the end -- */ -- break; -- } -+ if (buf->len >= 2) { -+ /* must be the end, drop the FCS */ -+ buf->len -= 2; - } -- else -- { -- /* if there is space, then insert the byte */ -- if (buf->len < buf->maxlen) -- { -- *p = c; -- p++; -- buf->len++; -- } -- } -+ else if (buf->len == 1) { -+ /* Do nothing, just return the single character*/ -+ } -+ else { -+ /* if the buffer is empty, then we have the beginning -+ * of a packet, not the end -+ */ -+ break; -+ } - - /* return what we have now */ - return buf->len; - - case PPP_ESCAPE: - escape = PPP_TRANS; -- if (convert) -- break; -+ break; - -- /* fall through */ - default: -- if (convert) -- c ^= escape; -+ ch ^= escape; - escape = 0; - if (buf->len < buf->maxlen) - { -- *p = c; -+ *p = ch; - p++; - buf->len++; - break; - } - l2tp_log (LOG_WARNING, "%s: read overrun\n", __FUNCTION__); -- pos=0; -- max=0; -+ c->rbuf_pos=0; -+ c->rbuf_max=0; - return -EINVAL; - } - } -@@ -412,6 +393,7 @@ void destroy_call (struct call *c) - /* if (c->dethrottle) deschedule(c->dethrottle); */ - if (c->zlb_xmit) - deschedule (c->zlb_xmit); -+ toss(c->ppp_buf); - - #ifdef IP_ALLOCATION - if (c->addr) -@@ -554,6 +536,9 @@ struct call *new_call (struct tunnel *parent) - tmp->container = parent; - /* tmp->rws = -1; */ - tmp->fd = -1; -+ tmp->rbuf_pos = 0; -+ tmp->rbuf_max = 0; -+ tmp->ppp_buf = new_payload (parent->peer); - tmp->oldptyconf = malloc (sizeof (struct termios)); - tmp->pnu = 0; - tmp->cnu = 0; Index: patches/patch-call_h =================================================================== RCS file: patches/patch-call_h diff -N patches/patch-call_h --- patches/patch-call_h 19 Jun 2015 16:34:41 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,13 +0,0 @@ ---- call.h.orig Tue Jun 16 02:19:52 2015 -+++ call.h Tue Jun 16 02:20:33 2015 -@@ -70,6 +70,10 @@ struct call - */ - struct tunnel *container; /* Tunnel we belong to */ - int fd; /* File descriptor for pty */ -+ unsigned char rbuf[MAX_RECV_SIZE]; /* pty read buffer */ -+ int rbuf_pos; /* Read buffer position */ -+ int rbuf_max; /* Read buffer data length */ -+ struct buffer *ppp_buf; /* Packet read from pty */ - struct termios *oldptyconf; - int die; - int nego; /* Show negotiation? */ Index: patches/patch-l2tp_h =================================================================== RCS file: patches/patch-l2tp_h diff -N patches/patch-l2tp_h --- patches/patch-l2tp_h 19 Jun 2015 16:34:41 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,29 +0,0 @@ ---- l2tp.h.orig Tue Jun 16 02:20:02 2015 -+++ l2tp.h Tue Jun 16 02:20:38 2015 -@@ -20,6 +20,8 @@ typedef unsigned long long _u64; - #define _L2TP_H - - #define MAXSTRLEN 120 /* Maximum length of common strings */ -+ /* FIXME: MAX_RECV_SIZE, what is it? */ -+#define MAX_RECV_SIZE 4096 /* Biggest packet we'll accept */ - - #include <netinet/in.h> - #include <termios.h> -@@ -109,8 +111,6 @@ struct payload_hdr - #define MIN_PAYLOAD_HDR_LEN 6 - - #define UDP_LISTEN_PORT 1701 -- /* FIXME: MAX_RECV_SIZE, what is it? */ --#define MAX_RECV_SIZE 4096 /* Biggest packet we'll accept */ - - #define OUR_L2TP_VERSION 0x100 /* We support version 1, revision 0 */ - -@@ -214,7 +214,7 @@ extern void destroy_tunnel (struct tunnel *); - extern struct buffer *new_payload (struct sockaddr_in); - extern void recycle_payload (struct buffer *, struct sockaddr_in); - extern void add_payload_hdr (struct tunnel *, struct call *, struct buffer *); --extern int read_packet (struct buffer *, int, int); -+extern int read_packet (struct call *); - extern void udp_xmit (struct buffer *buf, struct tunnel *t); - extern void control_xmit (void *); - extern int ppd; Index: patches/patch-network_c =================================================================== RCS file: patches/patch-network_c diff -N patches/patch-network_c --- patches/patch-network_c 19 Jun 2015 16:34:41 -0000 1.2 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,55 +0,0 @@ -$OpenBSD: patch-network_c,v 1.2 2015/06/19 16:34:41 sthen Exp $ ---- network.c.orig Tue Jun 16 02:20:11 2015 -+++ network.c Tue Jun 16 02:20:42 2015 -@@ -271,11 +271,9 @@ void udp_xmit (struct buffer *buf, struct tunnel *t) - memset(&msgh, 0, sizeof(struct msghdr)); - - msgh.msg_control = cbuf; -- msgh.msg_controllen = 0; -+ msgh.msg_controllen = sizeof(cbuf); - - if(gconfig.ipsecsaref && t->refhim != IPSEC_SAREF_NULL) { -- msgh.msg_controllen = sizeof(cbuf); -- - cmsg = CMSG_FIRSTHDR(&msgh); - cmsg->cmsg_level = IPPROTO_IP; - cmsg->cmsg_type = gconfig.sarefnum; -@@ -581,7 +579,6 @@ void network_thread () - { - /* Got some payload to send */ - int result; -- recycle_payload (buf, sc->container->peer); - /* - #ifdef DEBUG_FLOW_MORE - l2tp_log (LOG_DEBUG, "%s: rws = %d, pSs = %d, pLr = %d\n", -@@ -602,13 +599,12 @@ void network_thread () - sc->dethrottle = schedule(tv, dethrottle, sc); - } else */ - /* while ((result=read_packet(buf,sc->fd,sc->frame & SYNC_FRAMING))>0) { */ -- while ((result = -- read_packet (buf, sc->fd, SYNC_FRAMING)) > 0) -+ while ((result = read_packet (sc)) > 0) - { -- add_payload_hdr (sc->container, sc, buf); -+ add_payload_hdr (sc->container, sc, sc->ppp_buf); - if (gconfig.packet_dump) - { -- do_packet_dump (buf); -+ do_packet_dump (sc->ppp_buf); - } - - -@@ -618,10 +614,10 @@ void network_thread () - deschedule (sc->zlb_xmit); - sc->zlb_xmit = NULL; - } -- sc->tx_bytes += buf->len; -+ sc->tx_bytes += sc->ppp_buf->len; - sc->tx_pkts++; -- udp_xmit (buf, st); -- recycle_payload (buf, sc->container->peer); -+ udp_xmit (sc->ppp_buf, st); -+ recycle_payload (sc->ppp_buf, sc->container->peer); - } - if (result != 0) - { Index: patches/patch-xl2tpd-control_c =================================================================== RCS file: patches/patch-xl2tpd-control_c diff -N patches/patch-xl2tpd-control_c --- patches/patch-xl2tpd-control_c 18 Jan 2013 22:38:06 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,12 +0,0 @@ -$OpenBSD: patch-xl2tpd-control_c,v 1.1 2013/01/18 22:38:06 sthen Exp $ ---- xl2tpd-control.c.orig Fri Jan 18 22:30:05 2013 -+++ xl2tpd-control.c Fri Jan 18 22:31:46 2013 -@@ -96,7 +96,7 @@ int main (int argc, char *argv[]) - struct command_t* command = NULL; - int i; /* argv iterator */ - -- if (!strncmp (argv[1], "--help", 6)) -+ if (argv[1] && !strncmp (argv[1], "--help", 6)) - { - help(); - return 0;