xl2tpd: upstream updates

This commit is contained in:
andy.padavan
2017-10-01 09:49:21 +07:00
parent 2ec139e995
commit bd02fc4306
38 changed files with 364 additions and 342 deletions

View File

@@ -1,3 +1,105 @@
v1.3.10 (August 2, 2017)
* Update STRLEN in file.h to 100 (from 80) [Samir Hussain]
* xl2tpd-control: fix xl2tpd hanged up in "fopen" [wendy2001011]
* Update version in spec and opewnrt Makefile. [Samir Hussain]
v1.3.9 (February 8, 2017)
* Add xl2tpd-control man pages (Samir Hussain)
* Update spec file with newest Soure0 and version (Samir Hussain)
* Update License file (Samir Hussain)
* Display PID for call in the logs (Samir Hussain)
* Use left shift rather than pow() function. (Samir Hussain)
* Enable Travis integration (Samir Hussain)
* Remove unnecessary casting of malloc() results (Andrew Clayton)
* Remove an unused line of code in init_config() (Andrew Clayton)
* Fix some undefined behaviour in read_result() (Andrew Clayton)
* Fix feature test macro deprecation warnings (Andrew Clayton)
v1.3.8 (August 11, 2016)
* Another one fix for control buf handling in udp_xmit (Sergey Ryazanov)
* Fixing minor bug in Linux that was introduced by 90368 (Samir Hussain)
* Fix control buffer handling in udp_xmit (rsa9000)
* Avoid using IP_PKTINFO with non-Linux systems (Sergey Ryazanov)
* Remove duplicated UDP checksum disabling (Sergey Ryazanov)
* Handle LDLIBS carefully (Sergey Ryazanov)
* Avoid false-positive warning message from not smart compilers (Sergey Ryazanov)
* Correctly activate XPG4v2 support (Sergey Ryazanov)
* Simplify signal header inclusion (Sergey Ryazanov)
* Adding info on the mailing lists (Samir Hussain)
* Fixing minor spelling typo in code. (Samir Hussain)
* Fixing minor spelling mistakes in xl2tpd.conf.5 and l2tpd.conf.sample (Samir Hussain)
* Removing -fno-builtin from CFLAGS (Samir Hussain)
v1.3.7 (March 29, 2016)
* Adding defensive code to deal with error when pppd exits (Samir Hussain)
* Minor compilation fixes (Yousong Zhou)
* Refresh debian/ from Debian. Thanks! (Simon Deziel)
* Update URL (Simon Deziel)
* Update copyright year (Simon Deziel)
* Add local ip range option. (Patch by by Peter W Morreale)
* Drop RFC 2661 copy. (Simon Deziel)
* debian/control drop legacy Replaces (Simon Deziel)
* Typo fix (Simon Deziel)
* Fix #98 by checking if a valid PID is being killed (Pieter Jordaan)
* Avoid problems with bad avp lengths and remaining hidlen from previous
iteration (Cristi Cimpianu)
* Fix minor grammar issues in xl2tpd.conf(5) (kballou)
* Fix possible NULL reference when removing lac (Yousong Zhou)
* Describe autodial option in xl2tpd.conf manpage (Anton Leontiev)
* Update URL in BUGS file (Anton Leontiev)
* Add size optimization (Cristi Cimpianu)
* Remove useless returns from magic_lac_tunnel (Cristi Cimpianu)
* Remove duplicate xmit for ZLBs (Cristi Cimpianu)
* Fix segfault on lac remove (Cristi Cimpianu)
* Fix paths in man pages (Taiki Sugawara)
* Stop sending ZLB in response to out of order ZLB from check_control (Cristi Cimpianu)
* Add exponential backoff retransmits (Pieter Willem Jordaan)
* Fix build errors caused by inline function with gcc 5 (Kai Kang)
* Fix memory leaks and accessing free'd memory (Yousong Zhou)
* Fix double-free on dial_no_tmp; (Yousong Zhou)
* Change handle_special to return a value indicating if it frees the buffer (Cristi Cimpianu)
* Remove unnecessary NULL check on lac. (Yousong Zhou)
* xl2tpd-control: show all available commands in --help. (Yousong Zhou)
* Ignore SIGPIPE signal. (Yousong Zhou)
* Unlink result file to prevent leftover a regular file. (Yousong Zhou)
* Introduce new option -l for using syslog as the logging facility. (Yousong Zhou)
* start_pppd: place opts after "plugin pppol2tp.so". (Yousong Zhou)
* Fix typo in reporting available lns count. (Yousong Zhou)
* xl2tpd-control: enhance output of print_error(). (Yousong Zhou)
* xl2tpd-control: cleaup result file atexit(). (Yousong Zhou)
* xl2tpd-control: open control file with O_NONBLOCK. (Yousong Zhou)
* xl2tpd-control: define _GNU_SOURCE to use fmemopen() and friends. (Yousong Zhou)
* xl2tpd-control: check end-of-file when reading pipe to avoid dead loop. (Yousong Zhou)
* Correct CDN message result range (Constantin Calotescu)
* place the PPP frame buffer to the call structure (rsa9000)
* Place the pty read buffer to the call structure (rsa9000)
* Pass pointer to call structure to read_packet() (rsa9000)
* Remove convert arg of read_packet() function (rsa9000)
* Remove dead code (rsa9000)
* Fix the list of ignored files (rsa9000)
* Add checks before closing sockets (Cristi Cimpianu)
* Add a bit more info about existing tunnels and calls (Cristi Cimpianu)
* Fix endless loop (Cristi Cimpianu)
* Add fix for socket leak to fork children (Cristi Cimpianu)
* Random fixes (Constantin Calotescu)
* Solve some memory leaks that show up after several days of running with
flapping tunnels and calls. (Cristi Cimpianu)
* Fix for avoiding xltpd occasionally going into an endless loop. (Damian Ivereigh)
* Fixed issue with strtok modifying contents when pushing details for ppd plugins (Michael Lawson)
* Added the ability to add a pppd plugin and params to an lns (Michael Lawson)
* Modified lns_remove to close each call rather than just calling destroy_tunnel() (Michael Lawson)
* Added control method to remove an lns (Michael Lawson)
* Refactored the do_control() method to use a handler approach for processing (Michael Lawson)
* Fixed potential null pointer when creating a new lns (Michael Lawson)
* Added status control command for lns, this returns tunnel and call information via the control socket (Michael Lawson)
* Added control support for adding lns and status command in xl2tp-control (Michael Lawson)
* Added control pipe method CONTROL_PIPE_REQ_LNS_ADD_MODIFY to modify LNS configuration (Michael Lawson)
* Introduced shared control request types (Michael Lawson)
* Fixed typo in xl2tpd.conf.5 (paina)
* Some malloc/free sanity patches. (Patrick Naubert)
* Better NETBSD support. (Patrick Naubert)
* Prevent a DEBUG message from being sent to syslog when not debugging. (Patrick Naubert)
v1.3.6 (Jan 15, 2014)
* I keep screwing up the version number. Changes to CHANGES and l2tp.h
* Fix the size of the lenght param for AVP headers. This should fix Android

View File

@@ -1,12 +1,12 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
@@ -15,7 +15,7 @@ software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
@@ -55,8 +55,8 @@ patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
@@ -110,7 +110,7 @@ above, provided that you also meet all of these conditions:
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
@@ -168,7 +168,7 @@ access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
@@ -225,7 +225,7 @@ impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
@@ -255,7 +255,7 @@ make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
@@ -277,9 +277,9 @@ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
@@ -291,7 +291,7 @@ convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 19yy <name of author>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -303,17 +303,16 @@ the "copyright" line and a pointer to where the full notice is found.
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19yy name of author
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
@@ -336,5 +335,5 @@ necessary. Here is a sample; alter the names:
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

