Skip to contentSkip to conversation

change l2tp to xl2tp

PATCH New Martin Banky 1 participant 4 messages Oct 1, 2010

lore
Share & tools
lore
#0 lore raw

cover change l2tp to xl2tp

I'm not sure what format pppd.mk was in, I think it might have been an intermediate version, but it wouldn't compile. I heavily reworked this package so that it would compile correctly, there were several issues with CFLAGS that had to be fixed.

l2tp is no longer available on debian's site, but there is a fork called xl2tp that is currently being maintained.

Each patch is dependant on the previous patch.

[PATCH 1/3] libpcap: bump to 1.1.1
[PATCH 2/3] pppd: convert to gentargets
[PATCH 3/3] l2tp: convert to gentargets and change to xl2tp

#1 lore raw

PATCH 1/3 libpcap: bump to 1.1.1

---
 package/libpcap/libpcap-1.0.0-wireless.patch |   26 --------------------------
 package/libpcap/libpcap.mk                   |    2 +-
 2 files changed, 1 insertions(+), 27 deletions(-)
 delete mode 100644 package/libpcap/libpcap-1.0.0-wireless.patch
package/libpcap/libpcap-1.0.0-wireless.patch deleted +0 -26
deleted file mode 100644
index 7bcfcda..0000000
@@ -1,26 +0,0 @@
-[PATCH]: pcap-linux: fix build with wireless support
-
-Based on ba23aa7b upstream.
-
-linux/wireless.h includes linux/if.h, which conflicts with net/if.h as
-they both define if* structures. Fix build by simply using linux/if.h
-instead of net/if.h.
-
-Signed-off-by: Peter Korsgaard <[email protected]>
----
- pcap-linux.c |    2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-Index: libpcap-1.0.0/pcap-linux.c
-===================================================================
---- libpcap-1.0.0.orig/pcap-linux.c
-+++ libpcap-1.0.0/pcap-linux.c
-@@ -93,7 +93,7 @@ static const char rcsid[] _U_ =
- #include <sys/ioctl.h>
- #include <sys/utsname.h>
- #include <sys/mman.h>
--#include <net/if.h>
-+#include <linux/if.h>
- #include <netinet/in.h>
- #include <linux/if_ether.h>
- #include <net/if_arp.h>
package/libpcap/libpcap.mk +1 -1
index b14a6f7..eebfc03 100644
@@ -4,7 +4,7 @@
 #
 #############################################################
 
-LIBPCAP_VERSION:=1.0.0
+LIBPCAP_VERSION:=1.1.1
 LIBPCAP_SITE:=http://www.tcpdump.org/release
 LIBPCAP_SOURCE:=libpcap-$(LIBPCAP_VERSION).tar.gz
 LIBPCAP_INSTALL_STAGING:=YES
Signature · 1 line
1.7.3
#2 lore raw

PATCH 2/3 pppd: convert to gentargets

In reply to Martin Banky
---
 package/pppd/pppd-2.4.5-define-aligned_u64.patch |   13 +
 package/pppd/pppd-2.4.5-makefile-flags.patch     |  403 ++++++++++++++++++++++
 package/pppd/pppd-2.4.5-man-dir.patch            |   31 ++
 package/pppd/pppd-2.4.5-pppol2tp.patch           |   34 ++
 package/pppd/pppd.mk                             |  107 ++++---
 5 files changed, 540 insertions(+), 48 deletions(-)
 create mode 100644 package/pppd/pppd-2.4.5-define-aligned_u64.patch
 create mode 100644 package/pppd/pppd-2.4.5-makefile-flags.patch
 create mode 100644 package/pppd/pppd-2.4.5-man-dir.patch
 create mode 100644 package/pppd/pppd-2.4.5-pppol2tp.patch
package/pppd/pppd-2.4.5-define-aligned_u64.patch new file +13 -0
new file mode 100644
index 0000000..7eb0ad1
@@ -0,0 +1,13 @@
+Define aligned_u64, because it is not defined in the linux headers.
+--- a/pppd/sys-linux.c	2010-09-26 23:23:05.000000000 -0700
++++ b/pppd/sys-linux.c	2010-09-26 23:24:51.000000000 -0700
+@@ -118,6 +118,10 @@
+ #include <netinet/in.h>
+ #include <arpa/inet.h>
+ 
++#ifndef aligned_u64
++#define aligned_u64 unsigned long long __attribute__((aligned(8)))
++#endif
++ 
+ #include <linux/ppp_defs.h>
+ #include <linux/if_ppp.h>
package/pppd/pppd-2.4.5-makefile-flags.patch new file +403 -0

403 lines not on this page · raw message

