Signed-off-by: Florian Fainelli <florian@openwrt.org>
git-svn-id: svn://svn.openwrt.org/openwrt/packages@39938
3c298f89-4303-0410-b956-
a3cf2f4a3e73
-# Copyright (C) 2006-2011 OpenWrt.org
+# Copyright (C) 2006-2014 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
PKG_NAME:=xl2tpd
PKG_VERSION:=1.3.1
PKG_NAME:=xl2tpd
PKG_VERSION:=1.3.1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
# Host seems to be down.
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
# Host seems to be down.
---- a/Makefile 2011-08-16 20:28:19.968069040 +0200
-+++ b/Makefile 2011-08-16 20:27:57.968069032 +0200
-@@ -106,10 +106,10 @@
+--- a/Makefile
++++ b/Makefile
+@@ -106,10 +106,10 @@ BINDIR?=$(DESTDIR)${PREFIX}/bin
MANDIR?=$(DESTDIR)${PREFIX}/share/man
MANDIR?=$(DESTDIR)${PREFIX}/share/man
$(EXEC): $(OBJS) $(HDRS)
$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LDLIBS)
$(EXEC): $(OBJS) $(HDRS)
$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LDLIBS)
+@@ -117,14 +117,10 @@ $(EXEC): $(OBJS) $(HDRS)
$(CONTROL_EXEC): $(CONTROL_SRCS)
$(CC) $(CONTROL_SRCS) -o $@
$(CONTROL_EXEC): $(CONTROL_SRCS)
$(CC) $(CONTROL_SRCS) -o $@
install -d -m 0755 ${SBINDIR}
install -m 0755 $(EXEC) ${SBINDIR}/$(EXEC)
install -d -m 0755 ${MANDIR}/man5
install -d -m 0755 ${SBINDIR}
install -m 0755 $(EXEC) ${SBINDIR}/$(EXEC)
install -d -m 0755 ${MANDIR}/man5
+@@ -132,11 +128,6 @@ install: ${EXEC} pfc ${CONTROL_EXEC}
install -m 0644 doc/xl2tpd.8 ${MANDIR}/man8/
install -m 0644 doc/xl2tpd.conf.5 doc/l2tp-secrets.5 \
${MANDIR}/man5/
install -m 0644 doc/xl2tpd.8 ${MANDIR}/man8/
install -m 0644 doc/xl2tpd.conf.5 doc/l2tp-secrets.5 \
${MANDIR}/man5/
--- a/Makefile
+++ b/Makefile
--- a/Makefile
+++ b/Makefile
+@@ -62,8 +62,8 @@ 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
#
# are packages seperately (eg kernel-headers on Fedora)
# Note: 2.6.23+ support still needs some changes in the xl2tpd source
#
#
--- a/call.c
+++ b/call.c
#
--- a/call.c
+++ b/call.c
+@@ -680,6 +680,8 @@ struct call *get_call (int tunnel, int c
st->peer.sin_port = port;
st->refme = refme;
st->refhim = refhim;
st->peer.sin_port = port;
st->refme = refme;
st->refhim = refhim;
tunnels.head = st;
--- a/control.c
+++ b/control.c
tunnels.head = st;
--- a/control.c
+++ b/control.c
+@@ -596,6 +596,9 @@ int control_finish (struct tunnel *t, st
if (gconfig.debug_state)
l2tp_log (LOG_DEBUG, "%s: sending SCCCN\n", __FUNCTION__);
control_xmit (buf);
if (gconfig.debug_state)
l2tp_log (LOG_DEBUG, "%s: sending SCCCN\n", __FUNCTION__);
control_xmit (buf);
/* Schedule a HELLO */
tv.tv_sec = HELLO_DELAY;
tv.tv_usec = 0;
/* Schedule a HELLO */
tv.tv_sec = HELLO_DELAY;
tv.tv_usec = 0;
+@@ -608,6 +611,7 @@ int control_finish (struct tunnel *t, st
"Connection established to %s, %d. Local: %d, Remote: %d (ref=%u/%u).\n",
IPADDY (t->peer.sin_addr),
ntohs (t->peer.sin_port), t->ourtid, t->tid, t->refme, t->refhim);
"Connection established to %s, %d. Local: %d, Remote: %d (ref=%u/%u).\n",
IPADDY (t->peer.sin_addr),
ntohs (t->peer.sin_port), t->ourtid, t->tid, t->refme, t->refhim);
if (t->lac)
{
/* This is part of a LAC, so we want to go ahead
if (t->lac)
{
/* This is part of a LAC, so we want to go ahead
+@@ -635,6 +639,9 @@ int control_finish (struct tunnel *t, st
IPADDY (t->peer.sin_addr),
ntohs (t->peer.sin_port), t->ourtid, t->tid, t->refme, t->refhim,
t->lns->entname);
IPADDY (t->peer.sin_addr),
ntohs (t->peer.sin_port), t->ourtid, t->tid, t->refme, t->refhim,
t->lns->entname);
tv.tv_usec = 0;
--- a/l2tp.h
+++ b/l2tp.h
tv.tv_usec = 0;
--- a/l2tp.h
+++ b/l2tp.h
+@@ -167,6 +167,8 @@ struct tunnel
int ourrws; /* Receive Window Size */
int rxspeed; /* Receive bps */
int txspeed; /* Transmit bps */
int ourrws; /* Receive Window Size */
int rxspeed; /* Receive bps */
int txspeed; /* Transmit bps */
struct call *self;
struct lns *lns; /* LNS that owns us */
struct lac *lac; /* LAC that owns us */
struct call *self;
struct lns *lns; /* LNS that owns us */
struct lac *lac; /* LAC that owns us */
+@@ -220,6 +222,7 @@ extern void control_xmit (void *);
extern int ppd;
extern int switch_io; /* jz */
extern int control_fd;
extern int ppd;
extern int switch_io; /* jz */
extern int control_fd;
* 0 => current */
int fd; /* FD of UDP socket to use */
* 0 => current */
int fd; /* FD of UDP socket to use */
+@@ -36,6 +31,45 @@ struct pppol2tp_addr
__u16 d_tunnel, d_session; /* For sending outgoing packets */
};
__u16 d_tunnel, d_session; /* For sending outgoing packets */
};
/* Socket options:
* DEBUG - bitmask of debug message categories
* SENDSEQ - 0 => don't send packets with sequence numbers
/* Socket options:
* DEBUG - bitmask of debug message categories
* SENDSEQ - 0 => don't send packets with sequence numbers
+@@ -66,4 +100,4 @@ enum {
+#endif /* __LINUX_IF_PPPOL2TP_H */
--- a/network.c
+++ b/network.c
+#endif /* __LINUX_IF_PPPOL2TP_H */
--- a/network.c
+++ b/network.c
+@@ -45,6 +45,7 @@ int init_network (void)
server.sin_family = AF_INET;
server.sin_addr.s_addr = gconfig.listenaddr;
server.sin_port = htons (gconfig.port);
server.sin_family = AF_INET;
server.sin_addr.s_addr = gconfig.listenaddr;
server.sin_port = htons (gconfig.port);
if ((server_socket = socket (PF_INET, SOCK_DGRAM, 0)) < 0)
{
l2tp_log (LOG_CRIT, "%s: Unable to allocate socket. Terminating.\n",
if ((server_socket = socket (PF_INET, SOCK_DGRAM, 0)) < 0)
{
l2tp_log (LOG_CRIT, "%s: Unable to allocate socket. Terminating.\n",
+@@ -52,6 +53,10 @@ int init_network (void)
if (bind (server_socket, (struct sockaddr *) &server, sizeof (server)))
{
close (server_socket);
if (bind (server_socket, (struct sockaddr *) &server, sizeof (server)))
{
close (server_socket);
+@@ -321,6 +326,11 @@ int build_fdset (fd_set *readfds)
call = tun->call_head;
while (call)
{
call = tun->call_head;
while (call)
{
+@@ -390,6 +400,8 @@ void network_thread ()
struct iovec iov;
char cbuf[256];
unsigned int refme, refhim;
struct iovec iov;
char cbuf[256];
unsigned int refme, refhim;
/* This one buffer can be recycled for everything except control packets */
buf = new_buf (MAX_RECV_SIZE);
/* This one buffer can be recycled for everything except control packets */
buf = new_buf (MAX_RECV_SIZE);
+@@ -428,7 +440,21 @@ void network_thread ()
{
/*
* Okay, now we're ready for reading and processing new data.
{
/*
* Okay, now we're ready for reading and processing new data.
+@@ -457,12 +483,19 @@ void network_thread ()
msgh.msg_flags = 0;
/* Receive one packet. */
msgh.msg_flags = 0;
/* Receive one packet. */
if (errno != EAGAIN)
l2tp_log (LOG_WARNING,
"%s: recvfrom returned error %d (%s)\n",
if (errno != EAGAIN)
l2tp_log (LOG_WARNING,
"%s: recvfrom returned error %d (%s)\n",
+@@ -567,6 +600,8 @@ void network_thread ()
/*
* finished obvious sources, look for data from PPP connections.
/*
* finished obvious sources, look for data from PPP connections.
+@@ -639,3 +674,82 @@ void network_thread ()
+}
--- a/xl2tpd.c
+++ b/xl2tpd.c
+}
--- a/xl2tpd.c
+++ b/xl2tpd.c
+@@ -278,7 +278,11 @@ void death_handler (int signal)
struct tunnel *st, *st2;
int sec;
l2tp_log (LOG_CRIT, "%s: Fatal signal %d received\n", __FUNCTION__, signal);
struct tunnel *st, *st2;
int sec;
l2tp_log (LOG_CRIT, "%s: Fatal signal %d received\n", __FUNCTION__, signal);
st = tunnels.head;
while (st)
{
st = tunnels.head;
while (st)
{
+@@ -349,7 +353,7 @@ int start_pppd (struct call *c, struct p
int flags;
#endif
int pos = 1;
int flags;
#endif
int pos = 1;
#ifdef DEBUG_PPPD
int x;
#endif
#ifdef DEBUG_PPPD
int x;
#endif
+@@ -397,7 +401,7 @@ int start_pppd (struct call *c, struct p
sax.sa_family = AF_PPPOX;
sax.sa_protocol = PX_PROTO_OL2TP;
sax.pppol2tp.pid = 0;
sax.sa_family = AF_PPPOX;
sax.sa_protocol = PX_PROTO_OL2TP;
sax.pppol2tp.pid = 0;
sax.pppol2tp.addr.sin_addr.s_addr = c->container->peer.sin_addr.s_addr;
sax.pppol2tp.addr.sin_port = c->container->peer.sin_port;
sax.pppol2tp.addr.sin_family = AF_INET;
sax.pppol2tp.addr.sin_addr.s_addr = c->container->peer.sin_addr.s_addr;
sax.pppol2tp.addr.sin_port = c->container->peer.sin_port;
sax.pppol2tp.addr.sin_family = AF_INET;
+@@ -408,6 +412,7 @@ int start_pppd (struct call *c, struct p
if (connect(fd2, (struct sockaddr *)&sax, sizeof(sax)) < 0) {
l2tp_log (LOG_WARNING, "%s: Unable to connect PPPoL2TP socket.\n",
__FUNCTION__);
if (connect(fd2, (struct sockaddr *)&sax, sizeof(sax)) < 0) {
l2tp_log (LOG_WARNING, "%s: Unable to connect PPPoL2TP socket.\n",
__FUNCTION__);
return -EINVAL;
}
stropt[pos++] = strdup ("plugin");
return -EINVAL;
}
stropt[pos++] = strdup ("plugin");
+@@ -484,7 +489,7 @@ int start_pppd (struct call *c, struct p
dup2 (fd2, 0);
dup2 (fd2, 1);
close(fd2);
dup2 (fd2, 0);
dup2 (fd2, 1);
close(fd2);
/* close all the calls pty fds */
st = tunnels.head;
while (st)
/* close all the calls pty fds */
st = tunnels.head;
while (st)
+@@ -492,12 +497,17 @@ int start_pppd (struct call *c, struct p
sc = st->call_head;
while (sc)
{
sc = st->call_head;
while (sc)
{
/* close the UDP socket fd */
close (server_socket);
/* close the UDP socket fd */
close (server_socket);
+@@ -615,6 +625,10 @@ void destroy_tunnel (struct tunnel *t)
the memory pointed to by t->chal_us.vector at some other place */
if (t->chal_them.vector)
free (t->chal_them.vector);
the memory pointed to by t->chal_us.vector at some other place */
if (t->chal_them.vector)
free (t->chal_them.vector);
---- xl2tpd-1.3.1/control.c.orig 2012-04-25 12:59:28.718825985 +0100
-+++ xl2tpd-1.3.1/control.c 2012-04-25 12:59:37.063916785 +0100
+--- a/control.c
++++ b/control.c
@@ -905,8 +905,6 @@ int control_finish (struct tunnel *t, st
po = add_opt (po, c->lac->pppoptfile);
}
@@ -905,8 +905,6 @@ int control_finish (struct tunnel *t, st
po = add_opt (po, c->lac->pppoptfile);
}
--- /dev/null
+--- a/Makefile
++++ b/Makefile
+@@ -115,7 +115,7 @@ $(EXEC): $(OBJS) $(HDRS)
+ $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LDLIBS)
+
+ $(CONTROL_EXEC): $(CONTROL_SRCS)
+- $(CC) $(CONTROL_SRCS) -o $@
++ $(CC) $(CFLAGS) $(CONTROL_SRCS) -o $@
+
+ romfs:
+ $(ROMFSINST) /bin/$(EXEC)