View File

@@ -73,10 +73,6 @@ OSFLAGS?= -DLINUX -I$(KERNEL_HEADERS_PATH)
#
OSFLAGS+= -DUSE_KERNEL
#
# Uncomment the following for kernel module autoload
#
#OSFLAGS+= -DMODULE_AUTO
#
# Uncomment the following for set high prio for xl2tpd process
#
OSFLAGS+= -DHIGH_PRIO
@@ -110,7 +106,6 @@ HDRS=l2tp.h avp.h misc.h control.h call.h scheduler.h file.h aaa.h md5.h
OBJS=xl2tpd.o pty.o misc.o control.o avp.o call.o network.o avpsend.o scheduler.o file.o aaa.o md5.o
SRCS=${OBJS:.o=.c} ${HDRS}
CONTROL_SRCS=xl2tpd-control.c
LDLIBS= -lm
EXEC=xl2tpd
CONTROL_EXEC=xl2tpd-control

View File

@@ -26,3 +26,6 @@ IPsec SA Reference tracking do not yet work together.
Xl2tpd is based on the 0.69 L2TP by Jeff McAdams <jeffm@iglou.com>
It was de-facto maintained by Jacco de Leeuw <jacco2@dds.nl> in 2002 and 2003.
Mailing Lists :
https://lists.openswan.org/cgi-bin/mailman/listinfo/xl2tpd is home of the
mailing list. Note: This is a closed list - you *must* be subscribed to post.

View File

