--- a/Makefile
+++ b/Makefile
-@@ -62,8 +62,8 @@
+@@ -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
#
#
--- a/call.c
+++ b/call.c
-@@ -680,6 +680,8 @@
+@@ -680,6 +680,8 @@ struct call *get_call (int tunnel, int c
st->peer.sin_port = port;
st->refme = refme;
st->refhim = refhim;
tunnels.head = st;
--- a/control.c
+++ b/control.c
-@@ -596,6 +596,9 @@
+@@ -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);
/* Schedule a HELLO */
tv.tv_sec = HELLO_DELAY;
tv.tv_usec = 0;
-@@ -608,6 +611,7 @@
+@@ -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);
if (t->lac)
{
/* This is part of a LAC, so we want to go ahead
-@@ -635,6 +639,9 @@
+@@ -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);
tv.tv_usec = 0;
--- a/l2tp.h
+++ b/l2tp.h
-@@ -167,6 +167,8 @@
+@@ -167,6 +167,8 @@ struct tunnel
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 */
-@@ -220,6 +222,7 @@
+@@ -220,6 +222,7 @@ extern void control_xmit (void *);
extern int ppd;
extern int switch_io; /* jz */
extern int control_fd;
* 0 => current */
int fd; /* FD of UDP socket to use */
-@@ -36,6 +31,45 @@
+@@ -36,6 +31,45 @@ struct pppol2tp_addr
__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
-@@ -66,4 +100,4 @@
+@@ -66,4 +100,4 @@ enum {
+#endif /* __LINUX_IF_PPPOL2TP_H */
--- a/network.c
+++ b/network.c
-@@ -45,6 +45,7 @@
+@@ -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);
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 @@
+@@ -52,6 +53,10 @@ int init_network (void)
return -EINVAL;
};
if (bind (server_socket, (struct sockaddr *) &server, sizeof (server)))
{
close (server_socket);
-@@ -321,6 +326,11 @@
+@@ -321,6 +326,11 @@ int build_fdset (fd_set *readfds)
while (tun)
{
call = tun->call_head;
while (call)
{
-@@ -390,6 +400,8 @@
+@@ -390,6 +400,8 @@ void network_thread ()
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);
-@@ -428,7 +440,21 @@
+@@ -428,7 +440,21 @@ void network_thread ()
{
do_control ();
}
{
/*
* Okay, now we're ready for reading and processing new data.
-@@ -457,12 +483,19 @@
+@@ -457,12 +483,19 @@ void network_thread ()
msgh.msg_flags = 0;
/* Receive one packet. */
if (errno != EAGAIN)
l2tp_log (LOG_WARNING,
"%s: recvfrom returned error %d (%s)\n",
-@@ -567,6 +600,8 @@
+@@ -567,6 +600,8 @@ void network_thread ()
}
};
}
/*
* finished obvious sources, look for data from PPP connections.
-@@ -639,3 +674,82 @@
+@@ -639,3 +674,82 @@ void network_thread ()
}
}
+}
--- a/xl2tpd.c
+++ b/xl2tpd.c
-@@ -278,7 +278,11 @@
+@@ -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);
st = tunnels.head;
while (st)
{
-@@ -349,7 +353,7 @@
+@@ -349,7 +353,7 @@ int start_pppd (struct call *c, struct p
int flags;
#endif
int pos = 1;
#ifdef DEBUG_PPPD
int x;
#endif
-@@ -397,7 +401,7 @@
+@@ -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.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 @@
+@@ -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__);
return -EINVAL;
}
stropt[pos++] = strdup ("plugin");
-@@ -484,7 +489,7 @@
+@@ -484,7 +489,7 @@ int start_pppd (struct call *c, struct p
dup2 (fd2, 0);
dup2 (fd2, 1);
close(fd2);
/* close all the calls pty fds */
st = tunnels.head;
while (st)
-@@ -492,12 +497,17 @@
+@@ -492,12 +497,17 @@ int start_pppd (struct call *c, struct p
sc = st->call_head;
while (sc)
{
/* close the UDP socket fd */
close (server_socket);
-@@ -615,6 +625,10 @@
+@@ -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);