As far as I know, there's currently no possibility of doing PPP or PPPoE in Debian GNU/kFreeBSD. I'd like to see that fixed.
So I've started trying to port the userland ppp daemon from FreeBSD 8.0: http://svn.freebsd.org/base/release/8.0.0/usr.sbin/ppp/ The attached patch makes ppp compile, and I'm able to run it (as root) with the if_tun.ko module loaded: # kldload if_tun # ./ppp Working in interactive mode Warning: Add! route failed: ff02::/32: errno: Network is unreachable Using interface: tun0 Warning: No default entry found in config file. ppp ON loony> Now, I don't know if any of it actually *works*, but it's a good start. I guess the next step is to make a package out of this thing... Any suggestions on how I should proceed? I'm generally familiar with Debian packaging, but I wonder if there are any kfreebsd-specific tricks, especially since here there's no upstream tarball and a good few patches (I'm not used to the new quilt stuff...) I would also appreciate help on how to manage a package through SVN or SVK. Feedback welcome, A. -- Five out of four people have a problem with fractions
Index: id.h =================================================================== --- id.h (révision 205395) +++ id.h (copie de travail) @@ -61,9 +61,18 @@ #define ID0fopen fopen #define ID0open open #define ID0write write +#if defined(__linux__) || defined(__GNU__) || defined(__GLIBC__) +#include <lockdev.h> +#define ID0uu_lock dev_lock +#define ID0uu_lock_txfr dev_relock +#define ID0uu_unlock dev_unlock +#define UU_LOCK_OK 0 +#else /* on BSD */ #define ID0uu_lock uu_lock #define ID0uu_lock_txfr uu_lock_txfr #define ID0uu_unlock uu_unlock +#endif + #define ID0login(u) \ do { \ if (logout((u)->ut_line)) \ Index: tun.c =================================================================== --- tun.c (révision 205395) +++ tun.c (copie de travail) @@ -42,7 +42,7 @@ #include <errno.h> #include <string.h> -#if defined(__OpenBSD__) || defined(__NetBSD__) +#if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__linux__) || defined(__GNU__) || defined(__GLIBC__) #include <sys/ioctl.h> #endif #include <stdio.h> Index: ip.c =================================================================== --- ip.c (révision 205395) +++ ip.c (copie de travail) @@ -28,6 +28,7 @@ * $FreeBSD$ */ +#include "compat.h" #include <sys/param.h> #include <sys/socket.h> #include <netinet/in.h> @@ -37,9 +38,9 @@ #include <netinet/icmp6.h> #include <netinet/ip6.h> #endif -#include <netinet/ip_icmp.h> +#include <bsd/netinet/ip_icmp.h> +#include <netinet/tcp.h> #include <netinet/udp.h> -#include <netinet/tcp.h> #include <sys/un.h> #include <errno.h> Index: tcpmss.c =================================================================== --- tcpmss.c (révision 205395) +++ tcpmss.c (copie de travail) @@ -26,6 +26,7 @@ * $FreeBSD$ */ +#include "compat.h" #include <sys/param.h> #include <sys/socket.h> Index: async.c =================================================================== --- async.c (révision 205395) +++ async.c (copie de travail) @@ -27,10 +27,10 @@ * */ -#include <sys/cdefs.h> +#include <bsd/sys/cdefs.h> __FBSDID("$FreeBSD$"); -#include <sys/types.h> +#include <sys/_types.h> #include <string.h> #include <termios.h> Index: acf.c =================================================================== --- acf.c (révision 205395) +++ acf.c (copie de travail) @@ -26,7 +26,7 @@ * $FreeBSD$ */ -#include <sys/types.h> +#include <sys/_types.h> #include <stdio.h> #include <termios.h> Index: slcompress.c =================================================================== --- slcompress.c (révision 205395) +++ slcompress.c (copie de travail) @@ -39,6 +39,8 @@ * $FreeBSD$ */ +#include "compat.h" + #include <sys/param.h> #include <netinet/in_systm.h> #include <netinet/in.h> Index: Makefile =================================================================== --- Makefile (révision 205395) +++ Makefile (copie de travail) @@ -11,6 +11,7 @@ proto.c route.c server.c sig.c slcompress.c sync.c systems.c tcp.c \ tcpmss.c throughput.c timer.c tty.c tun.c udp.c vjcomp.c WARNS?= 3 +CFLAGS+=-D__FAVOR_BSD -D_BSD_SOURCE .if defined(RELEASE_CRUNCH) CFLAGS+=-DRELEASE_CRUNCH PPP_NO_ATM= @@ -38,8 +39,8 @@ BINGRP= network M4FLAGS= -LDADD= -lcrypt -lmd -lutil -lz -DPADD= ${LIBCRYPT} ${LIBMD} ${LIBUTIL} ${LIBZ} +LDADD= -lcrypt -lbsd -lutil -lz +DPADD= ${LIBCRYPT} ${LIBUTIL} ${LIBZ} .SUFFIXES: .8 .8.m4 @@ -76,6 +77,7 @@ .if defined(PPP_NO_SUID) CFLAGS+=-DNOSUID +LDADD+= -llockdev .else SRCS+= id.c .endif Index: chap.c =================================================================== --- chap.c (révision 205395) +++ chap.c (copie de travail) @@ -38,10 +38,7 @@ #include <ctype.h> #include <errno.h> #include <fcntl.h> -#ifndef NODES -#include <md4.h> -#endif -#include <md5.h> +#include <sys/md5.h> #include <paths.h> #include <signal.h> #include <stdio.h> Index: deflate.c =================================================================== --- deflate.c (révision 205395) +++ deflate.c (copie de travail) @@ -32,6 +32,7 @@ #include <stdlib.h> #include <zlib.h> +#include "compat.h" #include "mbuf.h" #include "log.h" #include "timer.h" Index: bundle.c =================================================================== --- bundle.c (révision 205395) +++ bundle.c (copie de travail) @@ -26,6 +26,9 @@ * $FreeBSD$ */ +#include <sys/ioccom.h> +#include <time.h> + #include <sys/param.h> #include <sys/socket.h> #include <netinet/in.h> @@ -51,6 +54,8 @@ #include <sys/uio.h> #include <sys/wait.h> #include <termios.h> +// this is mislead about the getpgrp() declaration +#undef __FAVOR_BSD #include <unistd.h> #include "layer.h" @@ -1629,7 +1634,11 @@ log_Printf(LogDEBUG, "Received confirmation from pid %ld\n", (long)newpid); if (lock && (res = ID0uu_lock_txfr(lock, newpid)) != UU_LOCK_OK) +#if defined(__linux__) || defined(__GNU__) || defined(__GLIBC__) + log_Printf(LogERROR, "lock transfer failed"); +#else log_Printf(LogERROR, "uu_lock_txfr: %s\n", uu_lockerr(res)); +#endif log_Printf(LogDEBUG, "Transmitting link (%d bytes)\n", expect); if ((got = writev(reply[0], iov + 1, niov - 1)) != expect) { Index: physical.c =================================================================== --- physical.c (révision 205395) +++ physical.c (copie de travail) @@ -41,6 +41,8 @@ #include <sysexits.h> #include <termios.h> #include <time.h> +// this is mislead about the getpgrp() declaration +#undef __FAVOR_BSD #include <unistd.h> #include <utmp.h> #if defined(__OpenBSD__) || defined(__NetBSD__) @@ -308,11 +310,15 @@ if (*p->name.full == '/' && p->type != PHYS_DIRECT && (res = ID0uu_lock(p->name.base)) != UU_LOCK_OK) { +#if defined(__linux__) || defined(__GNU__) || defined(__GLIBC__) + log_Printf(LogPHASE, "%s: %s is in use\n", p->link.name, p->name.full); +#else if (res == UU_LOCK_INUSE) log_Printf(LogPHASE, "%s: %s is in use\n", p->link.name, p->name.full); else log_Printf(LogPHASE, "%s: %s is in use: uu_lock: %s\n", p->link.name, p->name.full, uu_lockerr(res)); +#endif return 0; } @@ -323,7 +329,12 @@ physical_Unlock(struct physical *p) { if (*p->name.full == '/' && p->type != PHYS_DIRECT && - ID0uu_unlock(p->name.base) == -1) +#if defined(__linux__) || defined(__GNU__) || defined(__GLIBC__) + ID0uu_unlock(p->name.base, 0) == -1 +#else + ID0uu_unlock(p->name.base) == -1 +#endif + ) log_Printf(LogALERT, "%s: Can't uu_unlock %s\n", p->link.name, p->name.base); } @@ -762,7 +773,11 @@ int res; if ((res = ID0uu_lock_txfr(p->name.base, newpid)) != UU_LOCK_OK) +#if defined(__linux__) || defined(__GNU__) || defined(__GLIBC__) + log_Printf(LogPHASE, "uu_lock_txfr"); +#else log_Printf(LogPHASE, "uu_lock_txfr: %s\n", uu_lockerr(res)); +#endif } } Index: prompt.c =================================================================== --- prompt.c (révision 205395) +++ prompt.c (copie de travail) @@ -40,6 +40,8 @@ #include <string.h> #include <sys/fcntl.h> #include <termios.h> +// this is mislead about the getpgrp() declaration +#undef __FAVOR_BSD #include <unistd.h> #include "layer.h" Index: server.c =================================================================== --- server.c (révision 205395) +++ server.c (copie de travail) @@ -40,6 +40,7 @@ #include <termios.h> #include <unistd.h> +#include "compat.h" #include "log.h" #include "descriptor.h" #include "server.h" Index: cbcp.c =================================================================== --- cbcp.c (révision 205395) +++ cbcp.c (copie de travail) @@ -28,9 +28,7 @@ #include <sys/param.h> -#ifdef __FreeBSD__ #include <netinet/in.h> -#endif #include <sys/un.h> #include <string.h> Index: sync.c =================================================================== --- sync.c (révision 205395) +++ sync.c (copie de travail) @@ -26,7 +26,7 @@ * $FreeBSD$ */ -#include <sys/types.h> +#include <sys/_types.h> #include <stdio.h> #include <termios.h> Index: command.c =================================================================== --- command.c (révision 205395) +++ command.c (copie de travail) @@ -50,14 +50,6 @@ #include <termios.h> #include <unistd.h> -#ifndef NONAT -#ifdef LOCALNAT -#include "alias.h" -#else -#include <alias.h> -#endif -#endif - #include "layer.h" #include "defs.h" #include "command.h" Index: timer.c =================================================================== --- timer.c (révision 205395) +++ timer.c (copie de travail) @@ -28,6 +28,7 @@ * $FreeBSD$ */ +#include <sys/_types.h> #include <errno.h> #include <signal.h> #include <stdarg.h> Index: tty.c =================================================================== --- tty.c (révision 205395) +++ tty.c (copie de travail) @@ -41,6 +41,7 @@ #include <sys/uio.h> #include <termios.h> #include <ttyent.h> +#include <sys/ttycom.h> #include <unistd.h> #ifndef NONETGRAPH #include <netgraph.h> Index: defs.h =================================================================== --- defs.h (révision 205395) +++ defs.h (copie de travail) @@ -28,6 +28,8 @@ * $FreeBSD$ */ +#include "compat.h" + /* Check the following definitions for your machine environment */ #ifdef __FreeBSD__ # define MODEM_LIST "/dev/cuad1\0/dev/cuad0" /* name of tty device */
signature.asc
Description: Digital signature