l2tp: convert to gentargets and change to xl2tp

l2tp is no longer being developed, and xl2tpd is forked from l2tpd and is
maintained by Xelerance Corporation.

[Peter: remove invalid pppd dependency]
Signed-off-by: Martin Banky <Martin.Banky@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
This commit is contained in:
Martin Banky 2010-12-12 22:54:05 +01:00 committed by Peter Korsgaard
parent fc13fc7b57
commit 767dce8cee
11 changed files with 88 additions and 155 deletions

View File

@ -11,9 +11,11 @@
sdl_gfx, sdl_sound, sysklogd, sysvinit, udev, usbutils, xz,
zlib
New packages: dhrystone, fbgrab, lsuio, rsh-redone, whetstone
New packages: dhrystone, fbgrab, lsuio, rsh-redone, whetstone,
xl2tp
Removed packages: hotplug, libfloat, microcom, ng-spice-rework
Removed packages: hotplug, l2tp, libfloat, microcom,
ng-spice-rework
Issues resolved (http://bugs.uclibc.org):

View File

@ -380,7 +380,7 @@ source "package/ipsec-tools/Config.in"
source "package/iptables/Config.in"
source "package/iw/Config.in"
source "package/kismet/Config.in"
source "package/l2tp/Config.in"
source "package/xl2tp/Config.in"
if BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
source "package/lighttpd/Config.in"
endif

View File

@ -1,7 +0,0 @@
config BR2_PACKAGE_L2TP
bool "l2tp"
help
Layer 2 Tunnelling Protocol (RFC2661).
http://sourceforge.net/projects/l2tpd/

View File

@ -1,33 +0,0 @@
--- l2tpd-0.70-pre20031121.oorig/avpsend.c 2006-12-28 16:00:26.000000000 +0100
+++ l2tpd-0.70-pre20031121/avpsend.c 2006-12-28 16:21:06.000000000 +0100
@@ -98,19 +98,26 @@ int add_hostname_avp(struct buffer *buf,
int sz = 0;
if(t->lac && t->lac->hostname[0]) {
strncpy(n,t->lac->hostname, sizeof(n));
- sz = strnlen(t->lac->hostname, sizeof(t->lac->hostname));
+ sz = strlen(t->lac->hostname);
+ if (sz > sizeof(t->lac->hostname))
+ sz = sizeof(t->lac->hostname);
}
else if(t->lns && t->lns->hostname[0]) {
strncpy(n,t->lns->hostname, sizeof(n));
- sz = strnlen(t->lns->hostname, sizeof(t->lns->hostname));
+ sz = strlen(t->lns->hostname);
+ if (sz > sizeof(t->lns->hostname))
+ sz = sizeof(t->lns->hostname);
}
else {
if(gethostname(n, STRLEN)) {
strcpy(n,"eriwan");
sz = 6;
}
- else
- sz = strnlen(n, sizeof(n));
+ else {
+ sz = strlen(n);
+ if (sz > sizeof(n))
+ sz = sizeof(n);
+ }
}
if(add_avp(buf, HOSTNAME_AVP, n, sz, 1))
return 1;

View File

@ -1,49 +0,0 @@
diff -rdup l2tpd-0.70-pre20031121.oorig/avp.c l2tpd-0.70-pre20031121/avp.c
--- l2tpd-0.70-pre20031121.oorig/avp.c 2006-12-28 16:00:26.000000000 +0100
+++ l2tpd-0.70-pre20031121/avp.c 2006-12-28 16:06:43.000000000 +0100
@@ -146,6 +146,7 @@ int validate_msgtype_avp(int attr, stru
u_int8_t *p = data + sizeof(struct avp_hdr);
c->msgtype = get16(p);
+#ifdef SANITY
if (t->sanity)
{
/*
@@ -293,6 +294,7 @@ int validate_msgtype_avp(int attr, stru
return -EINVAL;
}
}
+#endif
return 0;
}
@@ -301,7 +303,7 @@ int validate_gen_avp(int attr, struct t
void *data, int datalen) {
(void)data; (void)datalen;
int i = 0, found = 0;
-
+#ifdef SANITY
if(t->sanity) {
for(i = 0; i < 8; i++) {
if(c->msgtype == avps[attr].allowed_states[i])
@@ -310,6 +312,7 @@ int validate_gen_avp(int attr, struct t
if(!found)
return -EINVAL;
}
+#endif
return 0;
}
diff -rdup l2tpd-0.70-pre20031121.oorig/l2tpd.c l2tpd-0.70-pre20031121/l2tpd.c
--- l2tpd-0.70-pre20031121.oorig/l2tpd.c 2006-12-28 16:00:26.000000000 +0100
+++ l2tpd-0.70-pre20031121/l2tpd.c 2006-12-28 16:04:15.000000000 +0100
@@ -748,7 +748,9 @@ struct tunnel *new_tunnel ()
tmp->peer.sin_family = AF_INET;
tmp->peer.sin_port = 0;
bzero (&(tmp->peer.sin_addr), sizeof (tmp->peer.sin_addr));
+#ifdef SANITY
tmp->sanity = -1;
+#endif
tmp->qtid = -1;
tmp->ourfc = ASYNC_FRAMING | SYNC_FRAMING;
tmp->ourbc = 0;

View File

@ -1,60 +0,0 @@
#############################################################
#
# l2tp
#
#############################################################
L2TP_VERSION:=0.70-pre20031121
L2TP_SOURCE:=l2tpd_$(L2TP_VERSION).orig.tar.gz
L2TP_PATCH:=l2tpd_$(L2TP_VERSION)-2.2.diff.gz
L2TP_SITE:=$(BR2_DEBIAN_MIRROR)/debian/pool/main/l/l2tpd/
L2TP_DIR:=$(BUILD_DIR)/l2tpd-$(L2TP_VERSION)
L2TP_CAT:=$(ZCAT)
L2TP_BINARY:=l2tpd
L2TP_TARGET_BINARY:=usr/sbin/l2tpd
$(DL_DIR)/$(L2TP_SOURCE):
$(call DOWNLOAD,$(L2TP_SITE),$(L2TP_SOURCE))
$(DL_DIR)/$(L2TP_PATCH):
$(call DOWNLOAD,$(L2TP_SITE),$(L2TP_PATCH))
l2tp-source: $(DL_DIR)/$(L2TP_SOURCE) $(DL_DIR)/$(L2TP_PATCH)
$(L2TP_DIR)/.unpacked: $(DL_DIR)/$(L2TP_SOURCE) $(DL_DIR)/$(L2TP_PATCH)
$(L2TP_CAT) $(DL_DIR)/$(L2TP_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
-mv -f $(L2TP_DIR).orig $(L2TP_DIR)
ifneq ($(L2TP_PATCH),)
(cd $(L2TP_DIR) && $(L2TP_CAT) $(DL_DIR)/$(L2TP_PATCH) | patch -p1)
if [ -d $(L2TP_DIR)/debian/patches ]; then \
toolchain/patch-kernel.sh $(L2TP_DIR) $(L2TP_DIR)/debian/patches \*.patch; \
fi
endif
toolchain/patch-kernel.sh $(L2TP_DIR) package/l2tp/ l2tp\*.patch
touch $(L2TP_DIR)/.unpacked
$(L2TP_DIR)/$(L2TP_BINARY): $(L2TP_DIR)/.unpacked
$(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(L2TP_DIR) \
DFLAGS= \
OSFLAGS="-DLINUX -UUSE_KERNEL $(TARGET_CFLAGS) -USANITY"
$(TARGET_DIR)/$(L2TP_TARGET_BINARY): $(L2TP_DIR)/$(L2TP_BINARY)
cp -dpf $(L2TP_DIR)/$(L2TP_BINARY) $@
cp -dpf package/l2tp/l2tpd $(TARGET_DIR)/etc/init.d/
$(STRIPCMD) $@
l2tp: $(TARGET_DIR)/$(L2TP_TARGET_BINARY)
l2tp-clean:
-$(MAKE) -C $(L2TP_DIR) clean
rm -f $(TARGET_DIR)/$(L2TP_TARGET_BINARY)
l2tp-dirclean:
rm -rf $(L2TP_DIR)
#############################################################
#
# Toplevel Makefile options
#
#############################################################
ifeq ($(BR2_PACKAGE_L2TP),y)
TARGETS+=l2tp
endif

11
package/xl2tp/Config.in Normal file
View File

@ -0,0 +1,11 @@
config BR2_PACKAGE_XL2TP
bool "xl2tp"
select BR2_PACKAGE_LIBPCAP
help
Layer 2 Tunnelling Protocol (RFC2661).
xl2tpd is an open source implementation of the L2TP tunneling
protocol. xl2tpd is forked from l2tpd and is maintained by
Xelerance Corporation.
http://www.xelerance.com/software/xl2tpd/

View File

@ -1,3 +1,6 @@
Replace SUSV3-specific functions index, bcopy, bzero and bcmp by their
POSIX variants.
--- l2tpd-0.70-pre20031121.oorig/osport.h 2004-07-08 22:47:52.000000000 +0200
+++ l2tpd-0.70-pre20031121/osport.h 2006-12-28 15:32:50.000000000 +0100
@@ -37,4 +37,11 @@

View File

@ -0,0 +1,33 @@
Make sure that the CFLAGS passed on the command line are taken into
account.
--- xl2tp-1.2.7/Makefile-orig 2010-08-05 15:33:46.000000000 -0700
+++ xl2tp-1.2.7/Makefile 2010-09-30 22:34:54.000000000 -0700
@@ -90,7 +90,7 @@ OSFLAGS?= -DLINUX -I$(KERNELSRC)/include
IPFLAGS?= -DIP_ALLOCATION
-CFLAGS+= $(DFLAGS) -O2 -fno-builtin -Wall -DSANITY $(OSFLAGS) $(IPFLAGS)
+COMPILE_FLAGS+= $(DFLAGS) -fno-builtin -Wall -DSANITY $(OSFLAGS) $(IPFLAGS)
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}
@@ -105,6 +105,9 @@ MANDIR?=$(DESTDIR)${PREFIX}/share/man
all: $(EXEC) pfc
+%.o: %.c
+ $(CC) $(COMPILE_FLAGS) $(CFLAGS) -c -o $@ -shared $<
+
clean:
rm -f $(OBJS) $(EXEC) pfc.o pfc
@@ -112,7 +115,7 @@ $(EXEC): $(OBJS) $(HDRS)
$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LDLIBS)
pfc:
- $(CC) $(CFLAGS) -c contrib/pfc.c
+ $(CC) $(COMPILE_FLAGS) $(CFLAGS) -c contrib/pfc.c
$(CC) $(LDFLAGS) -lpcap $(LDLIBS) -o pfc pfc.o
romfs:

33
package/xl2tp/xl2tp.mk Normal file
View File

@ -0,0 +1,33 @@
#############################################################
#
# xl2tp
#
#############################################################
XL2TP_VERSION = 1.2.7
XL2TP_SOURCE = xl2tpd-$(XL2TP_VERSION).tar.gz
XL2TP_SITE = ftp://ftp.xelerance.com/xl2tpd/
XL2TP_DEPENDENCIES = libpcap
define XL2TP_BUILD_CMDS
$(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D)
endef
define XL2TP_INSTALL_TARGET_CMDS
$(MAKE) DESTDIR=$(TARGET_DIR) PREFIX=/usr -C $(@D) install
endef
define XL2TP_UNINSTALL_TARGET_CMDS
rm -f $(TARGET_DIR)/usr/bin/pfc
rm -f $(TARGET_DIR)/usr/sbin/xl2tpd
rm -f $(TARGET_DIR)/usr/share/man/man1/pfc.1
rm -f $(TARGET_DIR)/usr/share/man/man8/xl2tpd.8
rm -f $(TARGET_DIR)/usr/share/man/man5/xl2tpd.conf.5
rm -f $(TARGET_DIR)/usr/share/man/man5/l2tp-secrets.5
endef
define XL2TP_CLEAN_CMDS
-$(MAKE) -C $(@D) clean
endef
$(eval $(call GENTARGETS,package,xl2tp))

View File

@ -1,8 +1,8 @@
#!/bin/sh
#
PATH=/bin:/usr/bin:/sbin:/usr/sbin
DAEMON=/usr/sbin/l2tpd
PIDFILE=/var/run/l2tpd.pid
DAEMON=/usr/sbin/xl2tpd
PIDFILE=/var/run/xl2tpd.pid
test -f $DAEMON || exit 0
@ -19,7 +19,7 @@ case "$1" in
start-stop-daemon -S -p $PIDFILE -x $DAEMON
;;
*)
echo "Usage: /etc/init.d/l2tdp {start|stop|restart|force-reload}"
echo "Usage: /etc/init.d/xl2tdp {start|stop|restart|force-reload}"
exit 1
;;
esac