diff -u freebsd-utils-8.1/debian/control freebsd-utils-8.1/debian/control --- freebsd-utils-8.1/debian/control +++ freebsd-utils-8.1/debian/control @@ -7,7 +7,7 @@ libkvm-dev (>= 8.1), libbsd-dev (>= 0.2.0), libc0.1-dev (>= 2.11.2), flex | flex-old, kfreebsd-kernel-headers (>= 0.51), libmemstat-dev, libnetgraph-dev, libipx-dev, libkiconv-dev, libgeom-dev, libdevstat-dev, libsbuf-dev, libcam-dev (>= 8.1), - libedit-dev, sharutils + libedit-dev, sharutils, libpcap-dev # libkvm-dev: dmesg # libgeom-dev : ccdconfig # libipx-dev: ifconfig diff -u freebsd-utils-8.1/debian/freebsd-net-tools.install freebsd-utils-8.1/debian/freebsd-net-tools.install --- freebsd-utils-8.1/debian/freebsd-net-tools.install +++ freebsd-utils-8.1/debian/freebsd-net-tools.install @@ -3,7 +3,9 @@ sbin/route/route /lib/freebsd debian/scripts/sbin/route /sbin sbin/pfctl/pfctl /sbin +sbin/pflogd/pflogd /sbin usr.sbin/authpf/authpf /usr/sbin/ +usr.sbin/ftp-proxy/ftp-proxy/ftp-proxy /usr/sbin/ usr.bin/netstat/netstat /usr/bin/ usr.sbin/pppctl/pppctl /usr/sbin/ usr.sbin/arp/arp /usr/sbin/ diff -u freebsd-utils-8.1/debian/freebsd-net-tools.postinst freebsd-utils-8.1/debian/freebsd-net-tools.postinst --- freebsd-utils-8.1/debian/freebsd-net-tools.postinst +++ freebsd-utils-8.1/debian/freebsd-net-tools.postinst @@ -7,7 +7,16 @@ echo "Removing obsolete (and Linux-specific) /etc/network/options ..." rm -f /etc/network/options fi - + # Add '_pflogd' group (if it is not available) + if ! getent group _pflogd >/dev/null; then + addgroup --system --force-badname _pflogd + fi + # Add '_pflogd' user (if it is not available) + if ! getent passwd _pflogd >/dev/null; then + adduser --quiet --system --no-create-home --home /var/run/_pflogd \ + --shell /usr/sbin/nologin --disabled-password \ + --ingroup _pflogd --force-badname _pflogd + fi ;; abort-upgrade|abort-remove|abort-deconfigure) diff -u freebsd-utils-8.1/debian/freebsd-net-tools.manpages freebsd-utils-8.1/debian/freebsd-net-tools.manpages --- freebsd-utils-8.1/debian/freebsd-net-tools.manpages +++ freebsd-utils-8.1/debian/freebsd-net-tools.manpages @@ -1,7 +1,9 @@ sbin/ifconfig/ifconfig.8 sbin/route/route.8 contrib/pf/authpf/authpf.8 +contrib/pf/ftp-proxy/ftp-proxy.8 contrib/pf/pfctl/pfctl.8 +contrib/pf/pflogd/pflogd.8 contrib/pf/man/*.5 usr.bin/netstat/netstat.1 usr.sbin/pppctl/pppctl.8 diff -u freebsd-utils-8.1/debian/changelog freebsd-utils-8.1/debian/changelog --- freebsd-utils-8.1/debian/changelog +++ freebsd-utils-8.1/debian/changelog @@ -1,3 +1,35 @@ +freebsd-utils (8.1-2.4) unstable; urgency=low + + * Non-maintainer upload. + * Moved headers to debian/include. + + -- Sergio Talens-Oliag Thu, 18 Nov 2010 21:45:02 +0100 + +freebsd-utils (8.1-2.3) unstable; urgency=low + + * Non-maintainer upload. + * Added ftp-proxy to the toolset (the .orig.tar.gz had to be changed). + + -- Sergio Talens-Oliag Mon, 15 Nov 2010 19:54:21 +0100 + +freebsd-utils (8.1-2.2) unstable; urgency=low + + * Non-maintainer upload. + * Added the '_pflogd' user and group and the '/var/run/_pflogd' directory. + + -- Sergio Talens-Oliag Fri, 05 Nov 2010 13:37:04 +0100 + +freebsd-utils (8.1-2.1) unstable; urgency=low + + * Non-maintainer upload. + * Added pflogd to the toolset. + * Added options to support more interface types on the ifconfig command + (carp, pfsync, lagg, bridges, ...). + * Added debian/net/if_bridgevar.h and debian/net/if_lagg.h on the source package + to be able to compile briging and lagg support on ifconfig. + + -- Sergio Talens-Oliag Mon, 18 Oct 2010 11:08:51 +0200 + freebsd-utils (8.1-2) unstable; urgency=low [ Aurelien Jarno ] diff -u freebsd-utils-8.1/debian/rules freebsd-utils-8.1/debian/rules --- freebsd-utils-8.1/debian/rules +++ freebsd-utils-8.1/debian/rules @@ -22,7 +22,7 @@ ORIGDIR=freebsd-utils-$(VERSION) PATH:=/usr/lib/freebsd:$(PATH) DESTDIR=$(CURDIR)/debian/tmp -PMAKE=COPTS="$(CFLAGS)" CFLAGS="$(CFLAGS) -I$(CURDIR)/debian" NO_WERROR=1 NOGCCERROR=1 NOSHARED=NO NO_SHARED=NO DESTDIR=$(DESTDIR) make +PMAKE=COPTS="$(CFLAGS)" CFLAGS="$(CFLAGS) -I$(CURDIR)/debian/include" NO_WERROR=1 NOGCCERROR=1 NOSHARED=NO NO_SHARED=NO DESTDIR=$(DESTDIR) make build: build-arch build-indep @@ -35,7 +35,8 @@ usr.bin/ktrdump usr.bin/vmstat sbin/devfs sbin/fdisk \ sbin/ifconfig sbin/route usr.bin/netstat usr.sbin/rpc.umntall \ usr.sbin/ppp usr.sbin/pppctl usr.sbin/arp \ - sbin/ipfw contrib/pf sbin/pfctl usr.sbin/authpf \ + sbin/ipfw contrib/pf sbin/pfctl sbin/pflogd usr.sbin/authpf \ + usr.sbin/ftp-proxy \ sbin/mount_std sbin/umount sbin/mount_autofs sbin/mount_cd9660 \ sbin/mount_ext2fs sbin/mount_hpfs sbin/mount_msdosfs sbin/mount_nfs \ sbin/mount_ntfs sbin/mount_nullfs sbin/mount_udf sbin/mount_unionfs \ @@ -129,10 +130,13 @@ freebsd-net-tools-stamp: patch-stamp lib-stamp $(PMAKE) -C sbin/ifconfig $(PMAKE) -C sbin/pfctl + $(PMAKE) -C sbin/pflogd $(PMAKE) -C sbin/route $(PMAKE) -C usr.bin/netstat $(PMAKE) -C usr.sbin/arp $(PMAKE) -C usr.sbin/authpf + $(PMAKE) -C usr.sbin/ftp-proxy/libevent + $(PMAKE) -C usr.sbin/ftp-proxy/ftp-proxy $(PMAKE) -C usr.sbin/pppctl touch $@ @@ -190,12 +194,18 @@ $(PMAKE) -C sbin/ifconfig clean $(PMAKE) -C sbin/pfctl clean + $(PMAKE) -C sbin/pflogd clean $(PMAKE) -C sbin/route clean $(PMAKE) -C usr.bin/netstat clean $(PMAKE) -C usr.sbin/arp clean $(PMAKE) -C usr.sbin/authpf clean + $(PMAKE) -C usr.sbin/ftp-proxy/libevent clean + $(PMAKE) -C usr.sbin/ftp-proxy/ftp-proxy clean $(PMAKE) -C usr.sbin/pppctl clean + # Remove a couple of leftovers + rm -f lib/*.o + QUILT_PATCHES=debian/patches quilt pop -a -R || test $$? = 2 rm -rf .pc rm -f *stamp diff -u freebsd-utils-8.1/debian/patches/013_pf.diff freebsd-utils-8.1/debian/patches/013_pf.diff --- freebsd-utils-8.1/debian/patches/013_pf.diff +++ freebsd-utils-8.1/debian/patches/013_pf.diff @@ -116,7 +116,47 @@ { --- a/contrib/pf/ftp-proxy/ftp-proxy.c +++ b/contrib/pf/ftp-proxy/ftp-proxy.c -@@ -95,7 +95,7 @@ +@@ -22,12 +22,17 @@ + #include + #include + #include ++#include + #include + #include + + #include + #include + #include ++/* Missing macros from the kFreeBSD sys/netinet/in.h header */ ++#define IPPORT_HIFIRSTAUTO 49152 ++#define IPPORT_HILASTAUTO 65535 ++ + #include + + #include +@@ -40,9 +45,12 @@ + #include + #include + #include ++#include + #include ++#include + #include + #include ++#include + #include + + #include "filter.h" +@@ -54,7 +62,7 @@ + #define NTOP_BUFS 3 + #define TCP_BACKLOG 10 + +-#define CHROOT_DIR "/var/empty" ++#define CHROOT_DIR "/var/run/ftp-proxy" + #define NOPRIV_USER "proxy" + + /* pfctl standard NAT range. */ +@@ -95,7 +103,7 @@ int drop_privs(void); void end_session(struct session *); int exit_daemon(void); @@ -125,7 +165,7 @@ void handle_connection(const int, short, void *); void handle_signal(int, short, void *); struct session * init_session(void); -@@ -229,7 +229,7 @@ +@@ -229,7 +237,7 @@ buf_avail); s->cbuf_valid += read; @@ -134,7 +174,7 @@ logmsg(LOG_DEBUG, "#%d client: %s", s->id, linebuf); if (!client_parse(s)) { end_session(s); -@@ -305,7 +305,7 @@ +@@ -305,7 +313,7 @@ { struct session *s, *next; @@ -143,7 +183,7 @@ LIST_FOREACH_SAFE(s, &sessions, entry, next) { #else for (s = LIST_FIRST(&sessions); s != LIST_END(&sessions); s = next) { -@@ -324,7 +324,7 @@ +@@ -324,7 +332,7 @@ } int @@ -152,7 +192,7 @@ { size_t i; -@@ -566,7 +566,7 @@ +@@ -566,7 +574,7 @@ /* We don't care about truncation. */ vsnprintf(buf, sizeof buf, message, ap); @@ -161,7 +201,7 @@ /* XXX: strnvis might be nice to have */ strvisx(visbuf, buf, MIN((sizeof(visbuf) / 4) - 1, strlen(buf)), -@@ -1053,7 +1053,7 @@ +@@ -1053,7 +1061,7 @@ buf_avail); s->sbuf_valid += read; @@ -224,7 +264,7 @@ if ($2 > RT_TABLEID_MAX || $2 < 0) { yyerror("invalid rtable id"); YYERROR; -@@ -2147,7 +2148,7 @@ +@@ -2155,7 +2156,7 @@ free($2); } | RTABLE number { @@ -233,7 +273,7 @@ if ($2 > RT_TABLEID_MAX || $2 < 0) { yyerror("invalid rtable id"); YYERROR; -@@ -3452,7 +3453,7 @@ +@@ -3468,7 +3469,7 @@ } ; @@ -242,7 +282,7 @@ natpass : /* empty */ { $$.b1 = $$.b2 = 0; $$.w2 = 0; } | PASS { $$.b1 = 1; $$.b2 = 0; $$.w2 = 0; } /* else -@@ -3826,7 +3827,7 @@ +@@ -3842,7 +3843,7 @@ rtable : /* empty */ { $$ = -1; } | RTABLE number { @@ -530,7 +570,7 @@ (unsigned long long)s->packets[0], (unsigned long long)s->packets[1], (unsigned long long)s->bytes[0], -@@ -302,7 +316,7 @@ +@@ -304,7 +318,7 @@ } if (opts & PF_OPT_VERBOSE2) { printf(" id: %016llx creatorid: %08x%s\n", @@ -1233,0 +1274,54 @@ +--- a/sbin/pflogd/Makefile ++++ b/sbin/pflogd/Makefile +@@ -6,7 +6,7 @@ + SRCS= pflogd.c pidfile.c privsep.c privsep_fdpass.c + MAN= pflogd.8 + +-LDADD= -lpcap -lutil ++LDADD= -lpcap -lutil -lbsd + DPADD= ${LIBPCAP} ${LIBUTIL} + + WARNS?= 2 +--- a/contrib/pf/libevent/event.c ++++ b/contrib/pf/libevent/event.c +@@ -38,9 +38,10 @@ + #include + #ifdef HAVE_SYS_TIME_H + #include +-#else ++#else + #include + #endif ++#include + #include + #include + #include +--- a/contrib/pf/ftp-proxy/filter.c ++++ b/contrib/pf/ftp-proxy/filter.c +@@ -23,6 +23,7 @@ + #include + #include + #include ++#define __FAVOR_BSD + #include + #include + +@@ -31,6 +32,7 @@ + #include + #include + #include ++#include + #include + + #include "filter.h" +--- a/usr.sbin/ftp-proxy/ftp-proxy/Makefile ++++ b/usr.sbin/ftp-proxy/ftp-proxy/Makefile +@@ -11,7 +11,7 @@ + CFLAGS+= -I${.CURDIR}/../../../sys/contrib/pf + + DPADD= ${LIBEVENT} +-LDADD= ${LIBEVENT} ++LDADD= ${LIBEVENT} -lrt -lbsd + + WARNS?= 2 + diff -u freebsd-utils-8.1/debian/patches/002_ifconfig.diff freebsd-utils-8.1/debian/patches/002_ifconfig.diff --- freebsd-utils-8.1/debian/patches/002_ifconfig.diff +++ freebsd-utils-8.1/debian/patches/002_ifconfig.diff @@ -13,11 +13,11 @@ sbin/ifconfig/ifvlan.c | 2 ++ 12 files changed, 53 insertions(+), 32 deletions(-) -Index: freebsd-utils/sbin/ifconfig/Makefile +Index: freebsd-utils-8.1/sbin/ifconfig/Makefile =================================================================== ---- freebsd-utils.orig/sbin/ifconfig/Makefile 2009-12-07 06:05:36.000000000 +0000 -+++ freebsd-utils/sbin/ifconfig/Makefile 2010-06-29 08:26:23.000000000 +0000 -@@ -21,22 +21,22 @@ +--- freebsd-utils-8.1.orig/sbin/ifconfig/Makefile 2010-10-18 10:56:30.000000000 +0200 ++++ freebsd-utils-8.1/sbin/ifconfig/Makefile 2010-10-18 11:00:35.623565809 +0200 +@@ -21,15 +21,15 @@ SRCS+= af_nd6.c # ND6 support SRCS+= ifclone.c # clone device support @@ -32,25 +32,12 @@ -SRCS+= ifieee80211.c regdomain.c # SIOC[GS]IEEE80211 support -DPADD+= ${LIBBSDXML} ${LIBSBUF} ${LIBJAIL} -LDADD+= -lbsdxml -ljail -lsbuf -- --SRCS+= ifcarp.c # SIOC[GS]VH support --SRCS+= ifgroup.c # ... --SRCS+= ifpfsync.c # pfsync(4) support +#SRCS+= ifieee80211.c regdomain.c # SIOC[GS]IEEE80211 support +#DPADD+= ${LIBBSDXML} ${LIBSBUF} ${LIBJAIL} +#LDADD+= -lbsdxml -ljail -lsbuf -+ -+#SRCS+= ifcarp.c # SIOC[GS]VH support -+#SRCS+= ifgroup.c # ... -+#SRCS+= ifpfsync.c # pfsync(4) support - --SRCS+= ifbridge.c # bridge support --SRCS+= iflagg.c # lagg support -+#SRCS+= ifbridge.c # bridge support -+#SRCS+= iflagg.c # lagg support - .if ${MK_IPX_SUPPORT} != "no" && !defined(RELEASE_CRUNCH) - SRCS+= af_ipx.c # IPX support + SRCS+= ifcarp.c # SIOC[GS]VH support + SRCS+= ifgroup.c # ... @@ -47,6 +47,7 @@ MAN= ifconfig.8 @@ -59,10 +46,10 @@ WARNS?= 0 .include -Index: freebsd-utils/sbin/ifconfig/ifcarp.c +Index: freebsd-utils-8.1/sbin/ifconfig/ifcarp.c =================================================================== ---- freebsd-utils.orig/sbin/ifconfig/ifcarp.c 2010-02-07 06:22:28.000000000 +0000 -+++ freebsd-utils/sbin/ifconfig/ifcarp.c 2010-06-29 08:26:23.000000000 +0000 +--- freebsd-utils-8.1.orig/sbin/ifconfig/ifcarp.c 2010-10-18 10:56:30.000000000 +0200 ++++ freebsd-utils-8.1/sbin/ifconfig/ifcarp.c 2010-10-18 11:00:35.623565809 +0200 @@ -43,6 +43,7 @@ #include #include @@ -71,10 +58,10 @@ #include #include #include -Index: freebsd-utils/sbin/ifconfig/ifconfig.c +Index: freebsd-utils-8.1/sbin/ifconfig/ifconfig.c =================================================================== ---- freebsd-utils.orig/sbin/ifconfig/ifconfig.c 2010-04-28 00:49:24.000000000 +0000 -+++ freebsd-utils/sbin/ifconfig/ifconfig.c 2010-06-29 08:28:37.000000000 +0000 +--- freebsd-utils-8.1.orig/sbin/ifconfig/ifconfig.c 2010-10-18 10:56:30.000000000 +0200 ++++ freebsd-utils-8.1/sbin/ifconfig/ifconfig.c 2010-10-18 11:00:35.624565936 +0200 @@ -48,6 +48,11 @@ #include #include @@ -223,10 +210,10 @@ DEF_CMD("link0", IFF_LINK0, setifflags), DEF_CMD("-link0", -IFF_LINK0, setifflags), DEF_CMD("link1", IFF_LINK1, setifflags), -Index: freebsd-utils/sbin/ifconfig/af_inet6.c +Index: freebsd-utils-8.1/sbin/ifconfig/af_inet6.c =================================================================== ---- freebsd-utils.orig/sbin/ifconfig/af_inet6.c 2009-12-07 06:05:36.000000000 +0000 -+++ freebsd-utils/sbin/ifconfig/af_inet6.c 2010-06-29 08:26:23.000000000 +0000 +--- freebsd-utils-8.1.orig/sbin/ifconfig/af_inet6.c 2010-10-18 10:56:30.000000000 +0200 ++++ freebsd-utils-8.1/sbin/ifconfig/af_inet6.c 2010-10-18 11:00:35.624565936 +0200 @@ -42,7 +42,6 @@ #include #include @@ -305,10 +292,10 @@ { ip6lifetime++; /* print IPv6 address lifetime */ } -Index: freebsd-utils/sbin/ifconfig/ifclone.c +Index: freebsd-utils-8.1/sbin/ifconfig/ifclone.c =================================================================== ---- freebsd-utils.orig/sbin/ifconfig/ifclone.c 2009-06-23 23:49:52.000000000 +0000 -+++ freebsd-utils/sbin/ifconfig/ifclone.c 2010-06-29 08:26:23.000000000 +0000 +--- freebsd-utils-8.1.orig/sbin/ifconfig/ifclone.c 2010-10-18 10:56:30.000000000 +0200 ++++ freebsd-utils-8.1/sbin/ifconfig/ifclone.c 2010-10-18 11:00:35.624565936 +0200 @@ -42,6 +42,7 @@ #include #include @@ -326,10 +313,10 @@ { list_cloners(); exit(0); -Index: freebsd-utils/sbin/ifconfig/af_link.c +Index: freebsd-utils-8.1/sbin/ifconfig/af_link.c =================================================================== ---- freebsd-utils.orig/sbin/ifconfig/af_link.c 2007-02-24 23:55:46.000000000 +0000 -+++ freebsd-utils/sbin/ifconfig/af_link.c 2010-06-29 08:26:23.000000000 +0000 +--- freebsd-utils-8.1.orig/sbin/ifconfig/af_link.c 2010-10-18 10:56:30.000000000 +0200 ++++ freebsd-utils-8.1/sbin/ifconfig/af_link.c 2010-10-18 11:00:35.625566901 +0200 @@ -46,13 +46,15 @@ #include #include @@ -347,10 +334,10 @@ { /* XXX no const 'cuz LLADDR is defined wrong */ struct sockaddr_dl *sdl = (struct sockaddr_dl *) ifa->ifa_addr; -Index: freebsd-utils/sbin/ifconfig/ifieee80211.c +Index: freebsd-utils-8.1/sbin/ifconfig/ifieee80211.c =================================================================== ---- freebsd-utils.orig/sbin/ifconfig/ifieee80211.c 2010-04-06 13:04:27.000000000 +0000 -+++ freebsd-utils/sbin/ifconfig/ifieee80211.c 2010-06-29 08:26:23.000000000 +0000 +--- freebsd-utils-8.1.orig/sbin/ifconfig/ifieee80211.c 2010-10-18 10:56:30.000000000 +0200 ++++ freebsd-utils-8.1/sbin/ifconfig/ifieee80211.c 2010-10-18 11:00:35.626565631 +0200 @@ -90,6 +90,10 @@ #include #include @@ -362,10 +349,10 @@ #include #include #include -Index: freebsd-utils/sbin/ifconfig/af_atalk.c +Index: freebsd-utils-8.1/sbin/ifconfig/af_atalk.c =================================================================== ---- freebsd-utils.orig/sbin/ifconfig/af_atalk.c 2009-06-23 23:49:52.000000000 +0000 -+++ freebsd-utils/sbin/ifconfig/af_atalk.c 2010-06-29 08:26:23.000000000 +0000 +--- freebsd-utils-8.1.orig/sbin/ifconfig/af_atalk.c 2010-10-18 10:56:30.000000000 +0200 ++++ freebsd-utils-8.1/sbin/ifconfig/af_atalk.c 2010-10-18 11:00:35.626565631 +0200 @@ -55,7 +55,7 @@ /* XXX FIXME -- should use strtoul for better parsing. */ @@ -393,10 +380,10 @@ { struct sockaddr_at *sat, null_sat; struct netrange *nr; -Index: freebsd-utils/sbin/ifconfig/af_inet.c +Index: freebsd-utils-8.1/sbin/ifconfig/af_inet.c =================================================================== ---- freebsd-utils.orig/sbin/ifconfig/af_inet.c 2009-06-23 23:49:52.000000000 +0000 -+++ freebsd-utils/sbin/ifconfig/af_inet.c 2010-06-29 08:26:23.000000000 +0000 +--- freebsd-utils-8.1.orig/sbin/ifconfig/af_inet.c 2010-10-18 10:56:30.000000000 +0200 ++++ freebsd-utils-8.1/sbin/ifconfig/af_inet.c 2010-10-18 11:00:35.627565759 +0200 @@ -42,13 +42,13 @@ #include #include @@ -421,10 +408,10 @@ { struct sockaddr_in *sin, null_sin; -Index: freebsd-utils/sbin/ifconfig/af_ipx.c +Index: freebsd-utils-8.1/sbin/ifconfig/af_ipx.c =================================================================== ---- freebsd-utils.orig/sbin/ifconfig/af_ipx.c 2007-06-13 18:07:59.000000000 +0000 -+++ freebsd-utils/sbin/ifconfig/af_ipx.c 2010-06-29 08:26:23.000000000 +0000 +--- freebsd-utils-8.1.orig/sbin/ifconfig/af_ipx.c 2010-10-18 10:56:30.000000000 +0200 ++++ freebsd-utils-8.1/sbin/ifconfig/af_ipx.c 2010-10-18 11:00:35.627565759 +0200 @@ -41,9 +41,9 @@ #include #include @@ -445,10 +432,10 @@ { struct sockaddr_ipx *sipx, null_sipx; -Index: freebsd-utils/sbin/ifconfig/ifgre.c +Index: freebsd-utils-8.1/sbin/ifconfig/ifgre.c =================================================================== ---- freebsd-utils.orig/sbin/ifconfig/ifgre.c 2009-06-23 23:49:52.000000000 +0000 -+++ freebsd-utils/sbin/ifconfig/ifgre.c 2010-06-29 08:26:23.000000000 +0000 +--- freebsd-utils-8.1.orig/sbin/ifconfig/ifgre.c 2010-10-18 10:56:30.000000000 +0200 ++++ freebsd-utils-8.1/sbin/ifconfig/ifgre.c 2010-10-18 11:00:35.627565759 +0200 @@ -65,7 +65,7 @@ } @@ -458,10 +445,10 @@ const struct afswtch *afp) { uint32_t grekey = atol(val); -Index: freebsd-utils/sbin/ifconfig/ifvlan.c +Index: freebsd-utils-8.1/sbin/ifconfig/ifvlan.c =================================================================== ---- freebsd-utils.orig/sbin/ifconfig/ifvlan.c 2010-03-18 19:10:03.000000000 +0000 -+++ freebsd-utils/sbin/ifconfig/ifvlan.c 2010-06-29 08:26:23.000000000 +0000 +--- freebsd-utils-8.1.orig/sbin/ifconfig/ifvlan.c 2010-10-18 10:56:30.000000000 +0200 ++++ freebsd-utils-8.1/sbin/ifconfig/ifvlan.c 2010-10-18 11:00:35.628565886 +0200 @@ -52,6 +52,8 @@ #include #include @@ -471,8 +458,10 @@ #include "ifconfig.h" #ifndef lint ---- freebsd-utils.orig/sbin/ifconfig/af_nd6.c -+++ freebsd-utils/sbin/ifconfig/af_nd6.c +Index: freebsd-utils-8.1/sbin/ifconfig/af_nd6.c +=================================================================== +--- freebsd-utils-8.1.orig/sbin/ifconfig/af_nd6.c 2010-10-18 10:56:30.000000000 +0200 ++++ freebsd-utils-8.1/sbin/ifconfig/af_nd6.c 2010-10-18 11:00:35.628565886 +0200 @@ -65,7 +65,7 @@ void setnd6defif(const char *, int, int, const struct afswtch *); @@ -493,0 +483,35 @@ +Index: freebsd-utils-8.1/sbin/ifconfig/ifpfsync.c +=================================================================== +--- freebsd-utils-8.1.orig/sbin/ifconfig/ifpfsync.c 2010-10-18 10:56:30.000000000 +0200 ++++ freebsd-utils-8.1/sbin/ifconfig/ifpfsync.c 2010-10-18 11:06:58.060770258 +0200 +@@ -32,6 +32,10 @@ + + #include + #include ++ ++/* Dirty hack, this is defined in kFreeBSD netinet/in.h, but not on the Debian headers */ ++#define INADDR_PFSYNC_GROUP (u_int32_t)0xe00000f0 /* 224.0.0.240 */ ++ + #include + #include + #include +@@ -42,6 +46,7 @@ + #include + #include + #include ++#include + #include + + #include "ifconfig.h" +Index: freebsd-utils-8.1/sbin/ifconfig/ifgroup.c +=================================================================== +--- freebsd-utils-8.1.orig/sbin/ifconfig/ifgroup.c 2010-10-18 10:56:30.000000000 +0200 ++++ freebsd-utils-8.1/sbin/ifconfig/ifgroup.c 2010-10-18 11:00:35.629565733 +0200 +@@ -39,6 +39,7 @@ + #include + #include + #include ++#include + #include + + #include "ifconfig.h" reverted: --- freebsd-utils-8.1/debian/net/if.h +++ freebsd-utils-8.1.orig/debian/net/if.h @@ -1,449 +0,0 @@ -/*- - * Copyright (c) 1982, 1986, 1989, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)if.h 8.1 (Berkeley) 6/10/93 - * $FreeBSD: src/sys/net/if.h,v 1.108 2007/06/11 20:08:11 andre Exp $ - */ - -#ifndef _NET_IF_H_ -#define _NET_IF_H_ - -#include - -#include - -#include -#include - -struct ifnet; - -/* - * Length of interface external name, including terminating '\0'. - * Note: this is the same size as a generic device's external name. - */ -#define IF_NAMESIZE 16 -#define IFNAMSIZ IF_NAMESIZE -#define IF_MAXUNIT 0x7fff /* historical value */ - -/* - * Structure used to query names of interface cloners. - */ - -struct if_clonereq { - int ifcr_total; /* total cloners (out) */ - int ifcr_count; /* room for this many in user buffer */ - char *ifcr_buffer; /* buffer for cloner names */ -}; - -/* - * Structure describing information about an interface - * which may be of interest to management entities. - */ -struct if_data { - /* generic interface information */ - unsigned char ifi_type; /* ethernet, tokenring, etc */ - unsigned char ifi_physical; /* e.g., AUI, Thinnet, 10base-T, etc */ - unsigned char ifi_addrlen; /* media address length */ - unsigned char ifi_hdrlen; /* media header length */ - unsigned char ifi_link_state; /* current link state */ - unsigned char ifi_spare_char1; /* spare byte */ - unsigned char ifi_spare_char2; /* spare byte */ - unsigned char ifi_datalen; /* length of this data struct */ - unsigned long ifi_mtu; /* maximum transmission unit */ - unsigned long ifi_metric; /* routing metric (external only) */ - unsigned long ifi_baudrate; /* linespeed */ - /* volatile statistics */ - unsigned long ifi_ipackets; /* packets received on interface */ - unsigned long ifi_ierrors; /* input errors on interface */ - unsigned long ifi_opackets; /* packets sent on interface */ - unsigned long ifi_oerrors; /* output errors on interface */ - unsigned long ifi_collisions; /* collisions on csma interfaces */ - unsigned long ifi_ibytes; /* total number of octets received */ - unsigned long ifi_obytes; /* total number of octets sent */ - unsigned long ifi_imcasts; /* packets received via multicast */ - unsigned long ifi_omcasts; /* packets sent via multicast */ - unsigned long ifi_iqdrops; /* dropped on input, this interface */ - unsigned long ifi_noproto; /* destined for unsupported protocol */ - unsigned long ifi_hwassist; /* HW offload capabilities, see IFCAP */ - time_t ifi_epoch; /* uptime at attach or stat reset */ - struct timeval ifi_lastchange; /* time of last administrative change */ -}; - -/*- - * Interface flags are of two types: network stack owned flags, and driver - * owned flags. Historically, these values were stored in the same ifnet - * flags field, but with the advent of fine-grained locking, they have been - * broken out such that the network stack is responsible for synchronizing - * the stack-owned fields, and the device driver the device-owned fields. - * Both halves can perform lockless reads of the other half's field, subject - * to accepting the involved races. - * - * Both sets of flags come from the same number space, and should not be - * permitted to conflict, as they are exposed to user space via a single - * field. - * - * The following symbols identify read and write requirements for fields: - * - * (i) if_flags field set by device driver before attach, read-only there - * after. - * (n) if_flags field written only by the network stack, read by either the - * stack or driver. - * (d) if_drv_flags field written only by the device driver, read by either - * the stack or driver. - */ -#define IFF_UP 0x1 /* (n) interface is up */ -#define IFF_BROADCAST 0x2 /* (i) broadcast address valid */ -#define IFF_DEBUG 0x4 /* (n) turn on debugging */ -#define IFF_LOOPBACK 0x8 /* (i) is a loopback net */ -#define IFF_POINTOPOINT 0x10 /* (i) is a point-to-point link */ -#define IFF_SMART 0x20 /* (i) interface manages own routes */ -#define IFF_DRV_RUNNING 0x40 /* (d) resources allocated */ -#define IFF_NOARP 0x80 /* (n) no address resolution protocol */ -#define IFF_PROMISC 0x100 /* (n) receive all packets */ -#define IFF_ALLMULTI 0x200 /* (n) receive all multicast packets */ -#define IFF_DRV_OACTIVE 0x400 /* (d) tx hardware queue is full */ -#define IFF_SIMPLEX 0x800 /* (i) can't hear own transmissions */ -#define IFF_LINK0 0x1000 /* per link layer defined bit */ -#define IFF_LINK1 0x2000 /* per link layer defined bit */ -#define IFF_LINK2 0x4000 /* per link layer defined bit */ -#define IFF_ALTPHYS IFF_LINK2 /* use alternate physical connection */ -#define IFF_MULTICAST 0x8000 /* (i) supports multicast */ -/* 0x10000 */ -#define IFF_PPROMISC 0x20000 /* (n) user-requested promisc mode */ -#define IFF_MONITOR 0x40000 /* (n) user-requested monitor mode */ -#define IFF_STATICARP 0x80000 /* (n) static ARP */ -#define IFF_NEEDSGIANT 0x100000 /* (i) hold Giant over if_start calls */ -#define IFF_DYING 0x200000 /* (n) interface is winding down */ -#define IFF_RENAMING 0x400000 /* (n) interface is being renamed */ - -/* - * Old names for driver flags so that user space tools can continue to use - * the old (portable) names. - */ -#ifndef _KERNEL -#define IFF_RUNNING IFF_DRV_RUNNING -#define IFF_OACTIVE IFF_DRV_OACTIVE -#endif - -/* flags set internally only: */ -#define IFF_CANTCHANGE \ - (IFF_BROADCAST|IFF_POINTOPOINT|IFF_DRV_RUNNING|IFF_DRV_OACTIVE|\ - IFF_SIMPLEX|IFF_MULTICAST|IFF_ALLMULTI|IFF_SMART|IFF_PROMISC) - -/* - * Values for if_link_state. - */ -#define LINK_STATE_UNKNOWN 0 /* link invalid/unknown */ -#define LINK_STATE_DOWN 1 /* link is down */ -#define LINK_STATE_UP 2 /* link is up */ - -/* - * Some convenience macros used for setting ifi_baudrate. - * XXX 1000 vs. 1024? --thorpej@netbsd.org - */ -#define IF_Kbps(x) ((x) * 1000) /* kilobits/sec. */ -#define IF_Mbps(x) (IF_Kbps((x) * 1000)) /* megabits/sec. */ -#define IF_Gbps(x) (IF_Mbps((x) * 1000)) /* gigabits/sec. */ - -/* - * Capabilities that interfaces can advertise. - * - * struct ifnet.if_capabilities - * contains the optional features & capabilities a particular interface - * supports (not only the driver but also the detected hw revision). - * Capabilities are defined by IFCAP_* below. - * struct ifnet.if_capenable - * contains the enabled (either by default or through ifconfig) optional - * features & capabilities on this interface. - * Capabilities are defined by IFCAP_* below. - * struct if_data.ifi_hwassist in mbuf CSUM_ flag form, controlled by above - * contains the enabled optional feature & capabilites that can be used - * individually per packet and are specified in the mbuf pkthdr.csum_flags - * field. IFCAP_* and CSUM_* do not match one to one and CSUM_* may be - * more detailed or differenciated than IFCAP_*. - * Hwassist features are defined CSUM_* in sys/mbuf.h - */ -#define IFCAP_RXCSUM 0x00001 /* can offload checksum on RX */ -#define IFCAP_TXCSUM 0x00002 /* can offload checksum on TX */ -#define IFCAP_NETCONS 0x00004 /* can be a network console */ -#define IFCAP_VLAN_MTU 0x00008 /* VLAN-compatible MTU */ -#define IFCAP_VLAN_HWTAGGING 0x00010 /* hardware VLAN tag support */ -#define IFCAP_JUMBO_MTU 0x00020 /* 9000 byte MTU supported */ -#define IFCAP_POLLING 0x00040 /* driver supports polling */ -#define IFCAP_VLAN_HWCSUM 0x00080 /* can do IFCAP_HWCSUM on VLANs */ -#define IFCAP_TSO4 0x00100 /* can do TCP Segmentation Offload */ -#define IFCAP_TSO6 0x00200 /* can do TCP6 Segmentation Offload */ -#define IFCAP_LRO 0x00400 /* can do Large Receive Offload */ -#define IFCAP_WOL_UCAST 0x00800 /* wake on any unicast frame */ -#define IFCAP_WOL_MCAST 0x01000 /* wake on any multicast frame */ -#define IFCAP_WOL_MAGIC 0x02000 /* wake on any Magic Packet */ -#define IFCAP_TOE4 0x04000 /* interface can offload TCP */ -#define IFCAP_TOE6 0x08000 /* interface can offload TCP6 */ -#define IFCAP_VLAN_HWFILTER 0x10000 /* interface hw can filter vlan tag */ -#define IFCAP_POLLING_NOCOUNT 0x20000 /* polling ticks cannot be fragmented */ -#define IFCAP_VLAN_HWTSO 0x40000 /* can do IFCAP_TSO on VLANs */ -#define IFCAP_LINKSTATE 0x80000 /* the runtime link state is dynamic */ - -#define IFCAP_HWCSUM (IFCAP_RXCSUM | IFCAP_TXCSUM) -#define IFCAP_TSO (IFCAP_TSO4 | IFCAP_TSO6) -#define IFCAP_WOL (IFCAP_WOL_UCAST | IFCAP_WOL_MCAST | IFCAP_WOL_MAGIC) -#define IFCAP_TOE (IFCAP_TOE4 | IFCAP_TOE6) - -#define IFQ_MAXLEN 50 -#define IFNET_SLOWHZ 1 /* granularity is 1 second */ - -/* - * Message format for use in obtaining information about interfaces - * from getkerninfo and the routing socket - */ -struct if_msghdr { - unsigned short ifm_msglen; /* to skip over non-understood messages */ - unsigned char ifm_version; /* future binary compatibility */ - unsigned char ifm_type; /* message type */ - int ifm_addrs; /* like rtm_addrs */ - int ifm_flags; /* value of if_flags */ - unsigned short ifm_index; /* index for associated ifp */ - struct if_data ifm_data;/* statistics and other data about if */ -}; - -/* - * Message format for use in obtaining information about interface addresses - * from getkerninfo and the routing socket - */ -struct ifa_msghdr { - unsigned short ifam_msglen; /* to skip over non-understood messages */ - unsigned char ifam_version; /* future binary compatibility */ - unsigned char ifam_type; /* message type */ - int ifam_addrs; /* like rtm_addrs */ - int ifam_flags; /* value of ifa_flags */ - unsigned short ifam_index; /* index for associated ifp */ - int ifam_metric; /* value of ifa_metric */ -}; - -/* - * Message format for use in obtaining information about multicast addresses - * from the routing socket - */ -struct ifma_msghdr { - unsigned short ifmam_msglen; /* to skip over non-understood messages */ - unsigned char ifmam_version; /* future binary compatibility */ - unsigned char ifmam_type; /* message type */ - int ifmam_addrs; /* like rtm_addrs */ - int ifmam_flags; /* value of ifa_flags */ - unsigned short ifmam_index; /* index for associated ifp */ -}; - -/* - * Message format announcing the arrival or departure of a network interface. - */ -struct if_announcemsghdr { - unsigned short ifan_msglen; /* to skip over non-understood messages */ - unsigned char ifan_version; /* future binary compatibility */ - unsigned char ifan_type; /* message type */ - unsigned short ifan_index; /* index for associated ifp */ - char ifan_name[IFNAMSIZ]; /* if name, e.g. "en0" */ - unsigned short ifan_what; /* what type of announcement */ -}; - -#define IFAN_ARRIVAL 0 /* interface arrival */ -#define IFAN_DEPARTURE 1 /* interface departure */ - -/* - * Buffer with length to be used in SIOCGIFDESCR/SIOCSIFDESCR requests - */ -struct ifreq_buffer { - size_t length; - void *buffer; -}; - -/* - * Interface request structure used for socket - * ioctl's. All interface ioctl's must have parameter - * definitions which begin with ifr_name. The - * remainder may be interface specific. - */ -struct ifreq { - char ifr_name[IFNAMSIZ]; /* if name, e.g. "en0" */ - union { - struct sockaddr ifru_addr; - struct sockaddr ifru_dstaddr; - struct sockaddr ifru_broadaddr; - struct sockaddr ifru_netmask; - struct ifreq_buffer ifru_buffer; - short ifru_flags[2]; - short ifru_index; - int ifru_jid; - int ifru_metric; - int ifru_mtu; - int ifru_phys; - int ifru_media; - char * ifru_data; - int ifru_cap[2]; - } ifr_ifru; -#define ifr_addr ifr_ifru.ifru_addr /* address */ -#define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-to-p link */ -#define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */ -#define ifr_netmask ifr_ifru.ifru_netmask /* interface net mask */ -#define ifr_buffer ifr_ifru.ifru_buffer /* user supplied buffer with its length */ -#define ifr_flags ifr_ifru.ifru_flags[0] /* flags (low 16 bits) */ -#define ifr_flagshigh ifr_ifru.ifru_flags[1] /* flags (high 16 bits) */ -#define ifr_jid ifr_ifru.ifru_jid /* jail/vnet */ -#define ifr_metric ifr_ifru.ifru_metric /* metric */ -#define ifr_mtu ifr_ifru.ifru_mtu /* mtu */ -#define ifr_phys ifr_ifru.ifru_phys /* physical wire */ -#define ifr_media ifr_ifru.ifru_media /* physical media */ -#define ifr_data ifr_ifru.ifru_data /* for use by interface */ -#define ifr_reqcap ifr_ifru.ifru_cap[0] /* requested capabilities */ -#define ifr_curcap ifr_ifru.ifru_cap[1] /* current capabilities */ -#define ifr_index ifr_ifru.ifru_index /* interface index */ -}; - -#define _SIZEOF_ADDR_IFREQ(ifr) \ - ((ifr).ifr_addr.sa_len > sizeof(struct sockaddr) ? \ - (sizeof(struct ifreq) - sizeof(struct sockaddr) + \ - (ifr).ifr_addr.sa_len) : sizeof(struct ifreq)) - -struct ifaliasreq { - char ifra_name[IFNAMSIZ]; /* if name, e.g. "en0" */ - struct sockaddr ifra_addr; - struct sockaddr ifra_broadaddr; - struct sockaddr ifra_mask; -}; - -struct ifmediareq { - char ifm_name[IFNAMSIZ]; /* if name, e.g. "en0" */ - int ifm_current; /* current media options */ - int ifm_mask; /* don't care mask */ - int ifm_status; /* media status */ - int ifm_active; /* active options */ - int ifm_count; /* # entries in ifm_ulist array */ - int *ifm_ulist; /* media words */ -}; - -struct ifdrv { - char ifd_name[IFNAMSIZ]; /* if name, e.g. "en0" */ - unsigned long ifd_cmd; - size_t ifd_len; - void *ifd_data; -}; - -/* - * Structure used to retrieve aux status data from interfaces. - * Kernel suppliers to this interface should respect the formatting - * needed by ifconfig(8): each line starts with a TAB and ends with - * a newline. The canonical example to copy and paste is in if_tun.c. - */ - -#define IFSTATMAX 800 /* 10 lines of text */ -struct ifstat { - char ifs_name[IFNAMSIZ]; /* if name, e.g. "en0" */ - char ascii[IFSTATMAX + 1]; -}; - -/* - * Structure used in SIOCGIFCONF request. - * Used to retrieve interface configuration - * for machine (useful for programs which - * must know all networks accessible). - */ -struct ifconf { - int ifc_len; /* size of associated buffer */ - union { - char *ifcu_buf; - struct ifreq *ifcu_req; - } ifc_ifcu; -#define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */ -#define ifc_req ifc_ifcu.ifcu_req /* array of structures returned */ -}; - -#if defined (__amd64__) || defined (COMPAT_32BIT) -struct ifconf32 { - int ifc_len; /* size of associated buffer */ - union { - unsigned int ifcu_buf; - unsigned int ifcu_req; - } ifc_ifcu; -}; -#endif - -/* - * interface groups - */ - -#define IFG_ALL "all" /* group contains all interfaces */ -/* XXX: will we implement this? */ -#define IFG_EGRESS "egress" /* if(s) default route(s) point to */ - -struct ifg_req { - union { - char ifgrqu_group[IFNAMSIZ]; - char ifgrqu_member[IFNAMSIZ]; - } ifgrq_ifgrqu; -#define ifgrq_group ifgrq_ifgrqu.ifgrqu_group -#define ifgrq_member ifgrq_ifgrqu.ifgrqu_member -}; - -/* - * Used to lookup groups for an interface - */ -struct ifgroupreq { - char ifgr_name[IFNAMSIZ]; - unsigned int ifgr_len; - union { - char ifgru_group[IFNAMSIZ]; - struct ifg_req *ifgru_groups; - } ifgr_ifgru; -#define ifgr_group ifgr_ifgru.ifgru_group -#define ifgr_groups ifgr_ifgru.ifgru_groups -}; - -/* - * Structure for SIOC[AGD]LIFADDR - */ -struct if_laddrreq { - char iflr_name[IFNAMSIZ]; - unsigned int flags; -#define IFLR_PREFIX 0x8000 /* in: prefix given out: kernel fills id */ - unsigned int prefixlen; /* in/out */ - struct sockaddr_storage addr; /* in/out */ - struct sockaddr_storage dstaddr; /* out */ -}; - -struct if_nameindex { - unsigned int if_index; /* 1, 2, ... */ - char *if_name; /* null terminated name: "le0", ... */ -}; - -__BEGIN_DECLS -void if_freenameindex(struct if_nameindex *); -char *if_indextoname(unsigned int, char *); -struct if_nameindex *if_nameindex(void); -unsigned int if_nametoindex(const char *); -__END_DECLS - -#endif /* !_NET_IF_H_ */ only in patch2: unchanged: --- freebsd-utils-8.1.orig/debian/freebsd-net-tools.dirs +++ freebsd-utils-8.1/debian/freebsd-net-tools.dirs @@ -0,0 +1,2 @@ +/var/run/_pflogd +/var/run/ftp-proxy only in patch2: unchanged: --- freebsd-utils-8.1.orig/debian/include/pcap-int.h +++ freebsd-utils-8.1/debian/include/pcap-int.h @@ -0,0 +1,493 @@ +/* + * Copyright (c) 1994, 1995, 1996 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the Computer Systems + * Engineering Group at Lawrence Berkeley Laboratory. + * 4. Neither the name of the University nor of the Laboratory may be used + * to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#) $Header: /tcpdump/master/libpcap/pcap-int.h,v 1.94 2008-09-16 00:20:23 guy Exp $ (LBL) + */ + +#ifndef pcap_int_h +#define pcap_int_h + +#include "pcap-config.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef HAVE_LIBDLPI +#include +#endif + +#ifdef WIN32 +#include +extern CRITICAL_SECTION g_PcapCompileCriticalSection; +#endif /* WIN32 */ + +#ifdef MSDOS +#include +#include +#endif + +#ifdef HAVE_SNF_API +#include +#endif + +#if (defined(_MSC_VER) && (_MSC_VER <= 1200)) /* we are compiling with Visual Studio 6, that doesn't support the LL suffix*/ + +/* + * Swap byte ordering of unsigned long long timestamp on a big endian + * machine. + */ +#define SWAPLL(ull) ((ull & 0xff00000000000000) >> 56) | \ + ((ull & 0x00ff000000000000) >> 40) | \ + ((ull & 0x0000ff0000000000) >> 24) | \ + ((ull & 0x000000ff00000000) >> 8) | \ + ((ull & 0x00000000ff000000) << 8) | \ + ((ull & 0x0000000000ff0000) << 24) | \ + ((ull & 0x000000000000ff00) << 40) | \ + ((ull & 0x00000000000000ff) << 56) + +#else /* A recent Visual studio compiler or not VC */ + +/* + * Swap byte ordering of unsigned long long timestamp on a big endian + * machine. + */ +#define SWAPLL(ull) ((ull & 0xff00000000000000LL) >> 56) | \ + ((ull & 0x00ff000000000000LL) >> 40) | \ + ((ull & 0x0000ff0000000000LL) >> 24) | \ + ((ull & 0x000000ff00000000LL) >> 8) | \ + ((ull & 0x00000000ff000000LL) << 8) | \ + ((ull & 0x0000000000ff0000LL) << 24) | \ + ((ull & 0x000000000000ff00LL) << 40) | \ + ((ull & 0x00000000000000ffLL) << 56) + +#endif /* _MSC_VER */ + +/* + * Savefile + */ +typedef enum { + NOT_SWAPPED, + SWAPPED, + MAYBE_SWAPPED +} swapped_type_t; + +/* + * Used when reading a savefile. + */ +struct pcap_sf { + FILE *rfile; + int (*next_packet_op)(pcap_t *, struct pcap_pkthdr *, u_char **); + int swapped; + size_t hdrsize; + swapped_type_t lengths_swapped; + int version_major; + int version_minor; + bpf_u_int32 ifcount; /* number of interfaces seen in this capture */ + u_int tsresol; /* time stamp resolution */ + u_int tsscale; /* scaling factor for resolution -> microseconds */ + u_int64_t tsoffset; /* time stamp offset */ +}; + +/* + * Used when doing a live capture. + */ +struct pcap_md { + struct pcap_stat stat; + /*XXX*/ + int use_bpf; /* using kernel filter */ + u_long TotPkts; /* can't oflow for 79 hrs on ether */ + u_long TotAccepted; /* count accepted by filter */ + u_long TotDrops; /* count of dropped packets */ + long TotMissed; /* missed by i/f during this run */ + long OrigMissed; /* missed by i/f before this run */ + char *device; /* device name */ + int timeout; /* timeout for buffering */ + int must_do_on_close; /* stuff we must do when we close */ + struct pcap *next; /* list of open pcaps that need stuff cleared on close */ +#ifdef linux + int sock_packet; /* using Linux 2.0 compatible interface */ + int cooked; /* using SOCK_DGRAM rather than SOCK_RAW */ + int ifindex; /* interface index of device we're bound to */ + int lo_ifindex; /* interface index of the loopback device */ + u_int packets_read; /* count of packets read with recvfrom() */ + bpf_u_int32 oldmode; /* mode to restore when turning monitor mode off */ + char *mondevice; /* mac80211 monitor device we created */ + u_char *mmapbuf; /* memory-mapped region pointer */ + size_t mmapbuflen; /* size of region */ + u_int tp_version; /* version of tpacket_hdr for mmaped ring */ + u_int tp_hdrlen; /* hdrlen of tpacket_hdr for mmaped ring */ + u_char *oneshot_buffer; /* buffer for copy of packet */ + long proc_dropped; /* packets reported dropped by /proc/net/dev */ +#endif /* linux */ + +#ifdef HAVE_DAG_API +#ifdef HAVE_DAG_STREAMS_API + u_char *dag_mem_bottom; /* DAG card current memory bottom pointer */ + u_char *dag_mem_top; /* DAG card current memory top pointer */ +#else /* HAVE_DAG_STREAMS_API */ + void *dag_mem_base; /* DAG card memory base address */ + u_int dag_mem_bottom; /* DAG card current memory bottom offset */ + u_int dag_mem_top; /* DAG card current memory top offset */ +#endif /* HAVE_DAG_STREAMS_API */ + int dag_fcs_bits; /* Number of checksum bits from link layer */ + int dag_offset_flags; /* Flags to pass to dag_offset(). */ + int dag_stream; /* DAG stream number */ + int dag_timeout; /* timeout specified to pcap_open_live. + * Same as in linux above, introduce + * generally? */ +#endif /* HAVE_DAG_API */ +#ifdef HAVE_SNF_API + snf_handle_t snf_handle; /* opaque device handle */ + snf_ring_t snf_ring; /* opaque device ring handle */ + int snf_timeout; + int snf_boardnum; +#endif /*HAVE_SNF_API*/ + +#ifdef HAVE_ZEROCOPY_BPF + /* + * Zero-copy read buffer -- for zero-copy BPF. 'buffer' above will + * alternative between these two actual mmap'd buffers as required. + * As there is a header on the front size of the mmap'd buffer, only + * some of the buffer is exposed to libpcap as a whole via bufsize; + * zbufsize is the true size. zbuffer tracks the current zbuf + * assocated with buffer so that it can be used to decide which the + * next buffer to read will be. + */ + u_char *zbuf1, *zbuf2, *zbuffer; + u_int zbufsize; + u_int zerocopy; + u_int interrupted; + struct timespec firstsel; + /* + * If there's currently a buffer being actively processed, then it is + * referenced here; 'buffer' is also pointed at it, but offset by the + * size of the header. + */ + struct bpf_zbuf_header *bzh; +#endif /* HAVE_ZEROCOPY_BPF */ +}; + +/* + * Stuff to do when we close. + */ +#define MUST_CLEAR_PROMISC 0x00000001 /* clear promiscuous mode */ +#define MUST_CLEAR_RFMON 0x00000002 /* clear rfmon (monitor) mode */ +#define MUST_DELETE_MONIF 0x00000004 /* delete monitor-mode interface */ + +struct pcap_opt { + int buffer_size; + char *source; + int promisc; + int rfmon; +}; + +/* + * Ultrix, DEC OSF/1^H^H^H^H^H^H^H^H^HDigital UNIX^H^H^H^H^H^H^H^H^H^H^H^H + * Tru64 UNIX, and some versions of NetBSD pad FDDI packets to make everything + * line up on a nice boundary. + */ +#ifdef __NetBSD__ +#include /* needed to declare __NetBSD_Version__ */ +#endif + +#if defined(ultrix) || defined(__osf__) || (defined(__NetBSD__) && __NetBSD_Version__ > 106000000) +#define PCAP_FDDIPAD 3 +#endif + +typedef int (*activate_op_t)(pcap_t *); +typedef int (*can_set_rfmon_op_t)(pcap_t *); +typedef int (*read_op_t)(pcap_t *, int cnt, pcap_handler, u_char *); +typedef int (*inject_op_t)(pcap_t *, const void *, size_t); +typedef int (*setfilter_op_t)(pcap_t *, struct bpf_program *); +typedef int (*setdirection_op_t)(pcap_t *, pcap_direction_t); +typedef int (*set_datalink_op_t)(pcap_t *, int); +typedef int (*getnonblock_op_t)(pcap_t *, char *); +typedef int (*setnonblock_op_t)(pcap_t *, int, char *); +typedef int (*stats_op_t)(pcap_t *, struct pcap_stat *); +#ifdef WIN32 +typedef int (*setbuff_op_t)(pcap_t *, int); +typedef int (*setmode_op_t)(pcap_t *, int); +typedef int (*setmintocopy_op_t)(pcap_t *, int); +#endif +typedef void (*cleanup_op_t)(pcap_t *); + +struct pcap { +#ifdef WIN32 + ADAPTER *adapter; + LPPACKET Packet; + int nonblock; +#else + int fd; + int selectable_fd; + int send_fd; +#endif /* WIN32 */ + +#ifdef HAVE_LIBDLPI + dlpi_handle_t dlpi_hd; +#endif + int snapshot; + int linktype; /* Network linktype */ + int linktype_ext; /* Extended information stored in the linktype field of a file */ + int tzoff; /* timezone offset */ + int offset; /* offset for proper alignment */ + int activated; /* true if the capture is really started */ + int oldstyle; /* if we're opening with pcap_open_live() */ + + int break_loop; /* flag set to force break from packet-reading loop */ + +#ifdef PCAP_FDDIPAD + int fddipad; +#endif + +#ifdef MSDOS + void (*wait_proc)(void); /* call proc while waiting */ +#endif + + struct pcap_sf sf; + struct pcap_md md; + struct pcap_opt opt; + + /* + * Read buffer. + */ + int bufsize; + u_char *buffer; + u_char *bp; + int cc; + + /* + * Place holder for pcap_next(). + */ + u_char *pkt; + + /* We're accepting only packets in this direction/these directions. */ + pcap_direction_t direction; + + /* + * Methods. + */ + activate_op_t activate_op; + can_set_rfmon_op_t can_set_rfmon_op; + read_op_t read_op; + inject_op_t inject_op; + setfilter_op_t setfilter_op; + setdirection_op_t setdirection_op; + set_datalink_op_t set_datalink_op; + getnonblock_op_t getnonblock_op; + setnonblock_op_t setnonblock_op; + stats_op_t stats_op; + + /* + * Routine to use as callback for pcap_next()/pcap_next_ex(). + */ + pcap_handler oneshot_callback; + +#ifdef WIN32 + /* + * These are, at least currently, specific to the Win32 NPF + * driver. + */ + setbuff_op_t setbuff_op; + setmode_op_t setmode_op; + setmintocopy_op_t setmintocopy_op; +#endif + cleanup_op_t cleanup_op; + + /* + * Placeholder for filter code if bpf not in kernel. + */ + struct bpf_program fcode; + + char errbuf[PCAP_ERRBUF_SIZE + 1]; + int dlt_count; + u_int *dlt_list; + + struct pcap_pkthdr pcap_header; /* This is needed for the pcap_next_ex() to work */ +}; + +/* + * This is a timeval as stored in a savefile. + * It has to use the same types everywhere, independent of the actual + * `struct timeval'; `struct timeval' has 32-bit tv_sec values on some + * platforms and 64-bit tv_sec values on other platforms, and writing + * out native `struct timeval' values would mean files could only be + * read on systems with the same tv_sec size as the system on which + * the file was written. + */ + +struct pcap_timeval { + bpf_int32 tv_sec; /* seconds */ + bpf_int32 tv_usec; /* microseconds */ +}; + +/* + * This is a `pcap_pkthdr' as actually stored in a savefile. + * + * Do not change the format of this structure, in any way (this includes + * changes that only affect the length of fields in this structure), + * and do not make the time stamp anything other than seconds and + * microseconds (e.g., seconds and nanoseconds). Instead: + * + * introduce a new structure for the new format; + * + * send mail to "tcpdump-workers@lists.tcpdump.org", requesting + * a new magic number for your new capture file format, and, when + * you get the new magic number, put it in "savefile.c"; + * + * use that magic number for save files with the changed record + * header; + * + * make the code in "savefile.c" capable of reading files with + * the old record header as well as files with the new record header + * (using the magic number to determine the header format). + * + * Then supply the changes as a patch at + * + * http://sourceforge.net/projects/libpcap/ + * + * so that future versions of libpcap and programs that use it (such as + * tcpdump) will be able to read your new capture file format. + */ + +struct pcap_sf_pkthdr { + struct pcap_timeval ts; /* time stamp */ + bpf_u_int32 caplen; /* length of portion present */ + bpf_u_int32 len; /* length this packet (off wire) */ +}; + +/* + * How a `pcap_pkthdr' is actually stored in savefiles written + * by some patched versions of libpcap (e.g. the ones in Red + * Hat Linux 6.1 and 6.2). + * + * Do not change the format of this structure, in any way (this includes + * changes that only affect the length of fields in this structure). + * Instead, introduce a new structure, as per the above. + */ + +struct pcap_sf_patched_pkthdr { + struct pcap_timeval ts; /* time stamp */ + bpf_u_int32 caplen; /* length of portion present */ + bpf_u_int32 len; /* length this packet (off wire) */ + int index; + unsigned short protocol; + unsigned char pkt_type; +}; + +/* + * User data structure for the one-shot callback used for pcap_next() + * and pcap_next_ex(). + */ +struct oneshot_userdata { + struct pcap_pkthdr *hdr; + const u_char **pkt; + pcap_t *pd; +}; + +int yylex(void); + +#ifndef min +#define min(a, b) ((a) > (b) ? (b) : (a)) +#endif + +/* XXX should these be in pcap.h? */ +int pcap_offline_read(pcap_t *, int, pcap_handler, u_char *); +int pcap_read(pcap_t *, int cnt, pcap_handler, u_char *); + +#ifndef HAVE_STRLCPY +#define strlcpy(x, y, z) \ + (strncpy((x), (y), (z)), \ + ((z) <= 0 ? 0 : ((x)[(z) - 1] = '\0')), \ + strlen((y))) +#endif + +#include + +#if !defined(HAVE_SNPRINTF) +#define snprintf pcap_snprintf +extern int snprintf (char *, size_t, const char *, ...); +#endif + +#if !defined(HAVE_VSNPRINTF) +#define vsnprintf pcap_vsnprintf +extern int vsnprintf (char *, size_t, const char *, va_list ap); +#endif + +/* + * Routines that most pcap implementations can use for non-blocking mode. + */ +#if !defined(WIN32) && !defined(MSDOS) +int pcap_getnonblock_fd(pcap_t *, char *); +int pcap_setnonblock_fd(pcap_t *p, int, char *); +#endif + +pcap_t *pcap_create_common(const char *, char *); +int pcap_do_addexit(pcap_t *); +void pcap_add_to_pcaps_to_close(pcap_t *); +void pcap_remove_from_pcaps_to_close(pcap_t *); +void pcap_cleanup_live_common(pcap_t *); +int pcap_not_initialized(pcap_t *); +int pcap_check_activated(pcap_t *); + +/* + * Internal interfaces for "pcap_findalldevs()". + * + * "pcap_platform_finddevs()" is a platform-dependent routine to + * add devices not found by the "standard" mechanisms (SIOCGIFCONF, + * "getifaddrs()", etc.. + * + * "pcap_add_if()" adds an interface to the list of interfaces. + */ +int pcap_platform_finddevs(pcap_if_t **, char *); +int add_addr_to_iflist(pcap_if_t **, const char *, u_int, struct sockaddr *, + size_t, struct sockaddr *, size_t, struct sockaddr *, size_t, + struct sockaddr *, size_t, char *); +int pcap_add_if(pcap_if_t **, const char *, u_int, const char *, char *); +struct sockaddr *dup_sockaddr(struct sockaddr *, size_t); +int add_or_find_if(pcap_if_t **, pcap_if_t **, const char *, u_int, + const char *, char *); + +#ifdef WIN32 +char *pcap_win32strerror(void); +#endif + +int install_bpf_program(pcap_t *, struct bpf_program *); + +int pcap_strcasecmp(const char *, const char *); + +#ifdef __cplusplus +} +#endif + +#endif only in patch2: unchanged: --- freebsd-utils-8.1.orig/debian/include/pcap-config.h +++ freebsd-utils-8.1/debian/include/pcap-config.h @@ -0,0 +1,38 @@ +#define HAVE_CLONING_BPF 1 +#define HAVE_DECL_ETHER_HOSTTON 1 +#define HAVE_ETHER_HOSTTON 1 +#define HAVE_FSEEKO 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_LIMITS_H 1 +#define HAVE_MEMORY_H 1 +#define HAVE_NETINET_ETHER_H 1 +#define HAVE_NETINET_IF_ETHER_H 1 +#define HAVE_NET_IF_MEDIA_H 1 +#define HAVE_PATHS_H 1 +#define HAVE_SNPRINTF 1 +#define HAVE_SOCKADDR_SA_LEN 1 +#define HAVE_SOCKADDR_STORAGE 1 +#define HAVE_SOCKLEN_T 1 +#define HAVE_STDINT_H 1 +#define HAVE_STDLIB_H 1 +#define HAVE_STRERROR 1 +#define HAVE_STRINGS_H 1 +#define HAVE_STRING_H 1 +#define HAVE_SYS_BITYPES_H 1 +#define HAVE_SYS_IOCCOM_H 1 +#define HAVE_SYS_SOCKIO_H 1 +#define HAVE_SYS_STAT_H 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_UNISTD_H 1 +#define HAVE_VERSION_H 1 +#define HAVE_VSNPRINTF 1 +#define HAVE___ATTRIBUTE__ 1 +#define INET6 1 +#define NETINET_ETHER_H_DECLARES_ETHER_HOSTTON +#define PACKAGE_BUGREPORT "" +#define PACKAGE_NAME "" +#define PACKAGE_STRING "" +#define PACKAGE_TARNAME "" +#define PACKAGE_VERSION "" +#define STDC_HEADERS 1 +#define inline inline only in patch2: unchanged: --- freebsd-utils-8.1.orig/debian/include/net/if_lagg.h +++ freebsd-utils-8.1/debian/include/net/if_lagg.h @@ -0,0 +1,243 @@ +/* $OpenBSD: if_trunk.h,v 1.11 2007/01/31 06:20:19 reyk Exp $ */ + +/* + * Copyright (c) 2005, 2006 Reyk Floeter + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * $FreeBSD$ + */ + +#ifndef _NET_LAGG_H +#define _NET_LAGG_H + +/* + * Global definitions + */ + +#define LAGG_MAX_PORTS 32 /* logically */ +#define LAGG_MAX_NAMESIZE 32 /* name of a protocol */ +#define LAGG_MAX_STACKING 4 /* maximum number of stacked laggs */ + +/* Port flags */ +#define LAGG_PORT_SLAVE 0x00000000 /* normal enslaved port */ +#define LAGG_PORT_MASTER 0x00000001 /* primary port */ +#define LAGG_PORT_STACK 0x00000002 /* stacked lagg port */ +#define LAGG_PORT_ACTIVE 0x00000004 /* port is active */ +#define LAGG_PORT_COLLECTING 0x00000008 /* port is receiving frames */ +#define LAGG_PORT_DISTRIBUTING 0x00000010 /* port is sending frames */ +#define LAGG_PORT_DISABLED 0x00000020 /* port is disabled */ +#define LAGG_PORT_BITS "\20\01MASTER\02STACK\03ACTIVE\04COLLECTING" \ + "\05DISTRIBUTING\06DISABLED" + +/* Supported lagg PROTOs */ +#define LAGG_PROTO_NONE 0 /* no lagg protocol defined */ +#define LAGG_PROTO_ROUNDROBIN 1 /* simple round robin */ +#define LAGG_PROTO_FAILOVER 2 /* active failover */ +#define LAGG_PROTO_LOADBALANCE 3 /* loadbalance */ +#define LAGG_PROTO_LACP 4 /* 802.3ad lacp */ +#define LAGG_PROTO_ETHERCHANNEL 5 /* Cisco FEC */ +#define LAGG_PROTO_MAX 6 + +struct lagg_protos { + const char *lpr_name; + int lpr_proto; +}; + +#define LAGG_PROTO_DEFAULT LAGG_PROTO_FAILOVER +#define LAGG_PROTOS { \ + { "failover", LAGG_PROTO_FAILOVER }, \ + { "fec", LAGG_PROTO_ETHERCHANNEL }, \ + { "lacp", LAGG_PROTO_LACP }, \ + { "loadbalance", LAGG_PROTO_LOADBALANCE }, \ + { "roundrobin", LAGG_PROTO_ROUNDROBIN }, \ + { "none", LAGG_PROTO_NONE }, \ + { "default", LAGG_PROTO_DEFAULT } \ +} + +/* + * lagg ioctls. + */ + +/* + * LACP current operational parameters structure. + */ +struct lacp_opreq { + uint16_t actor_prio; + uint8_t actor_mac[ETHER_ADDR_LEN]; + uint16_t actor_key; + uint16_t actor_portprio; + uint16_t actor_portno; + uint8_t actor_state; + uint16_t partner_prio; + uint8_t partner_mac[ETHER_ADDR_LEN]; + uint16_t partner_key; + uint16_t partner_portprio; + uint16_t partner_portno; + uint8_t partner_state; +}; + +/* lagg port settings */ +struct lagg_reqport { + char rp_ifname[IFNAMSIZ]; /* name of the lagg */ + char rp_portname[IFNAMSIZ]; /* name of the port */ + u_int32_t rp_prio; /* port priority */ + u_int32_t rp_flags; /* port flags */ + union { + struct lacp_opreq rpsc_lacp; + } rp_psc; +#define rp_lacpreq rp_psc.rpsc_lacp +}; + +#define SIOCGLAGGPORT _IOWR('i', 140, struct lagg_reqport) +#define SIOCSLAGGPORT _IOW('i', 141, struct lagg_reqport) +#define SIOCSLAGGDELPORT _IOW('i', 142, struct lagg_reqport) + +/* lagg, ports and options */ +struct lagg_reqall { + char ra_ifname[IFNAMSIZ]; /* name of the lagg */ + u_int ra_proto; /* lagg protocol */ + + size_t ra_size; /* size of buffer */ + struct lagg_reqport *ra_port; /* allocated buffer */ + int ra_ports; /* total port count */ + union { + struct lacp_opreq rpsc_lacp; + } ra_psc; +#define ra_lacpreq ra_psc.rpsc_lacp +}; + +#define SIOCGLAGG _IOWR('i', 143, struct lagg_reqall) +#define SIOCSLAGG _IOW('i', 144, struct lagg_reqall) + +#ifdef _KERNEL +/* + * Internal kernel part + */ + +#define lp_ifname lp_ifp->if_xname /* interface name */ +#define lp_link_state lp_ifp->if_link_state /* link state */ + +#define LAGG_PORTACTIVE(_tp) ( \ + ((_tp)->lp_link_state == LINK_STATE_UP) && \ + ((_tp)->lp_ifp->if_flags & IFF_UP) \ +) + +struct lagg_ifreq { + union { + struct ifreq ifreq; + struct { + char ifr_name[IFNAMSIZ]; + struct sockaddr_storage ifr_ss; + } ifreq_storage; + } ifreq; +}; + +#define sc_ifflags sc_ifp->if_flags /* flags */ +#define sc_ifname sc_ifp->if_xname /* name */ +#define sc_capabilities sc_ifp->if_capabilities /* capabilities */ + +#define IFCAP_LAGG_MASK 0xffff0000 /* private capabilities */ +#define IFCAP_LAGG_FULLDUPLEX 0x00010000 /* full duplex with >1 ports */ + +/* Private data used by the loadbalancing protocol */ +struct lagg_lb { + u_int32_t lb_key; + struct lagg_port *lb_ports[LAGG_MAX_PORTS]; +}; + +struct lagg_mc { + struct ifmultiaddr *mc_ifma; + SLIST_ENTRY(lagg_mc) mc_entries; +}; + +/* List of interfaces to have the MAC address modified */ +struct lagg_llq { + struct ifnet *llq_ifp; + uint8_t llq_lladdr[ETHER_ADDR_LEN]; + SLIST_ENTRY(lagg_llq) llq_entries; +}; + +struct lagg_softc { + struct ifnet *sc_ifp; /* virtual interface */ + struct rwlock sc_mtx; + int sc_proto; /* lagg protocol */ + u_int sc_count; /* number of ports */ + struct lagg_port *sc_primary; /* primary port */ + struct ifmedia sc_media; /* media config */ + caddr_t sc_psc; /* protocol data */ + uint32_t sc_seq; /* sequence counter */ + + SLIST_HEAD(__tplhd, lagg_port) sc_ports; /* list of interfaces */ + SLIST_ENTRY(lagg_softc) sc_entries; + + struct task sc_lladdr_task; + SLIST_HEAD(__llqhd, lagg_llq) sc_llq_head; /* interfaces to program + the lladdr on */ + + /* lagg protocol callbacks */ + int (*sc_detach)(struct lagg_softc *); + int (*sc_start)(struct lagg_softc *, struct mbuf *); + struct mbuf *(*sc_input)(struct lagg_softc *, struct lagg_port *, + struct mbuf *); + int (*sc_port_create)(struct lagg_port *); + void (*sc_port_destroy)(struct lagg_port *); + void (*sc_linkstate)(struct lagg_port *); + void (*sc_init)(struct lagg_softc *); + void (*sc_stop)(struct lagg_softc *); + void (*sc_lladdr)(struct lagg_softc *); + void (*sc_req)(struct lagg_softc *, caddr_t); + void (*sc_portreq)(struct lagg_port *, caddr_t); +}; + +struct lagg_port { + struct ifnet *lp_ifp; /* physical interface */ + struct lagg_softc *lp_softc; /* parent lagg */ + uint8_t lp_lladdr[ETHER_ADDR_LEN]; + + u_char lp_iftype; /* interface type */ + uint32_t lp_prio; /* port priority */ + uint32_t lp_flags; /* port flags */ + int lp_ifflags; /* saved ifp flags */ + void *lh_cookie; /* if state hook */ + caddr_t lp_psc; /* protocol data */ + int lp_detaching; /* ifnet is detaching */ + + SLIST_HEAD(__mclhd, lagg_mc) lp_mc_head; /* multicast addresses */ + + /* Redirected callbacks */ + int (*lp_ioctl)(struct ifnet *, u_long, caddr_t); + int (*lp_output)(struct ifnet *, struct mbuf *, struct sockaddr *, + struct route *); + + SLIST_ENTRY(lagg_port) lp_entries; +}; + +#define LAGG_LOCK_INIT(_sc) rw_init(&(_sc)->sc_mtx, "if_lagg rwlock") +#define LAGG_LOCK_DESTROY(_sc) rw_destroy(&(_sc)->sc_mtx) +#define LAGG_RLOCK(_sc) rw_rlock(&(_sc)->sc_mtx) +#define LAGG_WLOCK(_sc) rw_wlock(&(_sc)->sc_mtx) +#define LAGG_RUNLOCK(_sc) rw_runlock(&(_sc)->sc_mtx) +#define LAGG_WUNLOCK(_sc) rw_wunlock(&(_sc)->sc_mtx) +#define LAGG_RLOCK_ASSERT(_sc) rw_assert(&(_sc)->sc_mtx, RA_RLOCKED) +#define LAGG_WLOCK_ASSERT(_sc) rw_assert(&(_sc)->sc_mtx, RA_WLOCKED) + +extern struct mbuf *(*lagg_input_p)(struct ifnet *, struct mbuf *); +extern void (*lagg_linkstate_p)(struct ifnet *, int ); + +int lagg_enqueue(struct ifnet *, struct mbuf *); +uint32_t lagg_hashmbuf(struct mbuf *, uint32_t); + +#endif /* _KERNEL */ + +#endif /* _NET_LAGG_H */ only in patch2: unchanged: --- freebsd-utils-8.1.orig/debian/include/net/if_bridgevar.h +++ freebsd-utils-8.1/debian/include/net/if_bridgevar.h @@ -0,0 +1,328 @@ +/* $NetBSD: if_bridgevar.h,v 1.4 2003/07/08 07:13:50 itojun Exp $ */ + +/* + * Copyright 2001 Wasabi Systems, Inc. + * All rights reserved. + * + * Written by Jason R. Thorpe for Wasabi Systems, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed for the NetBSD Project by + * Wasabi Systems, Inc. + * 4. The name of Wasabi Systems, Inc. may not be used to endorse + * or promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * Copyright (c) 1999, 2000 Jason L. Wright (jason@thought.net) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Jason L. Wright + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * OpenBSD: if_bridge.h,v 1.14 2001/03/22 03:48:29 jason Exp + * + * $FreeBSD$ + */ + +/* + * Data structure and control definitions for bridge interfaces. + */ + +#include +#include +#include + +/* + * Commands used in the SIOCSDRVSPEC ioctl. Note the lookup of the + * bridge interface itself is keyed off the ifdrv structure. + */ +#define BRDGADD 0 /* add bridge member (ifbreq) */ +#define BRDGDEL 1 /* delete bridge member (ifbreq) */ +#define BRDGGIFFLGS 2 /* get member if flags (ifbreq) */ +#define BRDGSIFFLGS 3 /* set member if flags (ifbreq) */ +#define BRDGSCACHE 4 /* set cache size (ifbrparam) */ +#define BRDGGCACHE 5 /* get cache size (ifbrparam) */ +#define BRDGGIFS 6 /* get member list (ifbifconf) */ +#define BRDGRTS 7 /* get address list (ifbaconf) */ +#define BRDGSADDR 8 /* set static address (ifbareq) */ +#define BRDGSTO 9 /* set cache timeout (ifbrparam) */ +#define BRDGGTO 10 /* get cache timeout (ifbrparam) */ +#define BRDGDADDR 11 /* delete address (ifbareq) */ +#define BRDGFLUSH 12 /* flush address cache (ifbreq) */ + +#define BRDGGPRI 13 /* get priority (ifbrparam) */ +#define BRDGSPRI 14 /* set priority (ifbrparam) */ +#define BRDGGHT 15 /* get hello time (ifbrparam) */ +#define BRDGSHT 16 /* set hello time (ifbrparam) */ +#define BRDGGFD 17 /* get forward delay (ifbrparam) */ +#define BRDGSFD 18 /* set forward delay (ifbrparam) */ +#define BRDGGMA 19 /* get max age (ifbrparam) */ +#define BRDGSMA 20 /* set max age (ifbrparam) */ +#define BRDGSIFPRIO 21 /* set if priority (ifbreq) */ +#define BRDGSIFCOST 22 /* set if path cost (ifbreq) */ +#define BRDGADDS 23 /* add bridge span member (ifbreq) */ +#define BRDGDELS 24 /* delete bridge span member (ifbreq) */ +#define BRDGPARAM 25 /* get bridge STP params (ifbropreq) */ +#define BRDGGRTE 26 /* get cache drops (ifbrparam) */ +#define BRDGGIFSSTP 27 /* get member STP params list + * (ifbpstpconf) */ +#define BRDGSPROTO 28 /* set protocol (ifbrparam) */ +#define BRDGSTXHC 29 /* set tx hold count (ifbrparam) */ +#define BRDGSIFAMAX 30 /* set max interface addrs (ifbreq) */ + +/* + * Generic bridge control request. + */ +struct ifbreq { + char ifbr_ifsname[IFNAMSIZ]; /* member if name */ + uint32_t ifbr_ifsflags; /* member if flags */ + uint32_t ifbr_stpflags; /* member if STP flags */ + uint32_t ifbr_path_cost; /* member if STP cost */ + uint8_t ifbr_portno; /* member if port number */ + uint8_t ifbr_priority; /* member if STP priority */ + uint8_t ifbr_proto; /* member if STP protocol */ + uint8_t ifbr_role; /* member if STP role */ + uint8_t ifbr_state; /* member if STP state */ + uint32_t ifbr_addrcnt; /* member if addr number */ + uint32_t ifbr_addrmax; /* member if addr max */ + uint32_t ifbr_addrexceeded; /* member if addr violations */ + uint8_t pad[32]; +}; + +/* BRDGGIFFLAGS, BRDGSIFFLAGS */ +#define IFBIF_LEARNING 0x0001 /* if can learn */ +#define IFBIF_DISCOVER 0x0002 /* if sends packets w/ unknown dest. */ +#define IFBIF_STP 0x0004 /* if participates in spanning tree */ +#define IFBIF_SPAN 0x0008 /* if is a span port */ +#define IFBIF_STICKY 0x0010 /* if learned addresses stick */ +#define IFBIF_BSTP_EDGE 0x0020 /* member stp edge port */ +#define IFBIF_BSTP_AUTOEDGE 0x0040 /* member stp autoedge enabled */ +#define IFBIF_BSTP_PTP 0x0080 /* member stp point to point */ +#define IFBIF_BSTP_AUTOPTP 0x0100 /* member stp autoptp enabled */ +#define IFBIF_BSTP_ADMEDGE 0x0200 /* member stp admin edge enabled */ +#define IFBIF_BSTP_ADMCOST 0x0400 /* member stp admin path cost */ +#define IFBIF_PRIVATE 0x0800 /* if is a private segment */ + +#define IFBIFBITS "\020\001LEARNING\002DISCOVER\003STP\004SPAN" \ + "\005STICKY\014PRIVATE\006EDGE\007AUTOEDGE\010PTP" \ + "\011AUTOPTP" +#define IFBIFMASK ~(IFBIF_BSTP_EDGE|IFBIF_BSTP_AUTOEDGE|IFBIF_BSTP_PTP| \ + IFBIF_BSTP_AUTOPTP|IFBIF_BSTP_ADMEDGE| \ + IFBIF_BSTP_ADMCOST) /* not saved */ + +/* BRDGFLUSH */ +#define IFBF_FLUSHDYN 0x00 /* flush learned addresses only */ +#define IFBF_FLUSHALL 0x01 /* flush all addresses */ + +/* + * Interface list structure. + */ +struct ifbifconf { + uint32_t ifbic_len; /* buffer size */ + union { + caddr_t ifbicu_buf; + struct ifbreq *ifbicu_req; + } ifbic_ifbicu; +#define ifbic_buf ifbic_ifbicu.ifbicu_buf +#define ifbic_req ifbic_ifbicu.ifbicu_req +}; + +/* + * Bridge address request. + */ +struct ifbareq { + char ifba_ifsname[IFNAMSIZ]; /* member if name */ + unsigned long ifba_expire; /* address expire time */ + uint8_t ifba_flags; /* address flags */ + uint8_t ifba_dst[ETHER_ADDR_LEN];/* destination address */ + uint16_t ifba_vlan; /* vlan id */ +}; + +#define IFBAF_TYPEMASK 0x03 /* address type mask */ +#define IFBAF_DYNAMIC 0x00 /* dynamically learned address */ +#define IFBAF_STATIC 0x01 /* static address */ +#define IFBAF_STICKY 0x02 /* sticky address */ + +#define IFBAFBITS "\020\1STATIC\2STICKY" + +/* + * Address list structure. + */ +struct ifbaconf { + uint32_t ifbac_len; /* buffer size */ + union { + caddr_t ifbacu_buf; + struct ifbareq *ifbacu_req; + } ifbac_ifbacu; +#define ifbac_buf ifbac_ifbacu.ifbacu_buf +#define ifbac_req ifbac_ifbacu.ifbacu_req +}; + +/* + * Bridge parameter structure. + */ +struct ifbrparam { + union { + uint32_t ifbrpu_int32; + uint16_t ifbrpu_int16; + uint8_t ifbrpu_int8; + } ifbrp_ifbrpu; +}; +#define ifbrp_csize ifbrp_ifbrpu.ifbrpu_int32 /* cache size */ +#define ifbrp_ctime ifbrp_ifbrpu.ifbrpu_int32 /* cache time (sec) */ +#define ifbrp_prio ifbrp_ifbrpu.ifbrpu_int16 /* bridge priority */ +#define ifbrp_proto ifbrp_ifbrpu.ifbrpu_int8 /* bridge protocol */ +#define ifbrp_txhc ifbrp_ifbrpu.ifbrpu_int8 /* bpdu tx holdcount */ +#define ifbrp_hellotime ifbrp_ifbrpu.ifbrpu_int8 /* hello time (sec) */ +#define ifbrp_fwddelay ifbrp_ifbrpu.ifbrpu_int8 /* fwd time (sec) */ +#define ifbrp_maxage ifbrp_ifbrpu.ifbrpu_int8 /* max age (sec) */ +#define ifbrp_cexceeded ifbrp_ifbrpu.ifbrpu_int32 /* # of cache dropped + * adresses */ +/* + * Bridge current operational parameters structure. + */ +struct ifbropreq { + uint8_t ifbop_holdcount; + uint8_t ifbop_maxage; + uint8_t ifbop_hellotime; + uint8_t ifbop_fwddelay; + uint8_t ifbop_protocol; + uint16_t ifbop_priority; + uint16_t ifbop_root_port; + uint32_t ifbop_root_path_cost; + uint64_t ifbop_bridgeid; + uint64_t ifbop_designated_root; + uint64_t ifbop_designated_bridge; + struct timeval ifbop_last_tc_time; +}; + +/* + * Bridge member operational STP params structure. + */ +struct ifbpstpreq { + uint8_t ifbp_portno; /* bp STP port number */ + uint32_t ifbp_fwd_trans; /* bp STP fwd transitions */ + uint32_t ifbp_design_cost; /* bp STP designated cost */ + uint32_t ifbp_design_port; /* bp STP designated port */ + uint64_t ifbp_design_bridge; /* bp STP designated bridge */ + uint64_t ifbp_design_root; /* bp STP designated root */ +}; + +/* + * Bridge STP ports list structure. + */ +struct ifbpstpconf { + uint32_t ifbpstp_len; /* buffer size */ + union { + caddr_t ifbpstpu_buf; + struct ifbpstpreq *ifbpstpu_req; + } ifbpstp_ifbpstpu; +#define ifbpstp_buf ifbpstp_ifbpstpu.ifbpstpu_buf +#define ifbpstp_req ifbpstp_ifbpstpu.ifbpstpu_req +}; + +#ifdef _KERNEL + +#define BRIDGE_LOCK_INIT(_sc) do { \ + mtx_init(&(_sc)->sc_mtx, "if_bridge", NULL, MTX_DEF); \ + cv_init(&(_sc)->sc_cv, "if_bridge_cv"); \ +} while (0) +#define BRIDGE_LOCK_DESTROY(_sc) do { \ + mtx_destroy(&(_sc)->sc_mtx); \ + cv_destroy(&(_sc)->sc_cv); \ +} while (0) +#define BRIDGE_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) +#define BRIDGE_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx) +#define BRIDGE_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->sc_mtx, MA_OWNED) +#define BRIDGE_LOCK2REF(_sc, _err) do { \ + mtx_assert(&(_sc)->sc_mtx, MA_OWNED); \ + if ((_sc)->sc_iflist_xcnt > 0) \ + (_err) = EBUSY; \ + else \ + (_sc)->sc_iflist_ref++; \ + mtx_unlock(&(_sc)->sc_mtx); \ +} while (0) +#define BRIDGE_UNREF(_sc) do { \ + mtx_lock(&(_sc)->sc_mtx); \ + (_sc)->sc_iflist_ref--; \ + if (((_sc)->sc_iflist_xcnt > 0) && ((_sc)->sc_iflist_ref == 0)) \ + cv_broadcast(&(_sc)->sc_cv); \ + mtx_unlock(&(_sc)->sc_mtx); \ +} while (0) +#define BRIDGE_XLOCK(_sc) do { \ + mtx_assert(&(_sc)->sc_mtx, MA_OWNED); \ + (_sc)->sc_iflist_xcnt++; \ + while ((_sc)->sc_iflist_ref > 0) \ + cv_wait(&(_sc)->sc_cv, &(_sc)->sc_mtx); \ +} while (0) +#define BRIDGE_XDROP(_sc) do { \ + mtx_assert(&(_sc)->sc_mtx, MA_OWNED); \ + (_sc)->sc_iflist_xcnt--; \ +} while (0) + +#define BRIDGE_INPUT(_ifp, _m) do { \ + KASSERT(bridge_input_p != NULL, \ + ("%s: if_bridge not loaded!", __func__)); \ + _m = (*bridge_input_p)(_ifp, _m); \ + if (_m != NULL) \ + _ifp = _m->m_pkthdr.rcvif; \ +} while (0) + +#define BRIDGE_OUTPUT(_ifp, _m, _err) do { \ + KASSERT(bridge_output_p != NULL, \ + ("%s: if_bridge not loaded!", __func__)); \ + _err = (*bridge_output_p)(_ifp, _m, NULL, NULL); \ +} while (0) + +extern struct mbuf *(*bridge_input_p)(struct ifnet *, struct mbuf *); +extern int (*bridge_output_p)(struct ifnet *, struct mbuf *, + struct sockaddr *, struct rtentry *); +extern void (*bridge_dn_p)(struct mbuf *, struct ifnet *); + +#endif /* _KERNEL */ only in patch2: unchanged: --- freebsd-utils-8.1.orig/debian/include/net/if.h +++ freebsd-utils-8.1/debian/include/net/if.h @@ -0,0 +1,449 @@ +/*- + * Copyright (c) 1982, 1986, 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)if.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/net/if.h,v 1.108 2007/06/11 20:08:11 andre Exp $ + */ + +#ifndef _NET_IF_H_ +#define _NET_IF_H_ + +#include + +#include + +#include +#include + +struct ifnet; + +/* + * Length of interface external name, including terminating '\0'. + * Note: this is the same size as a generic device's external name. + */ +#define IF_NAMESIZE 16 +#define IFNAMSIZ IF_NAMESIZE +#define IF_MAXUNIT 0x7fff /* historical value */ + +/* + * Structure used to query names of interface cloners. + */ + +struct if_clonereq { + int ifcr_total; /* total cloners (out) */ + int ifcr_count; /* room for this many in user buffer */ + char *ifcr_buffer; /* buffer for cloner names */ +}; + +/* + * Structure describing information about an interface + * which may be of interest to management entities. + */ +struct if_data { + /* generic interface information */ + unsigned char ifi_type; /* ethernet, tokenring, etc */ + unsigned char ifi_physical; /* e.g., AUI, Thinnet, 10base-T, etc */ + unsigned char ifi_addrlen; /* media address length */ + unsigned char ifi_hdrlen; /* media header length */ + unsigned char ifi_link_state; /* current link state */ + unsigned char ifi_spare_char1; /* spare byte */ + unsigned char ifi_spare_char2; /* spare byte */ + unsigned char ifi_datalen; /* length of this data struct */ + unsigned long ifi_mtu; /* maximum transmission unit */ + unsigned long ifi_metric; /* routing metric (external only) */ + unsigned long ifi_baudrate; /* linespeed */ + /* volatile statistics */ + unsigned long ifi_ipackets; /* packets received on interface */ + unsigned long ifi_ierrors; /* input errors on interface */ + unsigned long ifi_opackets; /* packets sent on interface */ + unsigned long ifi_oerrors; /* output errors on interface */ + unsigned long ifi_collisions; /* collisions on csma interfaces */ + unsigned long ifi_ibytes; /* total number of octets received */ + unsigned long ifi_obytes; /* total number of octets sent */ + unsigned long ifi_imcasts; /* packets received via multicast */ + unsigned long ifi_omcasts; /* packets sent via multicast */ + unsigned long ifi_iqdrops; /* dropped on input, this interface */ + unsigned long ifi_noproto; /* destined for unsupported protocol */ + unsigned long ifi_hwassist; /* HW offload capabilities, see IFCAP */ + time_t ifi_epoch; /* uptime at attach or stat reset */ + struct timeval ifi_lastchange; /* time of last administrative change */ +}; + +/*- + * Interface flags are of two types: network stack owned flags, and driver + * owned flags. Historically, these values were stored in the same ifnet + * flags field, but with the advent of fine-grained locking, they have been + * broken out such that the network stack is responsible for synchronizing + * the stack-owned fields, and the device driver the device-owned fields. + * Both halves can perform lockless reads of the other half's field, subject + * to accepting the involved races. + * + * Both sets of flags come from the same number space, and should not be + * permitted to conflict, as they are exposed to user space via a single + * field. + * + * The following symbols identify read and write requirements for fields: + * + * (i) if_flags field set by device driver before attach, read-only there + * after. + * (n) if_flags field written only by the network stack, read by either the + * stack or driver. + * (d) if_drv_flags field written only by the device driver, read by either + * the stack or driver. + */ +#define IFF_UP 0x1 /* (n) interface is up */ +#define IFF_BROADCAST 0x2 /* (i) broadcast address valid */ +#define IFF_DEBUG 0x4 /* (n) turn on debugging */ +#define IFF_LOOPBACK 0x8 /* (i) is a loopback net */ +#define IFF_POINTOPOINT 0x10 /* (i) is a point-to-point link */ +#define IFF_SMART 0x20 /* (i) interface manages own routes */ +#define IFF_DRV_RUNNING 0x40 /* (d) resources allocated */ +#define IFF_NOARP 0x80 /* (n) no address resolution protocol */ +#define IFF_PROMISC 0x100 /* (n) receive all packets */ +#define IFF_ALLMULTI 0x200 /* (n) receive all multicast packets */ +#define IFF_DRV_OACTIVE 0x400 /* (d) tx hardware queue is full */ +#define IFF_SIMPLEX 0x800 /* (i) can't hear own transmissions */ +#define IFF_LINK0 0x1000 /* per link layer defined bit */ +#define IFF_LINK1 0x2000 /* per link layer defined bit */ +#define IFF_LINK2 0x4000 /* per link layer defined bit */ +#define IFF_ALTPHYS IFF_LINK2 /* use alternate physical connection */ +#define IFF_MULTICAST 0x8000 /* (i) supports multicast */ +/* 0x10000 */ +#define IFF_PPROMISC 0x20000 /* (n) user-requested promisc mode */ +#define IFF_MONITOR 0x40000 /* (n) user-requested monitor mode */ +#define IFF_STATICARP 0x80000 /* (n) static ARP */ +#define IFF_NEEDSGIANT 0x100000 /* (i) hold Giant over if_start calls */ +#define IFF_DYING 0x200000 /* (n) interface is winding down */ +#define IFF_RENAMING 0x400000 /* (n) interface is being renamed */ + +/* + * Old names for driver flags so that user space tools can continue to use + * the old (portable) names. + */ +#ifndef _KERNEL +#define IFF_RUNNING IFF_DRV_RUNNING +#define IFF_OACTIVE IFF_DRV_OACTIVE +#endif + +/* flags set internally only: */ +#define IFF_CANTCHANGE \ + (IFF_BROADCAST|IFF_POINTOPOINT|IFF_DRV_RUNNING|IFF_DRV_OACTIVE|\ + IFF_SIMPLEX|IFF_MULTICAST|IFF_ALLMULTI|IFF_SMART|IFF_PROMISC) + +/* + * Values for if_link_state. + */ +#define LINK_STATE_UNKNOWN 0 /* link invalid/unknown */ +#define LINK_STATE_DOWN 1 /* link is down */ +#define LINK_STATE_UP 2 /* link is up */ + +/* + * Some convenience macros used for setting ifi_baudrate. + * XXX 1000 vs. 1024? --thorpej@netbsd.org + */ +#define IF_Kbps(x) ((x) * 1000) /* kilobits/sec. */ +#define IF_Mbps(x) (IF_Kbps((x) * 1000)) /* megabits/sec. */ +#define IF_Gbps(x) (IF_Mbps((x) * 1000)) /* gigabits/sec. */ + +/* + * Capabilities that interfaces can advertise. + * + * struct ifnet.if_capabilities + * contains the optional features & capabilities a particular interface + * supports (not only the driver but also the detected hw revision). + * Capabilities are defined by IFCAP_* below. + * struct ifnet.if_capenable + * contains the enabled (either by default or through ifconfig) optional + * features & capabilities on this interface. + * Capabilities are defined by IFCAP_* below. + * struct if_data.ifi_hwassist in mbuf CSUM_ flag form, controlled by above + * contains the enabled optional feature & capabilites that can be used + * individually per packet and are specified in the mbuf pkthdr.csum_flags + * field. IFCAP_* and CSUM_* do not match one to one and CSUM_* may be + * more detailed or differenciated than IFCAP_*. + * Hwassist features are defined CSUM_* in sys/mbuf.h + */ +#define IFCAP_RXCSUM 0x00001 /* can offload checksum on RX */ +#define IFCAP_TXCSUM 0x00002 /* can offload checksum on TX */ +#define IFCAP_NETCONS 0x00004 /* can be a network console */ +#define IFCAP_VLAN_MTU 0x00008 /* VLAN-compatible MTU */ +#define IFCAP_VLAN_HWTAGGING 0x00010 /* hardware VLAN tag support */ +#define IFCAP_JUMBO_MTU 0x00020 /* 9000 byte MTU supported */ +#define IFCAP_POLLING 0x00040 /* driver supports polling */ +#define IFCAP_VLAN_HWCSUM 0x00080 /* can do IFCAP_HWCSUM on VLANs */ +#define IFCAP_TSO4 0x00100 /* can do TCP Segmentation Offload */ +#define IFCAP_TSO6 0x00200 /* can do TCP6 Segmentation Offload */ +#define IFCAP_LRO 0x00400 /* can do Large Receive Offload */ +#define IFCAP_WOL_UCAST 0x00800 /* wake on any unicast frame */ +#define IFCAP_WOL_MCAST 0x01000 /* wake on any multicast frame */ +#define IFCAP_WOL_MAGIC 0x02000 /* wake on any Magic Packet */ +#define IFCAP_TOE4 0x04000 /* interface can offload TCP */ +#define IFCAP_TOE6 0x08000 /* interface can offload TCP6 */ +#define IFCAP_VLAN_HWFILTER 0x10000 /* interface hw can filter vlan tag */ +#define IFCAP_POLLING_NOCOUNT 0x20000 /* polling ticks cannot be fragmented */ +#define IFCAP_VLAN_HWTSO 0x40000 /* can do IFCAP_TSO on VLANs */ +#define IFCAP_LINKSTATE 0x80000 /* the runtime link state is dynamic */ + +#define IFCAP_HWCSUM (IFCAP_RXCSUM | IFCAP_TXCSUM) +#define IFCAP_TSO (IFCAP_TSO4 | IFCAP_TSO6) +#define IFCAP_WOL (IFCAP_WOL_UCAST | IFCAP_WOL_MCAST | IFCAP_WOL_MAGIC) +#define IFCAP_TOE (IFCAP_TOE4 | IFCAP_TOE6) + +#define IFQ_MAXLEN 50 +#define IFNET_SLOWHZ 1 /* granularity is 1 second */ + +/* + * Message format for use in obtaining information about interfaces + * from getkerninfo and the routing socket + */ +struct if_msghdr { + unsigned short ifm_msglen; /* to skip over non-understood messages */ + unsigned char ifm_version; /* future binary compatibility */ + unsigned char ifm_type; /* message type */ + int ifm_addrs; /* like rtm_addrs */ + int ifm_flags; /* value of if_flags */ + unsigned short ifm_index; /* index for associated ifp */ + struct if_data ifm_data;/* statistics and other data about if */ +}; + +/* + * Message format for use in obtaining information about interface addresses + * from getkerninfo and the routing socket + */ +struct ifa_msghdr { + unsigned short ifam_msglen; /* to skip over non-understood messages */ + unsigned char ifam_version; /* future binary compatibility */ + unsigned char ifam_type; /* message type */ + int ifam_addrs; /* like rtm_addrs */ + int ifam_flags; /* value of ifa_flags */ + unsigned short ifam_index; /* index for associated ifp */ + int ifam_metric; /* value of ifa_metric */ +}; + +/* + * Message format for use in obtaining information about multicast addresses + * from the routing socket + */ +struct ifma_msghdr { + unsigned short ifmam_msglen; /* to skip over non-understood messages */ + unsigned char ifmam_version; /* future binary compatibility */ + unsigned char ifmam_type; /* message type */ + int ifmam_addrs; /* like rtm_addrs */ + int ifmam_flags; /* value of ifa_flags */ + unsigned short ifmam_index; /* index for associated ifp */ +}; + +/* + * Message format announcing the arrival or departure of a network interface. + */ +struct if_announcemsghdr { + unsigned short ifan_msglen; /* to skip over non-understood messages */ + unsigned char ifan_version; /* future binary compatibility */ + unsigned char ifan_type; /* message type */ + unsigned short ifan_index; /* index for associated ifp */ + char ifan_name[IFNAMSIZ]; /* if name, e.g. "en0" */ + unsigned short ifan_what; /* what type of announcement */ +}; + +#define IFAN_ARRIVAL 0 /* interface arrival */ +#define IFAN_DEPARTURE 1 /* interface departure */ + +/* + * Buffer with length to be used in SIOCGIFDESCR/SIOCSIFDESCR requests + */ +struct ifreq_buffer { + size_t length; + void *buffer; +}; + +/* + * Interface request structure used for socket + * ioctl's. All interface ioctl's must have parameter + * definitions which begin with ifr_name. The + * remainder may be interface specific. + */ +struct ifreq { + char ifr_name[IFNAMSIZ]; /* if name, e.g. "en0" */ + union { + struct sockaddr ifru_addr; + struct sockaddr ifru_dstaddr; + struct sockaddr ifru_broadaddr; + struct sockaddr ifru_netmask; + struct ifreq_buffer ifru_buffer; + short ifru_flags[2]; + short ifru_index; + int ifru_jid; + int ifru_metric; + int ifru_mtu; + int ifru_phys; + int ifru_media; + char * ifru_data; + int ifru_cap[2]; + } ifr_ifru; +#define ifr_addr ifr_ifru.ifru_addr /* address */ +#define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-to-p link */ +#define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */ +#define ifr_netmask ifr_ifru.ifru_netmask /* interface net mask */ +#define ifr_buffer ifr_ifru.ifru_buffer /* user supplied buffer with its length */ +#define ifr_flags ifr_ifru.ifru_flags[0] /* flags (low 16 bits) */ +#define ifr_flagshigh ifr_ifru.ifru_flags[1] /* flags (high 16 bits) */ +#define ifr_jid ifr_ifru.ifru_jid /* jail/vnet */ +#define ifr_metric ifr_ifru.ifru_metric /* metric */ +#define ifr_mtu ifr_ifru.ifru_mtu /* mtu */ +#define ifr_phys ifr_ifru.ifru_phys /* physical wire */ +#define ifr_media ifr_ifru.ifru_media /* physical media */ +#define ifr_data ifr_ifru.ifru_data /* for use by interface */ +#define ifr_reqcap ifr_ifru.ifru_cap[0] /* requested capabilities */ +#define ifr_curcap ifr_ifru.ifru_cap[1] /* current capabilities */ +#define ifr_index ifr_ifru.ifru_index /* interface index */ +}; + +#define _SIZEOF_ADDR_IFREQ(ifr) \ + ((ifr).ifr_addr.sa_len > sizeof(struct sockaddr) ? \ + (sizeof(struct ifreq) - sizeof(struct sockaddr) + \ + (ifr).ifr_addr.sa_len) : sizeof(struct ifreq)) + +struct ifaliasreq { + char ifra_name[IFNAMSIZ]; /* if name, e.g. "en0" */ + struct sockaddr ifra_addr; + struct sockaddr ifra_broadaddr; + struct sockaddr ifra_mask; +}; + +struct ifmediareq { + char ifm_name[IFNAMSIZ]; /* if name, e.g. "en0" */ + int ifm_current; /* current media options */ + int ifm_mask; /* don't care mask */ + int ifm_status; /* media status */ + int ifm_active; /* active options */ + int ifm_count; /* # entries in ifm_ulist array */ + int *ifm_ulist; /* media words */ +}; + +struct ifdrv { + char ifd_name[IFNAMSIZ]; /* if name, e.g. "en0" */ + unsigned long ifd_cmd; + size_t ifd_len; + void *ifd_data; +}; + +/* + * Structure used to retrieve aux status data from interfaces. + * Kernel suppliers to this interface should respect the formatting + * needed by ifconfig(8): each line starts with a TAB and ends with + * a newline. The canonical example to copy and paste is in if_tun.c. + */ + +#define IFSTATMAX 800 /* 10 lines of text */ +struct ifstat { + char ifs_name[IFNAMSIZ]; /* if name, e.g. "en0" */ + char ascii[IFSTATMAX + 1]; +}; + +/* + * Structure used in SIOCGIFCONF request. + * Used to retrieve interface configuration + * for machine (useful for programs which + * must know all networks accessible). + */ +struct ifconf { + int ifc_len; /* size of associated buffer */ + union { + char *ifcu_buf; + struct ifreq *ifcu_req; + } ifc_ifcu; +#define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */ +#define ifc_req ifc_ifcu.ifcu_req /* array of structures returned */ +}; + +#if defined (__amd64__) || defined (COMPAT_32BIT) +struct ifconf32 { + int ifc_len; /* size of associated buffer */ + union { + unsigned int ifcu_buf; + unsigned int ifcu_req; + } ifc_ifcu; +}; +#endif + +/* + * interface groups + */ + +#define IFG_ALL "all" /* group contains all interfaces */ +/* XXX: will we implement this? */ +#define IFG_EGRESS "egress" /* if(s) default route(s) point to */ + +struct ifg_req { + union { + char ifgrqu_group[IFNAMSIZ]; + char ifgrqu_member[IFNAMSIZ]; + } ifgrq_ifgrqu; +#define ifgrq_group ifgrq_ifgrqu.ifgrqu_group +#define ifgrq_member ifgrq_ifgrqu.ifgrqu_member +}; + +/* + * Used to lookup groups for an interface + */ +struct ifgroupreq { + char ifgr_name[IFNAMSIZ]; + unsigned int ifgr_len; + union { + char ifgru_group[IFNAMSIZ]; + struct ifg_req *ifgru_groups; + } ifgr_ifgru; +#define ifgr_group ifgr_ifgru.ifgru_group +#define ifgr_groups ifgr_ifgru.ifgru_groups +}; + +/* + * Structure for SIOC[AGD]LIFADDR + */ +struct if_laddrreq { + char iflr_name[IFNAMSIZ]; + unsigned int flags; +#define IFLR_PREFIX 0x8000 /* in: prefix given out: kernel fills id */ + unsigned int prefixlen; /* in/out */ + struct sockaddr_storage addr; /* in/out */ + struct sockaddr_storage dstaddr; /* out */ +}; + +struct if_nameindex { + unsigned int if_index; /* 1, 2, ... */ + char *if_name; /* null terminated name: "le0", ... */ +}; + +__BEGIN_DECLS +void if_freenameindex(struct if_nameindex *); +char *if_indextoname(unsigned int, char *); +struct if_nameindex *if_nameindex(void); +unsigned int if_nametoindex(const char *); +__END_DECLS + +#endif /* !_NET_IF_H_ */ only in patch2: unchanged: --- freebsd-utils-8.1.orig/usr.sbin/Makefile.inc +++ freebsd-utils-8.1/usr.sbin/Makefile.inc @@ -0,0 +1,4 @@ +# @(#)Makefile.inc 8.1 (Berkeley) 6/6/93 +# $FreeBSD$ + +BINDIR?= /usr/sbin only in patch2: unchanged: --- freebsd-utils-8.1.orig/usr.sbin/ftp-proxy/Makefile.inc +++ freebsd-utils-8.1/usr.sbin/ftp-proxy/Makefile.inc @@ -0,0 +1,5 @@ +# $FreeBSD$ + +LIBEVENT= ${.OBJDIR}/../libevent/libevent.a + +.include "../Makefile.inc" \ No newline at end of file only in patch2: unchanged: --- freebsd-utils-8.1.orig/usr.sbin/ftp-proxy/Makefile +++ freebsd-utils-8.1/usr.sbin/ftp-proxy/Makefile @@ -0,0 +1,5 @@ +# $FreeBSD$ + +SUBDIR= libevent ftp-proxy + +.include only in patch2: unchanged: --- freebsd-utils-8.1.orig/usr.sbin/ftp-proxy/ftp-proxy/Makefile +++ freebsd-utils-8.1/usr.sbin/ftp-proxy/ftp-proxy/Makefile @@ -0,0 +1,18 @@ +# $FreeBSD$ + +.PATH: ${.CURDIR}/../../../contrib/pf/ftp-proxy + +PROG= ftp-proxy +MAN= ftp-proxy.8 + +SRCS= ftp-proxy.c filter.c + +CFLAGS+= -I${.CURDIR}/../../../contrib/pf/libevent +CFLAGS+= -I${.CURDIR}/../../../sys/contrib/pf + +DPADD= ${LIBEVENT} +LDADD= ${LIBEVENT} + +WARNS?= 2 + +.include only in patch2: unchanged: --- freebsd-utils-8.1.orig/usr.sbin/ftp-proxy/libevent/Makefile +++ freebsd-utils-8.1/usr.sbin/ftp-proxy/libevent/Makefile @@ -0,0 +1,25 @@ +# $FreeBSD$ + +.PATH: ${.CURDIR}/../../../contrib/pf/libevent + + +LIB= event +INTERNALLIB=yes +SRCS= buffer.c evbuffer.c event.c kqueue.c log.c poll.c select.c signal.c +HDRS= event.h + +CFLAGS+= -I${.CURDIR} \ + -DHAVE_CLOCK_GETTIME \ + -DHAVE_FCNTL_H \ + -DHAVE_POLL \ + -DHAVE_SELECT \ + -DHAVE_SETFD \ + -DHAVE_STDARG_H \ + -DHAVE_SYS_IOCTL_H \ + -DHAVE_SYS_TIME_H \ + -DHAVE_UNISTD_H \ + -DHAVE_VASPRINTF \ + -DHAVE_WORKING_KQUEUE \ + -DVERSION='"1.3b"' + +.include only in patch2: unchanged: --- freebsd-utils-8.1.orig/sbin/pflogd/Makefile +++ freebsd-utils-8.1/sbin/pflogd/Makefile @@ -0,0 +1,14 @@ +# $FreeBSD$ + +.PATH: ${.CURDIR}/../../contrib/pf/pflogd + +PROG= pflogd +SRCS= pflogd.c pidfile.c privsep.c privsep_fdpass.c +MAN= pflogd.8 + +LDADD= -lpcap -lutil +DPADD= ${LIBPCAP} ${LIBUTIL} + +WARNS?= 2 + +.include