@@ -65,7 +65,7 @@ void reserve_addr (unsigned int addr)
if (ip_used (addr))
return;
tmp = uaddr[addr % ADDR_HASH_SIZE];
tmp2 = (struct addr_ent *) malloc (sizeof (struct addr_ent));
tmp2 = malloc (sizeof (struct addr_ent));
uaddr[addr % ADDR_HASH_SIZE] = tmp2;
tmp2->next = tmp;
tmp2->addr = addr;
@@ -111,7 +111,7 @@ unsigned int get_addr (struct iprange *ipr)
for (x = ntohl (ipr->start); x <= ntohl (ipr->end); x++)
{
/* Found an IP in an ALLOW range, check to be sure it is
consistant through the remaining regions */
consistent through the remaining regions */
if (!ip_used (x))
{
status = SENSE_ALLOW;
@@ -434,7 +434,7 @@ void encrypt_avp (struct buffer *buf, _u16 len, struct tunnel *t)
int decrypt_avp (char *buf, struct tunnel *t)
{
/* Decrypts a hidden AVP pointed to by buf. The
new header will be exptected to be two characters
new header will be expected to be two characters
offset from the old */
int cnt = 0;
int len, olen, flags;

View File

@@ -130,7 +130,7 @@ struct unaligned_u16 {
} __attribute__((packed));
/*
* t, c, data, and datalen may be assumed to be defined for all avp's
* t, c, data, and datalen may be assumed to be defined for all AVP's
*/
int message_type_avp (struct tunnel *t, struct call *c, void *data,
@@ -167,7 +167,7 @@ int message_type_avp (struct tunnel *t, struct call *c, void *data,
if (t->sanity)
{
/*
* Look ou our state for each message and make sure everything
* Look out our state for each message and make sure everything
* make sense...
*/
if ((c != t->self) && (c->msgtype < Hello))
@@ -381,8 +381,8 @@ int ignore_avp (struct tunnel *t, struct call *c, void *data, int datalen)
* The spec says we have to accept authentication information
* even if we just ignore it, so that's exactly what
* we're going to do at this point. Proxy authentication is such
* a rediculous security threat anyway except from local
* controled machines.
* a ridiculous security threat anyway except from local
* controlled machines.
*
* FIXME: I need to handle proxy authentication as an option.
* One option is to simply change the options we pass to pppd.
@@ -436,7 +436,7 @@ int result_code_avp (struct tunnel *t, struct call *c, void *data,
int datalen)
{
/*
* Find out what version of l2tp the other side is using.
* Find out what version of L2TP the other side is using.
* I'm not sure what we're supposed to do with this but whatever..
*/
@@ -539,7 +539,7 @@ int protocol_version_avp (struct tunnel *t, struct call *c, void *data,
int datalen)
{
/*
* Find out what version of l2tp the other side is using.
* Find out what version of L2TP the other side is using.
* I'm not sure what we're supposed to do with this but whatever..
*/
@@ -1478,7 +1478,7 @@ int rx_speed_avp (struct tunnel *t, struct call *c, void *data, int datalen)
int tx_speed_avp (struct tunnel *t, struct call *c, void *data, int datalen)
{
/*
* What is the tranmsit baud rate of the call?
* What is the transmit baud rate of the call?
*/
struct unaligned_u16 *raw = data;
@@ -1634,9 +1634,11 @@ int handle_avps (struct buffer *buf, struct tunnel *t, struct call *c)
int hidlen = 0;
char *data = buf->start + sizeof (struct control_hdr);
avp = (struct avp_hdr *) data;
/* I had to comment out the following since Valgrind tells me it leaks like my bathroom faucet
if (gconfig.debug_avp)
l2tp_log (LOG_DEBUG, "%s: handling avp's for tunnel %d, call %d\n",
__FUNCTION__, t->ourtid, c->ourcid);
*/
while (len > 0)
{
hidlen = 0;
@@ -1660,7 +1662,7 @@ int handle_avps (struct buffer *buf, struct tunnel *t, struct call *c)
{
if (DEBUG)
l2tp_log (LOG_WARNING,
"%s: don't know how to handle atribute %d.\n",
"%s: don't know how to handle attribute %d.\n",
__FUNCTION__, avp->attr);
goto next;
}
@@ -1708,7 +1710,7 @@ int handle_avps (struct buffer *buf, struct tunnel *t, struct call *c)
l2tp_log (LOG_DEBUG, "%s: Hidden bit set on AVP.\n", __FUNCTION__);
#endif
/* We want to rewrite the AVP as an unhidden AVP
and then pass it along as normal. Remeber how
and then pass it along as normal. Remember how
long the AVP was in the first place though! */
hidlen = avp->length;
if (decrypt_avp (data, t))
@@ -1771,7 +1773,7 @@ int handle_avps (struct buffer *buf, struct tunnel *t, struct call *c)
else
{
if (DEBUG)
l2tp_log (LOG_WARNING, "%s: no handler for atribute %d (%s).\n",
l2tp_log (LOG_WARNING, "%s: no handler for attribute %d (%s).\n",
__FUNCTION__, avp->attr,
avps[avp->attr].description);
}

View File

@@ -38,7 +38,7 @@ void add_header(struct buffer *buf, _u16 length, _u16 type) {
}
/*
* These routines should add avp's to a buffer
* These routines should add AVP's to a buffer
* to be sent
*/

View File

@@ -129,7 +129,7 @@ int read_packet (struct call *c)
/*
* Oops, we were interrupted!
* Or, we ran out of data too soon
* anyway, we discared whatever it is we
* anyway, we discarded whatever it is we
* have
*/
return 0;
@@ -223,8 +223,8 @@ void call_close (struct call *c)
* entire tunnel
*/
/* First deschedule any remaining packet transmissions
for this tunnel. That means Hello's and any reminaing
/* First de-schedule any remaining packet transmissions
for this tunnel. That means Hello's and any remaining
packets scheduled for transmission. This is a very
nasty little piece of code here. */
@@ -265,7 +265,7 @@ void call_close (struct call *c)
if (c->closing)
{
/* Really close this tunnel, as our
StopCCN has been ack'd */
StopCCN has been ACK'd */
#ifdef DEBUG_CLOSE
l2tp_log (LOG_DEBUG, "%s: Actually closing tunnel %d\n", __FUNCTION__,
c->container->ourtid);
@@ -317,7 +317,7 @@ void call_close (struct call *c)
tmp = tmp2;
}
l2tp_log (LOG_INFO,
"Connection %d closed to %s, port %d (%s)\n",
"Connection %d closed to %s, port %d (%s)\n",
c->container->tid,
IPADDY (c->container->peer.sin_addr),
ntohs (c->container->peer.sin_port), c->errormsg);
@@ -389,7 +389,10 @@ void destroy_call (struct call *c)
* Close the tty
*/
if (c->fd > 0)
{
close (c->fd);
c->fd = -1;
}
/* if (c->dethrottle) deschedule(c->dethrottle); */
if (c->zlb_xmit)
deschedule (c->zlb_xmit);
@@ -404,9 +407,9 @@ void destroy_call (struct call *c)
#endif
/*
* Kill off pppd and wait for it to
* Kill off PPPD and wait for it to
* return to us. This should only be called
* in rare cases if pppd hasn't already died
* in rare cases if PPPD hasn't already died
* voluntarily
*/
pid = c->pppd;
@@ -415,8 +418,8 @@ void destroy_call (struct call *c)
/* Set c->pppd to zero to prevent recursion with child_handler */
c->pppd = 0;
/*
* There is a bug in some pppd versions where sending a SIGTERM
* does not actually seem to kill pppd, and xl2tpd waits indefinately
* There is a bug in some PPPD versions where sending a SIGTERM
* does not actually seem to kill PPPD, and xl2tpd waits indefinately
* using waitpid, not accepting any new connections either. Therefor
* we now use some more force and send it a SIGKILL instead of SIGTERM.
* One confirmed buggy version of pppd is ppp-2.4.2-6.4.RHEL4
@@ -537,7 +540,7 @@ struct call *get_call (int tunnel, int call, struct in_addr addr, int port,
IPsecSAref_t refme, IPsecSAref_t refhim)
{
/*
* Figure out which call struct should handle this.
* Figure out which call struct should handle this.
* If we have tunnel and call ID's then they are unique.
* Otherwise, if the tunnel is 0, look for an existing connection
* or create a new tunnel.

View File

@@ -14,12 +14,11 @@
# include <pcap-bpf.h>
#endif
#ifdef OPENBSD
#if defined(FREEBSD) || defined(OPENBSD) || defined(NETBSD) || defined(SOLARIS)
# include <net/ppp_defs.h>
#endif
#ifdef SOLARIS
# include <net/ppp_defs.h>
# define u_int32_t unsigned int
#endif

View File

@@ -414,7 +414,7 @@ int control_finish (struct tunnel *t, struct call *c)
/* FIXME: Do we need to be sure they specified a version number?
* Theoretically, yes, but we don't have anything in the code
* to actually *do* anything with it, so...why check at this point?
* We shouldn't be requiring a bearer capabilities avp to be present in
* We shouldn't be requiring a bearer capabilities AVP to be present in
* SCCRQ and SCCRP as they aren't required
if (t->bc < 0 ) {
if (DEBUG) l2tp_log(LOG_DEBUG,
@@ -442,7 +442,7 @@ int control_finish (struct tunnel *t, struct call *c)
(y != t))
{
/* This can happen if we get a duplicate
StartCCN or if they don't get our ack packet */
StartCCN or if they don't get our ACK packet */
/*
* But it is legitimate for two different remote systems
* to use the same tid
@@ -538,7 +538,7 @@ int control_finish (struct tunnel *t, struct call *c)
/* FIXME: Do we need to be sure they specified a version number?
* Theoretically, yes, but we don't have anything in the code
* to actually *do* anything with it, so...why check at this point?
* We shouldn't be requiring a bearer capabilities avp to be present in
* We shouldn't be requiring a bearer capabilities AVP to be present in
* SCCRQ and SCCRP as they aren't required
if (t->bc < 0 ) {
if (DEBUG) log(LOG_DEBUG,
@@ -748,7 +748,7 @@ int control_finish (struct tunnel *t, struct call *c)
if (z->cid == p->cid)
{
/* This can happen if we get a duplicate
ICRQ or if they don't get our ack packet */
ICRQ or if they don't get our ACK packet */
l2tp_log (LOG_DEBUG,
"%s: Peer requested call %d twice, ignoring second one.\n",
__FUNCTION__, p->cid);
@@ -1023,8 +1023,8 @@ int control_finish (struct tunnel *t, struct call *c)
start_pppd (c, po);
opt_destroy (po);
l2tp_log (LOG_NOTICE,
"Call established with %s, Local: %d, Remote: %d, Serial: %d\n",
IPADDY (t->peer.sin_addr), c->ourcid, c->cid,
"Call established with %s, PID: %d, Local: %d, Remote: %d, Serial: %d\n",
IPADDY (t->peer.sin_addr), c->pppd, c->ourcid, c->cid,
c->serno);
break;
#ifndef DISABLE_OCRP_OCCN
@@ -1325,7 +1325,7 @@ static inline int check_payload (struct buffer *buf, struct tunnel *t,
{
if (DEBUG)
{
l2tp_log (LOG_DEBUG, "%s: Aempted to send payload on tunnel\n",
l2tp_log (LOG_DEBUG, "%s: Attempted to send payload on tunnel\n",
__FUNCTION__);
}
return -EINVAL;
@@ -1336,7 +1336,7 @@ static inline int check_payload (struct buffer *buf, struct tunnel *t,
no matter what. we'll look more later */
if (DEBUG)
{
l2tp_log (LOG_DEBUG, "%s:Recieved to small of packet\n", __FUNCTION__);
l2tp_log (LOG_DEBUG, "%s:Received to small of packet\n", __FUNCTION__);
}
return -EINVAL;
}
@@ -1584,7 +1584,7 @@ void send_zlb (void *data)
__FUNCTION__);
return;
}
/* Update the counter so we know what Lr was when we last transmited a ZLB */
/* Update the counter so we know what Lr was when we last transmitted a ZLB */
c->prx = c->data_rec_seq_num;
buf = new_payload (t->peer);
add_payload_hdr (t, c, buf);
@@ -1674,7 +1674,7 @@ static inline int write_packet (struct buffer *buf, struct tunnel *t, struct cal
/*
* sync->async conversion if we're doing sync frames
* since the pppd driver will expect async frames
* since the PPPD driver will expect async frames
* Write leading flag character
*/

View File

@@ -1,46 +0,0 @@
Dapper Drake 6.0.6.1LTS
Debian GNU/Linux `dpkg' package management program version 1.13.11 (amd64).
Public Domain document by Jacob Appelbaum <jacob@appelbaum.net>
You may need to install other packages to build the software. This build doc is for amd64.
It should work on any arch. I assume you have dpkg-buildpackage. Don't forget to install libc-dev:
apt-get -y install \
cpp cpp-4.0 fakeroot gcc gcc-4.0 libc6-dev linux-kernel-headers \
debconf-utils debhelper dpkg-dev gettext html2text intltool-debian make \
po-debconf
>From start to finish:
wget http://www.xelerance.com/software/xl2tpd/xl2tpd-1.1.12.tar.gz
wget http://www.xelerance.com/software/xl2tpd/xl2tpd-1.1.12.tar.gz.asc
gpg --search-keys 0xB5CC27E1
gpg --verify xl2tpd-1.1.12.tar.gz.asc
tar -xvzf xl2tpd-1.1.12.tar.gz
cd xl2tpd-1.1.12/
chmod +x debian/rules
# Ensure that you're inside of xl2tpd-1.1.12/
patch -p0 < doc/dapper-control.patch
# Now build the package
dpkg-buildpackage -rfakeroot
# Without the patch, it will likely fail with an error like:
dpkg-deb: parse error, in file `debian/xl2tpd/DEBIAN/control' near line 7 package `xl2tpd':
`Replaces' field, reference to `l2tpd': error in version: version string is empty
dh_builddeb: command returned error code 512
make: *** [binary-arch] Error 1
ls ../ *.deb
l2tpd_1.1.11.dfsg.1-2_all.deb
xl2tpd_1.1.11.dfsg.1-2_amd64.deb
apt-get -y install libpcap0.8 ppp
dpkg -i xl2tpd_1.1.11.dfsg.1-2_amd64.deb
dpkg -i l2tpd_1.1.11.dfsg.1-2_all.deb

View File

@@ -1,4 +1,4 @@
xl2tpd (XL2TPDBASEVERSION-1xelerance1) lucid; urgency=low
xl2tpd (XL2TPDBASEVERSION-0xelerance1) trusty; urgency=low
* Update to XL2TPDBASEVERSION
@@ -8,7 +8,7 @@ xl2tpd (XL2TPDBASEVERSION-1xelerance1) lucid; urgency=low
not file any Debian/Ubuntu bug reports for this package but contact
<simon@xelerance.com> if you have a problem.
-- Simon Deziel <simon@xelerance.com> Thu, 10 Mar 2011 11:04:42 -0400
-- Simon Deziel <simon@xelerance.com> Tue, 08 Mar 2016 15:51:48 -0500
Local variables:
mode: debian-changelog

View File

@@ -1 +1 @@
5
7

View File

@@ -2,24 +2,21 @@ Source: xl2tpd
Section: net
Priority: optional
Maintainer: Simon Deziel <simon@xelerance.com>
Homepage: http://www.xelerance.com/software/xl2tpd/
Build-Depends: debhelper (>= 7), libpcap0.8-dev
Standards-Version: 3.9.1
Homepage: https://www.xelerance.com/software/xl2tpd/
Vcs-Browser: https://github.com/xelerance/xl2tpd
Vcs-Git: git://github.com/xelerance/xl2tpd.git
Build-Depends: debhelper (>= 7.0.8), libpcap0.8-dev
Standards-Version: 3.9.5
Package: xl2tpd
Architecture: any
Provides: l2tpd
# For Ubuntu dapper drake, use:
#Replaces: l2tpd (<< ${source-Version})
Replaces: l2tpd (<< ${source:Version})
Depends: ${shlibs:Depends}, ${misc:Depends}, ppp
Description: a layer 2 tunneling protocol implementation
Description: layer 2 tunneling protocol implementation
xl2tpd is an open source implementation of the L2TP tunneling
protocol (RFC2661). xl2tpd is forked from l2tpd and is maintained by
Xelerance Corporation.
.
This package replaces the obsolete and unmaintained l2tpd.
.
The main purpose of this protocol is to tunnel PPP frames through IP
networks. It implements both LAC and LNS role in the L2TP networking
architecture.

View File

@@ -1,18 +1,17 @@
Upstream-Source: http://www.xelerance.com/software/xl2tpd/
Upstream Author: Xelerance Corporation
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Source: https://github.com/xelerance/xl2tpd
Files: *
Copyright: (c) 2006-2011 Xelerance Corporation
Copyright: (c) 2006-2016 Xelerance Corporation
License: GPL-2+
Please see the CREDITS file for a complete copyright history of all parts of
the project.
.
On Debian systems, the complete text of the GNU General
Public License can be found in `/usr/share/common-licenses/GPL-2'.
Files: debian/*
Copyright: (c) 2007-2011 Roberto C. Sanchez <roberto@connexer.com>
Copyright: (c) 2007-2013 Roberto C. Sanchez <roberto@connexer.com>
License: GPL-2+
The packaging is based on the packaging of the original l2tpd package by
Jean-Francois Dive.

View File

@@ -1,4 +1,4 @@
# The etc/xl2tpd/l2tp-secrets file must not be readable by non-root
xl2tpd: non-standard-file-perm etc/xl2tpd/l2tp-secrets 0600 != 0644
xl2tpd: hyphen-used-as-minus-sign usr/share/man/man1/pfc.1.gz:36
xl2tpd: hyphen-used-as-minus-sign

View File

@@ -0,0 +1,41 @@
#!/bin/sh
# Repackage upstream source to exclude non-distributable files
# should be called as "repack sh --upstream-source <ver> <downloaded file>
# (for example, via uscan)
set -e
set -u
FILE=$3
PKG=`dpkg-parsechangelog|grep ^Source:|sed 's/^Source: //'`
VER="$2+dfsg"
printf "\nRepackaging $FILE\n"
DIR=`mktemp -d ./tmpRepackXXXXXX`
trap "rm -rf $DIR" QUIT INT EXIT
tar xzf $FILE -C $DIR
TARGET=`echo $FILE |sed 's/_\(.*\)\.orig/_\1+dfsg.orig/'`
REPACK=`basename $TARGET`
UP_DIR=`ls -1 $DIR`
(
set -e
set -u
cd $DIR
rm -rv $UP_DIR/debian/
REPACK_DIR="$PKG-$VER.orig"
mv $UP_DIR $REPACK_DIR
tar -c $REPACK_DIR | gzip -9 > $REPACK
)
rm -v $FILE
mv $DIR/$REPACK $TARGET
echo "*** $FILE repackaged as $TARGET"

View File

@@ -22,10 +22,12 @@ configure-stamp:
dh_testdir
touch configure-stamp
build: build-stamp
build: build-arch build-indep
build-arch: build-stamp
build-indep: build-stamp
build-stamp: configure-stamp
dh_testdir
$(MAKE)
$(MAKE) CFLAGS=" -DDEBUG_PPPD -DTRUST_PPPD_TO_DIE -O2 -fno-builtin -Wall -DSANITY -DLINUX -I$(KERNELSRC)/include/ -DIP_ALLOCATION -DUSE_KERNEL $(shell dpkg-buildflags --get CFLAGS)" CPPFLAGS=" -DDEBUG_PPPD -DTRUST_PPPD_TO_DIE -O2 -fno-builtin -Wall -DSANITY -DLINUX -I$(KERNELSRC)/include/ -DIP_ALLOCATION $(shell dpkg-buildflags --get CPPFLAGS)" LDFLAGS=" $(shell dpkg-buildflags --get LDFLAGS)"
touch $@
clean:
@@ -46,7 +48,7 @@ install: build
# Build architecture-independent files here.
binary-indep: build install
dh_link -pl2tpd usr/share/doc/xl2tpd usr/share/doc/l2tpd
# Nothing to do here
# Build architecture-dependent files here.
binary-arch: build install

View File

@@ -1,9 +1,9 @@
# Example watch control file for uscan
# Rename this file to "watch" and then you can run the "uscan" command
# to check for upstream updates and more.
# See uscan(1) for format
# The uversionmangle option separates consecutive digits in the version string
# with a period. The reason for this is that in the past, upstream used
# version numbers like 1.00, 1.00, and 1.1.08. For some time now they have
# switched to a more "standard" 1.2.8, 1.3.0, 1.3.1, and so forth, versioning
# scheme.
# Compulsory line, this is a version 3 file
version=3
opts="dversionmangle=s/\+dfsg//,uversionmangle=s/(\d)(\d)/\1\.\2/g" https://github.com/xelerance/xl2tpd/tags .*/v?(\d[\d\.]+)\.(?:tgz|tbz2|txz|tar\.(?:gz|bz2|xz)) debian debian/repack.sh
opts="dversionmangle=s/\+dfsg//" ftp://ftp.xelerance.com/xl2tpd/xl2tpd-(.*)\.tar\.gz debian debian/repack.sh

View File

@@ -20,6 +20,8 @@ DESC=xl2tpd
test -x $DAEMON || exit 0
. /lib/lsb/init-functions
# Include xl2tpd defaults if available
if [ -f /etc/default/xl2tpd ] ; then
. /etc/default/xl2tpd
@@ -54,7 +56,7 @@ case "$1" in
restart)
test -d ${XL2TPD_RUN_DIR:-/var/run/xl2tpd} || mkdir -p ${XL2TPD_RUN_DIR:-/var/run/xl2tpd}
echo -n "Restarting $DESC: "
start-stop-daemon --stop --quiet --pidfile \
start-stop-daemon --oknodo --stop --quiet --pidfile \
$PIDFILE --exec $DAEMON
sleep 1
start-stop-daemon --start --quiet --pidfile \

View File

@@ -1,37 +0,0 @@
#!/bin/sh
# preinst script for xl2tpd
#
# see: dh_installdeb(1)
set -e
# summary of how this script can be called:
# * <new-preinst> `install'
# * <new-preinst> `install' <old-version>
# * <new-preinst> `upgrade' <old-version>
# * <old-preinst> `abort-upgrade' <new-version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
case "$1" in
install|upgrade)
;;
abort-upgrade)
;;
*)
echo "preinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0

View File

@@ -3,7 +3,7 @@
;
; This example file should give you some idea of how the options for l2tpd
; should work. The best place to look for a list of all options is in
; the source code itself, until I have the time to write better documetation :)
; the source code itself, until I have the time to write better documentation :)
; Specifically, the file "file.c" contains a list of commands at the end.
;
; You most definitely don't have to spell out everything as it is done here

View File

@@ -20,6 +20,11 @@ This option prevents xl2tpd from detaching from the terminal and
daemonizing.
.TP
.B -l
This option tells xl2tpd to use syslog for logging even when \fB\-D\fR
was specified.
.TP
.B -c <config file>
Tells xl2tpd to use an alternate config file. Default is
/etc/xl2tpd/xl2tpd.conf. Fallback configuration file is

View File

@@ -5,8 +5,8 @@ xl2tpd.conf \- L2TPD configuration file
The xl2tpd.conf file contains configuration information for xl2tpd, the implementation of l2tp protocol.
The configuration file is composed of sections and parameters. Each section
has a given name which will be used when using the configuration FIFO
(normaly /var/run/xl2tpd/l2tp\-control). See xl2tpd.8 for more details.
has a given name which will be used when using the configuration FIFO
(normally /var/run/xl2tpd/l2tp\-control). See xl2tpd.8 for more details.
The specific given name
.B default
@@ -19,11 +19,11 @@ l2tp tunnels. The default is /etc/xl2tpd/l2tp\-secrets.
.TP
.B ipsec saref
Use IPsec Security Association trackinng. When this is enabled, packets
Use IPsec Security Association tracking. When this is enabled, packets
received by xl2tpd should have to extra fields (refme and refhim) which
allows tracking of multiple clients using the same internal NATed IP
address, and allows tracking of multiple clients behind the same
NAT router. This neds to be supported by the kernel. Currently, this
NAT router. This needs to be supported by the kernel. Currently, this
only works with Openswan KLIPS in "mast" mode. (see http://www.openswan.org/)
Set this to yes and the system will provide proper SAref values in the
@@ -221,8 +221,8 @@ If set to yes, xl2tpd will automatically dial the LAC during startup.
.TP
.B redial
If set to yes, xl2tpd will attempt to redial if the call get
disconected. Note that, if enabled, xl2tpd will keep passwords in
memory: a potental security risk.
disconnected. Note that, if enabled, xl2tpd will keep passwords in
memory: a potential security risk.
.TP
.B redial timeout

View File

@@ -74,7 +74,6 @@ int init_config ()
returnedValue = parse_config (f);
fclose (f);
return (returnedValue);
filerr[0] = 0;
}
struct lns *new_lns ()
@@ -900,7 +899,7 @@ struct iprange *set_range (char *word, char *value, struct iprange *in)
"format is '%s <host or ip> - <host or ip>'\n", word);
return NULL;
}
ipr = (struct iprange *) malloc (sizeof (struct iprange));
ipr = malloc (sizeof (struct iprange));
ipr->next = NULL;
hp = gethostbyname (value);
if (!hp)
@@ -1500,7 +1499,7 @@ int parse_config (FILE * f)
#ifdef DEBUG_FILE
l2tp_log (LOG_DEBUG, "parse_config: field is %s, value is %s\n", s, t);
#endif
/* Okay, bit twidling is done. Let's handle this */
/* Okay, bit twiddling is done. Let's handle this */
switch (parse_one_option (s, t, context | def, data))
{
@@ -1512,7 +1511,7 @@ int parse_config (FILE * f)
l2tp_log (LOG_CRIT, "parse_config: line %d: Unknown field '%s'\n",
linenum, s);
return -1;
}
}
}
}
return 0;

View File

@@ -16,7 +16,7 @@
#ifndef _FILE_H
#define _FILE_H
#define STRLEN 80 /* Length of a string */
#define STRLEN 100 /* Length of a string */
/* Definition of a keyword */
struct keyword
@@ -153,6 +153,7 @@ struct global
char pidfile[STRLEN]; /* File containing the pid number*/
char controlfile[STRLEN]; /* Control file name (named pipe) */
int daemon; /* Use daemon mode? */
int syslog; /* Use syslog for logging? */
int accesscontrol; /* Use access control? */
int forceuserspace; /* Force userspace? */
int packet_dump; /* Dump (print) all packets? */

View File

@@ -44,7 +44,7 @@ typedef unsigned long long _u64;
#define CONTROL_PIPE_MESSAGE_SIZE 1024
#define BINARY "xl2tpd"
#define SERVER_VERSION "xl2tpd-1.3.6"
#define SERVER_VERSION "xl2tpd-1.3.10"
#define VENDOR_NAME "xelerance.com"
#ifndef PPPD
#define PPPD "/usr/sbin/pppd"

View File

@@ -1,6 +1,6 @@
#ifdef FREEBSD
# include <machine/endian.h>
#elif defined(OPENBSD)
#elif defined(OPENBSD) || defined(NETBSD)
# define __BSD_VISIBLE 0
# include <machine/endian.h>
#elif defined(LINUX)

View File

@@ -23,7 +23,7 @@
#include <errno.h>
#include <string.h>
#include <syslog.h>
#if (__GLIBC__ < 2)
#if defined (__GLIBC__) && (__GLIBC__ < 2)
# if defined(FREEBSD) || defined(OPENBSD)
# include <sys/signal.h>
# elif defined(LINUX)
@@ -68,7 +68,7 @@ void l2tp_log (int level, const char *fmt, ...)
vsnprintf (buf, sizeof (buf), fmt, args);
va_end (args);
if(gconfig.daemon) {
if(gconfig.syslog) {
init_log();
SYSLOG_CALL( syslog (level, "%s", buf) );
} else {
@@ -235,7 +235,7 @@ struct ppp_opts *add_opt (struct ppp_opts *option, char *fmt, ...)
{
va_list args;
struct ppp_opts *new, *last;
new = (struct ppp_opts *) malloc (sizeof (struct ppp_opts));
new = malloc (sizeof (struct ppp_opts));
if (!new)
{
l2tp_log (LOG_WARNING,

View File

@@ -31,60 +31,12 @@
#include "ipsecmast.h"
#include "misc.h" /* for IPADDY macro */
#include <math.h>
char hostname[256];
int server_socket = -1; /* Server socket */
#ifdef USE_KERNEL
int kernel_support; /* Kernel Support there or not? */
#endif
#if defined(USE_KERNEL) && defined(MODULE_AUTO)
void modprobe() {
char * modules[] = { "l2tp_ppp", "pppol2tp", NULL };
char ** module;
char buf[256], *tok;
int pid, exit_status, fd;
FILE * fmod = fopen("/proc/modules", "r");
if (fmod == NULL)
return;
while (fgets(buf, 255, fmod) != NULL) {
if ((tok = strtok(buf, " ")) != NULL) {
for (module = modules; *module != NULL; ++module) {
if (!strcmp(*module, tok)) {
fclose(fmod);
return;
}
}
}
}
fclose(fmod);
for (module = modules; *module != NULL; ++module) {
if ((pid = fork()) >= 0) {
if (pid == 0) {
setenv("PATH", "/sbin:/usr/sbin:/bin:/usr/bin", 1);
if ((fd = open("/dev/null", O_RDWR)) > -1) {
dup2(fd, 1);
dup2(fd, 2);
}
execlp("modprobe", "modprobe", "-q", *module, (char *)NULL);
exit(1);
} else {
if ((pid = waitpid(pid, &exit_status, 0)) != -1 && WIFEXITED(exit_status)) {
if (WEXITSTATUS(exit_status) == 0)
return;
}
}
}
}
}
#endif
int init_network (void)
{
long arg;
@@ -106,6 +58,9 @@ int init_network (void)
arg=1;
setsockopt(server_socket, SOL_SOCKET, SO_REUSEADDR, &arg, sizeof(arg));
#ifdef SO_NO_CHECK
setsockopt(server_socket, SOL_SOCKET, SO_NO_CHECK, &arg, sizeof(arg));
#endif
if (bind (server_socket, (struct sockaddr *) &server, sizeof (server)))
{
@@ -142,15 +97,6 @@ int init_network (void)
l2tp_log(LOG_INFO, "No attempt being made to use IPsec SAref's since we're not on a Linux machine.\n");
#endif
#ifdef SO_NO_CHECK
/* turn off UDP checksums */
arg=1;
if (setsockopt(server_socket, SOL_SOCKET, SO_NO_CHECK , (void*)&arg,
sizeof(arg)) ==-1) {
l2tp_log(LOG_INFO, "unable to turn off UDP checksums");
}
#endif
#ifdef USE_KERNEL
if (gconfig.forceuserspace)
{
@@ -159,9 +105,6 @@ int init_network (void)
}
else
{
#if defined(USE_KERNEL) && defined(MODULE_AUTO)
modprobe();
#endif
int kernel_fd = socket(AF_PPPOX, SOCK_DGRAM, PX_PROTO_OL2TP);
if (kernel_fd < 0)
{
@@ -326,7 +269,7 @@ void control_xmit (void *b)
tv.tv_usec = 0;
if (buf->retries > 1)
tv.tv_sec = 1*pow(2, buf->retries-1);
tv.tv_sec = 1LL << (buf->retries-1);
schedule (tv, control_xmit, buf);
#ifdef DEBUG_CONTROL_XMIT
@@ -339,24 +282,21 @@ void control_xmit (void *b)
void udp_xmit (struct buffer *buf, struct tunnel *t)
{
struct cmsghdr *cmsg;
struct cmsghdr *cmsg = NULL;
char cbuf[CMSG_SPACE(sizeof (unsigned int) + sizeof (struct in_pktinfo))];
unsigned int *refp;
struct msghdr msgh;
int err;
struct iovec iov;
struct in_pktinfo *pktinfo;
int finallen;
int finallen = 0;
/*
* OKAY, now send a packet with the right SAref values.
*/
memset(&msgh, 0, sizeof(struct msghdr));
cmsg = NULL;
msgh.msg_control = cbuf;
msgh.msg_controllen = sizeof(cbuf);
finallen = 0;
if (gconfig.ipsecsaref && t->refhim != IPSEC_SAREF_NULL) {
cmsg = CMSG_FIRSTHDR(&msgh);
@@ -372,11 +312,11 @@ void udp_xmit (struct buffer *buf, struct tunnel *t)
finallen = cmsg->cmsg_len;
}
if (t->my_addr.ipi_addr.s_addr){
if ( ! cmsg) {
cmsg = CMSG_FIRSTHDR(&msgh);
cmsg = CMSG_FIRSTHDR(&msgh);
}
else {
cmsg = CMSG_NXTHDR(&msgh, cmsg);
@@ -391,16 +331,24 @@ void udp_xmit (struct buffer *buf, struct tunnel *t)
finallen += cmsg->cmsg_len;
}
/*
* Some OS don't like assigned buffer with zero length (e.g. OpenBSD),
* some OS don't like empty buffer with non-zero length (e.g. Linux).
* So make them all happy by assigning control buffer only if we really
* have something there and zero both fields otherwise.
*/
msgh.msg_controllen = finallen;
if (!finallen)
msgh.msg_control = NULL;
iov.iov_base = buf->start;
iov.iov_len = buf->len;
/* return packet from whence it came */
msgh.msg_name = &buf->peer;
msgh.msg_namelen = sizeof(buf->peer);
msgh.msg_iov = &iov;
msgh.msg_iovlen = 1;
msgh.msg_flags = 0;
@@ -675,7 +623,7 @@ void network_thread ()
* have already closed or some such nonsense. To
* prevent this from closing the tunnel, if we get a
* call on a valid tunnel, but not with a valid CID,
* we'll just send a ZLB to ack receiving the packet.
* we'll just send a ZLB to ACK receiving the packet.
*/
if (gconfig.debug_tunnel)
l2tp_log (LOG_DEBUG,
@@ -791,7 +739,9 @@ int connect_pppol2tp(struct tunnel *t) {
flags=1;
setsockopt(ufd, SOL_SOCKET, SO_REUSEADDR, &flags, sizeof(flags));
#ifdef SO_NO_CHECK
setsockopt(ufd, SOL_SOCKET, SO_NO_CHECK, &flags, sizeof(flags));
#endif
if (bind (ufd, (struct sockaddr *) &server, sizeof (server)))
{

View File

@@ -1,11 +1,11 @@
Summary: Layer 2 Tunnelling Protocol Daemon (RFC 2661)
Name: xl2tpd
Version: 1.3.2
Version: 1.3.10
Release: 1%{?dist}
License: GPLv2
Url: http://www.xelerance.com/software/xl2tpd/
Group: System Environment/Daemons
Source0: http://www.xelerance.com/software/xl2tpd/xl2tpd-%{version}.tar.gz
Source0: https://github.com/xelerance/xl2tpd/archive/v%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Requires: ppp
BuildRequires: kernel-headers => 2.6.23
@@ -97,7 +97,7 @@ fi
%files
%defattr(-,root,root)
%doc BUGS CHANGES CREDITS LICENSE README.* TODO doc/rfc2661.txt
%doc BUGS CHANGES CREDITS LICENSE README.* TODO
%doc doc/README.patents examples/chapsecrets.sample
%attr(0755,root,root) %{_sbindir}/xl2tpd
%attr(0755,root,root) %{_sbindir}/xl2tpd-control

View File

@@ -2,7 +2,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=xl2tpd
PKG_VERSION:=1.3.2
PKG_VERSION:=1.3.10
PKG_RELEASE:=1
PKG_MD5SUM:=ab5656eb5a3d1973f7f69b039675332e-NEEDSUPDATING

View File

@@ -1,11 +1,11 @@
Summary: Layer 2 Tunnelling Protocol Daemon (RFC 2661)
Name: xl2tpd
Version: 1.3.2
Version: 1.3.10
Release: 1%{?dist}
License: GPLv2
Url: http://www.xelerance.com/software/xl2tpd/
Group: Productivity/Networking/Other
Source0: http://www.xelerance.com/software/xl2tpd/xl2tpd-%{version}.tar.gz
Source0: https://github.com/xelerance/xl2tpd/archive/v%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Requires: ppp >= 2.4.3
BuildRequires: libpcap
@@ -88,7 +88,7 @@ exit 0
%files
%defattr(-,root,root)
%doc BUGS CHANGES CREDITS LICENSE README.* TODO doc/rfc2661.txt
%doc BUGS CHANGES CREDITS LICENSE README.* TODO
%doc doc/README.patents examples/chapsecrets.sample
%{_sbindir}/rcxl2tpd
%{_sbindir}/xl2tpd

View File

@@ -1,11 +1,11 @@
Summary: Layer 2 Tunnelling Protocol Daemon (RFC 2661)
Name: xl2tpd
Version: 1.3.2
Version: 1.3.10
Release: 1%{?dist}
License: GPLv2
Url: http://www.xelerance.com/software/xl2tpd/
Group: Productivity/Networking/Other
Source0: http://www.xelerance.com/software/xl2tpd/xl2tpd-%{version}.tar.gz
Source0: https://github.com/xelerance/xl2tpd/archive/v%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Requires: ppp >= 2.4.3
BuildRequires: libpcap-devel
@@ -88,7 +88,7 @@ exit 0
%files
%defattr(-,root,root)
%doc BUGS CHANGES CREDITS LICENSE README.* TODO doc/rfc2661.txt
%doc BUGS CHANGES CREDITS LICENSE README.* TODO
%doc doc/README.patents examples/chapsecrets.sample
%{_sbindir}/rcxl2tpd
%{_sbindir}/xl2tpd

View File

@@ -15,8 +15,10 @@
*/
#define _ISOC99_SOURCE
#define _XOPEN_SOURCE
#define _BSD_SOURCE
#define _DEFAULT_SOURCE
#define _GNU_SOURCE
#define _XOPEN_SOURCE
#define _XOPEN_SOURCE_EXTENDED
#include <stdlib.h>
@@ -41,7 +43,7 @@
#define PTY01 "0123456789abcdef"
#endif
#ifdef FREEBSD
#if defined(FREEBSD) || defined(NETBSD)
#define PTY00 "/dev/ptyXX"
#define PTY10 "p"
#define PTY01 "0123456789abcdefghijklmnopqrstuv"
@@ -115,7 +117,7 @@ int getPtyMaster_ptmx(char *ttybuf, int ttybuflen)
int getPtyMaster_ptm(char *ttybuf, int ttybuflen)
{
int amaster, aslave;
char *tty = (char*) malloc(64);
char *tty = malloc(64);
if((openpty(&amaster, &aslave, tty, NULL, NULL)) == -1)
{

View File

@@ -105,13 +105,12 @@ struct schedule_entry *schedule (struct timeval tv, void (*func) (void *),
};
if (q)
{
q->next =
(struct schedule_entry *) malloc (sizeof (struct schedule_entry));
q->next = malloc (sizeof (struct schedule_entry));
q = q->next;
}
else
{
q = (struct schedule_entry *) malloc (sizeof (struct schedule_entry));
q = malloc (sizeof (struct schedule_entry));
events = q;
}
q->tv = tv;

View File

@@ -93,7 +93,7 @@ int main (int argc, char *argv[])
{
char* control_filename = NULL;
char* tunnel_name = NULL;
struct command_t* command = NULL;
struct command_t* command = NULL;
int i; /* argv iterator */
if (argv[1] && !strncmp (argv[1], "--help", 6))

View File

@@ -17,7 +17,8 @@
#define _ISOC99_SOURCE
#define _XOPEN_SOURCE
#define _BSD_SOURCE
#define _XOPEN_SOURCE_EXTENDED
#define _DEFAULT_SOURCE
#define _XOPEN_SOURCE_EXTENDED 1
#define _GNU_SOURCE
#include <stdlib.h>
@@ -30,17 +31,7 @@
#include <errno.h>
#include <unistd.h>
#include <time.h>
#if (__GLIBC__ < 2)
# if defined(FREEBSD) || defined(OPENBSD)
# include <sys/signal.h>
# elif defined(LINUX)
# include <bsd/signal.h>
# elif defined(SOLARIS)
# include <signal.h>
# endif
#else
# include <signal.h>
#endif
#include <signal.h>
#ifndef LINUX
# include <sys/socket.h>
#endif
@@ -71,7 +62,7 @@ static void open_controlfd(void);
volatile sig_atomic_t sigterm_received;
volatile sig_atomic_t sigint_received;
volatile sig_atomic_t sigchld_received;
volatile sig_atomic_t sigusr1_received;;
volatile sig_atomic_t sigusr1_received;
volatile sig_atomic_t sighup_received;
void init_tunnel_list (struct tunnel_list *t)
@@ -145,7 +136,7 @@ void show_status (void)
while (c)
{
cnt++;
l2tp_log (LOG_WARNING,
l2tp_log (LOG_WARNING,
"Call %s # %lu, ID = %d (local), %d (remote), serno = %u,"
" data_seq_num = %d, data_rec_seq_num = %d,"
" pLr = %d, tx = %u bytes (%u), rx= %u bytes (%u)",
@@ -189,9 +180,9 @@ void show_status (void)
void null_handler(int sig)
{
/* FIXME
* A sighup is received when a call is terminated, unknown origine ..
* I catch it and ll looks good, but ..
/* FIXME
* A sighup is received when a call is terminated, unknown origine ..
* I catch it and ll looks good, but ..
*/
}
@@ -206,7 +197,7 @@ void child_handler (int signal)
* Oops, somebody we launched was killed.
* It's time to reap them and close that call.
* But first, we have to find out what PID died.
* unfortunately, pppd will
* unfortunately, pppd will
*/
struct tunnel *t;
struct call *c;
@@ -250,7 +241,7 @@ void child_handler (int signal)
c->cid );
}
c->needclose = -1;
/*
/*
* OK...pppd died, we can go ahead and close the pty for
* it
*/
@@ -357,7 +348,6 @@ int start_pppd (struct call *c, struct ppp_opts *opts)
/* char a, b; */
char tty[512];
char *stropt[80];
struct ppp_opts *p;
#ifdef USE_KERNEL
struct sockaddr_pppol2tp sax;
int flags;
@@ -371,16 +361,7 @@ int start_pppd (struct call *c, struct ppp_opts *opts)
struct call *sc;
struct tunnel *st;
p = opts;
stropt[0] = strdup (PPPD);
while (p)
{
stropt[pos] = (char *) malloc (strlen (p->option) + 1);
strncpy (stropt[pos], p->option, strlen (p->option) + 1);
pos++;
p = p->next;
}
stropt[pos] = NULL;
if (c->pppd > 0)
{
l2tp_log(LOG_WARNING, "%s: PPP already started on call!\n", __FUNCTION__);
@@ -429,21 +410,20 @@ int start_pppd (struct call *c, struct ppp_opts *opts)
stropt[pos++] = strdup ("plugin");
stropt[pos++] = strdup ("pppol2tp.so");
stropt[pos++] = strdup ("pppol2tp");
stropt[pos] = (char *) malloc (10);
stropt[pos] = malloc (10);
snprintf (stropt[pos], 10, "%d", fd2);
pos++;
if (c->container->lns) {
stropt[pos++] = strdup ("pppol2tp_lns_mode");
stropt[pos++] = strdup ("pppol2tp_tunnel_id");
stropt[pos] = (char *) malloc (10);
stropt[pos] = malloc (10);
snprintf (stropt[pos], 10, "%d", c->container->ourtid);
pos++;
stropt[pos++] = strdup ("pppol2tp_session_id");
stropt[pos] = (char *) malloc (10);
stropt[pos] = malloc (10);
snprintf (stropt[pos], 10, "%d", c->ourcid);
pos++;
}
stropt[pos] = NULL;
}
else
#endif
@@ -453,7 +433,7 @@ int start_pppd (struct call *c, struct ppp_opts *opts)
l2tp_log (LOG_WARNING, "%s: unable to allocate pty, abandoning!\n",
__FUNCTION__);
return -EINVAL;
}
}
/* set fd opened above to not echo so we don't see read our own packets
back of the file descriptor that we just wrote them to */
@@ -472,6 +452,17 @@ int start_pppd (struct call *c, struct ppp_opts *opts)
return -EINVAL;
}
stropt[pos++] = strdup(tty);
}
{
struct ppp_opts *p = opts;
int maxn_opts = sizeof(stropt) / sizeof(stropt[0]) - 1;
while (p && pos < maxn_opts)
{
stropt[pos] = strdup (p->option);
pos++;
p = p->next;
}
stropt[pos] = NULL;
}
@@ -484,7 +475,7 @@ int start_pppd (struct call *c, struct ppp_opts *opts)
#endif
#ifdef __uClinux__
c->pppd = vfork ();
#else
#else
c->pppd = fork ();
#endif
@@ -501,7 +492,7 @@ int start_pppd (struct call *c, struct ppp_opts *opts)
close (0); /* redundant; the dup2() below would do that, too */
close (1); /* ditto */
/* close (2); No, we want to keep the connection to /dev/null. */
/* close (2); No, we want to keep the connection to /dev/null. */
#ifdef USE_KERNEL
if (!kernel_support)
#endif
@@ -510,35 +501,40 @@ int start_pppd (struct call *c, struct ppp_opts *opts)
/* connect the pty to stdin and stdout */
dup2 (fd2, 0);
dup2 (fd2, 1);
close(fd2);
close(fd2);
}
/* close all the calls pty fds */
st = tunnels.head;
while (st)
{
sc = st->call_head;
while (sc)
{
#ifdef USE_KERNEL
if (kernel_support) {
if (kernel_support) {
if(st->udp_fd!=-1)
close(st->udp_fd); /* tunnel UDP fd */
if(st->pppox_fd!=-1)
close(st->pppox_fd); /* tunnel PPPoX fd */
} else
} else
#endif
close (sc->fd); /* call pty fd */
sc = sc->next;
{
sc = st->call_head;
while (sc)
{
if(sc->fd!=-1)
close (sc->fd); /* call pty fd */
sc = sc->next;
}
}
st = st->next;
}
/* close the UDP socket fd */
if (server_socket > 0) {
if (server_socket != -1) {
close (server_socket);
server_socket = -1;
}
/* close the control pipe fd */
if (control_fd > 0) {
if (control_fd != -1) {
close (control_fd);
control_fd = -1;
}
@@ -751,18 +747,15 @@ void magic_lac_tunnel (void *data)
{
/* FIXME: I should try different LNS's if I get failures */
l2tp_call (lac->lns->hostname, lac->lns->port, lac, NULL);
return;
}
else if (deflac && deflac->lns)
{
l2tp_call (deflac->lns->hostname, deflac->lns->port, lac, NULL);
return;
}
else
{
l2tp_log (LOG_WARNING, "%s: Unable to find hostname to dial for '%s'\n",
__FUNCTION__, lac->entname);
return;
}
}
@@ -928,7 +921,7 @@ struct tunnel *new_tunnel ()
tmp->txspeed = DEFAULT_TX_BPS;
memset (tmp->chal_us.reply, 0, MD_SIG_SIZE);
memset (tmp->chal_them.reply, 0, MD_SIG_SIZE);
tmp->chal_them.vector = (unsigned char *) malloc (VECTOR_SIZE);
tmp->chal_them.vector = malloc (VECTOR_SIZE);
return tmp;
}
@@ -947,13 +940,13 @@ int parse_one_line_lac (char* bufp, struct lac *tc)
/* FIXME: I should check for incompatible options */
char *s, *d, *t;
int linenum = 0;
s = strtok (bufp, ";");
// parse options token by token
// parse options token by token
while (s != NULL)
{
linenum++;
while ((*s < 33) && *s)
s++; /* Skip over beginning white space */
t = s + strlen (s);
@@ -981,7 +974,7 @@ int parse_one_line_lac (char* bufp, struct lac *tc)
__FUNCTION__, s, t);
#endif
/* Okay, bit twidling is done. Let's handle this */
switch (parse_one_option (s, t, CONTEXT_LAC, tc))
{
case -1:
@@ -1063,7 +1056,6 @@ void do_control ()
/*FIXME: check quotes to allow filenames with spaces?
(do not forget quotes escaping to allow filenames with quotes)*/
/*FIXME: write to res_filename may cause SIGPIPE, need to catch it*/
resf = fopen (res_filename, "w");
if (!resf) {
l2tp_log (LOG_DEBUG, "%s: Can't open result file %s\n",
@@ -1355,7 +1347,7 @@ void do_control ()
void usage(void) {
printf("\nxl2tpd version: %s\n", SERVER_VERSION);
printf("Usage: xl2tpd [-c <config file>] [-s <secret file>] [-p <pid file>]\n"
" [-C <control file>] [-D]\n"
" [-C <control file>] [-D] [-l]\n"
" [-v, --version]\n");
printf("\n");
exit(1);
@@ -1366,6 +1358,7 @@ void init_args(int argc, char *argv[])
int i=0;
gconfig.daemon=1;
gconfig.syslog=-1;
memset(gconfig.altauthfile,0,STRLEN);
memset(gconfig.altconfigfile,0,STRLEN);
memset(gconfig.authfile,0,STRLEN);
@@ -1403,6 +1396,9 @@ void init_args(int argc, char *argv[])
else if (! strncmp(argv[i],"-D",2)) {
gconfig.daemon=0;
}
else if (! strncmp(argv[i],"-l",2)) {
gconfig.syslog=1;
}
else if (! strncmp(argv[i],"-s",2)) {
if(++i == argc)
usage();
@@ -1428,6 +1424,13 @@ void init_args(int argc, char *argv[])
usage();
}
}
/*
* defaults to syslog if no log facility was explicitly
* specified and we are about to daemonize
*/
if (gconfig.syslog < 0)
gconfig.syslog = gconfig.daemon;
}
@@ -1442,7 +1445,11 @@ void daemonize() {
exit(1);
}
else if (pid)
{
close(server_socket);
closelog();
exit(0);
}
close(0);
i = open("/dev/null", O_RDWR);
@@ -1507,7 +1514,7 @@ static void consider_pidfile() {
}
}
static void open_controlfd()
static void open_controlfd()
{
control_fd = open (gconfig.controlfile, O_RDONLY | O_NONBLOCK, 0600);
if (control_fd < 0)
@@ -1528,7 +1535,6 @@ static void open_controlfd()
void init (int argc,char *argv[])
{
struct lac *lac;
struct in_addr listenaddr;
struct utsname uts;
init_args (argc,argv);
@@ -1560,6 +1566,7 @@ void init (int argc,char *argv[])
signal (SIGCHLD, &sigchld_handler);
signal (SIGUSR1, &sigusr1_handler);
signal (SIGHUP, &sighup_handler);
signal (SIGPIPE, SIG_IGN);
init_scheduler ();
unlink(gconfig.controlfile);
@@ -1574,10 +1581,8 @@ void init (int argc,char *argv[])
l2tp_log (LOG_INFO, "Forked by Scott Balmos and David Stipp, (C) 2001\n");
l2tp_log (LOG_INFO, "Inherited by Jeff McAdams, (C) 2002\n");
l2tp_log (LOG_INFO, "Forked again by Xelerance (www.xelerance.com) (C) 2006-2016\n");
l2tp_log (LOG_INFO, "Listening on IP address %s, port %d\n", inet_ntoa(listenaddr), gconfig.port);
#endif
listenaddr.s_addr = gconfig.listenaddr;
lac = laclist;
while (lac)
{