package/pppd/pppd-2.4.5-man-dir.patch new file +31 -0
new file mode 100644
index 0000000..c9434f6
@@ -0,0 +1,31 @@
+Change the MANDIR variable in the top makefile
+to match the rest of the makefiles
+--- a/linux/Makefile.top	2009-11-16 15:26:07.000000000 -0700
++++ b/linux/Makefile.top	2010-09-30 19:57:19.000000000 -0700
+@@ -3,7 +3,7 @@
+ DESTDIR = $(INSTROOT)@DESTDIR@
+ BINDIR = $(DESTDIR)/sbin
+ INCDIR = $(DESTDIR)/include
+-MANDIR = $(DESTDIR)/share/man
++MANDIR = $(DESTDIR)/share/man/man8
+ ETCDIR = $(INSTROOT)@SYSCONF@/ppp
+ 
+ # uid 0 = root
+@@ -16,7 +16,7 @@ all:
+ 	cd pppstats; $(MAKE) $(MFLAGS) all
+ 	cd pppdump; $(MAKE) $(MFLAGS) all
+ 
+-install: $(BINDIR) $(MANDIR)/man8 install-progs install-devel
++install: $(BINDIR) $(MANDIR) install-progs install-devel
+ 
+ install-progs:
+ 	cd chat; $(MAKE) $(MFLAGS) install
+@@ -40,7 +40,7 @@ $(ETCDIR)/chap-secrets:
+ 
+ $(BINDIR):
+ 	$(INSTALL) -d -m 755 $@
+-$(MANDIR)/man8:
++$(MANDIR):
+ 	$(INSTALL) -d -m 755 $@
+ $(ETCDIR):
+ 	$(INSTALL) -d -m 755 $@
package/pppd/pppd-2.4.5-pppol2tp.patch new file +34 -0
new file mode 100644
index 0000000..249789a
@@ -0,0 +1,34 @@
+Per Paul Howarth
+
+"...due to ppp bundling a copy of linux/if_pppol2tp.h and this being used in
+preference to the system one. A recent change in kernel-headers has added a
+definition of struct pppol2tpv3_addr to this header file, and that definition
+is needed by linux/if_pppox.h but isn't found when compiling ppp due to the
+presence of the bundled copy of linux/if_pppol2tp.h. Simplest fix is to add
+the definition of struct pppol2tpv3_addr to the bundled copy..."
+
+See https://bugzilla.redhat.com/show_bug.cgi?id=617625
+
+--- ppp-2.4.5/include/linux/if_pppol2tp.h	2009-11-16 22:26:07.000000000 +0000
++++ ppp-2.4.5/include/linux/if_pppol2tp.h	2010-07-16 22:35:22.000000000 +0100
+@@ -32,6 +32,20 @@
+ 	__u16 d_tunnel, d_session;	/* For sending outgoing packets */
+ };
+ 
++/* The L2TPv3 protocol changes tunnel and session ids from 16 to 32
++ * bits. So we need a different sockaddr structure.
++ */
++struct pppol2tpv3_addr {
++	pid_t	pid;			/* pid that owns the fd.
++					 * 0 => current */
++	int	fd;			/* FD of UDP or IP socket to use */
++
++	struct sockaddr_in addr;	/* IP address and port to send to */
++
++	__u32 s_tunnel, s_session;	/* For matching incoming packets */
++	__u32 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
package/pppd/pppd.mk +59 -48

131 lines not on this page · raw message

Signature · 1 line
1.7.3
#3 lore raw

PATCH 3/3 l2tp: convert to gentargets and change to xl2tp

In reply to Martin Banky

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

---
 package/Config.in                              |    2 +-
 package/l2tp/Config.in                         |    7 ---
 package/l2tp/l2tp-legacy.patch                 |   14 ------
 package/l2tp/l2tp-no-gnu-extensions.patch      |   33 -------------
 package/l2tp/l2tp-sanity.patch                 |   49 -------------------
 package/l2tp/l2tp.mk                           |   60 ------------------------
 package/l2tp/l2tpd                             |   27 -----------
 package/xl2tp/Config.in                        |   11 ++++
 package/xl2tp/xl2tp-1.2.7-legacy.patch         |   14 ++++++
 package/xl2tp/xl2tp-1.2.7-makefile-flags.patch |   30 ++++++++++++
 package/xl2tp/xl2tp.mk                         |   33 +++++++++++++
 package/xl2tp/xl2tpd                           |   27 +++++++++++
 12 files changed, 116 insertions(+), 191 deletions(-)
 delete mode 100644 package/l2tp/Config.in
 delete mode 100644 package/l2tp/l2tp-legacy.patch
 delete mode 100644 package/l2tp/l2tp-no-gnu-extensions.patch
 delete mode 100644 package/l2tp/l2tp-sanity.patch
 delete mode 100644 package/l2tp/l2tp.mk
 delete mode 100755 package/l2tp/l2tpd
 create mode 100644 package/xl2tp/Config.in
 create mode 100644 package/xl2tp/xl2tp-1.2.7-legacy.patch
 create mode 100644 package/xl2tp/xl2tp-1.2.7-makefile-flags.patch
 create mode 100644 package/xl2tp/xl2tp.mk
 create mode 100755 package/xl2tp/xl2tpd
package/Config.in +1 -1
index 7a38e7d..94d330c 100644
@@ -370,7 +370,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
package/l2tp/Config.in deleted +0 -7
deleted file mode 100644
index da4f589..0000000
@@ -1,7 +0,0 @@
-config BR2_PACKAGE_L2TP
-	bool "l2tp"
-	help
-	  Layer 2 Tunnelling Protocol (RFC2661).
-
-	  http://sourceforge.net/projects/l2tpd/
-
package/l2tp/l2tp-legacy.patch deleted +0 -14
deleted file mode 100644
index 39506d8..0000000
@@ -1,14 +0,0 @@
---- 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 @@
- 
- #endif /* defined(SOLARIS) */
- 
-+#if defined __UCLIBC__ && !defined UCLIBC_SUSV3_LEGACY_MACROS
-+# define index(x, y)        strchr(x, y)
-+# define bcopy(S1, S2, LEN) ((void)memmove(S2, S1, LEN))
-+# define bzero(S1, LEN)     ((void)memset(S1,  0, LEN))
-+# define bcmp(S1,S2,LEN)    ((memcmp(S2, S1, LEN)==0)?0:1)
-+#endif /* defined __UCLIBC__ && !defined UCLIBC_SUSV3_LEGACY_MACROS */
-+
- #endif /* _OSPORT_H_ */
package/l2tp/l2tp-no-gnu-extensions.patch deleted +0 -33
deleted file mode 100644
index ef07e26..0000000
@@ -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;
package/l2tp/l2tp-sanity.patch deleted +0 -49

49 lines not on this page · raw message

package/l2tp/l2tp.mk deleted +0 -60

60 lines not on this page · raw message

package/l2tp/l2tpd deleted +0 -27
deleted file mode 100755
index 8bed72d..0000000
@@ -1,27 +0,0 @@
-#!/bin/sh
-#
-PATH=/bin:/usr/bin:/sbin:/usr/sbin
-DAEMON=/usr/sbin/l2tpd
-PIDFILE=/var/run/l2tpd.pid
-
-test -f $DAEMON || exit 0
-
-case "$1" in
-  start)
-    start-stop-daemon -S  -p $PIDFILE -x $DAEMON -- -D &
-    ;;
-  stop)
-    start-stop-daemon -K  -p $PIDFILE -x $DAEMON
-    ;;
-  restart|force-reload)
-    start-stop-daemon -K  -p $PIDFILE -x $DAEMON 
-    sleep 1
-    start-stop-daemon -S  -p $PIDFILE -x $DAEMON
-    ;;
-  *)
-    echo "Usage: /etc/init.d/l2tdp {start|stop|restart|force-reload}"
-    exit 1
-    ;;
-esac
-
-exit 0
package/xl2tp/Config.in new file +11 -0
new file mode 100644
index 0000000..8f9d9b1
@@ -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/
package/xl2tp/xl2tp-1.2.7-legacy.patch new file +14 -0
new file mode 100644
index 0000000..39506d8
@@ -0,0 +1,14 @@
+--- 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 @@
+ 
+ #endif /* defined(SOLARIS) */
+ 
++#if defined __UCLIBC__ && !defined UCLIBC_SUSV3_LEGACY_MACROS
++# define index(x, y)        strchr(x, y)
++# define bcopy(S1, S2, LEN) ((void)memmove(S2, S1, LEN))
++# define bzero(S1, LEN)     ((void)memset(S1,  0, LEN))
++# define bcmp(S1,S2,LEN)    ((memcmp(S2, S1, LEN)==0)?0:1)
++#endif /* defined __UCLIBC__ && !defined UCLIBC_SUSV3_LEGACY_MACROS */
++
+ #endif /* _OSPORT_H_ */
package/xl2tp/xl2tp-1.2.7-makefile-flags.patch new file +30 -0
new file mode 100644
index 0000000..26ca592
@@ -0,0 +1,30 @@
+--- 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:
package/xl2tp/xl2tp.mk new file +33 -0
new file mode 100644
index 0000000..1cbd760
@@ -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 = pppd libpcap
+
+define XL2TP_BUILD_CMDS
+	$(MAKE) CC="$(TARGET_CC)" CFLAGS="$(TARGET_CFLAGS)" LDFLAGS="$(TARGET_LDFLAGS)" -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))
package/xl2tp/xl2tpd new file +27 -0
new file mode 100755
index 0000000..36c12a2
@@ -0,0 +1,27 @@
+#!/bin/sh
+#
+PATH=/bin:/usr/bin:/sbin:/usr/sbin
+DAEMON=/usr/sbin/xl2tpd
+PIDFILE=/var/run/xl2tpd.pid
+
+test -f $DAEMON || exit 0
+
+case "$1" in
+  start)
+    start-stop-daemon -S  -p $PIDFILE -x $DAEMON -- -D &
+    ;;
+  stop)
+    start-stop-daemon -K  -p $PIDFILE -x $DAEMON
+    ;;
+  restart|force-reload)
+    start-stop-daemon -K  -p $PIDFILE -x $DAEMON 
+    sleep 1
+    start-stop-daemon -S  -p $PIDFILE -x $DAEMON
+    ;;
+  *)
+    echo "Usage: /etc/init.d/xl2tdp {start|stop|restart|force-reload}"
+    exit 1
+    ;;
+esac
+
+exit 0
Signature · 1 line
1.7.3