diff options
author | alepulver <alepulver@FreeBSD.org> | 2007-02-19 01:49:37 +0800 |
---|---|---|
committer | alepulver <alepulver@FreeBSD.org> | 2007-02-19 01:49:37 +0800 |
commit | 48cb7298fa1c29208aef2ba2c38b2091c766a7b1 (patch) | |
tree | 16a0a17b569e589dc787de079e7f0126a195980f /net/vde2 | |
parent | 63d4834104c38dfb66d57ded07425b67d4a859d6 (diff) | |
download | freebsd-ports-gnome-48cb7298fa1c29208aef2ba2c38b2091c766a7b1.tar.gz freebsd-ports-gnome-48cb7298fa1c29208aef2ba2c38b2091c766a7b1.tar.zst freebsd-ports-gnome-48cb7298fa1c29208aef2ba2c38b2091c766a7b1.zip |
- Add net/vde2 (repocopied from net/vde).
- Add CONFLICTS between them.
PR: ports/108539
Submitted by: "Philip M. Gollucci" <pgollucci@p6m7g8.com>
Diffstat (limited to 'net/vde2')
25 files changed, 78 insertions, 1115 deletions
diff --git a/net/vde2/Makefile b/net/vde2/Makefile index af5c40036dba..2d0fb6d8c249 100644 --- a/net/vde2/Makefile +++ b/net/vde2/Makefile @@ -1,29 +1,38 @@ -# New ports collection makefile for: vde -# Date created: 30 Janurary 2005 -# Whom: Craig Boston <craig@yekse.gank.org> +# New ports collection makefile for: vde2 +# Date created: 20 January 2007 +# Whom: Philip M. Gollucci <pgollucci@p6m7g8.com> # # $FreeBSD$ # -PORTNAME= vde -PORTVERSION= 1.5.7 +PORTNAME= vde2 +PORTVERSION= 2.1.6 CATEGORIES= net MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} MASTER_SITE_SUBDIR= vde -EXTRACT_SUFX= .tgz -MAINTAINER= craig@yekse.gank.org +MAINTAINER= pgollucci@p6m7g8.com COMMENT= User-mode virtual ethernet infrastructure +CONFLICTS= vde-[0-9]* + USE_GMAKE= yes USE_GETOPT_LONG=yes -INSTALLS_SHLIB= yes +USE_LDCONFIG= yes +GNU_CONFIGURE= yes +CONFIGURE_ARGS= --datarootdir=${PREFIX} + +SHLIB_MAJOR= 2 +PLIST_SUB= SHLIB_MAJOR="${SHLIB_MAJOR}" .include <bsd.port.pre.mk> CFLAGS+= ${CPPFLAGS} -fPIC MAKE_ENV+= LDFLAGS="${LDFLAGS}" -MAN1= dpipe.1 slirpvde.1 vdetaplib.1 vdeq.1 vde_plug.1 vde_switch.1 - +MAN1= dpipe.1 slirpvde.1 unixterm.1 \ + vde_cryptcab.1 vde_plug.1 vde_plug2tap.1 \ + vde_switch.1 vdeq.1 vdetaplib.1 \ + wirefilter.1 +MLINKS= vdeq.1 vdeqemu.1 .include <bsd.port.post.mk> diff --git a/net/vde2/distinfo b/net/vde2/distinfo index ce04af4db698..fb679c41500e 100644 --- a/net/vde2/distinfo +++ b/net/vde2/distinfo @@ -1,3 +1,3 @@ -MD5 (vde-1.5.7.tgz) = f89a958a6997114b46abd66c00e217c8 -SHA256 (vde-1.5.7.tgz) = a80d907c1705e9b4f5eb62593753f5120e8e71066395fa3241eb425825ccf82b -SIZE (vde-1.5.7.tgz) = 139314 +MD5 (vde2-2.1.6.tar.gz) = 15a13ac5c109d088eb302a4e9d81d65e +SHA256 (vde2-2.1.6.tar.gz) = c5c1ba6c7b89cf36a01a7955c0da89c68d6601accaa45e054eac5b9f9e4ae49e +SIZE (vde2-2.1.6.tar.gz) = 536666 diff --git a/net/vde2/files/patch-Makefile b/net/vde2/files/patch-Makefile deleted file mode 100644 index 5d0cf76b3e4b..000000000000 --- a/net/vde2/files/patch-Makefile +++ /dev/null @@ -1,40 +0,0 @@ ---- Makefile Sat Jan 29 15:02:08 2005 -+++ Makefile Sun Jan 30 13:46:59 2005 -@@ -1,14 +1,15 @@ --TUNTAP = $(shell [ -e /usr/include/linux/if_tun.h ] && echo -DTUNTAP) -+TUNTAP = $(shell [ -e /usr/include/net/if_tun.h ] && echo -DTUNTAP) - - OBJSSW = hash.o port.o vde_switch.o tuntap.o - BINSW = vde_switch - BIN = $(BINSW) dpipe vde_plug - #CFLAGS = -g -Wall $(TUNTAP) -DINFO -O3 --CFLAGS = -Wall $(TUNTAP) -O3 -+CFLAGS += -Wall $(TUNTAP) -O - --BIN_DIR ?= /usr/local/bin --LIB_DIR ?= /usr/local/lib --MAN_DIR ?= /usr/local/man -+PREFIX ?= /usr/local -+BIN_DIR ?= $(PREFIX)/bin -+LIB_DIR ?= $(PREFIX)/lib -+MAN_DIR ?= $(PREFIX)/man - - ifneq ($(TUNTAP),) - OBJS += tuntap.o -@@ -30,13 +31,13 @@ - vde_switch.o: vde_switch.c vde.h switch.h hash.h port.h tuntap.h - - $(BINSW) : $(OBJSSW) -- $(CC) $(CFLAGS) -o $(BINSW) $(OBJSSW) -+ $(CC) $(CFLAGS) $(LDFLAGS) -o $(BINSW) $(OBJSSW) - - dpipe: dpipe.o -- $(CC) $(CFLAGS) -o dpipe dpipe.o -+ $(CC) $(CFLAGS) $(LDFLAGS) -o dpipe dpipe.o - - vde_plug: vde_plug.o -- $(CC) $(CFLAGS) -o vde_plug vde_plug.o -+ $(CC) $(CFLAGS) $(LDFLAGS) -o vde_plug vde_plug.o - - clean : - rm -f $(BIN) *.o *~ diff --git a/net/vde2/files/patch-configure b/net/vde2/files/patch-configure new file mode 100644 index 000000000000..9d51fcd02635 --- /dev/null +++ b/net/vde2/files/patch-configure @@ -0,0 +1,11 @@ +--- ./configure.orig Thu Dec 21 13:01:27 2006 ++++ ./configure Sun Feb 18 12:49:30 2007 +@@ -25746,7 +25746,7 @@ + _ACEOF + + ;; +- darwin*) ++ freebsd*) + + cat >>confdefs.h <<\_ACEOF + #define VDE_DARWIN 1 diff --git a/net/vde2/files/patch-doc__Makefile.am b/net/vde2/files/patch-doc__Makefile.am new file mode 100644 index 000000000000..0af939ab5f2d --- /dev/null +++ b/net/vde2/files/patch-doc__Makefile.am @@ -0,0 +1,11 @@ +--- ./doc/Makefile.am.orig Mon Dec 18 10:30:19 2006 ++++ ./doc/Makefile.am Sun Feb 18 12:49:30 2007 +@@ -6,8 +6,6 @@ + sed 's/%LIBEXECDIR%/$(subst /,\/,$(libexecdir))/g' $< > $@ + + install-data-hook: +- rm -f $(DESTDIR)$(mandir)/man1/vdeqemu.1 +- (cd $(DESTDIR)$(mandir)/man1 && $(LN_S) vdeq.1 vdeqemu.1) + + uninstall-local: + rm -f $(DESTDIR)$(mandir)/man1/vdeqemu.1 diff --git a/net/vde2/files/patch-hash.c b/net/vde2/files/patch-hash.c deleted file mode 100644 index e4cdaef6e90b..000000000000 --- a/net/vde2/files/patch-hash.c +++ /dev/null @@ -1,23 +0,0 @@ ---- hash.c Sat Jan 29 15:02:08 2005 -+++ hash.c Sat Jan 29 15:08:18 2005 -@@ -14,7 +14,11 @@ - #include <syslog.h> - #include <sys/types.h> - #include <sys/time.h> -+#ifdef __FreeBSD__ -+#include <signal.h> -+#else - #include <sys/signal.h> -+#endif - #include "switch.h" - #include "hash.h" - -@@ -129,7 +133,7 @@ - printf("Hash: %d Addr: %02x:%02x:%02x:%02x:%02x:%02x to port: %s " - "age %ld secs\n", calc_hash(e->dst), - e->dst[0], e->dst[1], e->dst[2], e->dst[3], e->dst[4], e->dst[5], -- (*p->port_id)(e->port), (int) p->now - e->last_seen); -+ (*p->port_id)(e->port), (long) p->now - e->last_seen); - } - - void print_hash(char *(*port_id)(void *)) diff --git a/net/vde2/files/patch-port.c b/net/vde2/files/patch-port.c deleted file mode 100644 index 02d2359c0e15..000000000000 --- a/net/vde2/files/patch-port.c +++ /dev/null @@ -1,34 +0,0 @@ ---- port.c Sat Jan 29 15:02:08 2005 -+++ port.c Sun Jan 30 11:36:03 2005 -@@ -10,6 +10,9 @@ - #include <syslog.h> - #include <sys/socket.h> - #include <sys/un.h> -+#ifdef __FreeBSD__ -+#include <string.h> -+#endif - #include "switch.h" - #include "hash.h" - #include "port.h" -@@ -316,10 +319,19 @@ - port=p->data; - //if(match_sock(p->control, fd, p->data, p->data_len, &data)) break; - if(p->data_len == sizeof(struct sock_data) && -- !(memcmp(&(port->sock), &mine->sock, sizeof(mine->sock)))) break; -+#ifdef __FreeBSD__ -+ port->sock.sun_family == mine->sock.sun_family && -+ !(strcmp(port->sock.sun_path, mine->sock.sun_path))) -+#else -+ !(memcmp(&(port->sock), &mine->sock, sizeof(mine->sock)))) -+#endif -+ break; - } - } -- handle_direct_data(p,hub,&packet,len); -+ if (i < g_nfds) -+ handle_direct_data(p,hub,&packet,len); -+ else -+ printlog(LOG_WARNING, "No port associated with descriptor %d", fd); - return 0; - } - diff --git a/net/vde2/files/patch-qemu::Makefile b/net/vde2/files/patch-qemu::Makefile deleted file mode 100644 index 1b460436f1d3..000000000000 --- a/net/vde2/files/patch-qemu::Makefile +++ /dev/null @@ -1,8 +0,0 @@ ---- qemu/Makefile Sat Jan 29 15:02:08 2005 -+++ qemu/Makefile Sun Jan 30 12:59:52 2005 -@@ -1,4 +1,4 @@ --ALL: vdeq -+all: vdeq - - vdeq.o: vdeq.c ../vde.h - diff --git a/net/vde2/files/patch-qemu::vdeq.c b/net/vde2/files/patch-qemu::vdeq.c deleted file mode 100644 index 9c34761c145e..000000000000 --- a/net/vde2/files/patch-qemu::vdeq.c +++ /dev/null @@ -1,103 +0,0 @@ ---- qemu/vdeq.c Sat Jan 29 15:02:08 2005 -+++ qemu/vdeq.c Sun Jan 30 13:31:46 2005 -@@ -7,14 +7,20 @@ - #include <signal.h> - #include <errno.h> - #include <unistd.h> -+#ifndef __FreeBSD__ - #include <stdint.h> -+#endif - #include <libgen.h> - #include <sys/ioctl.h> - #include <sys/socket.h> - #include <sys/un.h> - #include <sys/uio.h> - #include <sys/poll.h> -+#ifdef __FreeBSD__ -+#include <string.h> -+#include <sys/time.h> - #include "../vde.h" -+#endif - - #define SWITCH_MAGIC 0xfeedface - #define BUFSIZE 2048 -@@ -29,6 +35,15 @@ - struct sockaddr_un sock; - }; - -+#ifdef __FreeBSD__ -+static char *data_socket = NULL; -+ -+static void cleanup() -+{ -+ if(data_socket != NULL) -+ unlink(data_socket); -+} -+#endif - - static int send_fd(char *name, int fddata, struct sockaddr_un *datasock, int intno, int group) - { -@@ -37,6 +52,9 @@ - int fdctl; - - struct sockaddr_un sock; -+#ifdef __FreeBSD__ -+ struct timeval tv; -+#endif - - if((fdctl = socket(AF_UNIX, SOCK_STREAM, 0)) < 0){ - perror("socket"); -@@ -56,7 +74,14 @@ - - req.sock.sun_family=AF_UNIX; - memset(req.sock.sun_path, 0, sizeof(req.sock.sun_path)); -+#ifdef __FreeBSD__ -+ gettimeofday(&tv, NULL); -+ snprintf(req.sock.sun_path, sizeof(req.sock.sun_path), "%s.%i.%li", -+ VDEDATSOCK, pid, tv.tv_usec); -+ data_socket = strdup(req.sock.sun_path); -+#else - sprintf(&req.sock.sun_path[1], "%5d-%2d", pid, intno); -+#endif - - if(bind(fddata, (struct sockaddr *) &req.sock, sizeof(req.sock)) < 0){ - perror("bind"); -@@ -111,20 +136,23 @@ - static void leave() - { - fprintf(stderr,"qemu exited: %s quits\n", vdeqname); -+#ifdef __FreeBSD__ -+ cleanup(0, NULL); -+#endif - exit(0); - } - - int main(int argc, char **argv) - { - int *fddata; -- char *argsock,**sockname; -+ char *argsock = NULL,**sockname; - struct sockaddr_un *dataout,datain; - int datainsize; - int result; - int group=0; - int *connected_fd; - register ssize_t nx; -- int args; -+ int args = 0; - int newargc; - char **newargv; - typedef int pair[2]; -@@ -154,10 +182,10 @@ - )) { - usage(); - } else if (argc > args+1 && -- (strcmp(argv[args],"-vdesock")==0) || -+ ((strcmp(argv[args],"-vdesock")==0) || - (strcmp(argv[args],"-sock")==0) || - (strcmp(argv[args],"-unix")==0) || -- (strcmp(argv[args],"-s")==0) -+ (strcmp(argv[args],"-s")==0)) - ){ - argsock=argv[args+1]; - args+=2; diff --git a/net/vde2/files/patch-slirpvde::Makefile b/net/vde2/files/patch-slirpvde::Makefile deleted file mode 100644 index 05f3bea2367d..000000000000 --- a/net/vde2/files/patch-slirpvde::Makefile +++ /dev/null @@ -1,20 +0,0 @@ ---- slirpvde/Makefile Sat Jan 29 15:02:08 2005 -+++ slirpvde/Makefile Sun Jan 30 14:02:57 2005 -@@ -3,7 +3,7 @@ - tcp_timer.o udp.o \ - bootp.o - --CFLAGS=-I. -DVDE -+CFLAGS+=-I. -DVDE - - all: libslirp.a slirpvde - -@@ -34,7 +34,7 @@ - udp.o: udp.c ip_icmp.h - - slirpvde: slirpvde.o libslirp.a -- $(CC) -o slirpvde slirpvde.o libslirp.a -+ $(CC) $(LDFLAGS) -o slirpvde slirpvde.o libslirp.a - - clean: - rm -rf *.o slirpvde libslirp.a diff --git a/net/vde2/files/patch-slirpvde::ip.h b/net/vde2/files/patch-slirpvde::ip.h deleted file mode 100644 index 7f19d53739d6..000000000000 --- a/net/vde2/files/patch-slirpvde::ip.h +++ /dev/null @@ -1,34 +0,0 @@ ---- slirpvde/ip.h Sat Jan 29 15:02:08 2005 -+++ slirpvde/ip.h Sun Jan 30 14:00:32 2005 -@@ -37,6 +37,31 @@ - #ifndef _IP_H_ - #define _IP_H_ - -+#ifdef __FreeBSD__ -+#include <sys/endian.h> -+ -+#if !defined(__BYTE_ORDER) -+#if defined(_BYTE_ORDER) -+#define __BYTE_ORDER _BYTE_ORDER -+#elif defined(BYTE_ORDER) -+#define __BYTE_ORDER BYTE_ORDER -+#else -+#error BYTE_ORDER not defined -+#endif -+#endif /* !defined(__BYTE_ORDER) */ -+ -+#if !defined(__BIG_ENDIAN) -+#if defined(_BIG_ENDIAN) -+#define __BIG_ENDIAN _BIG_ENDIAN -+#elif defined(BIG_ENDIAN) -+#define __BIG_ENDIAN BIG_ENDIAN -+#else -+#error BIG_ENDIAN not defined -+#endif -+#endif /* !defined(__BIG_ENDIAN) */ -+ -+#endif /* __FreeBSD__ */ -+ - #if __BYTE_ORDER == __BIG_ENDIAN - # ifndef NTOHL - # define NTOHL(d) diff --git a/net/vde2/files/patch-slirpvde::libslirp.h b/net/vde2/files/patch-slirpvde::libslirp.h deleted file mode 100644 index b8a62739b93f..000000000000 --- a/net/vde2/files/patch-slirpvde::libslirp.h +++ /dev/null @@ -1,14 +0,0 @@ ---- slirpvde/libslirp.h Sat Jan 29 15:02:08 2005 -+++ slirpvde/libslirp.h Sun Jan 30 13:55:31 2005 -@@ -2,7 +2,11 @@ - #define _LIBSLIRP_H - - #include <sys/select.h> -+#ifdef __FreeBSD__ -+#include <sys/types.h> -+#else - #include <stdint.h> -+#endif - - void slirp_init(char *network); - diff --git a/net/vde2/files/patch-slirpvde::slirp_config.h b/net/vde2/files/patch-slirpvde::slirp_config.h deleted file mode 100644 index dfd1288b6c2e..000000000000 --- a/net/vde2/files/patch-slirpvde::slirp_config.h +++ /dev/null @@ -1,33 +0,0 @@ ---- slirpvde/slirp_config.h Sat Jan 29 15:02:08 2005 -+++ slirpvde/slirp_config.h Sat Jan 29 15:15:18 2005 -@@ -61,10 +61,18 @@ - #define HAVE_STDLIB_H - - /* Define if you have sys/ioctl.h */ -+#ifdef __FreeBSD__ -+#define HAVE_SYS_IOCTL_H -+#else - #undef HAVE_SYS_IOCTL_H -+#endif - - /* Define if you have sys/filio.h */ -+#ifdef __FreeBSD__ -+#define HAVE_SYS_FILIO_H -+#else - #undef HAVE_SYS_FILIO_H -+#endif - - /* Define if you have strerror */ - #define HAVE_STRERROR -@@ -162,7 +170,11 @@ - #define HAVE_MEMMOVE - - /* Define if you have <termios.h> */ -+#ifdef __FreeBSD__ -+#define HAVE_TERMIOS_H -+#else - #undef HAVE_TERMIOS_H -+#endif - - /* Define if you have gethostid */ - #undef HAVE_GETHOSTID diff --git a/net/vde2/files/patch-slirpvde::slirpvde.c b/net/vde2/files/patch-slirpvde::slirpvde.c deleted file mode 100644 index f76790701b07..000000000000 --- a/net/vde2/files/patch-slirpvde::slirpvde.c +++ /dev/null @@ -1,95 +0,0 @@ ---- slirpvde/slirpvde.c Sat Jan 29 15:02:08 2005 -+++ slirpvde/slirpvde.c Sun Jan 30 14:24:33 2005 -@@ -7,7 +7,9 @@ - #include <signal.h> - #include <errno.h> - #include <unistd.h> -+#ifndef __FreeBSD__ - #include <stdint.h> -+#endif - #include <libgen.h> - #include <sys/ioctl.h> - #include <sys/socket.h> -@@ -16,6 +18,10 @@ - #include <sys/poll.h> - #include <libslirp.h> - #include <getopt.h> -+#ifdef __FreeBSD__ -+#include <string.h> -+#include <sys/time.h> -+#endif - - #define SWITCH_MAGIC 0xfeedface - #define BUFSIZE 2048 -@@ -32,6 +38,25 @@ - struct sockaddr_un sock; - }; - -+#ifdef __FreeBSD__ -+#include "../vde.h" -+static char *data_socket = NULL; -+ -+static void cleanup() -+{ -+ if(data_socket != NULL) -+ unlink(data_socket); -+} -+ -+static void sig_handler(int sig) -+{ -+ fprintf(stderr, "Caught signal %d, cleaning up and exiting\n", sig); -+ cleanup(1,NULL); -+ signal(sig, SIG_DFL); -+ kill(getpid(), sig); -+} -+#endif -+ - static int send_fd(char *name, int fddata, struct sockaddr_un *datasock, int group) - { - int pid = getpid(); -@@ -39,6 +64,9 @@ - int fdctl; - - struct sockaddr_un sock; -+#ifdef __FreeBSD__ -+ struct timeval tv; -+#endif - - if((fdctl = socket(AF_UNIX, SOCK_STREAM, 0)) < 0){ - perror("socket"); -@@ -58,7 +86,14 @@ - - req.sock.sun_family=AF_UNIX; - memset(req.sock.sun_path, 0, sizeof(req.sock.sun_path)); -+#ifdef __FreeBSD__ -+ gettimeofday(&tv, NULL); -+ snprintf(req.sock.sun_path, sizeof(req.sock.sun_path), "%s.%i.%li", -+ VDEDATSOCK, pid, tv.tv_usec); -+ data_socket = strdup(req.sock.sun_path); -+#else - sprintf(&req.sock.sun_path[1], "%5d", pid); -+#endif - - if(bind(fddata, (struct sockaddr *) &req.sock, sizeof(req.sock)) < 0){ - perror("bind"); -@@ -149,7 +184,6 @@ - int group=0; - int connected_fd; - register ssize_t nx; -- register int i; - fd_set rs,ws,xs; - int opt,longindx; - char *netw=NULL; -@@ -175,6 +209,12 @@ - exit(1); - } - connected_fd=send_fd(sockname, fddata, &dataout, group); -+#ifdef __FreeBSD__ -+ if(signal(SIGINT, sig_handler) < 0) { -+ perror("signal"); -+ } -+ signal(SIGPIPE, SIG_IGN); /* FreeBSD 4.x sends SIGPIPE on reset sockets */ -+#endif - slirp_init(netw); - - for(;;) { diff --git a/net/vde2/files/patch-slirpvde::tcp.h b/net/vde2/files/patch-slirpvde::tcp.h deleted file mode 100644 index 1dade2d0986c..000000000000 --- a/net/vde2/files/patch-slirpvde::tcp.h +++ /dev/null @@ -1,34 +0,0 @@ ---- slirpvde/tcp.h Sat Jan 29 15:02:08 2005 -+++ slirpvde/tcp.h Sun Jan 30 14:00:50 2005 -@@ -37,6 +37,31 @@ - #ifndef _TCP_H_ - #define _TCP_H_ - -+#ifdef __FreeBSD__ -+#include <sys/endian.h> -+ -+#if !defined(__BYTE_ORDER) -+#if defined(_BYTE_ORDER) -+#define __BYTE_ORDER _BYTE_ORDER -+#elif defined(BYTE_ORDER) -+#define __BYTE_ORDER BYTE_ORDER -+#else -+#error BYTE_ORDER not defined -+#endif -+#endif /* !defined(__BYTE_ORDER) */ -+ -+#if !defined(__BIG_ENDIAN) -+#if defined(_BIG_ENDIAN) -+#define __BIG_ENDIAN _BIG_ENDIAN -+#elif defined(BIG_ENDIAN) -+#define __BIG_ENDIAN BIG_ENDIAN -+#else -+#error BIG_ENDIAN not defined -+#endif -+#endif /* !defined(__BIG_ENDIAN) */ -+ -+#endif /* __FreeBSD__ */ -+ - typedef u_int32_t tcp_seq; - - #define PR_SLOWHZ 2 /* 2 slow timeouts per second (approx) */ diff --git a/net/vde2/files/patch-tuntap.c b/net/vde2/files/patch-tuntap.c deleted file mode 100644 index 43b31617ea17..000000000000 --- a/net/vde2/files/patch-tuntap.c +++ /dev/null @@ -1,45 +0,0 @@ ---- tuntap.c Sat Jan 29 15:02:08 2005 -+++ tuntap.c Sun Jan 30 00:27:23 2005 -@@ -11,8 +11,16 @@ - #include <unistd.h> - #include <syslog.h> - #include <sys/ioctl.h> -+#ifdef __FreeBSD__ -+#include <sys/types.h> -+#include <sys/socket.h> -+#endif - #include <net/if.h> -+#ifdef __FreeBSD__ -+#include <net/if_tun.h> -+#else - #include <linux/if_tun.h> -+#endif - #include "port.h" - #include "switch.h" - -@@ -28,13 +36,16 @@ - - int open_tap(char *dev) - { -+#ifndef __FreeBSD__ - struct ifreq ifr; -+#endif - int fd; - -- if((fd = open("/dev/net/tun", O_RDWR)) < 0){ -- printlog(LOG_ERR,"Failed to open /dev/net/tun %s",strerror(errno)); -+ if((fd = open(dev, O_RDWR)) < 0){ -+ printlog(LOG_ERR,"Failed to open %s %s", dev, strerror(errno)); - return(-1); - } -+#ifndef __FreeBSD__ - memset(&ifr, 0, sizeof(ifr)); - ifr.ifr_flags = IFF_TAP | IFF_NO_PI; - strncpy(ifr.ifr_name, dev, sizeof(ifr.ifr_name) - 1); -@@ -43,5 +54,6 @@ - close(fd); - return(-1); - } -+#endif - return(fd); - } diff --git a/net/vde2/files/patch-vde.h b/net/vde2/files/patch-vde.h deleted file mode 100644 index 8097ca0bcce2..000000000000 --- a/net/vde2/files/patch-vde.h +++ /dev/null @@ -1,15 +0,0 @@ ---- vde.h Sat Jan 29 15:02:08 2005 -+++ vde.h Sun Jan 30 11:39:43 2005 -@@ -2,6 +2,12 @@ - #define VDESTDSOCK "/tmp/vde.ctl" - #endif - -+#ifdef __FreeBSD__ -+#ifndef VDEDATSOCK -+#define VDEDATSOCK "/tmp/.vde.data" -+#endif -+#endif -+ - #define DO_SYSLOG - #define VDE_IP_LOG - diff --git a/net/vde2/files/patch-vde_cryptcab__crc32.c b/net/vde2/files/patch-vde_cryptcab__crc32.c new file mode 100644 index 000000000000..9b6b9c5bffef --- /dev/null +++ b/net/vde2/files/patch-vde_cryptcab__crc32.c @@ -0,0 +1,25 @@ +--- ./vde_cryptcab/crc32.c.orig Fri Jul 7 11:54:39 2006 ++++ ./vde_cryptcab/crc32.c Sun Feb 18 12:50:56 2007 +@@ -15,19 +15,20 @@ +
+ #include <stdio.h>
+ #include <stdlib.h>
++#include <sys/types.h>
+
+ /* crc_tab[] -- this crcTable is being build by chksum_crc32GenTab().
+ * so make sure, you call it before using the other
+ * functions!
+ */
+-u_int32_t crc_tab[256];
++uint32_t crc_tab[256];
+
+ /* chksum_crc() -- to a given block, this one calculates the
+ * crc32-checksum until the length is
+ * reached. the crc32-checksum will be
+ * the result.
+ */
+-u_int32_t chksum_crc32 (unsigned char *block, unsigned int length)
++uint32_t chksum_crc32 (unsigned char *block, unsigned int length)
+ {
+ register unsigned long crc;
+ unsigned long i;
diff --git a/net/vde2/files/patch-vde_plug.c b/net/vde2/files/patch-vde_plug.c deleted file mode 100644 index 416291e4337e..000000000000 --- a/net/vde2/files/patch-vde_plug.c +++ /dev/null @@ -1,98 +0,0 @@ ---- vde_plug.c Sat Jan 29 15:02:08 2005 -+++ vde_plug.c Sun Jan 30 13:52:57 2005 -@@ -7,7 +7,9 @@ - #include <signal.h> - #include <errno.h> - #include <unistd.h> -+#ifndef __FreeBSD__ - #include <stdint.h> -+#endif - #include <getopt.h> - #include <sys/ioctl.h> - #include <sys/socket.h> -@@ -15,6 +17,11 @@ - #include <sys/uio.h> - #include <sys/poll.h> - #include <sys/utsname.h> -+#ifdef __FreeBSD__ -+#include <sys/time.h> -+#include <netinet/in.h> -+#include <string.h> -+#endif - #include "vde.h" - #ifdef VDE_IP_LOG - #define DO_SYSLOG -@@ -47,6 +54,24 @@ - static struct passwd *callerpwd; - static char host[256]; - -+#ifdef __FreeBSD__ -+static char *data_socket = NULL; -+ -+static void cleanup() -+{ -+ if(data_socket != NULL) -+ unlink(data_socket); -+} -+ -+static void sig_handler(int sig) -+{ -+ fprintf(stderr, "Caught signal %d, cleaning up and exiting\n", sig); -+ cleanup(1,NULL); -+ signal(sig, SIG_DFL); -+ kill(getpid(), sig); -+} -+#endif -+ - void write_syslog_entry(char *message) - { - char *ssh_client; -@@ -183,6 +208,9 @@ - int fdctl; - - struct sockaddr_un sock; -+#ifdef __FreeBSD__ -+ struct timeval tv; -+#endif - - if((fdctl = socket(AF_UNIX, SOCK_STREAM, 0)) < 0){ - perror("socket"); -@@ -202,7 +230,14 @@ - - req.sock.sun_family=AF_UNIX; - memset(req.sock.sun_path, 0, sizeof(req.sock.sun_path)); -+#ifdef __FreeBSD__ -+ gettimeofday(&tv, NULL); -+ snprintf(req.sock.sun_path, sizeof(req.sock.sun_path), "%s.%i.%li", -+ VDEDATSOCK, pid, tv.tv_usec); -+ data_socket = strdup(req.sock.sun_path); -+#else - sprintf(&req.sock.sun_path[1], "%5d", pid); -+#endif - - if(bind(fddata, (struct sockaddr *) &req.sock, sizeof(req.sock)) < 0){ - perror("bind"); -@@ -309,6 +344,10 @@ - int connected_fd; - register ssize_t nx; - -+#ifdef __FreeBSD__ -+ atexit(cleanup); -+#endif -+ - uname(&me); - if (argv[0][0] == '-') - netusage(); //implies exit -@@ -383,6 +422,12 @@ - } - connected_fd=send_fd(sockname, fddata, &dataout, group); - pollv[1].fd=fddata; -+ -+#ifdef __FreeBSD__ -+ if(signal(SIGINT, sig_handler) < 0) { -+ perror("signal"); -+ } -+#endif - - for(;;) { - result=poll(pollv,2,-1); diff --git a/net/vde2/files/patch-vde_switch.c b/net/vde2/files/patch-vde_switch.c deleted file mode 100644 index c95f04789071..000000000000 --- a/net/vde2/files/patch-vde_switch.c +++ /dev/null @@ -1,80 +0,0 @@ ---- vde_switch.c Sat Jan 29 15:02:08 2005 -+++ vde_switch.c Sun Jan 30 13:33:00 2005 -@@ -8,7 +8,9 @@ - #include <stdlib.h> - #include <signal.h> - #include <fcntl.h> -+#ifndef __FreeBSD__ - #include <stdint.h> -+#endif - #include <getopt.h> - #include <sys/socket.h> - #include <sys/un.h> -@@ -17,7 +19,11 @@ - #include <unistd.h> - #include <syslog.h> - #include <libgen.h> -+#ifdef __FreeBSD__ -+#include <string.h> -+#else - #include <endian.h> -+#endif - #include "vde.h" - #include "switch.h" - #include "port.h" -@@ -95,6 +101,13 @@ - } - } - -+#ifdef __FreeBSD__ -+static void cleanupwrapper() -+{ -+ cleanup(0, NULL); -+} -+#endif -+ - void **g_fdsdata = NULL; - int g_nfds = 0; - int g_minfds = 0; -@@ -276,19 +289,27 @@ - - void bind_data_socket(int fd, struct sockaddr_un *sun) - { -+ struct timeval tv; -+ -+ sun->sun_family = AF_UNIX; -+#ifdef __FreeBSD__ -+ gettimeofday(&tv, NULL); -+ snprintf(sun->sun_path, sizeof(sun->sun_path), "%s.%i.%li", -+ VDEDATSOCK, getpid(), tv.tv_usec); -+ data_socket = strdup(sun->sun_path); -+#else - struct { - char zero; - int pid; - int usecs; - } name; -- struct timeval tv; - - name.zero = 0; - name.pid = getpid(); - gettimeofday(&tv, NULL); - name.usecs = tv.tv_usec; -- sun->sun_family = AF_UNIX; - memcpy(sun->sun_path, &name, sizeof(name)); -+#endif - if(bind(fd, (struct sockaddr *) sun, sizeof(*sun)) < 0){ - printlog(LOG_ERR,"Binding to data socket %s",strerror(errno)); - exit(1); -@@ -338,7 +359,11 @@ - int tap_fd = -1; - #endif - -+#ifdef __FreeBSD__ -+ atexit(cleanupwrapper); -+#else - on_exit(cleanup, NULL); -+#endif - prog = argv[0]; - /* option parsing */ - { diff --git a/net/vde2/files/patch-vdetaplib::Makefile b/net/vde2/files/patch-vdetaplib::Makefile deleted file mode 100644 index ff72703ce702..000000000000 --- a/net/vde2/files/patch-vdetaplib::Makefile +++ /dev/null @@ -1,11 +0,0 @@ ---- vdetaplib/Makefile Sat Jan 29 15:02:08 2005 -+++ vdetaplib/Makefile Sun Jan 30 12:21:39 2005 -@@ -9,7 +9,7 @@ - all: vdetap libvdetap.so - - libvdetap.so: libvdetap.a -- $(LD) -E -o $@ -L./ -ldl -shared -export-dynamic -Bdynamic \ -+ $(LD) -E -o $@ -L./ -shared -export-dynamic -Bdynamic \ - --whole-archive libvdetap.a - - libvdetap.a: libvdetap.o diff --git a/net/vde2/files/patch-vdetaplib::libvdetap.c b/net/vde2/files/patch-vdetaplib::libvdetap.c deleted file mode 100644 index 7c304913b035..000000000000 --- a/net/vde2/files/patch-vdetaplib::libvdetap.c +++ /dev/null @@ -1,260 +0,0 @@ ---- vdetaplib/libvdetap.c Sat Jan 29 15:02:08 2005 -+++ vdetaplib/libvdetap.c Sun Jan 30 13:29:07 2005 -@@ -5,26 +5,39 @@ - #include <sys/socket.h> - #include <sys/syscall.h> - #include <sys/stat.h> -+#include <limits.h> -+#include <dlfcn.h> - #include <stdarg.h> - #include <string.h> - #include <unistd.h> - #include <stdlib.h> --#define __USE_LARGEFILE64 - #include <fcntl.h> - #include <errno.h> - #include <signal.h> --#include <linux/ioctl.h> --#include <linux/if.h> --#include <linux/if_tun.h> -+#include <stdio.h> -+#include <sys/ioctl.h> -+#include <net/if.h> -+#include <net/if_tun.h> - --#define TUNTAPPATH "/dev/net/tun" -+#define TUNTAPPATH "/dev/tap" - #define VDETAPEXEC "vdetap" - #define VDEALLTAP "VDEALLTAP" - #define MAX 10 - -+#if defined(RTLD_NEXT) -+#define REAL_LIBC RTLD_NEXT -+#else -+#define REAL_LIBC ((void *) -1L) -+#endif -+ -+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__bsdi__) -+typedef unsigned long request_t; -+#else -+typedef int request_t; -+#endif -+ - int tapfd[2] = {-1,-1}; - static int tapcount=0; --static int tuncount=0; - - static struct pidlist { - pid_t pid; -@@ -39,11 +52,6 @@ - return rv; - } - --static void plfree (struct pidlist *el) { -- el->next=flh; -- flh=el; --} -- - static int addpid(int pid) { - struct pidlist *plp; - if ((plp=plmalloc ()) != NULL) { -@@ -74,105 +82,41 @@ - } - } - -- int --native_open(const char *pathname, int flags, mode_t data) --{ -- return (syscall(SYS_open, pathname, flags, data)); --} -- -- int --native_ioctl(int fd, unsigned long int command, char *data) --{ -- return (syscall(SYS_ioctl, fd, command, data)); --} -- -- - int open(const char *path, int flags, ...) - { -- static char buf[PATH_MAX]; -+ static int (*func) (const char *, int, mode_t) = NULL; -+ char *vdesock; -+ int pid; - va_list ap; - mode_t data; - -- va_start(ap, flags); -- data = va_arg(ap, mode_t); -- va_end(ap); -- -- if (strcmp(path,TUNTAPPATH)==0 && tapfd[0] == -1) { -- if (socketpair(PF_UNIX, SOCK_DGRAM, 0,tapfd) == 0) { -- return tapfd[0]; -- } -- else -- return -1; -- -- } else -- return native_open(path, flags, data); --} -- --int open64(const char *path, int flags, ...) --{ -- static char buf[PATH_MAX]; -- va_list ap; -- mode_t data; -+ if (!func) -+ func = (int (*) (const char *, int, mode_t)) -+ dlsym (REAL_LIBC, "open"); - - va_start(ap, flags); -- data = va_arg(ap, mode_t); -+ data = va_arg(ap, int); - va_end(ap); - - if (strcmp(path,TUNTAPPATH)==0 && tapfd[0] == -1) { - if (socketpair(PF_UNIX, SOCK_DGRAM, 0,tapfd) == 0) { -- return tapfd[0]; -- } -- else -- return -1; -- -- } else -- return native_open(path, flags | O_LARGEFILE, data); --} -- --int ioctl(int fd, unsigned long int command, ...) --{ -- va_list ap; -- char *data; -- char *vdesock; -- int pid; -- -- va_start(ap, command); -- data = va_arg(ap, char *); -- va_end(ap); -- -- if (fd == tapfd[0]) { -- if (command == TUNSETIFF) { -- struct ifreq *ifr = (struct ifreq *) data; - char num[5]; - char name[10]; -- -- ifr->ifr_name[IFNAMSIZ-1] = '\0'; -- if (ifr->ifr_name[0] == 0) { -- if (ifr->ifr_flags & IFF_TAP) -- sprintf(name,"tap%d",tapcount++); -- else -- sprintf(name,"tun%d",tuncount++); -- strncpy(ifr->ifr_name,name,IFNAMSIZ); -- } -- else if (strchr(ifr->ifr_name, '%') != NULL) { -- sprintf(name,ifr->ifr_name,tapcount++); -- strncpy(ifr->ifr_name,name,IFNAMSIZ); -- } -- if (ifr->ifr_flags & IFF_TAP && -- ((vdesock=getenv(ifr->ifr_name)) != NULL) -- ||(vdesock=getenv(VDEALLTAP)) != NULL){ -+ sprintf(name,"tap%d",tapcount++); -+ if (((vdesock=getenv(name)) != NULL) -+ ||(vdesock=getenv(VDEALLTAP)) != NULL){ - if ((pid=fork()) < 0) { - close(tapfd[1]); - errno=EINVAL; - return -1; - } else if (pid > 0) { /*father*/ -- if(pid=addpid(pid) < 0) { -+ if((pid=addpid(pid)) < 0) { - close(tapfd[0]); - close(tapfd[1]); - return -1; - } else { - close(tapfd[1]); -- return 0; -+ return tapfd[0]; - } - } else { /*son*/ - plh=NULL; -@@ -181,34 +125,53 @@ - execlp(VDETAPEXEC,"-",num,vdesock,(char *) 0); - } - } -- else /*roll back to the native tuntap*/ -- { -- int newfd; -- int saverrno; -- int resultioctl; -- close(tapfd[1]); -- if ((newfd=native_open(TUNTAPPATH, O_RDWR, 0)) < 0) { -- saverrno=errno; -- close(tapfd[0]); -- errno=saverrno; -- return -1; -- } else -- { -- resultioctl=native_ioctl(fd, command, data); -- if (resultioctl < 0) { -- saverrno=errno; -- close(tapfd[0]); -- errno=saverrno; -- return -1; -- } else { -- dup2(newfd,tapfd[0]); -- return resultioctl; -- } -- } -- } -- } else -- return 0; -+ return tapfd[0]; -+ } -+ else -+ return -1; -+ - } else -- return (native_ioctl(fd, command, data)); -+ return (*func)(path, flags, data); -+} -+ -+int ioctl(int fd, unsigned long int command, ...) -+{ -+ static int (*func) (int, request_t, void *) = NULL; -+ int dummy; -+ va_list ap; -+ char *data; -+ struct ifstat *ifs; -+ -+ if (!func) -+ func = (int (*) (int, request_t, void *)) -+ dlsym (REAL_LIBC, "ioctl"); -+ -+ va_start(ap, command); -+ data = va_arg(ap, char *); -+ va_end(ap); -+ -+ if (fd == tapfd[0]) { -+ switch(command) { -+ case SIOCSIFFLAGS: -+ case SIOCADDMULTI: -+ case SIOCDELMULTI: -+ break; -+ -+ case SIOCGIFSTATUS: -+ ifs = (struct ifstat *)data; -+ dummy = strlen(ifs->ascii); -+ if(plh && dummy < sizeof(ifs->ascii)) -+ snprintf(ifs->ascii + dummy, -+ sizeof(ifs->ascii) - dummy, -+ "\tOpened by PID %d\n", -+ plh[0].pid); -+ break; -+ -+ default: -+ return (*func) (fd, command, data); -+ } -+ } -+ -+ return (*func) (fd, command, data); - } - diff --git a/net/vde2/files/patch-vdetaplib::test.c b/net/vde2/files/patch-vdetaplib::test.c deleted file mode 100644 index d26ffa326253..000000000000 --- a/net/vde2/files/patch-vdetaplib::test.c +++ /dev/null @@ -1,46 +0,0 @@ ---- vdetaplib/test.c Sat Jan 29 15:02:08 2005 -+++ vdetaplib/test.c Sun Jan 30 12:27:35 2005 -@@ -6,35 +6,28 @@ - #include <errno.h> - #include <string.h> - #include <unistd.h> -+#include <sys/types.h> - #include <sys/ioctl.h> -+#include <sys/socket.h> - #include <net/if.h> --#include <linux/if_tun.h> -+#include <net/if_tun.h> - - static int tun_alloc(char *dev) - { -- struct ifreq ifr; -+ struct ifstat ifs; - int fd, err; - -- if( (fd = open("/dev/net/tun", O_RDWR)) < 0 ) -+ if( (fd = open("/dev/tap", O_RDWR)) < 0 ) - return (-1); - -- memset(&ifr, 0, sizeof(ifr)); -+ memset(&ifs, 0, sizeof(ifs)); - -- /* Flags: IFF_TUN - TUN device (no Ethernet headers) -- * IFF_TAP - TAP device -- * -- * IFF_NO_PI - Do not provide packet information -- */ -- ifr.ifr_flags = IFF_TAP; -- if( *dev ) -- strncpy(ifr.ifr_name, dev, IFNAMSIZ); -- -- if( (err = ioctl(fd, TUNSETIFF, (void *) &ifr)) < 0 ){ -+ if( (err = ioctl(fd, SIOCGIFSTATUS, (void *) &ifs)) < 0 ){ - close(fd); - return err; - } - printf("ioctl returns\n"); -- strcpy(dev, ifr.ifr_name); -+ puts(ifs.ascii); - printf("ioctl idev\n"); - return fd; - } diff --git a/net/vde2/files/patch-vdetaplib::vdetap.c b/net/vde2/files/patch-vdetaplib::vdetap.c deleted file mode 100644 index 3e5ded1cc07b..000000000000 --- a/net/vde2/files/patch-vdetaplib::vdetap.c +++ /dev/null @@ -1,107 +0,0 @@ ---- vdetaplib/vdetap.c Sat Jan 29 15:02:08 2005 -+++ vdetaplib/vdetap.c Sun Jan 30 14:05:26 2005 -@@ -2,11 +2,25 @@ - * Reseased under the GPLv2 */ - - #include <stdio.h> -+#ifndef __FreeBSD__ - #include <stdint.h> -+#endif -+#ifdef __FreeBSD__ -+#include <sys/types.h> -+#include <sys/time.h> -+#include <unistd.h> -+#else - #include <sys/select.h> -+#endif - #include <sys/poll.h> - #include <sys/socket.h> - #include <sys/un.h> -+#ifdef __FreeBSD__ -+#include "../vde.h" -+#include <signal.h> -+#include <stdlib.h> -+#include <string.h> -+#endif - - #define SWITCH_MAGIC 0xfeedface - #define BUFSIZE 2048 -@@ -21,6 +35,23 @@ - - static unsigned char bufin[BUFSIZE]; - -+#ifdef __FreeBSD__ -+static char *data_socket = NULL; -+ -+static void cleanup() -+{ -+ if(data_socket != NULL) -+ unlink(data_socket); -+} -+ -+static void sig_handler(int sig) -+{ -+ cleanup(1, NULL); -+ signal(sig, SIG_DFL); -+ kill(getpid(), sig); -+} -+#endif -+ - static int send_fd(char *name, int fddata, struct sockaddr_un *datasock, int intno, int group) - { - int pid = getpid(); -@@ -28,6 +59,9 @@ - int fdctl; - - struct sockaddr_un sock; -+#ifdef __FreeBSD__ -+ struct timeval tv; -+#endif - - if((fdctl = socket(AF_UNIX, SOCK_STREAM, 0)) < 0){ - perror("socket"); -@@ -47,7 +81,14 @@ - - req.sock.sun_family=AF_UNIX; - memset(req.sock.sun_path, 0, sizeof(req.sock.sun_path)); -+#ifdef __FreeBSD__ -+ gettimeofday(&tv, NULL); -+ snprintf(req.sock.sun_path, sizeof(req.sock.sun_path), "%s.%i.%li", -+ VDEDATSOCK, pid, tv.tv_usec); -+ data_socket = strdup(req.sock.sun_path); -+#else - sprintf(&req.sock.sun_path[1], "%5d-%2d", pid, intno); -+#endif - - if(bind(fddata, (struct sockaddr *) &req.sock, sizeof(req.sock)) < 0){ - perror("bind"); -@@ -69,7 +110,7 @@ - - static struct pollfd pollv[]={{0,POLLIN|POLLHUP,0},{0,POLLIN|POLLHUP,0}}; - --main(int argc,char *argv[]) -+int main(int argc,char *argv[]) - { - int fd,fddata; - struct sockaddr_un dataout,datain; -@@ -96,6 +137,12 @@ - send_fd(argv[2],fddata,&dataout,0,0); - pollv[0].fd=fd; - pollv[1].fd=fddata; -+ -+#ifdef __FreeBSD__ -+ if(signal(SIGINT, sig_handler) < 0) { -+ perror("signal"); -+ } -+#endif - for(;;) { - result=poll(pollv,2,-1); - if (pollv[0].revents & POLLHUP || pollv[1].revents & POLLHUP) -@@ -113,5 +160,7 @@ - write(fd,bufin,nx); - } - } -+ cleanup(0, NULL); -+ return 0; - } - diff --git a/net/vde2/pkg-plist b/net/vde2/pkg-plist index 5d6c79f75ade..212d54e349ce 100644 --- a/net/vde2/pkg-plist +++ b/net/vde2/pkg-plist @@ -1,8 +1,15 @@ bin/dpipe bin/slirpvde +bin/unixterm +bin/vde_cryptcab bin/vde_plug +bin/vde_plug2tap bin/vde_switch bin/vdeq bin/vdeqemu -bin/vdetap -lib/libvdetap.so +bin/wirefilter +include/libvdeplug.h +lib/libvdeplug.a +lib/libvdeplug.la +lib/libvdeplug.so +lib/libvdeplug.so.%%SHLIB_MAJOR%% |