From owner-svn-src-user@FreeBSD.ORG Sun Oct 11 11:00:15 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 130581065670; Sun, 11 Oct 2009 11:00:15 +0000 (UTC) (envelope-from eri@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 013A68FC1C; Sun, 11 Oct 2009 11:00:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n9BB0EAQ009537; Sun, 11 Oct 2009 11:00:14 GMT (envelope-from eri@svn.freebsd.org) Received: (from eri@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9BB0E0w009528; Sun, 11 Oct 2009 11:00:14 GMT (envelope-from eri@svn.freebsd.org) Message-Id: <200910111100.n9BB0E0w009528@svn.freebsd.org> From: Ermal Luçi Date: Sun, 11 Oct 2009 11:00:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r197954 - in user/eri/pf45/head/contrib/pf: authpf ftp-proxy pflogd tftp-proxy X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Oct 2009 11:00:15 -0000 Author: eri Date: Sun Oct 11 11:00:14 2009 New Revision: 197954 URL: http://svn.freebsd.org/changeset/base/197954 Log: Fix compilation of all userland utilities of pf(4). Modified: user/eri/pf45/head/contrib/pf/authpf/authpf.c user/eri/pf45/head/contrib/pf/ftp-proxy/filter.c user/eri/pf45/head/contrib/pf/ftp-proxy/ftp-proxy.c user/eri/pf45/head/contrib/pf/pflogd/pflogd.c user/eri/pf45/head/contrib/pf/pflogd/privsep.c user/eri/pf45/head/contrib/pf/pflogd/privsep_fdpass.c user/eri/pf45/head/contrib/pf/tftp-proxy/filter.c user/eri/pf45/head/contrib/pf/tftp-proxy/tftp-proxy.c Modified: user/eri/pf45/head/contrib/pf/authpf/authpf.c ============================================================================== --- user/eri/pf45/head/contrib/pf/authpf/authpf.c Sun Oct 11 07:03:56 2009 (r197953) +++ user/eri/pf45/head/contrib/pf/authpf/authpf.c Sun Oct 11 11:00:14 2009 (r197954) @@ -16,6 +16,11 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifdef __FreeBSD__ +#include +__FBSDID("$FreeBSD$"); +#endif + #include #include #include @@ -68,7 +73,11 @@ struct timeval Tstart, Tend; /* start an volatile sig_atomic_t want_death; static void need_death(int signo); +#ifdef __FreeBSD__ +static void do_death(int); +#else static __dead void do_death(int); +#endif extern char *__progname; /* program name */ /* @@ -912,7 +921,11 @@ need_death(int signo) /* * function that removes our stuff when we go away. */ +#ifdef __FreeBSD__ +static void +#else static __dead void +#endif do_death(int active) { int ret = 0; Modified: user/eri/pf45/head/contrib/pf/ftp-proxy/filter.c ============================================================================== --- user/eri/pf45/head/contrib/pf/ftp-proxy/filter.c Sun Oct 11 07:03:56 2009 (r197953) +++ user/eri/pf45/head/contrib/pf/ftp-proxy/filter.c Sun Oct 11 11:00:14 2009 (r197954) @@ -16,6 +16,11 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifdef __FreeBSD__ +#include +__FBSDID("$FreeBSD$"); +#endif + #include #include #include Modified: user/eri/pf45/head/contrib/pf/ftp-proxy/ftp-proxy.c ============================================================================== --- user/eri/pf45/head/contrib/pf/ftp-proxy/ftp-proxy.c Sun Oct 11 07:03:56 2009 (r197953) +++ user/eri/pf45/head/contrib/pf/ftp-proxy/ftp-proxy.c Sun Oct 11 11:00:14 2009 (r197954) @@ -16,6 +16,11 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifdef __FreeBSD__ +#include +__FBSDID("$FreeBSD$"); +#endif + #include #include #include @@ -44,6 +49,10 @@ #include "filter.h" +#ifdef __FreeBSD__ +#define LIST_END(s) NULL +#endif + #define CONNECT_TIMEOUT 30 #define MIN_PORT 1024 #define MAX_LINE 500 @@ -574,7 +583,11 @@ logmsg(int pri, const char *message, ... /* We don't care about truncation. */ vsnprintf(buf, sizeof buf, message, ap); +#ifdef __FreeBSD__ + strvis(visbuf, buf, VIS_CSTYLE | VIS_NL); +#else strnvis(visbuf, buf, sizeof visbuf, VIS_CSTYLE | VIS_NL); +#endif fprintf(stderr, "%s\n", visbuf); } Modified: user/eri/pf45/head/contrib/pf/pflogd/pflogd.c ============================================================================== --- user/eri/pf45/head/contrib/pf/pflogd/pflogd.c Sun Oct 11 07:03:56 2009 (r197953) +++ user/eri/pf45/head/contrib/pf/pflogd/pflogd.c Sun Oct 11 11:00:14 2009 (r197954) @@ -30,12 +30,21 @@ * POSSIBILITY OF SUCH DAMAGE. */ +#ifdef __FreeBSD__ +#include +__FBSDID("$FreeBSD$"); + +#include +#endif #include #include #include #include #include #include +#ifdef __FreeBSD__ +#include +#endif #include #include #include @@ -48,7 +57,11 @@ #include #include #include +#ifdef __FreeBSD__ +#include "pidfile.h" +#else #include +#endif #include "pflogd.h" pcap_t *hpcap; @@ -153,7 +166,11 @@ logmsg(int pri, const char *message, ... va_end(ap); } +#ifdef __FreeBSD__ +void +#else __dead void +#endif usage(void) { fprintf(stderr, "usage: pflogd [-Dx] [-d delay] [-f filename]"); @@ -214,7 +231,11 @@ if_exists(char *ifname) sizeof(ifr.ifr_name)) errx(1, "main ifr_name: strlcpy"); ifr.ifr_data = (caddr_t)&ifrdat; +#ifdef __FreeBSD__ + if (ioctl(s, DIOCGIFSPEED, (caddr_t)&ifr) == -1) +#else if (ioctl(s, SIOCGIFDATA, (caddr_t)&ifr) == -1) +#endif return (0); if (close(s)) err(1, "close"); Modified: user/eri/pf45/head/contrib/pf/pflogd/privsep.c ============================================================================== --- user/eri/pf45/head/contrib/pf/pflogd/privsep.c Sun Oct 11 07:03:56 2009 (r197953) +++ user/eri/pf45/head/contrib/pf/pflogd/privsep.c Sun Oct 11 11:00:14 2009 (r197954) @@ -16,6 +16,12 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ + +#ifdef __FreeBSD__ +#include +__FBSDID("$FreeBSD$"); +#endif + #include #include #include @@ -28,13 +34,20 @@ #include #include #include +#ifndef __FreeBSD__ #include #include +#endif #include #include #include #include #include +#ifdef __FreeBSD__ +/* XXX: pcap pollutes namespace with strlcpy if not present previously */ +#include +#include +#endif #include #include #include "pflogd.h" @@ -69,7 +82,11 @@ priv_init(void) int snaplen, ret, olderrno; struct passwd *pw; +#ifdef __FreeBSD__ + for (i = 1; i < NSIG; i++) +#else for (i = 1; i < _NSIG; i++) +#endif signal(i, SIG_DFL); /* Create sockets */ Modified: user/eri/pf45/head/contrib/pf/pflogd/privsep_fdpass.c ============================================================================== --- user/eri/pf45/head/contrib/pf/pflogd/privsep_fdpass.c Sun Oct 11 07:03:56 2009 (r197953) +++ user/eri/pf45/head/contrib/pf/pflogd/privsep_fdpass.c Sun Oct 11 11:00:14 2009 (r197954) @@ -31,6 +31,12 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ + +#ifdef __FreeBSD__ +#include +__FBSDID("$FreeBSD$"); +#endif + #include #include #include Modified: user/eri/pf45/head/contrib/pf/tftp-proxy/filter.c ============================================================================== --- user/eri/pf45/head/contrib/pf/tftp-proxy/filter.c Sun Oct 11 07:03:56 2009 (r197953) +++ user/eri/pf45/head/contrib/pf/tftp-proxy/filter.c Sun Oct 11 11:00:14 2009 (r197954) @@ -16,6 +16,11 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifdef __FreeBSD__ +#include +__FBSDID("$FreeBSD$"); +#endif + #include #include Modified: user/eri/pf45/head/contrib/pf/tftp-proxy/tftp-proxy.c ============================================================================== --- user/eri/pf45/head/contrib/pf/tftp-proxy/tftp-proxy.c Sun Oct 11 07:03:56 2009 (r197953) +++ user/eri/pf45/head/contrib/pf/tftp-proxy/tftp-proxy.c Sun Oct 11 11:00:14 2009 (r197954) @@ -27,6 +27,11 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#ifdef __FreeBSD__ +#include +__FBSDID("$FreeBSD$"); +#endif + #include #include #include From owner-svn-src-user@FreeBSD.ORG Sun Oct 11 20:49:13 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 045461065676; Sun, 11 Oct 2009 20:49:13 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id D3D3C8FC08; Sun, 11 Oct 2009 20:49:12 +0000 (UTC) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id 574CF46B1A; Sun, 11 Oct 2009 16:49:12 -0400 (EDT) Date: Sun, 11 Oct 2009 21:49:12 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Ermal LuXi In-Reply-To: <200910101741.n9AHfGnt088331@svn.freebsd.org> Message-ID: References: <200910101741.n9AHfGnt088331@svn.freebsd.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: Re: svn commit: r197936 - in user/eri/pf45/head/sys: contrib/pf/net i386/conf X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Oct 2009 20:49:13 -0000 On Sat, 10 Oct 2009, Ermal LuXi wrote: > * Make possible that pfsync(4) can be loaded as module. > * Fix typos which unbreaks GENERIC builds. > > NOTE: As of now pf 4.5 is working on FreeBSD 8+. Very cool, nice work! Robert From owner-svn-src-user@FreeBSD.ORG Sun Oct 11 21:25:48 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6EEAD106566B; Sun, 11 Oct 2009 21:25:48 +0000 (UTC) (envelope-from eri@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5ADBF8FC08; Sun, 11 Oct 2009 21:25:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n9BLPmaE031036; Sun, 11 Oct 2009 21:25:48 GMT (envelope-from eri@svn.freebsd.org) Received: (from eri@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9BLPl4Y030996; Sun, 11 Oct 2009 21:25:47 GMT (envelope-from eri@svn.freebsd.org) Message-Id: <200910112125.n9BLPl4Y030996@svn.freebsd.org> From: Ermal Luçi Date: Sun, 11 Oct 2009 21:25:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r197972 - in user/eri/pf45/head: . contrib/openpam contrib/openpam/doc/man crypto/openssh etc etc/rc.d lib/libc/include lib/libc/sys lib/libthr lib/libthr/thread libexec/rtld-elf share/... X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Oct 2009 21:25:48 -0000 Author: eri Date: Sun Oct 11 21:25:47 2009 New Revision: 197972 URL: http://svn.freebsd.org/changeset/base/197972 Log: IFH Added: user/eri/pf45/head/sys/dev/ath/ath_hal/ah_eeprom_v4k.c - copied unchanged from r197971, head/sys/dev/ath/ath_hal/ah_eeprom_v4k.c user/eri/pf45/head/sys/dev/ath/ath_hal/ah_eeprom_v4k.h - copied unchanged from r197971, head/sys/dev/ath/ath_hal/ah_eeprom_v4k.h Modified: user/eri/pf45/head/ (props changed) user/eri/pf45/head/contrib/openpam/ (props changed) user/eri/pf45/head/contrib/openpam/doc/man/pam.conf.5 user/eri/pf45/head/crypto/openssh/sshd_config user/eri/pf45/head/etc/rc.d/bgfsck user/eri/pf45/head/etc/rc.d/cleartmp user/eri/pf45/head/etc/rc.d/faith user/eri/pf45/head/etc/rc.d/fsck user/eri/pf45/head/etc/rc.d/hostid user/eri/pf45/head/etc/rc.d/hostname user/eri/pf45/head/etc/rc.d/ldconfig user/eri/pf45/head/etc/rc.d/motd user/eri/pf45/head/etc/rc.d/mountcritlocal user/eri/pf45/head/etc/rc.d/moused user/eri/pf45/head/etc/rc.d/netif user/eri/pf45/head/etc/rc.d/newsyslog user/eri/pf45/head/etc/rc.d/nfsclient user/eri/pf45/head/etc/rc.d/pf user/eri/pf45/head/etc/rc.d/savecore user/eri/pf45/head/etc/rc.d/stf user/eri/pf45/head/etc/rc.subr user/eri/pf45/head/lib/libc/include/namespace.h user/eri/pf45/head/lib/libc/include/un-namespace.h user/eri/pf45/head/lib/libc/sys/Symbol.map user/eri/pf45/head/lib/libc/sys/intro.2 user/eri/pf45/head/lib/libc/sys/nanosleep.2 user/eri/pf45/head/lib/libthr/pthread.map user/eri/pf45/head/lib/libthr/thread/thr_private.h user/eri/pf45/head/lib/libthr/thread/thr_syscalls.c user/eri/pf45/head/libexec/rtld-elf/rtld.c user/eri/pf45/head/share/man/man4/lindev.4 user/eri/pf45/head/sys/amd64/include/atomic.h user/eri/pf45/head/sys/amd64/include/elf.h user/eri/pf45/head/sys/arm/include/elf.h user/eri/pf45/head/sys/cam/ata/ata_da.c user/eri/pf45/head/sys/conf/files user/eri/pf45/head/sys/conf/files.amd64 user/eri/pf45/head/sys/conf/files.i386 user/eri/pf45/head/sys/dev/agp/agp_i810.c user/eri/pf45/head/sys/dev/drm/drm_pciids.h user/eri/pf45/head/sys/dev/drm/i915_drv.h user/eri/pf45/head/sys/dev/fdc/fdc.c user/eri/pf45/head/sys/fs/tmpfs/tmpfs.h user/eri/pf45/head/sys/fs/tmpfs/tmpfs_subr.c user/eri/pf45/head/sys/fs/tmpfs/tmpfs_vnops.c user/eri/pf45/head/sys/geom/concat/g_concat.c user/eri/pf45/head/sys/geom/label/g_label.c user/eri/pf45/head/sys/geom/part/g_part.c user/eri/pf45/head/sys/geom/shsec/g_shsec.c user/eri/pf45/head/sys/geom/stripe/g_stripe.c user/eri/pf45/head/sys/geom/uzip/g_uzip.c user/eri/pf45/head/sys/i386/include/atomic.h user/eri/pf45/head/sys/i386/include/elf.h user/eri/pf45/head/sys/ia64/include/elf.h user/eri/pf45/head/sys/kern/imgact_elf.c user/eri/pf45/head/sys/kern/kern_event.c user/eri/pf45/head/sys/kern/kern_exit.c user/eri/pf45/head/sys/kern/kern_sig.c user/eri/pf45/head/sys/kern/kern_thr.c user/eri/pf45/head/sys/kern/subr_trap.c user/eri/pf45/head/sys/mips/include/elf.h user/eri/pf45/head/sys/net/if_bridge.c user/eri/pf45/head/sys/net/if_ethersubr.c user/eri/pf45/head/sys/net/pfil.c user/eri/pf45/head/sys/netgraph/ng_bridge.c user/eri/pf45/head/sys/netinet/ip_fastfwd.c user/eri/pf45/head/sys/netinet/ip_input.c user/eri/pf45/head/sys/netinet/ip_output.c user/eri/pf45/head/sys/netinet/ip_var.h user/eri/pf45/head/sys/netinet/ipfw/ip_fw2.c user/eri/pf45/head/sys/netinet/ipfw/ip_fw_pfil.c user/eri/pf45/head/sys/netinet/raw_ip.c user/eri/pf45/head/sys/netinet/sctp_bsd_addr.c user/eri/pf45/head/sys/netinet/sctp_os_bsd.h user/eri/pf45/head/sys/netinet/sctp_pcb.c user/eri/pf45/head/sys/netinet6/ip6_forward.c user/eri/pf45/head/sys/netinet6/ip6_input.c user/eri/pf45/head/sys/netinet6/ip6_output.c user/eri/pf45/head/sys/netinet6/ip6_var.h user/eri/pf45/head/sys/powerpc/aim/swtch.S user/eri/pf45/head/sys/powerpc/aim/trap_subr.S user/eri/pf45/head/sys/powerpc/include/elf.h user/eri/pf45/head/sys/sparc64/include/elf.h user/eri/pf45/head/sys/sun4v/include/elf.h user/eri/pf45/head/sys/sys/signalvar.h user/eri/pf45/head/tools/regression/sigqueue/sigqtest1/sigqtest1.c user/eri/pf45/head/tools/regression/sigqueue/sigqtest2/sigqtest2.c user/eri/pf45/head/usr.bin/systat/keyboard.c user/eri/pf45/head/usr.bin/systat/main.c user/eri/pf45/head/usr.sbin/mfiutil/mfiutil.8 (props changed) Modified: user/eri/pf45/head/contrib/openpam/doc/man/pam.conf.5 ============================================================================== --- user/eri/pf45/head/contrib/openpam/doc/man/pam.conf.5 Sun Oct 11 20:52:18 2009 (r197971) +++ user/eri/pf45/head/contrib/openpam/doc/man/pam.conf.5 Sun Oct 11 21:25:47 2009 (r197972) @@ -109,7 +109,7 @@ will be failure regardless of the succes .It Cm requisite If this module succeeds, the result of the chain will be success unless a later module fails. -If it module fails, the chain is broken and the result is failure. +If the module fails, the chain is broken and the result is failure. .It Cm sufficient If this module succeeds, the chain is broken and the result is success. Modified: user/eri/pf45/head/crypto/openssh/sshd_config ============================================================================== --- user/eri/pf45/head/crypto/openssh/sshd_config Sun Oct 11 20:52:18 2009 (r197971) +++ user/eri/pf45/head/crypto/openssh/sshd_config Sun Oct 11 21:25:47 2009 (r197972) @@ -17,7 +17,6 @@ #VersionAddendum FreeBSD-20091001 #Port 22 -#Protocol 2 #AddressFamily any #ListenAddress 0.0.0.0 #ListenAddress :: Modified: user/eri/pf45/head/etc/rc.d/bgfsck ============================================================================== --- user/eri/pf45/head/etc/rc.d/bgfsck Sun Oct 11 20:52:18 2009 (r197971) +++ user/eri/pf45/head/etc/rc.d/bgfsck Sun Oct 11 21:25:47 2009 (r197972) @@ -31,7 +31,7 @@ bgfsck_start () bgfsck_msg="${bgfsck_msg} in ${background_fsck_delay} seconds" fi if [ -z "${rc_force}" ]; then - [ -z "${rc_quiet}" ] && echo "${bgfsck_msg}." + check_startmsgs && echo "${bgfsck_msg}." fi (sleep ${background_fsck_delay}; nice -4 fsck -B -p) 2>&1 | \ Modified: user/eri/pf45/head/etc/rc.d/cleartmp ============================================================================== --- user/eri/pf45/head/etc/rc.d/cleartmp Sun Oct 11 20:52:18 2009 (r197971) +++ user/eri/pf45/head/etc/rc.d/cleartmp Sun Oct 11 21:25:47 2009 (r197972) @@ -25,7 +25,7 @@ cleartmp_start() ${tmp}/.ICE-unix ${tmp}/.font-unix" if checkyesno ${rcvar1}; then - [ -z "${rc_quiet}" ] && echo "Clearing ${tmp}." + check_startmsgs && echo "Clearing ${tmp}." # This is not needed for mfs, but doesn't hurt anything. # Things to note: @@ -44,7 +44,7 @@ cleartmp_start() elif checkyesno clear_tmp_X; then # Remove X lock files, since they will prevent you from # restarting X. Remove other X related directories. - [ -z "${rc_quiet}" ] && echo "Clearing ${tmp} (X related)." + check_startmsgs && echo "Clearing ${tmp} (X related)." rm -rf ${tmp}/.X[0-9]-lock ${x11_socket_dirs} fi if checkyesno clear_tmp_X; then Modified: user/eri/pf45/head/etc/rc.d/faith ============================================================================== --- user/eri/pf45/head/etc/rc.d/faith Sun Oct 11 20:52:18 2009 (r197971) +++ user/eri/pf45/head/etc/rc.d/faith Sun Oct 11 21:25:47 2009 (r197972) @@ -39,9 +39,7 @@ faith_up() route change -inet6 ${prefix} -prefixlen ${prefixlen} \ -ifp faith0 done - if [ -z "${rc_quiet}" ]; then - ifconfig faith0 - fi + check_startmsgs && ifconfig faith0 ;; esac } Modified: user/eri/pf45/head/etc/rc.d/fsck ============================================================================== --- user/eri/pf45/head/etc/rc.d/fsck Sun Oct 11 20:52:18 2009 (r197971) +++ user/eri/pf45/head/etc/rc.d/fsck Sun Oct 11 21:25:47 2009 (r197972) @@ -23,7 +23,7 @@ fsck_start() # During fsck ignore SIGQUIT trap : 3 - [ -z "${rc_quiet}" ] && echo "Starting file system checks:" + check_startmsgs && echo "Starting file system checks:" if checkyesno background_fsck; then fsck -F -p else Modified: user/eri/pf45/head/etc/rc.d/hostid ============================================================================== --- user/eri/pf45/head/etc/rc.d/hostid Sun Oct 11 20:52:18 2009 (r197971) +++ user/eri/pf45/head/etc/rc.d/hostid Sun Oct 11 21:25:47 2009 (r197972) @@ -49,9 +49,9 @@ hostid_set() # Set both kern.hostuuid and kern.hostid. # - [ -z "${rc_quiet}" ] && echo "Setting hostuuid: ${uuid}." + check_startmsgs && echo "Setting hostuuid: ${uuid}." ${SYSCTL_W} kern.hostuuid="${uuid}" >/dev/null - [ -z "${rc_quiet}" ] && echo "Setting hostid: ${id}." + check_startmsgs && echo "Setting hostid: ${id}." ${SYSCTL_W} kern.hostid=${id} >/dev/null } Modified: user/eri/pf45/head/etc/rc.d/hostname ============================================================================== --- user/eri/pf45/head/etc/rc.d/hostname Sun Oct 11 20:52:18 2009 (r197971) +++ user/eri/pf45/head/etc/rc.d/hostname Sun Oct 11 21:25:47 2009 (r197972) @@ -72,8 +72,9 @@ hostname_start() # All right, it is safe to invoke hostname(1) now. # - [ -z "${rc_quiet}" ] && echo "Setting hostname: ${hostname}." + check_startmsgs && echo -n "Setting hostname: ${hostname}" /bin/hostname "${hostname}" + check_startmsgs && echo '.' } load_rc_config $name Modified: user/eri/pf45/head/etc/rc.d/ldconfig ============================================================================== --- user/eri/pf45/head/etc/rc.d/ldconfig Sun Oct 11 20:52:18 2009 (r197971) +++ user/eri/pf45/head/etc/rc.d/ldconfig Sun Oct 11 21:25:47 2009 (r197972) @@ -36,7 +36,7 @@ ldconfig_start() _LDC="${_LDC} ${i}" fi done - [ -z "${rc_quiet}" ] && echo 'ELF ldconfig path:' ${_LDC} + check_startmsgs && echo 'ELF ldconfig path:' ${_LDC} ${ldconfig} -elf ${_ins} ${_LDC} case `sysctl -n hw.machine_arch` in @@ -55,7 +55,7 @@ ldconfig_start() _LDC="${_LDC} ${i}" fi done - [ -z "${rc_quiet}" ] && + check_startmsgs && echo '32-bit compatibility ldconfig path:' ${_LDC} ${ldconfig} -32 -m ${_ins} ${_LDC} ;; @@ -72,8 +72,7 @@ ldconfig_start() _LDC="${_LDC} ${i}" fi done - [ -z "${rc_quiet}" ] && - echo 'a.out ldconfig path:' ${_LDC} + check_startmsgs && echo 'a.out ldconfig path:' ${_LDC} ${ldconfig} -aout ${_ins} ${_LDC} ;; esac Modified: user/eri/pf45/head/etc/rc.d/motd ============================================================================== --- user/eri/pf45/head/etc/rc.d/motd Sun Oct 11 20:52:18 2009 (r197971) +++ user/eri/pf45/head/etc/rc.d/motd Sun Oct 11 21:25:47 2009 (r197972) @@ -22,7 +22,7 @@ motd_start() # Must be done *before* interactive logins are possible # to prevent possible race conditions. # - [ -z "${rc_quiet}" ] && echo -n 'Updating motd:' + check_startmsgs && echo -n 'Updating motd:' if [ ! -f /etc/motd ]; then install -c -o root -g wheel -m ${PERMS} /dev/null /etc/motd fi @@ -42,7 +42,7 @@ motd_start() } rm -f $T - [ -z "${rc_quiet}" ] && echo . + check_startmsgs && echo '.' } load_rc_config $name Modified: user/eri/pf45/head/etc/rc.d/mountcritlocal ============================================================================== --- user/eri/pf45/head/etc/rc.d/mountcritlocal Sun Oct 11 20:52:18 2009 (r197971) +++ user/eri/pf45/head/etc/rc.d/mountcritlocal Sun Oct 11 21:25:47 2009 (r197972) @@ -28,7 +28,7 @@ mountcritlocal_start() esac # Mount everything except nfs filesystems. - [ -z "${rc_quiet}" ] && echo -n 'Mounting local file systems:' + check_startmsgs && echo -n 'Mounting local file systems:' mount_excludes='no' for i in ${netfs_types}; do fstype=${i%:*} @@ -37,7 +37,7 @@ mountcritlocal_start() mount_excludes=${mount_excludes%,} mount -a -t ${mount_excludes} err=$? - [ -z "${rc_quiet}" ] && echo '.' + check_startmsgs && echo '.' case ${err} in 0) Modified: user/eri/pf45/head/etc/rc.d/moused ============================================================================== --- user/eri/pf45/head/etc/rc.d/moused Sun Oct 11 20:52:18 2009 (r197971) +++ user/eri/pf45/head/etc/rc.d/moused Sun Oct 11 21:25:47 2009 (r197972) @@ -51,8 +51,9 @@ moused_start() mytype="$moused_type" fi - [ -z "${rc_quiet}" ] && echo -n "Starting ${ms} moused." + check_startmsgs && echo -n "Starting ${ms} moused" /usr/sbin/moused ${myflags} -p ${myport} -t ${mytype} ${pidarg} + check_startmsgs && echo '.' mousechar_arg= case ${mousechar_start} in Modified: user/eri/pf45/head/etc/rc.d/netif ============================================================================== --- user/eri/pf45/head/etc/rc.d/netif Sun Oct 11 20:52:18 2009 (r197971) +++ user/eri/pf45/head/etc/rc.d/netif Sun Oct 11 21:25:47 2009 (r197972) @@ -143,7 +143,7 @@ network_common() ;; esac echo "${_str} Network:${_ok}." - if [ -z "${rc_quiet}" ]; then + if check_startmsgs; then for ifn in ${_ok}; do /sbin/ifconfig ${ifn} done Modified: user/eri/pf45/head/etc/rc.d/newsyslog ============================================================================== --- user/eri/pf45/head/etc/rc.d/newsyslog Sun Oct 11 20:52:18 2009 (r197971) +++ user/eri/pf45/head/etc/rc.d/newsyslog Sun Oct 11 21:25:47 2009 (r197972) @@ -17,9 +17,9 @@ stop_cmd=":" newsyslog_start() { - [ -z "${rc_quiet}" ] && echo -n "Creating and/or trimming log files:" + check_startmsgs && echo -n 'Creating and/or trimming log files' ${command} ${rc_flags} - [ -z "${rc_quiet}" ] && echo "." + check_startmsgs && echo '.' } load_rc_config $name Modified: user/eri/pf45/head/etc/rc.d/nfsclient ============================================================================== --- user/eri/pf45/head/etc/rc.d/nfsclient Sun Oct 11 20:52:18 2009 (r197971) +++ user/eri/pf45/head/etc/rc.d/nfsclient Sun Oct 11 21:25:47 2009 (r197972) @@ -22,7 +22,8 @@ nfsclient_start() # if [ -n "${nfs_access_cache}" ]; then - [ -z "${rc_quiet}" ] && echo "NFS access cache time=${nfs_access_cache}" + check_startmsgs && + echo "NFS access cache time=${nfs_access_cache}" if ! sysctl vfs.nfs.access_cache_timeout=${nfs_access_cache} >/dev/null; then warn "failed to set access cache timeout" fi Modified: user/eri/pf45/head/etc/rc.d/pf ============================================================================== --- user/eri/pf45/head/etc/rc.d/pf Sun Oct 11 20:52:18 2009 (r197971) +++ user/eri/pf45/head/etc/rc.d/pf Sun Oct 11 21:25:47 2009 (r197972) @@ -25,19 +25,21 @@ required_modules="pf" pf_start() { - [ -z "${rc_quiet}" ] && echo "Enabling pf." + check_startmsgs && echo -n 'Enabling pf' $pf_program -F all > /dev/null 2>&1 $pf_program -f "$pf_rules" $pf_flags if ! $pf_program -s info | grep -q "Enabled" ; then $pf_program -e fi + check_startmsgs && echo '.' } pf_stop() { if $pf_program -s info | grep -q "Enabled" ; then - [ -z "${rc_quiet}" ] && echo "Disabling pf." + echo -n 'Disabling pf' $pf_program -d + echo '.' fi } Modified: user/eri/pf45/head/etc/rc.d/savecore ============================================================================== --- user/eri/pf45/head/etc/rc.d/savecore Sun Oct 11 20:52:18 2009 (r197971) +++ user/eri/pf45/head/etc/rc.d/savecore Sun Oct 11 21:25:47 2009 (r197972) @@ -69,7 +69,7 @@ savecore_start() ${crashinfo_program} -d ${dumpdir} fi else - [ -z "${rc_quiet}" ] && echo "No core dumps found" + check_startmsgs && echo 'No core dumps found.' fi } Modified: user/eri/pf45/head/etc/rc.d/stf ============================================================================== --- user/eri/pf45/head/etc/rc.d/stf Sun Oct 11 20:52:18 2009 (r197971) +++ user/eri/pf45/head/etc/rc.d/stf Sun Oct 11 21:25:47 2009 (r197972) @@ -53,9 +53,8 @@ stf_up() ifconfig stf0 create >/dev/null 2>&1 ifconfig stf0 inet6 2002:${ipv4_in_hexformat}:${stf_interface_ipv6_slaid:-0}:${stf_interface_ipv6_ifid} \ prefixlen ${stf_prefixlen} - if [ -z "${rc_quiet}" ]; then - /sbin/ifconfig stf0 - fi + check_startmsgs && /sbin/ifconfig stf0 + # disallow packets to malicious 6to4 prefix route add -inet6 2002:e000:: -prefixlen 20 ::1 -reject route add -inet6 2002:7f00:: -prefixlen 24 ::1 -reject Modified: user/eri/pf45/head/etc/rc.subr ============================================================================== --- user/eri/pf45/head/etc/rc.subr Sun Oct 11 20:52:18 2009 (r197971) +++ user/eri/pf45/head/etc/rc.subr Sun Oct 11 21:25:47 2009 (r197972) @@ -398,6 +398,20 @@ wait_for_pids() } # +# check_startmsgs +# If rc_quiet is set (usually as a result of using faststart at +# boot time) check if rc_startmsgs is enabled. +# +check_startmsgs() +{ + if [ -n "$rc_quiet" ]; then + checkyesno rc_startmsgs + else + return 0 + fi +} + +# # run_rc_command argument # Search for argument in the list of supported commands, which is: # "start stop restart rcvar status poll ${extra_commands}" @@ -708,13 +722,7 @@ run_rc_command() # setup the full command to run # - _show_startmsgs=1 - if [ -n "${rc_quiet}" ]; then - if ! checkyesno rc_startmsgs; then - unset _show_startmsgs - fi - fi - [ -n "$_show_startmsgs" ] && echo "Starting ${name}." + check_startmsgs && echo "Starting ${name}." if [ -n "$_chroot" ]; then _doit="\ ${_nice:+nice -n $_nice }\ Modified: user/eri/pf45/head/lib/libc/include/namespace.h ============================================================================== --- user/eri/pf45/head/lib/libc/include/namespace.h Sun Oct 11 20:52:18 2009 (r197971) +++ user/eri/pf45/head/lib/libc/include/namespace.h Sun Oct 11 21:25:47 2009 (r197972) @@ -80,6 +80,7 @@ #define listen _listen #define nanosleep _nanosleep #define open _open +#define openat _openat #define poll _poll #define pthread_atfork _pthread_atfork #define pthread_attr_destroy _pthread_attr_destroy Modified: user/eri/pf45/head/lib/libc/include/un-namespace.h ============================================================================== --- user/eri/pf45/head/lib/libc/include/un-namespace.h Sun Oct 11 20:52:18 2009 (r197971) +++ user/eri/pf45/head/lib/libc/include/un-namespace.h Sun Oct 11 21:25:47 2009 (r197972) @@ -61,6 +61,7 @@ #undef listen #undef nanosleep #undef open +#undef openat #undef poll #undef pthread_atfork #undef pthread_attr_destroy Modified: user/eri/pf45/head/lib/libc/sys/Symbol.map ============================================================================== --- user/eri/pf45/head/lib/libc/sys/Symbol.map Sun Oct 11 20:52:18 2009 (r197971) +++ user/eri/pf45/head/lib/libc/sys/Symbol.map Sun Oct 11 21:25:47 2009 (r197972) @@ -769,6 +769,8 @@ FBSDprivate_1.0 { __sys_olio_listio; _open; __sys_open; + _openat; + __sys_openat; _pathconf; __sys_pathconf; _pipe; Modified: user/eri/pf45/head/lib/libc/sys/intro.2 ============================================================================== --- user/eri/pf45/head/lib/libc/sys/intro.2 Sun Oct 11 20:52:18 2009 (r197971) +++ user/eri/pf45/head/lib/libc/sys/intro.2 Sun Oct 11 21:25:47 2009 (r197972) @@ -456,6 +456,14 @@ The specified extended attribute does no .It Er 88 EDOOFUS Em "Programming error" . A function or API is being abused in a way which could only be detected at run-time. +.It Er 89 EBADMSG Em "Bad message" . +A corrupted message was detected. +.It Er 90 EMULTIHOP Em "Multihop attempted" . +This error code is unused, but present for compatibility with other systems. +.It Er 91 ENOLINK Em "Link has been severed" . +This error code is unused, but present for compatibility with other systems. +.It Er 92 EPROTO Em "Protocol error" . +A device or socket encountered an unrecoverable protocol error. .It Er 93 ENOTCAPABLE Em "Capabilities insufficient" . An operation on a capability file descriptor requires greater privilege than the capability allows. Modified: user/eri/pf45/head/lib/libc/sys/nanosleep.2 ============================================================================== --- user/eri/pf45/head/lib/libc/sys/nanosleep.2 Sun Oct 11 20:52:18 2009 (r197971) +++ user/eri/pf45/head/lib/libc/sys/nanosleep.2 Sun Oct 11 21:25:47 2009 (r197972) @@ -47,7 +47,9 @@ The .Fn nanosleep system call -causes the process to sleep for the specified time. +causes the calling thread to sleep until the time interval specified by +.Fa rqtp +has elapsed. An unmasked signal will cause it to terminate the sleep early, regardless of the .Dv SA_RESTART Modified: user/eri/pf45/head/lib/libthr/pthread.map ============================================================================== --- user/eri/pf45/head/lib/libthr/pthread.map Sun Oct 11 20:52:18 2009 (r197971) +++ user/eri/pf45/head/lib/libthr/pthread.map Sun Oct 11 21:25:47 2009 (r197972) @@ -195,6 +195,7 @@ FBSDprivate_1.0 { __msync; __nanosleep; __open; + __openat; __poll; __pthread_cond_timedwait; __pthread_cond_wait; @@ -406,3 +407,7 @@ FBSD_1.1 { pthread_mutex_setspinloops_np; pthread_mutex_setyieldloops_np; }; + +FBSD_1.2 { + openat; +}; Modified: user/eri/pf45/head/lib/libthr/thread/thr_private.h ============================================================================== --- user/eri/pf45/head/lib/libthr/thread/thr_private.h Sun Oct 11 20:52:18 2009 (r197971) +++ user/eri/pf45/head/lib/libthr/thread/thr_private.h Sun Oct 11 21:25:47 2009 (r197972) @@ -668,6 +668,7 @@ void _pthread_cleanup_pop(int); #ifdef _SYS_FCNTL_H_ int __sys_fcntl(int, int, ...); int __sys_open(const char *, int, ...); +int __sys_openat(int, const char *, int, ...); #endif /* #include */ Modified: user/eri/pf45/head/lib/libthr/thread/thr_syscalls.c ============================================================================== --- user/eri/pf45/head/lib/libthr/thread/thr_syscalls.c Sun Oct 11 20:52:18 2009 (r197971) +++ user/eri/pf45/head/lib/libthr/thread/thr_syscalls.c Sun Oct 11 21:25:47 2009 (r197972) @@ -139,6 +139,7 @@ int __fsync(int); int __msync(void *, size_t, int); int __nanosleep(const struct timespec *, struct timespec *); int __open(const char *, int,...); +int __openat(int, const char *, int,...); int __poll(struct pollfd *, unsigned int, int); ssize_t __read(int, void *buf, size_t); ssize_t __readv(int, const struct iovec *, int); @@ -341,6 +342,33 @@ __open(const char *path, int flags,...) return ret; } +__weak_reference(__openat, openat); + +int +__openat(int fd, const char *path, int flags, ...) +{ + struct pthread *curthread = _get_curthread(); + int ret; + int mode = 0; + va_list ap; + + _thr_cancel_enter(curthread); + + /* Check if the file is being created: */ + if (flags & O_CREAT) { + /* Get the creation mode: */ + va_start(ap, flags); + mode = va_arg(ap, int); + va_end(ap); + } + + ret = __sys_openat(fd, path, flags, mode); + + _thr_cancel_leave(curthread); + + return ret; +} + __weak_reference(__poll, poll); int Modified: user/eri/pf45/head/libexec/rtld-elf/rtld.c ============================================================================== --- user/eri/pf45/head/libexec/rtld-elf/rtld.c Sun Oct 11 20:52:18 2009 (r197971) +++ user/eri/pf45/head/libexec/rtld-elf/rtld.c Sun Oct 11 21:25:47 2009 (r197972) @@ -474,6 +474,7 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_ /* Initialize a fake symbol for resolving undefined weak references. */ sym_zero.st_info = ELF_ST_INFO(STB_GLOBAL, STT_NOTYPE); sym_zero.st_shndx = SHN_UNDEF; + sym_zero.st_value = -(uintptr_t)obj_main->relocbase; if (!libmap_disable) libmap_disable = (bool)lm_init(libmap_override); @@ -991,26 +992,26 @@ digest_phdr(const Elf_Phdr *phdr, int ph obj = obj_new(); for (ph = phdr; ph < phlimit; ph++) { - switch (ph->p_type) { + if (ph->p_type != PT_PHDR) + continue; - case PT_PHDR: - if ((const Elf_Phdr *)ph->p_vaddr != phdr) { - _rtld_error("%s: invalid PT_PHDR", path); - return NULL; - } - obj->phdr = (const Elf_Phdr *) ph->p_vaddr; - obj->phsize = ph->p_memsz; - break; + obj->phdr = phdr; + obj->phsize = ph->p_memsz; + obj->relocbase = (caddr_t)phdr - ph->p_vaddr; + break; + } + + for (ph = phdr; ph < phlimit; ph++) { + switch (ph->p_type) { case PT_INTERP: - obj->interp = (const char *) ph->p_vaddr; + obj->interp = (const char *)(ph->p_vaddr + obj->relocbase); break; case PT_LOAD: if (nsegs == 0) { /* First load segment */ obj->vaddrbase = trunc_page(ph->p_vaddr); - obj->mapbase = (caddr_t) obj->vaddrbase; - obj->relocbase = obj->mapbase - obj->vaddrbase; + obj->mapbase = obj->vaddrbase + obj->relocbase; obj->textsize = round_page(ph->p_vaddr + ph->p_memsz) - obj->vaddrbase; } else { /* Last load segment */ @@ -1021,7 +1022,7 @@ digest_phdr(const Elf_Phdr *phdr, int ph break; case PT_DYNAMIC: - obj->dynamic = (const Elf_Dyn *) ph->p_vaddr; + obj->dynamic = (const Elf_Dyn *)(ph->p_vaddr + obj->relocbase); break; case PT_TLS: @@ -1029,7 +1030,7 @@ digest_phdr(const Elf_Phdr *phdr, int ph obj->tlssize = ph->p_memsz; obj->tlsalign = ph->p_align; obj->tlsinitsize = ph->p_filesz; - obj->tlsinit = (void*) ph->p_vaddr; + obj->tlsinit = (void*)(ph->p_vaddr + obj->relocbase); break; } } Modified: user/eri/pf45/head/share/man/man4/lindev.4 ============================================================================== --- user/eri/pf45/head/share/man/man4/lindev.4 Sun Oct 11 20:52:18 2009 (r197971) +++ user/eri/pf45/head/share/man/man4/lindev.4 Sun Oct 11 21:25:47 2009 (r197972) @@ -30,7 +30,7 @@ .Os .Sh NAME .Nm lindev -.Nd the lindev module +.Nd Linux-specific pseudo devices support .Sh SYNOPSIS To compile this collection of linux-specific pseudo devices into the kernel, place the following line in your kernel configuration file: Modified: user/eri/pf45/head/sys/amd64/include/atomic.h ============================================================================== --- user/eri/pf45/head/sys/amd64/include/atomic.h Sun Oct 11 20:52:18 2009 (r197971) +++ user/eri/pf45/head/sys/amd64/include/atomic.h Sun Oct 11 21:25:47 2009 (r197972) @@ -78,8 +78,6 @@ void atomic_##NAME##_barr_##TYPE(volatil int atomic_cmpset_int(volatile u_int *dst, u_int exp, u_int src); int atomic_cmpset_long(volatile u_long *dst, u_long exp, u_long src); -int atomic_cmpset_barr_int(volatile u_int *dst, u_int exp, u_int src); -int atomic_cmpset_barr_long(volatile u_long *dst, u_long exp, u_long src); u_int atomic_fetchadd_int(volatile u_int *p, u_int v); u_long atomic_fetchadd_long(volatile u_long *p, u_long v); @@ -131,33 +129,47 @@ struct __hack * Returns 0 on failure, non-zero on success */ -#define DEFINE_CMPSET_GEN(NAME, TYPE, OP) \ -static __inline int \ -atomic_cmpset_##NAME(volatile u_##TYPE *dst, u_##TYPE exp, u_##TYPE src)\ -{ \ - u_char res; \ - \ - __asm __volatile( \ - " " MPLOCKED " " \ - " " OP " %2,%1 ; " \ - " sete %0 ; " \ - "1: " \ - "# atomic_cmpset_##NAME" \ - : "=a" (res), /* 0 */ \ - "=m" (*dst) /* 1 */ \ - : "r" (src), /* 2 */ \ - "a" (exp), /* 3 */ \ - "m" (*dst) /* 4 */ \ - : "memory"); \ - \ - return (res); \ -} \ -struct __hack +static __inline int +atomic_cmpset_int(volatile u_int *dst, u_int exp, u_int src) +{ + u_char res; + + __asm __volatile( + " " MPLOCKED " " + " cmpxchgl %2,%1 ; " + " sete %0 ; " + "1: " + "# atomic_cmpset_int" + : "=a" (res), /* 0 */ + "=m" (*dst) /* 1 */ + : "r" (src), /* 2 */ + "a" (exp), /* 3 */ + "m" (*dst) /* 4 */ + : "memory"); + + return (res); +} + +static __inline int +atomic_cmpset_long(volatile u_long *dst, u_long exp, u_long src) +{ + u_char res; -DEFINE_CMPSET_GEN(int, int, "cmpxchgl"); -DEFINE_CMPSET_GEN(long, long, "cmpxchgq"); -DEFINE_CMPSET_GEN(barr_int, int, "cmpxchgl"); -DEFINE_CMPSET_GEN(barr_long, long, "cmpxchgq"); + __asm __volatile( + " " MPLOCKED " " + " cmpxchgq %2,%1 ; " + " sete %0 ; " + "1: " + "# atomic_cmpset_long" + : "=a" (res), /* 0 */ + "=m" (*dst) /* 1 */ + : "r" (src), /* 2 */ + "a" (exp), /* 3 */ + "m" (*dst) /* 4 */ + : "memory"); + + return (res); +} /* * Atomically add the value of v to the integer pointed to by p and return @@ -358,8 +370,8 @@ u_long atomic_readandclear_long(volatile #define atomic_add_rel_int atomic_add_barr_int #define atomic_subtract_acq_int atomic_subtract_barr_int #define atomic_subtract_rel_int atomic_subtract_barr_int -#define atomic_cmpset_acq_int atomic_cmpset_barr_int -#define atomic_cmpset_rel_int atomic_cmpset_barr_int +#define atomic_cmpset_acq_int atomic_cmpset_int +#define atomic_cmpset_rel_int atomic_cmpset_int #define atomic_set_acq_long atomic_set_barr_long #define atomic_set_rel_long atomic_set_barr_long @@ -369,8 +381,8 @@ u_long atomic_readandclear_long(volatile #define atomic_add_rel_long atomic_add_barr_long #define atomic_subtract_acq_long atomic_subtract_barr_long #define atomic_subtract_rel_long atomic_subtract_barr_long -#define atomic_cmpset_acq_long atomic_cmpset_barr_long -#define atomic_cmpset_rel_long atomic_cmpset_barr_long +#define atomic_cmpset_acq_long atomic_cmpset_long +#define atomic_cmpset_rel_long atomic_cmpset_long /* Operations on 8-bit bytes. */ #define atomic_set_8 atomic_set_char Modified: user/eri/pf45/head/sys/amd64/include/elf.h ============================================================================== --- user/eri/pf45/head/sys/amd64/include/elf.h Sun Oct 11 20:52:18 2009 (r197971) +++ user/eri/pf45/head/sys/amd64/include/elf.h Sun Oct 11 21:25:47 2009 (r197972) @@ -106,4 +106,10 @@ __ElfType(Auxinfo); #define ELF_TARG_MACH EM_X86_64 #define ELF_TARG_VER 1 +#if __ELF_WORD_SIZE == 32 +#define ET_DYN_LOAD_ADDR 0x01001000 +#else +#define ET_DYN_LOAD_ADDR 0x01021000 +#endif + #endif /* !_MACHINE_ELF_H_ */ Modified: user/eri/pf45/head/sys/arm/include/elf.h ============================================================================== --- user/eri/pf45/head/sys/arm/include/elf.h Sun Oct 11 20:52:18 2009 (r197971) +++ user/eri/pf45/head/sys/arm/include/elf.h Sun Oct 11 21:25:47 2009 (r197972) @@ -97,4 +97,7 @@ __ElfType(Auxinfo); * value. */ #define MAGIC_TRAMP_NUMBER 0x5c000003 + +#define ET_DYN_LOAD_ADDR 0x12000 + #endif /* !_MACHINE_ELF_H_ */ Modified: user/eri/pf45/head/sys/cam/ata/ata_da.c ============================================================================== --- user/eri/pf45/head/sys/cam/ata/ata_da.c Sun Oct 11 20:52:18 2009 (r197971) +++ user/eri/pf45/head/sys/cam/ata/ata_da.c Sun Oct 11 21:25:47 2009 (r197972) @@ -721,6 +721,8 @@ adaregister(struct cam_periph *periph, v softc->disk->d_flags = 0; if (softc->flags & ADA_FLAG_CAN_FLUSHCACHE) softc->disk->d_flags |= DISKFLAG_CANFLUSHCACHE; + strlcpy(softc->disk->d_ident, cgd->serial_num, + MIN(sizeof(softc->disk->d_ident), cgd->serial_num_len + 1)); adasetgeom(periph, cgd); softc->disk->d_sectorsize = softc->params.secsize; Modified: user/eri/pf45/head/sys/conf/files ============================================================================== --- user/eri/pf45/head/sys/conf/files Sun Oct 11 20:52:18 2009 (r197971) +++ user/eri/pf45/head/sys/conf/files Sun Oct 11 21:25:47 2009 (r197972) @@ -1921,7 +1921,6 @@ gnu/fs/reiserfs/reiserfs_vnops.c optiona isa/isa_if.m standard isa/isa_common.c optional isa isa/isahint.c optional isa -isa/orm.c optional isa isa/pnp.c optional isa isapnp isa/pnpparse.c optional isa isapnp fs/cd9660/cd9660_bmap.c optional cd9660 Modified: user/eri/pf45/head/sys/conf/files.amd64 ============================================================================== --- user/eri/pf45/head/sys/conf/files.amd64 Sun Oct 11 20:52:18 2009 (r197971) +++ user/eri/pf45/head/sys/conf/files.amd64 Sun Oct 11 21:25:47 2009 (r197972) @@ -228,6 +228,7 @@ dev/syscons/scvtb.c optional sc dev/uart/uart_cpu_amd64.c optional uart dev/wpi/if_wpi.c optional wpi isa/atrtc.c standard +isa/orm.c optional isa isa/syscons_isa.c optional sc isa/vga_isa.c optional vga kern/link_elf_obj.c standard Modified: user/eri/pf45/head/sys/conf/files.i386 ============================================================================== --- user/eri/pf45/head/sys/conf/files.i386 Sun Oct 11 20:52:18 2009 (r197971) +++ user/eri/pf45/head/sys/conf/files.i386 Sun Oct 11 21:25:47 2009 (r197972) @@ -362,6 +362,7 @@ i386/svr4/svr4_locore.s optional compat i386/svr4/svr4_machdep.c optional compat_svr4 # isa/atrtc.c optional atpic +isa/orm.c optional isa isa/syscons_isa.c optional sc isa/vga_isa.c optional vga kern/imgact_aout.c optional compat_aout Modified: user/eri/pf45/head/sys/dev/agp/agp_i810.c ============================================================================== --- user/eri/pf45/head/sys/dev/agp/agp_i810.c Sun Oct 11 20:52:18 2009 (r197971) +++ user/eri/pf45/head/sys/dev/agp/agp_i810.c Sun Oct 11 21:25:47 2009 (r197972) @@ -175,6 +175,8 @@ static const struct agp_i810_match { "Intel Q45 SVGA controller"}, {0x2E228086, CHIP_G4X, 0x00020000, "Intel G45 SVGA controller"}, + {0x2E328086, CHIP_G4X, 0x00020000, + "Intel G41 SVGA controller"}, {0, 0, 0, NULL} }; Copied: user/eri/pf45/head/sys/dev/ath/ath_hal/ah_eeprom_v4k.c (from r197971, head/sys/dev/ath/ath_hal/ah_eeprom_v4k.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/eri/pf45/head/sys/dev/ath/ath_hal/ah_eeprom_v4k.c Sun Oct 11 21:25:47 2009 (r197972, copy of r197971, head/sys/dev/ath/ath_hal/ah_eeprom_v4k.c) @@ -0,0 +1,404 @@ +/* + * Copyright (c) 2009 Rui Paulo + * Copyright (c) 2008 Sam Leffler, Errno Consulting + * Copyright (c) 2008 Atheros Communications, Inc. + * + * Permission to use, copy, modify, and/or 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$ + */ +#include "opt_ah.h" + +#include "ah.h" +#include "ah_internal.h" +#include "ah_eeprom_v14.h" +#include "ah_eeprom_v4k.h" + +static HAL_STATUS +v4kEepromGet(struct ath_hal *ah, int param, void *val) +{ +#define CHAN_A_IDX 0 +#define CHAN_B_IDX 1 +#define IS_VERS(op, v) ((pBase->version & AR5416_EEP_VER_MINOR_MASK) op (v)) + HAL_EEPROM_v4k *ee = AH_PRIVATE(ah)->ah_eeprom; + const MODAL_EEP4K_HEADER *pModal = &ee->ee_base.modalHeader; + const BASE_EEP4K_HEADER *pBase = &ee->ee_base.baseEepHeader; + uint32_t sum; + uint8_t *macaddr; + int i; + + switch (param) { + case AR_EEP_NFTHRESH_5: + *(int16_t *)val = pModal[0].noiseFloorThreshCh[0]; + return HAL_OK; + case AR_EEP_NFTHRESH_2: + *(int16_t *)val = pModal[1].noiseFloorThreshCh[0]; + return HAL_OK; + case AR_EEP_MACADDR: /* Get MAC Address */ + sum = 0; + macaddr = val; + for (i = 0; i < 6; i++) { + macaddr[i] = pBase->macAddr[i]; + sum += pBase->macAddr[i]; + } + if (sum == 0 || sum == 0xffff*3) { + HALDEBUG(ah, HAL_DEBUG_ANY, "%s: bad mac address %s\n", + __func__, ath_hal_ether_sprintf(macaddr)); + return HAL_EEBADMAC; + } + return HAL_OK; + case AR_EEP_REGDMN_0: + return pBase->regDmn[0]; + case AR_EEP_REGDMN_1: + return pBase->regDmn[1]; + case AR_EEP_OPCAP: + return pBase->deviceCap; + case AR_EEP_OPMODE: + return pBase->opCapFlags; + case AR_EEP_RFSILENT: + return pBase->rfSilent; + case AR_EEP_OB_5: + return pModal[CHAN_A_IDX].ob; + case AR_EEP_DB_5: + return pModal[CHAN_A_IDX].db; + case AR_EEP_OB_2: + return pModal[CHAN_B_IDX].ob; + case AR_EEP_DB_2: + return pModal[CHAN_B_IDX].db; + case AR_EEP_TXMASK: + return pBase->txMask; + case AR_EEP_RXMASK: + return pBase->rxMask; + case AR_EEP_RXGAIN_TYPE: + return AR5416_EEP_RXGAIN_ORIG; + case AR_EEP_TXGAIN_TYPE: + return IS_VERS(>=, AR5416_EEP_MINOR_VER_19) ? + pBase->txGainType : AR5416_EEP_TXGAIN_ORIG; +#if 0 + case AR_EEP_OL_PWRCTRL: + HALASSERT(val == AH_NULL); + return pBase->openLoopPwrCntl ? HAL_OK : HAL_EIO; +#endif + case AR_EEP_AMODE: + HALASSERT(val == AH_NULL); + return pBase->opCapFlags & AR5416_OPFLAGS_11A ? + HAL_OK : HAL_EIO; + case AR_EEP_BMODE: + case AR_EEP_GMODE: + HALASSERT(val == AH_NULL); + return pBase->opCapFlags & AR5416_OPFLAGS_11G ? + HAL_OK : HAL_EIO; + case AR_EEP_32KHZCRYSTAL: + case AR_EEP_COMPRESS: + case AR_EEP_FASTFRAME: /* XXX policy decision, h/w can do it */ + case AR_EEP_WRITEPROTECT: /* NB: no write protect bit */ + HALASSERT(val == AH_NULL); + /* fall thru... */ + case AR_EEP_MAXQCU: /* NB: not in opCapFlags */ + case AR_EEP_KCENTRIES: /* NB: not in opCapFlags */ + return HAL_EIO; + case AR_EEP_AES: + case AR_EEP_BURST: + case AR_EEP_RFKILL: + case AR_EEP_TURBO5DISABLE: + case AR_EEP_TURBO2DISABLE: + HALASSERT(val == AH_NULL); + return HAL_OK; + case AR_EEP_ANTGAINMAX_2: + *(int8_t *) val = ee->ee_antennaGainMax[1]; + return HAL_OK; + case AR_EEP_ANTGAINMAX_5: + *(int8_t *) val = ee->ee_antennaGainMax[0]; + return HAL_OK; + default: + HALASSERT(0); + return HAL_EINVAL; + } +#undef IS_VERS +#undef CHAN_A_IDX +#undef CHAN_B_IDX +} + +static HAL_BOOL +v4kEepromSet(struct ath_hal *ah, int param, int v) +{ + HAL_EEPROM_v4k *ee = AH_PRIVATE(ah)->ah_eeprom; + + switch (param) { + case AR_EEP_ANTGAINMAX_2: + ee->ee_antennaGainMax[1] = (int8_t) v; + return HAL_OK; + case AR_EEP_ANTGAINMAX_5: + ee->ee_antennaGainMax[0] = (int8_t) v; + return HAL_OK; + } + return HAL_EINVAL; +} + +static HAL_BOOL +v4kEepromDiag(struct ath_hal *ah, int request, + const void *args, uint32_t argsize, void **result, uint32_t *resultsize) +{ + HAL_EEPROM_v4k *ee = AH_PRIVATE(ah)->ah_eeprom; + + switch (request) { + case HAL_DIAG_EEPROM: + *result = &ee->ee_base; + *resultsize = sizeof(ee->ee_base); + return AH_TRUE; + } + return AH_FALSE; +} + +/* Do structure specific swaps if Eeprom format is non native to host */ +static void +eepromSwap(struct ar5416eeprom_4k *ee) +{ + uint32_t integer, i; + uint16_t word; + MODAL_EEP4K_HEADER *pModal; + + /* convert Base Eep header */ + word = __bswap16(ee->baseEepHeader.length); + ee->baseEepHeader.length = word; + + word = __bswap16(ee->baseEepHeader.checksum); + ee->baseEepHeader.checksum = word; + + word = __bswap16(ee->baseEepHeader.version); + ee->baseEepHeader.version = word; + + word = __bswap16(ee->baseEepHeader.regDmn[0]); + ee->baseEepHeader.regDmn[0] = word; + + word = __bswap16(ee->baseEepHeader.regDmn[1]); + ee->baseEepHeader.regDmn[1] = word; + + word = __bswap16(ee->baseEepHeader.rfSilent); + ee->baseEepHeader.rfSilent = word; + + word = __bswap16(ee->baseEepHeader.blueToothOptions); + ee->baseEepHeader.blueToothOptions = word; + + word = __bswap16(ee->baseEepHeader.deviceCap); + ee->baseEepHeader.deviceCap = word; + + /* convert Modal Eep header */ + pModal = &ee->modalHeader; + + /* XXX linux/ah_osdep.h only defines __bswap32 for BE */ + integer = __bswap32(pModal->antCtrlCommon); + pModal->antCtrlCommon = integer; + + for (i = 0; i < AR5416_4K_MAX_CHAINS; i++) { + integer = __bswap32(pModal->antCtrlChain[i]); + pModal->antCtrlChain[i] = integer; + } + + for (i = 0; i < AR5416_EEPROM_MODAL_SPURS; i++) { + word = __bswap16(pModal->spurChans[i].spurChan); + pModal->spurChans[i].spurChan = word; + } +} + +static uint16_t +v4kEepromGetSpurChan(struct ath_hal *ah, int ix, HAL_BOOL is2GHz) +{ + HAL_EEPROM_v4k *ee = AH_PRIVATE(ah)->ah_eeprom; + + HALASSERT(0 <= ix && ix < AR5416_EEPROM_MODAL_SPURS); + HALASSERT(is2GHz); + return ee->ee_base.modalHeader.spurChans[ix].spurChan; +} + +/************************************************************************** + * fbin2freq + * + * Get channel value from binary representation held in eeprom + * RETURNS: the frequency in MHz + */ +static uint16_t +fbin2freq(uint8_t fbin, HAL_BOOL is2GHz) +{ + /* + * Reserved value 0xFF provides an empty definition both as + * an fbin and as a frequency - do not convert + */ + if (fbin == AR5416_BCHAN_UNUSED) + return fbin; + return (uint16_t)((is2GHz) ? (2300 + fbin) : (4800 + 5 * fbin)); +} + +/* + * Copy EEPROM Conformance Testing Limits contents + * into the allocated space + */ +/* USE CTLS from chain zero */ +#define CTL_CHAIN 0 + +static void +v4kEepromReadCTLInfo(struct ath_hal *ah, HAL_EEPROM_v4k *ee) +{ + RD_EDGES_POWER *rep = ee->ee_rdEdgesPower; + int i, j; + + HALASSERT(AR5416_NUM_CTLS <= sizeof(ee->ee_rdEdgesPower)/NUM_EDGES); + + for (i = 0; ee->ee_base.ctlIndex[i] != 0 && i < AR5416_4K_NUM_CTLS; i++) { + for (j = 0; j < NUM_EDGES; j ++) { + /* XXX Confirm this is the right thing to do when an invalid channel is stored */ + if (ee->ee_base.ctlData[i].ctlEdges[CTL_CHAIN][j].bChannel == AR5416_BCHAN_UNUSED) { + rep[j].rdEdge = 0; + rep[j].twice_rdEdgePower = 0; + rep[j].flag = 0; + } else { + rep[j].rdEdge = fbin2freq( + ee->ee_base.ctlData[i].ctlEdges[CTL_CHAIN][j].bChannel, + (ee->ee_base.ctlIndex[i] & CTL_MODE_M) != CTL_11A); + rep[j].twice_rdEdgePower = MS(ee->ee_base.ctlData[i].ctlEdges[CTL_CHAIN][j].tPowerFlag, CAL_CTL_EDGES_POWER); + rep[j].flag = MS(ee->ee_base.ctlData[i].ctlEdges[CTL_CHAIN][j].tPowerFlag, CAL_CTL_EDGES_FLAG) != 0; + } + } + rep += NUM_EDGES; + } + ee->ee_numCtls = i; + HALDEBUG(ah, HAL_DEBUG_ATTACH | HAL_DEBUG_EEPROM, + "%s Numctls = %u\n",__func__,i); +} + +/* + * Reclaim any EEPROM-related storage. + */ +static void +v4kEepromDetach(struct ath_hal *ah) +{ + HAL_EEPROM_v4k *ee = AH_PRIVATE(ah)->ah_eeprom; + + ath_hal_free(ee); + AH_PRIVATE(ah)->ah_eeprom = AH_NULL; +} + +#define owl_get_eep_ver(_ee) \ + (((_ee)->ee_base.baseEepHeader.version >> 12) & 0xF) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Mon Oct 12 16:47:55 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 939BF106566B; Mon, 12 Oct 2009 16:47:55 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 81DD18FC19; Mon, 12 Oct 2009 16:47:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n9CGltIX077340; Mon, 12 Oct 2009 16:47:55 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9CGlttl077323; Mon, 12 Oct 2009 16:47:55 GMT (envelope-from des@svn.freebsd.org) Message-Id: <200910121647.n9CGlttl077323@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Mon, 12 Oct 2009 16:47:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r197987 - in user/des/svnsup: . src src/apply src/distill X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Oct 2009 16:47:55 -0000 Author: des Date: Mon Oct 12 16:47:55 2009 New Revision: 197987 URL: http://svn.freebsd.org/changeset/base/197987 Log: Witness the birth of svnsup! Added: user/des/svnsup/ (props changed) user/des/svnsup/Makefile.am (contents, props changed) user/des/svnsup/autogen.des (contents, props changed) user/des/svnsup/autogen.sh (contents, props changed) user/des/svnsup/configure.ac (contents, props changed) user/des/svnsup/src/ (props changed) user/des/svnsup/src/Makefile.am (contents, props changed) user/des/svnsup/src/apply/ (props changed) user/des/svnsup/src/apply/Makefile.am (contents, props changed) user/des/svnsup/src/apply/main.c (contents, props changed) user/des/svnsup/src/distill/ (props changed) user/des/svnsup/src/distill/Makefile.am (contents, props changed) user/des/svnsup/src/distill/auth.c (contents, props changed) user/des/svnsup/src/distill/distill.c (contents, props changed) user/des/svnsup/src/distill/distill.h (contents, props changed) user/des/svnsup/src/distill/editor.c (contents, props changed) user/des/svnsup/src/distill/error.c (contents, props changed) user/des/svnsup/src/distill/log.c (contents, props changed) user/des/svnsup/src/distill/ra.c (contents, props changed) user/des/svnsup/src/distill/txdelta.c (contents, props changed) Added: user/des/svnsup/Makefile.am ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/des/svnsup/Makefile.am Mon Oct 12 16:47:55 2009 (r197987) @@ -0,0 +1,3 @@ +# $Id$ + +SUBDIRS = src Added: user/des/svnsup/autogen.des ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/des/svnsup/autogen.des Mon Oct 12 16:47:55 2009 (r197987) @@ -0,0 +1,5 @@ +#!/bin/sh + +sh -x ./autogen.sh +set -x +./configure --enable-wall --enable-wextra --enable-werror "$@" Added: user/des/svnsup/autogen.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/des/svnsup/autogen.sh Mon Oct 12 16:47:55 2009 (r197987) @@ -0,0 +1,11 @@ +#!/bin/sh +# +# $Id$ +# + +set -e + +aclocal +autoheader +automake --add-missing --copy --foreign +autoconf Added: user/des/svnsup/configure.ac ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/des/svnsup/configure.ac Mon Oct 12 16:47:55 2009 (r197987) @@ -0,0 +1,126 @@ +# +# $Id$ +# +AC_PREREQ([2.59]) +AC_INIT([svnsup], [1.0], [des@des.no]) +AC_CONFIG_SRCDIR([src/distill/distill.c]) +AM_CONFIG_HEADER([config.h]) + +AC_LANG(C) +AC_C_CONST +AM_INIT_AUTOMAKE + +AC_PROG_CC +AC_PROG_CPP +AC_PROG_INSTALL +AC_PROG_LN_S +AC_PROG_MAKE_SET + +PKG_PROG_PKG_CONFIG + +AC_ARG_ENABLE(debugging, + AS_HELP_STRING([--enable-debugging], + [enable debugging (default is NO)]), + [ + CFLAGS="${CFLAGS} -O0 -g" + CPPFLAGS="${CPPFLAGS} -DDEBUG" + ] +) + +AC_ARG_ENABLE(wall, + AS_HELP_STRING([--enable-wall], + [gcc only: compile with -Wall (default is NO)]), + AS_IF([test x"${GCC+set}" = xset], [ + CFLAGS="${CFLAGS} -Wall" + ], [ + AC_MSG_WARN([-Wall is only supported on gcc]) + ]) +) + +AC_ARG_ENABLE(wextra, + AS_HELP_STRING([--enable-wextra], + [gcc only: compile with -Wextra (default is NO)]), + AS_IF([test x"${GCC+set}" = xset], [ + CFLAGS="${CFLAGS} -Wextra" + ], [ + AC_MSG_WARN([-Wextra is only supported on gcc]) + ]) +) + +AC_ARG_ENABLE(werror, + AS_HELP_STRING([--enable-werror], + [gcc only: compile with -Werror (default is NO)]), + AS_IF([test x"${GCC+set}" = xset], [ + CFLAGS="${CFLAGS} -Werror" + ], [ + AC_MSG_WARN([-Werror is only supported on gcc]) + ]) +) + +# +# APR +# +PKG_CHECK_MODULES([APR_1], [apr-1]) + +# +# Subersion remote access library +# +saved_CPPFLAGS="${CPPFLAGS}" +CPPFLAGS="${APR_1_CFLAGS}" +AC_CHECK_HEADER([subversion-1/svn_ra.h], [], [ + AC_MSG_ERROR([cannot proceed without ]) +]) +CPPFLAGS="${saved_CPPFLAGS}" +saved_LIBS="${LIBS}" +LIBS="" +AC_CHECK_LIB([svn_ra-1], [svn_ra_version], [], [ + AC_MSG_ERROR([cannot proceed without libsvn_ra-1]) +]) +SVN_RA_1_LIBS="${LIBS}" +LIBS="${saved_LIBS}" +AC_SUBST([SVN_RA_1_LIBS]) + +# +# Subversion delta library +# +saved_CPPFLAGS="${CPPFLAGS}" +CPPFLAGS="${APR_1_CFLAGS}" +AC_CHECK_HEADER([subversion-1/svn_delta.h], [], [ + AC_MSG_ERROR([cannot proceed without ]) +]) +CPPFLAGS="${saved_CPPFLAGS}" +saved_LIBS="${LIBS}" +AC_CHECK_LIB([svn_delta-1], [svn_delta_version], [], [ + AC_MSG_ERROR([cannot proceed without libsvn_delta-1]) +]) +SVN_DELTA_1_LIBS="${LIBS}" +LIBS="${saved_LIBS}" +AC_SUBST([SVN_DELTA_1_LIBS]) + +# +# Subversion client library +# +saved_CPPFLAGS="${CPPFLAGS}" +CPPFLAGS="${APR_1_CFLAGS}" +AC_CHECK_HEADER([subversion-1/svn_client.h], [], [ + AC_MSG_ERROR([cannot proceed without ]) +]) +CPPFLAGS="${saved_CPPFLAGS}" +saved_LIBS="${LIBS}" +AC_CHECK_LIB([svn_client-1], [svn_client_version], [], [ + AC_MSG_ERROR([cannot proceed without libsvn_client-1]) +]) +SVN_CLIENT_1_LIBS="${LIBS}" +LIBS="${saved_LIBS}" +AC_SUBST([SVN_CLIENT_1_LIBS]) + +# +# Output +# +AC_CONFIG_FILES([ + Makefile + src/Makefile + src/distill/Makefile + src/apply/Makefile +]) +AC_OUTPUT Added: user/des/svnsup/src/Makefile.am ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/des/svnsup/src/Makefile.am Mon Oct 12 16:47:55 2009 (r197987) @@ -0,0 +1,3 @@ +# $Id$ + +SUBDIRS = distill apply Added: user/des/svnsup/src/apply/Makefile.am ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/des/svnsup/src/apply/Makefile.am Mon Oct 12 16:47:55 2009 (r197987) @@ -0,0 +1,8 @@ +# $Id$ + +bin_PROGRAMS = svnsup-apply + +svnsup_apply_SOURCES = \ + main.c + +svnsup_apply_LDADD = Added: user/des/svnsup/src/apply/main.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/des/svnsup/src/apply/main.c Mon Oct 12 16:47:55 2009 (r197987) @@ -0,0 +1,34 @@ +/*- + * Copyright (c) 2009 Dag-Erling Coïdan Smørgrav + * 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 + * in this position and unchanged. + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + * + * $Id$ + */ + +int +main(void) +{ + return (0); +} Added: user/des/svnsup/src/distill/Makefile.am ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/des/svnsup/src/distill/Makefile.am Mon Oct 12 16:47:55 2009 (r197987) @@ -0,0 +1,24 @@ +# $Id$ + +bin_PROGRAMS = svnsup-distill + +noinst_HEADERS = \ + distill.h + +svnsup_distill_SOURCES = \ + auth.c \ + distill.c \ + editor.c \ + error.c \ + log.c \ + ra.c \ + txdelta.c + +svnsup_distill_CPPFLAGS = \ + ${APR_1_CFLAGS} + +svnsup_distill_LDADD = \ + ${APR_1_LDADD} \ + ${SVN_DELTA_1_LIBS} \ + ${SVN_CLIENT_1_LIBS} \ + ${SVN_RA_1_LIBS} Added: user/des/svnsup/src/distill/auth.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/des/svnsup/src/distill/auth.c Mon Oct 12 16:47:55 2009 (r197987) @@ -0,0 +1,53 @@ +/*- + * Copyright (c) 2009 Dag-Erling Coïdan Smørgrav + * 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 + * in this position and unchanged. + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + * + * $Id$ + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#include "distill.h" + +svn_error_t * +username_prompt_callback(svn_auth_cred_username_t **cred, + void *baton, + const char *realm, + svn_boolean_t may_save, + apr_pool_t *pool) +{ + + (void)cred; + (void)baton; + (void)realm; + (void)may_save; + (void)pool; + fprintf(stderr, "%s(%s)\n", __func__, realm); + return (SVN_NO_ERROR); +} Added: user/des/svnsup/src/distill/distill.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/des/svnsup/src/distill/distill.c Mon Oct 12 16:47:55 2009 (r197987) @@ -0,0 +1,137 @@ +/*- + * Copyright (c) 2009 Dag-Erling Coïdan Smørgrav + * 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 + * in this position and unchanged. + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + * + * $Id$ + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include + +#include "distill.h" + +int debug; +int verbose; + +static int +distill(const char *url, unsigned long revision) +{ + apr_pool_t *pool; + apr_status_t status; + svn_auth_provider_object_t *auth_provider; + apr_array_header_t *auth_providers; + svn_ra_session_t *ra_session; + svn_error_t *error; + + /* our root pool */ + status = apr_pool_create(&pool, NULL); + SVNSUP_APR_ERROR(status, "apr_pool_create()"); + + /* set up our authentication system */ + /* XXX check for errors */ + auth_providers = apr_array_make(pool, 1, sizeof auth_provider); + svn_client_get_username_prompt_provider(&auth_provider, + username_prompt_callback, NULL, 0, pool); + APR_ARRAY_PUSH(auth_providers, svn_auth_provider_object_t *) = + auth_provider; + svn_auth_open(&ra_callbacks.auth_baton, auth_providers, pool); + + /* open a connection to the repo */ + error = svn_ra_open3(&ra_session, url, NULL, &ra_callbacks, + NULL, NULL, pool); + SVNSUP_SVN_ERROR(error, "svn_ra_open3()"); + + /* get revision metadata */ + error = svn_ra_get_log2(ra_session, NULL, revision, revision, 0, + TRUE, TRUE, FALSE, NULL, log_entry_receiver, NULL, pool); + SVNSUP_SVN_ERROR(error, "svn_ra_get_log()"); + + /* replay the requested revision */ + error = svn_ra_replay(ra_session, revision, revision - 1, TRUE, + &delta_editor, NULL, pool); + SVNSUP_SVN_ERROR(error, "svn_ra_replay()"); + + /* clean up */ + apr_pool_destroy(pool); + return (0); +} + +static void +usage(void) +{ + + fprintf(stderr, "usage: svnsup-distill [-v] url rev\n"); + exit(1); +} + +int +main(int argc, char *argv[]) +{ + apr_status_t status; + const char *url; + char *end, *revstr; + unsigned long rev; + int opt, ret; + + while ((opt = getopt(argc, argv, "dv")) != -1) + switch (opt) { + case 'd': + ++debug; + break; + case 'v': + ++verbose; + break; + default: + usage(); + } + + argc -= optind; + argv += optind; + + if (argc != 2) + usage(); + + url = argv[0]; + revstr = argv[1]; + if (*revstr == 'r') + ++revstr; + rev = strtoul(revstr, &end, 10); + if (rev == 0 || end == revstr || *end != '\0') + usage(); + + status = apr_initialize(); + if (status != APR_SUCCESS) + return (1); + + ret = distill(url, rev); + + apr_terminate(); + return (ret); +} Added: user/des/svnsup/src/distill/distill.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/des/svnsup/src/distill/distill.h Mon Oct 12 16:47:55 2009 (r197987) @@ -0,0 +1,104 @@ +/*- + * Copyright (c) 2009 Dag-Erling Coïdan Smørgrav + * 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 + * in this position and unchanged. + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + * + * $Id$ + */ + +#ifndef DISTILL_H_INCLUDED +#define DISTILL_H_INCLUDED + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +extern int debug; +extern int verbose; + +typedef struct svnsup_where { + const char *file; + int line; + const char *func; +} svnsup_where_t; +#define SVNSUP_WHERE \ + &((struct svnsup_where){ __FILE__, __LINE__, __func__ }) + +/* apr errors */ +void svnsup_apr_error(svnsup_where_t *, apr_status_t, const char *, ...); +#define SVNSUP_APR_ERROR(status, ...) \ + do { \ + if ((status) != APR_SUCCESS) \ + svnsup_apr_error(SVNSUP_WHERE, \ + (status), __VA_ARGS__); \ + } while (0) + +/* svn errors */ +void svnsup_svn_error(svnsup_where_t *, svn_error_t *, const char *, ...); +#define SVNSUP_SVN_ERROR(error, ...) \ + do { \ + if ((error) != SVN_NO_ERROR) \ + svnsup_svn_error(SVNSUP_WHERE, \ + (error), __VA_ARGS__); \ + } while (0) + +/* assertions */ +void svnsup_assert(svnsup_where_t *, const char *, const char *, ...); +#define SVNSUP_ASSERT(cond, ...) \ + do { \ + if (!(cond)) \ + svnsup_assert(SVNSUP_WHERE, \ + #cond, __VA_ARGS__); \ + } while (0) + +/* debugging messages */ +#define SVNSUP_DEBUG(fmt, ...) \ + do { \ + if (debug) \ + fprintf(stderr, fmt, __VA_ARGS__); \ + } while (0) + +/* authentication */ +svn_error_t *username_prompt_callback(svn_auth_cred_username_t **, + void *, const char *, svn_boolean_t, apr_pool_t *); + +/* callback function for log entries */ +svn_error_t *log_entry_receiver(void *, svn_log_entry_t *, apr_pool_t *); + +/* callback function for file deltas */ +svn_error_t *txdelta_window_handler(svn_txdelta_window_t *, void *); + +/* callback lists */ +extern struct svn_ra_callbacks2_t ra_callbacks; +extern struct svn_delta_editor_t delta_editor; + +#endif Added: user/des/svnsup/src/distill/editor.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/des/svnsup/src/distill/editor.c Mon Oct 12 16:47:55 2009 (r197987) @@ -0,0 +1,269 @@ +/*- + * Copyright (c) 2009 Dag-Erling Coïdan Smørgrav + * 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 + * in this position and unchanged. + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + * + * $Id$ + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "distill.h" + +svn_error_t * +set_target_revision(void *edit_baton, + svn_revnum_t target_revision, + apr_pool_t *pool) +{ + + (void)edit_baton; + (void)pool; + SVNSUP_DEBUG("%s(r%ld)\n", __func__, (long)target_revision); + return (SVN_NO_ERROR); +} + +svn_error_t * +open_root(void *edit_baton, + svn_revnum_t base_revision, + apr_pool_t *dir_pool, + void **root_baton) +{ + + (void)edit_baton; + (void)dir_pool; + SVNSUP_DEBUG("%s(%ld)\n", __func__, (long)base_revision); + *root_baton = (void *)__LINE__; + return (SVN_NO_ERROR); +} + +svn_error_t * +delete_entry(const char *path, + svn_revnum_t revision, + void *parent_baton, + apr_pool_t *pool) +{ + + (void)parent_baton; + (void)pool; + SVNSUP_DEBUG("%s(%ld, %s)\n", __func__, (long)revision, path); + return (SVN_NO_ERROR); +} + +svn_error_t * +add_directory(const char *path, + void *parent_baton, + const char *copyfrom_path, + svn_revnum_t copyfrom_revision, + apr_pool_t *dir_pool, + void **child_baton) +{ + + (void)parent_baton; + (void)dir_pool; + SVNSUP_DEBUG("%s(%s, %s, %ld)\n", __func__, path, + copyfrom_path, (long)copyfrom_revision); + *child_baton = (void *)__LINE__; + return (SVN_NO_ERROR); +} + +svn_error_t * +open_directory(const char *path, + void *parent_baton, + svn_revnum_t base_revision, + apr_pool_t *dir_pool, + void **child_baton) +{ + + (void)parent_baton; + (void)dir_pool; + SVNSUP_DEBUG("%s(%s, %ld)\n", __func__, path, + (long)base_revision); + *child_baton = (void *)__LINE__; + return (SVN_NO_ERROR); +} + +svn_error_t * +change_dir_prop(void *dir_baton, + const char *name, + const svn_string_t *value, + apr_pool_t *pool) +{ + + (void)dir_baton; + (void)pool; + SVNSUP_DEBUG("%s(%s, %s)\n", __func__, name, value->data); + return (SVN_NO_ERROR); +} + +svn_error_t * +close_directory(void *dir_baton, + apr_pool_t *pool) +{ + + (void)dir_baton; + (void)pool; + SVNSUP_DEBUG("%s()\n", __func__); + return (SVN_NO_ERROR); +} + +svn_error_t * +absent_directory(const char *path, + void *parent_baton, + apr_pool_t *pool) +{ + + (void)parent_baton; + (void)pool; + SVNSUP_DEBUG("%s(%s)\n", __func__, path); + return (SVN_NO_ERROR); +} + +svn_error_t * +add_file(const char *path, + void *parent_baton, + const char *copyfrom_path, + svn_revnum_t copyfrom_revision, + apr_pool_t *file_pool, + void **file_baton) +{ + + (void)parent_baton; + (void)file_pool; + SVNSUP_DEBUG("%s(%s, %s, %ld)\n", __func__, path, + copyfrom_path, (long)copyfrom_revision); + *file_baton = (void *)__LINE__; + return (SVN_NO_ERROR); +} + +svn_error_t * +open_file(const char *path, + void *parent_baton, + svn_revnum_t base_revision, + apr_pool_t *file_pool, + void **file_baton) +{ + + (void)parent_baton; + (void)file_pool; + SVNSUP_DEBUG("%s(%s, %ld)\n", __func__, path, + (long)base_revision); + *file_baton = (void *)__LINE__; + return (SVN_NO_ERROR); +} + +svn_error_t * +apply_textdelta(void *file_baton, + const char *base_checksum, + apr_pool_t *pool, + svn_txdelta_window_handler_t *handler, + void **handler_baton) +{ + + (void)file_baton; + (void)pool; + SVNSUP_DEBUG("%s(%s)\n", __func__, base_checksum); + *handler = txdelta_window_handler; + *handler_baton = (void *)__LINE__; + return (SVN_NO_ERROR); +} + +svn_error_t * +change_file_prop(void *file_baton, + const char *name, + const svn_string_t *value, + apr_pool_t *pool) +{ + + (void)file_baton; + (void)pool; + SVNSUP_DEBUG("%s(%s, %s)\n", __func__, name, value->data); + return (SVN_NO_ERROR); +} + +svn_error_t * +close_file(void *file_baton, + const char *text_checksum, + apr_pool_t *pool) +{ + + (void)file_baton; + (void)pool; + SVNSUP_DEBUG("%s(%s)\n", __func__, text_checksum); + return (SVN_NO_ERROR); +} + +svn_error_t * +absent_file(const char *path, + void *parent_baton, + apr_pool_t *pool) +{ + + (void)parent_baton; + (void)pool; + SVNSUP_DEBUG("%s(%s)\n", __func__, path); + return (SVN_NO_ERROR); +} + +svn_error_t * +close_edit(void *edit_baton, + apr_pool_t *pool) +{ + + (void)edit_baton; + (void)pool; + SVNSUP_DEBUG("%s()\n", __func__); + return (SVN_NO_ERROR); +} + +svn_error_t * +abort_edit(void *edit_baton, + apr_pool_t *pool) +{ + + (void)edit_baton; + (void)pool; + SVNSUP_DEBUG("%s()\n", __func__); + return (SVN_NO_ERROR); +} + +struct svn_delta_editor_t delta_editor = { + .set_target_revision = set_target_revision, + .open_root = open_root, + .delete_entry = delete_entry, + .add_directory = add_directory, + .open_directory = open_directory, + .change_dir_prop = change_dir_prop, + .close_directory = close_directory, + .absent_directory = absent_directory, + .add_file = add_file, + .open_file = open_file, + .apply_textdelta = apply_textdelta, + .change_file_prop = change_file_prop, + .close_file = close_file, + .absent_file = absent_file, + .close_edit = close_edit, + .abort_edit = abort_edit, +}; Added: user/des/svnsup/src/distill/error.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/des/svnsup/src/distill/error.c Mon Oct 12 16:47:55 2009 (r197987) @@ -0,0 +1,89 @@ +/*- + * Copyright (c) 2009 Dag-Erling Coïdan Smørgrav + * 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 + * in this position and unchanged. + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + * + * $Id$ + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include + +#include "distill.h" + +void +svnsup_svn_error(svnsup_where_t *where, svn_error_t *error, const char *fmt, ...) +{ + va_list ap; + + fprintf(stderr, "svnsup: "); + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end(ap); + fprintf(stderr, "\n"); + svn_handle_error2(error, stderr, FALSE, "svnsup: "); + if (debug) + fprintf(stderr, "svnsup: in %s() on line %d of %s\n", + where->func, where->line, where->file); + exit(1); +} + +void +svnsup_apr_error(svnsup_where_t *where, apr_status_t status, const char *fmt, ...) +{ + char errbuf[1024]; + va_list ap; + + fprintf(stderr, "svnsup: "); + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end(ap); + apr_strerror(status, errbuf, sizeof(errbuf)); + fprintf(stderr, "\nsvnsup: %s\n", errbuf); + if (debug) + fprintf(stderr, "svnsup: in %s() on line %d of %s\n", + where->func, where->line, where->file); + exit(1); +} + +void +svnsup_assert(svnsup_where_t *where, const char *cond, const char *fmt, ...) +{ + va_list ap; + + if (debug) + fprintf(stderr, "svnsup: assertion failed: %s\n", cond); + fprintf(stderr, "svnsup: "); + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end(ap); + if (debug) + fprintf(stderr, "svnsup: in %s() on line %d of %s\n", + where->func, where->line, where->file); + exit(1); +} Added: user/des/svnsup/src/distill/log.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/des/svnsup/src/distill/log.c Mon Oct 12 16:47:55 2009 (r197987) @@ -0,0 +1,75 @@ +/*- + * Copyright (c) 2009 Dag-Erling Coïdan Smørgrav + * 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 + * in this position and unchanged. + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + * + * $Id$ + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#include "distill.h" + +svn_error_t * +log_entry_receiver(void *baton, + svn_log_entry_t *log_entry, + apr_pool_t *pool) +{ +#if 0 + apr_hash_index_t *hash_index; + const void *key; + void *value; + apr_ssize_t keylen; +#else + svn_string_t *value; +#endif + + (void)pool; + (void)baton; + SVNSUP_DEBUG("%s(r%lu)\n", __func__, (long)log_entry->revision); + fprintf(stderr, "revision properties:\n"); +#if 0 + for (hash_index = apr_hash_first(pool, log_entry->revprops); + hash_index != NULL; hash_index = apr_hash_next(hash_index)) { + apr_hash_this(hash_index, &key, &keylen, &value); + fprintf(stderr, " %s: %s\n", (const char *)key, + ((svn_string_t *)value)->data); + } +#else + do { + const char *props[] = { "svn:author", "svn:date", NULL }; + const char **p; + for (p = props; *p != NULL; ++p) { + value = apr_hash_get(log_entry->revprops, *p, APR_HASH_KEY_STRING); + SVNSUP_ASSERT(value != NULL, "revision has no %s property", *p); + fprintf(stderr, " %s: %s\n", *p, value->data); + } + } while (0); +#endif + return (SVN_NO_ERROR); +} Added: user/des/svnsup/src/distill/ra.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/des/svnsup/src/distill/ra.c Mon Oct 12 16:47:55 2009 (r197987) @@ -0,0 +1,155 @@ +/*- + * Copyright (c) 2009 Dag-Erling Coïdan Smørgrav + * 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 + * in this position and unchanged. + * 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. + * *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Mon Oct 12 16:51:48 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 94E73106566B; Mon, 12 Oct 2009 16:51:48 +0000 (UTC) (envelope-from eri@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8419A8FC18; Mon, 12 Oct 2009 16:51:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n9CGpmrX077448; Mon, 12 Oct 2009 16:51:48 GMT (envelope-from eri@svn.freebsd.org) Received: (from eri@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9CGpm4L077443; Mon, 12 Oct 2009 16:51:48 GMT (envelope-from eri@svn.freebsd.org) Message-Id: <200910121651.n9CGpm4L077443@svn.freebsd.org> From: Ermal Luçi Date: Mon, 12 Oct 2009 16:51:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r197988 - user/eri/pf45/head/sys/contrib/pf/net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Oct 2009 16:51:48 -0000 Author: eri Date: Mon Oct 12 16:51:48 2009 New Revision: 197988 URL: http://svn.freebsd.org/changeset/base/197988 Log: * First pass at adding virtualization to pf(4). * The rule of V_ is not followed in an attempt to minimize the diff with upstream(hopefully it works). * Fix some whitespaces around. NOTE: The tree might not build now. Modified: user/eri/pf45/head/sys/contrib/pf/net/pf.c user/eri/pf45/head/sys/contrib/pf/net/pf_if.c user/eri/pf45/head/sys/contrib/pf/net/pf_ioctl.c user/eri/pf45/head/sys/contrib/pf/net/pf_lb.c user/eri/pf45/head/sys/contrib/pf/net/pf_norm.c user/eri/pf45/head/sys/contrib/pf/net/pf_osfp.c user/eri/pf45/head/sys/contrib/pf/net/pfvar.h Modified: user/eri/pf45/head/sys/contrib/pf/net/pf.c ============================================================================== --- user/eri/pf45/head/sys/contrib/pf/net/pf.c Mon Oct 12 16:47:55 2009 (r197987) +++ user/eri/pf45/head/sys/contrib/pf/net/pf.c Mon Oct 12 16:51:48 2009 (r197988) @@ -88,20 +88,20 @@ __FBSDID("$FreeBSD$"); #include #include #include - #ifdef __FreeBSD__ - #include - #include - #include - #define betoh64 be64toh - #else +#ifdef __FreeBSD__ +#include +#include +#include +#define betoh64 be64toh +#else #include #endif #include - #ifdef __FreeBSD__ - #include - #include - #include - #else +#ifdef __FreeBSD__ +#include +#include +#include +#else #include #endif @@ -155,21 +155,21 @@ __FBSDID("$FreeBSD$"); #include #include #include - #ifdef __FreeBSD__ - #include - #include - #endif +#ifdef __FreeBSD__ +#include +#include +#endif #endif /* INET6 */ #ifdef __FreeBSD__ - #include - #include - #include - #include +#include +#include +#include +#include - extern int ip_optcopy(struct ip *, struct ip *); - extern int debug_pfugidhack; - #endif +extern int ip_optcopy(struct ip *, struct ip *); +extern int debug_pfugidhack; +#endif #define DPFPRINTF(n, x) if (pf_status.debug >= (n)) printf x @@ -178,6 +178,41 @@ __FBSDID("$FreeBSD$"); */ /* state tables */ +#ifdef __FreeBSD__ +VNET_DEFINE(struct pf_state_tree, pf_statetbl); + +VNET_DEFINE(struct pf_altqqueue, pf_altqs[2]); +VNET_DEFINE(struct pf_palist, pf_pabuf); +VNET_DEFINE(struct pf_altqqueue, *pf_altqs_active); +VNET_DEFINE(struct pf_altqqueue, *pf_altqs_inactive); +VNET_DEFINE(struct pf_status, pf_status); + +VNET_DEFINE(u_int32_t, ticket_altqs_active); +VNET_DEFINE(u_int32_t, ticket_altqs_inactive); +VNET_DEFINE(int, altqs_inactive_open); +VNET_DEFINE(u_int32_t, ticket_pabuf); + +VNET_DEFINE(MD5_CTX, pf_tcp_secret_ctx); +VNET_DEFINE(u_char, pf_tcp_secret[16]); +VNET_DEFINE(int, pf_tcp_secret_init); +VNET_DEFINE(int, pf_tcp_iss_off); + +struct pf_anchor_stackframe { + struct pf_ruleset *rs; + struct pf_rule *r; + struct pf_anchor_node *parent; + struct pf_anchor *child; +}; +VNET_DEFINE(struct pf_anchor_stackframe, pf_anchor_stack[64]); + +VNET_DEFINE(uma_zone_t, pf_src_tree_pl); +VNET_DEFINE(uma_zone_t, pf_rule_pl); +VNET_DEFINE(uma_zone_t, pf_pooladdr_pl); +VNET_DEFINE(uma_zone_t, pf_state_pl); +VNET_DEFINE(uma_zone_t, pf_state_key_pl); +VNET_DEFINE(uma_zone_t, pf_state_item_pl); +VNET_DEFINE(uma_zone_t, pf_altq_pl); +#else struct pf_state_tree pf_statetbl; struct pf_altqqueue pf_altqs[2]; @@ -203,11 +238,6 @@ struct pf_anchor_stackframe { struct pf_anchor *child; } pf_anchor_stack[64]; - #ifdef __FreeBSD__ - uma_zone_t pf_src_tree_pl, pf_rule_pl, pf_pooladdr_pl; - uma_zone_t pf_state_pl, pf_state_key_pl, pf_state_item_pl; -uma_zone_t pf_altq_pl; - #else struct pool pf_src_tree_pl, pf_rule_pl, pf_pooladdr_pl; struct pool pf_state_pl, pf_state_key_pl, pf_state_item_pl; struct pool pf_altq_pl; @@ -323,12 +353,12 @@ int pf_src_connlimit(struct pf_state int pf_check_congestion(struct ifqueue *); #ifdef __FreeBSD__ - int in4_cksum(struct mbuf *m, u_int8_t nxt, int off, int len); +int in4_cksum(struct mbuf *m, u_int8_t nxt, int off, int len); - extern int pf_end_threads; +VNET_DECLARE(int, pf_end_threads); - struct pf_pool_limit pf_pool_limits[PF_LIMIT_MAX]; - #else +VNET_DEFINE(struct pf_pool_limit, pf_pool_limits[PF_LIMIT_MAX]); +#else extern struct pool pfr_ktable_pl; extern struct pool pfr_kentry_pl; @@ -405,10 +435,17 @@ static __inline int pf_state_compare_key static __inline int pf_state_compare_id(struct pf_state *, struct pf_state *); +#ifdef __FreeBSD__ +VNET_DEFINE(struct pf_src_tree, tree_src_tracking); + +VNET_DEFINE(struct pf_state_tree_id, tree_id); +VNET_DEFINE(struct pf_state_queue, state_list); +#else struct pf_src_tree tree_src_tracking; struct pf_state_tree_id tree_id; struct pf_state_queue state_list; +#endif RB_GENERATE(pf_src_tree, pf_src_node, entry, pf_src_compare); RB_GENERATE(pf_state_tree, pf_state_key, entry, pf_state_compare_key); @@ -1233,10 +1270,10 @@ pf_state_expires(const struct pf_state * return (state->expire + timeout); } - #ifdef __FreeBSD__ - int - pf_purge_expired_src_nodes(int waslocked) - #else +#ifdef __FreeBSD__ +int +pf_purge_expired_src_nodes(int waslocked) +#else void pf_purge_expired_src_nodes(int waslocked) #endif @@ -1315,7 +1352,7 @@ pf_src_tree_remove_state(struct pf_state void pf_unlink_state(struct pf_state *cur) { - #ifdef __FreeBSD__ +#ifdef __FreeBSD__ if (cur->local_flags & PFSTATE_EXPIRING) return; cur->local_flags |= PFSTATE_EXPIRING; @@ -1378,10 +1415,10 @@ pf_free_state(struct pf_state *cur) #endif return; #endif - #ifdef __FreeBSD__ +#ifdef __FreeBSD__ KASSERT(cur->timeout == PFTM_UNLINKED, ("pf_free_state: cur->timeout != PFTM_UNLINKED")); - #else +#else KASSERT(cur->timeout == PFTM_UNLINKED); #endif if (--cur->rule.ptr->states_cur <= 0 && @@ -1404,10 +1441,10 @@ pf_free_state(struct pf_state *cur) pf_status.states--; } - #ifdef __FreeBSD__ - int - pf_purge_expired_states(u_int32_t maxcheck, int waslocked) - #else +#ifdef __FreeBSD__ +int +pf_purge_expired_states(u_int32_t maxcheck, int waslocked) +#else void pf_purge_expired_states(u_int32_t maxcheck) #endif @@ -1947,9 +1984,9 @@ pf_modulate_sack(struct mbuf *m, int off struct tcphdr *th, struct pf_state_peer *dst) { int hlen = (th->th_off << 2) - sizeof(*th), thoptlen = hlen; - #ifdef __FreeBSD__ +#ifdef __FreeBSD__ u_int8_t opts[TCP_MAXOLEN], *opt = opts; - #else +#else u_int8_t opts[MAX_TCPOPTLEN], *opt = opts; #endif int copyback = 0, i, olen; @@ -2004,9 +2041,9 @@ pf_modulate_sack(struct mbuf *m, int off } void - #ifdef __FreeBSD__ - pf_send_tcp(struct mbuf *replyto, const struct pf_rule *r, sa_family_t af, - #else +#ifdef __FreeBSD__ +pf_send_tcp(struct mbuf *replyto, const struct pf_rule *r, sa_family_t af, +#else pf_send_tcp(const struct pf_rule *r, sa_family_t af, #endif const struct pf_addr *saddr, const struct pf_addr *daddr, @@ -2245,40 +2282,40 @@ pf_send_icmp(struct mbuf *m, u_int8_t ty struct pf_rule *r) { struct mbuf *m0; - #ifdef __FreeBSD__ +#ifdef __FreeBSD__ struct ip *ip; struct pf_mtag *pf_mtag; - #endif +#endif - #ifdef __FreeBSD__ +#ifdef __FreeBSD__ m0 = m_copypacket(m, M_DONTWAIT); if (m0 == NULL) return; - #else +#else if ((m0 = m_copy(m, 0, M_COPYALL)) == NULL) return; #endif - #ifdef __FreeBSD__ +#ifdef __FreeBSD__ if ((pf_mtag = pf_get_mtag(m0)) == NULL) return; /* XXX: revisit */ m0->m_flags |= M_SKIP_FIREWALL; - #else +#else m0->m_pkthdr.pf.flags |= PF_TAG_GENERATED; #endif if (r->rtableid >= 0) - #ifdef __FreeBSD__ +#ifdef __FreeBSD__ { M_SETFIB(m0, r->rtableid); pf_mtag->rtableid = r->rtableid; - #else +#else m0->m_pkthdr.pf.rtableid = r->rtableid; - #endif - #ifdef __FreeBSD__ +#endif +#ifdef __FreeBSD__ } - #endif +#endif #ifdef ALTQ if (r->qid) { @@ -2297,7 +2334,7 @@ pf_send_icmp(struct mbuf *m, u_int8_t ty switch (af) { #ifdef INET case AF_INET: - #ifdef __FreeBSD__ +#ifdef __FreeBSD__ /* icmp_error() expects host byte ordering */ ip = mtod(m0, struct ip *); NTOHS(ip->ip_len); @@ -2305,20 +2342,20 @@ pf_send_icmp(struct mbuf *m, u_int8_t ty PF_UNLOCK(); icmp_error(m0, type, code, 0, 0); PF_LOCK(); - #else +#else icmp_error(m0, type, code, 0, 0); #endif break; #endif /* INET */ #ifdef INET6 case AF_INET6: - #ifdef __FreeBSD__ +#ifdef __FreeBSD__ PF_UNLOCK(); - #endif +#endif icmp6_error(m0, type, code, 0); - #ifdef __FreeBSD__ +#ifdef __FreeBSD__ PF_LOCK(); - #endif +#endif break; #endif /* INET6 */ } @@ -2639,17 +2676,17 @@ pf_addr_inc(struct pf_addr *addr, sa_fam #endif /* INET6 */ int - #ifdef __FreeBSD__ - pf_socket_lookup(int direction, struct pf_pdesc *pd, struct inpcb *inp_arg) - #else +#ifdef __FreeBSD__ +pf_socket_lookup(int direction, struct pf_pdesc *pd, struct inpcb *inp_arg) +#else pf_socket_lookup(int direction, struct pf_pdesc *pd) #endif { struct pf_addr *saddr, *daddr; u_int16_t sport, dport; - #ifdef __FreeBSD__ +#ifdef __FreeBSD__ struct inpcbinfo *pi; - #else +#else struct inpcbtable *tb; #endif struct inpcb *inp; @@ -2763,11 +2800,11 @@ pf_socket_lookup(int direction, struct p default: return (-1); } - #ifdef __FreeBSD__ +#ifdef __FreeBSD__ pd->lookup.uid = inp->inp_cred->cr_uid; pd->lookup.gid = inp->inp_cred->cr_groups[0]; INP_INFO_RUNLOCK(pi); - #else +#else pd->lookup.uid = inp->inp_socket->so_euid; pd->lookup.gid = inp->inp_socket->so_egid; pd->lookup.pid = inp->inp_socket->so_cpid; Modified: user/eri/pf45/head/sys/contrib/pf/net/pf_if.c ============================================================================== --- user/eri/pf45/head/sys/contrib/pf/net/pf_if.c Mon Oct 12 16:47:55 2009 (r197987) +++ user/eri/pf45/head/sys/contrib/pf/net/pf_if.c Mon Oct 12 16:51:48 2009 (r197988) @@ -32,37 +32,37 @@ * POSSIBILITY OF SUCH DAMAGE. */ - #if defined(__FreeBSD__) - #include "opt_inet.h" - #include "opt_inet6.h" +#if defined(__FreeBSD__) +#include "opt_inet.h" +#include "opt_inet6.h" - #include +#include __FBSDID("$FreeBSD$"); - #endif +#endif #include #include - #ifdef __FreeBSD__ - #include - #endif +#ifdef __FreeBSD__ +#include +#endif #include #include #include #include #include - #ifndef __FreeBSD__ +#ifndef __FreeBSD__ #include #endif #include - #ifndef __FreeBSD__ +#ifndef __FreeBSD__ #include #endif #include #include - #ifdef __FreeBSD__ - #include - #endif +#ifdef __FreeBSD__ +#include +#endif #include #include @@ -76,25 +76,36 @@ __FBSDID("$FreeBSD$"); #include #endif /* INET6 */ +#ifdef __FreeBSD__ +VNET_DEFINE(struct pfi_kif, *pfi_all); +VNET_DEFINE(uma_zone_t, pfi_addr_pl); +VNET_DEFINE(struct pfi_ifhead, pfi_ifs); +#define pfi_ifs VNET(pfi_ifs) +VNET_DEFINE(long, pfi_update); +#define pfi_update VNET(pfi_update) +VNET_DEFINE(struct pfr_addr, *pfi_buffer); +#define pfi_buffer VNET(pfi_buffer) +VNET_DEFINE(int, pfi_buffer_cnt); +#define pfi_buffer_cnt VNET(pfi_buffer_cnt) +VNET_DEFINE(int, pfi_buffer_max); +#define pfi_buffer_max VNET(pfi_buffer_max) +#else struct pfi_kif *pfi_all = NULL; - #ifdef __FreeBSD__ - uma_zone_t pfi_addr_pl; - #else struct pool pfi_addr_pl; -#endif struct pfi_ifhead pfi_ifs; long pfi_update = 1; struct pfr_addr *pfi_buffer; int pfi_buffer_cnt; int pfi_buffer_max; - #ifdef __FreeBSD__ - eventhandler_tag pfi_attach_cookie = NULL; - eventhandler_tag pfi_detach_cookie = NULL; - eventhandler_tag pfi_attach_group_cookie = NULL; - eventhandler_tag pfi_change_group_cookie = NULL; - eventhandler_tag pfi_detach_group_cookie = NULL; - eventhandler_tag pfi_ifaddr_event_cookie = NULL; - #endif +#endif +#ifdef __FreeBSD__ +VNET_DEFINE(eventhandler_tag, pfi_attach_cookie); +VNET_DEFINE(eventhandler_tag, pfi_detach_cookie); +VNET_DEFINE(eventhandler_tag, pfi_attach_group_cookie); +VNET_DEFINE(eventhandler_tag, pfi_change_group_cookie); +VNET_DEFINE(eventhandler_tag, pfi_detach_group_cookie); +VNET_DEFINE(eventhandler_tag, pfi_ifaddr_event_cookie); +#endif void pfi_kif_update(struct pfi_kif *); void pfi_dynaddr_update(struct pfi_dynaddr *dyn); @@ -106,15 +117,15 @@ void pfi_address_add(struct sockaddr * int pfi_if_compare(struct pfi_kif *, struct pfi_kif *); int pfi_skip_if(const char *, struct pfi_kif *); int pfi_unmask(void *); - #ifdef __FreeBSD__ - void pfi_attach_ifnet_event(void * __unused, struct ifnet *); - void pfi_detach_ifnet_event(void * __unused, struct ifnet *); - void pfi_attach_group_event(void * __unused, struct ifg_group *); - void pfi_change_group_event(void * __unused, char *); - void pfi_detach_group_event(void * __unused, struct ifg_group *); - void pfi_ifaddr_event(void * __unused, struct ifnet *); +#ifdef __FreeBSD__ +void pfi_attach_ifnet_event(void * __unused, struct ifnet *); +void pfi_detach_ifnet_event(void * __unused, struct ifnet *); +void pfi_attach_group_event(void * __unused, struct ifg_group *); +void pfi_change_group_event(void * __unused, char *); +void pfi_detach_group_event(void * __unused, struct ifg_group *); +void pfi_ifaddr_event(void * __unused, struct ifnet *); - #endif +#endif RB_PROTOTYPE(pfi_ifhead, pfi_kif, pfik_tree, pfi_if_compare); RB_GENERATE(pfi_ifhead, pfi_kif, pfik_tree, pfi_if_compare); Modified: user/eri/pf45/head/sys/contrib/pf/net/pf_ioctl.c ============================================================================== --- user/eri/pf45/head/sys/contrib/pf/net/pf_ioctl.c Mon Oct 12 16:47:55 2009 (r197987) +++ user/eri/pf45/head/sys/contrib/pf/net/pf_ioctl.c Mon Oct 12 16:51:48 2009 (r197988) @@ -176,24 +176,41 @@ int pf_addr_setup(struct pf_ruleset * struct pf_addr_wrap *, sa_family_t); void pf_addr_copyout(struct pf_addr_wrap *); -struct pf_rule pf_default_rule; +#define TAGID_MAX 50000 #ifdef __FreeBSD__ -struct sx pf_consistency_lock; -SX_SYSINIT(pf_consistency_lock, &pf_consistency_lock, "pf_statetbl_lock"); -#else -struct rwlock pf_consistency_lock = RWLOCK_INITIALIZER("pfcnslk"); +VNET_DEFINE(struct pf_rule, pf_default_rule); +#define pf_default_rule VNET(pf_default_rule); +VNET_DEFINE(struct sx, pf_consistency_lock); +#define pf_consistency_lock VNET(pf_consistency_lock); +SX_SYSINIT(pf_consistency_lock, &pf_consistency_lock, + "pf_statetbl_lock"); +#ifdef ALTQ +static VNET_DEFINE(int, pf_altq_running); +#define pf_altq_running VNET(pf_altq_running) #endif + +TAILQ_HEAD(pf_tags, pf_tagname); + +VNET_DEFINE(struct pf_tags, pf_tags); +#define pf_tags VNET(pf_tags) +VNET_DEFINE(struct pf_tags, pf_qids); +#define pf_qids VNET(pf_qids); + +#else /* !__FreeBSD__ */ +struct pf_rule pf_default_rule; +struct rwlock pf_consistency_lock = RWLOCK_INITIALIZER("pfcnslk"); #ifdef ALTQ -static int pf_altq_running; +static int pf_altq_running; #endif -#define TAGID_MAX 50000 TAILQ_HEAD(pf_tags, pf_tagname) pf_tags = TAILQ_HEAD_INITIALIZER(pf_tags), pf_qids = TAILQ_HEAD_INITIALIZER(pf_qids); +#endif /* __FreeBSD__ */ #if (PF_QNAME_SIZE != PF_TAG_NAME_SIZE) #error PF_QNAME_SIZE must be equal to PF_TAG_NAME_SIZE #endif + u_int16_t tagname2tag(struct pf_tags *, char *); void tag2tagname(struct pf_tags *, u_int16_t, char *); void tag_unref(struct pf_tags *, u_int16_t); @@ -204,120 +221,116 @@ void pf_rtlabel_copyout(struct pf_add #define DPFPRINTF(n, x) if (pf_status.debug >= (n)) printf x #ifdef __FreeBSD__ - static struct cdev *pf_dev; - - /* - * XXX - These are new and need to be checked when moveing to a new version - */ - static void pf_clear_states(void); - static int pf_clear_tables(void); - static void pf_clear_srcnodes(void); - /* - * XXX - These are new and need to be checked when moveing to a new version - */ - - /* - * Wrapper functions for pfil(9) hooks - */ - static int pf_check_in(void *arg, struct mbuf **m, struct ifnet *ifp, - int dir, struct inpcb *inp); - static int pf_check_out(void *arg, struct mbuf **m, struct ifnet *ifp, - int dir, struct inpcb *inp); - #ifdef INET6 - static int pf_check6_in(void *arg, struct mbuf **m, struct ifnet *ifp, - int dir, struct inpcb *inp); - static int pf_check6_out(void *arg, struct mbuf **m, struct ifnet *ifp, - int dir, struct inpcb *inp); - #endif - - static int hook_pf(void); - static int dehook_pf(void); - static int shutdown_pf(void); - static int pf_load(void); - static int pf_unload(void); - -static struct cdevsw pf_cdevsw = { - .d_ioctl = pfioctl, - .d_name = PF_NAME, - .d_version = D_VERSION, - }; - - static volatile int pf_pfil_hooked = 0; - int pf_end_threads = 0; - struct mtx pf_task_mtx; - #ifdef __FreeBSD__ - /* pfsync */ - pfsync_state_import_t *pfsync_state_import_ptr = NULL; - pfsync_insert_state_t *pfsync_insert_state_ptr = NULL; - pfsync_update_state_t *pfsync_update_state_ptr = NULL; - pfsync_delete_state_t *pfsync_delete_state_ptr = NULL; - pfsync_clear_states_t *pfsync_clear_states_ptr = NULL; - pfsync_state_in_use_t *pfsync_state_in_use_ptr = NULL; - pfsync_defer_t *pfsync_defer_ptr = NULL; - pfsync_up_t *pfsync_up_ptr = NULL; - /* pflow */ - export_pflow_t *export_pflow_ptr = NULL; - #if NPFLOG >0 - pflog_packet_t *pflog_packet_ptr = NULL; - #endif - #else - pflog_packet_t *pflog_packet_ptr = NULL; - #endif - - int debug_pfugidhack = 0; - SYSCTL_INT(_debug, OID_AUTO, pfugidhack, CTLFLAG_RW, &debug_pfugidhack, 0, - "Enable/disable pf user/group rules mpsafe hack"); - - void - init_pf_mutex(void) - { - mtx_init(&pf_task_mtx, "pf task mtx", NULL, MTX_DEF); - } +static VNET_DEFINE(struct cdev, *pf_dev); - void - destroy_pf_mutex(void) - { - mtx_destroy(&pf_task_mtx); - } - void - init_zone_var(void) - { - pf_src_tree_pl = pf_rule_pl = NULL; - pf_state_pl = pf_state_key_pl = pf_state_item_pl = NULL; +/* + * XXX - These are new and need to be checked when moveing to a new version + */ +static void pf_clear_states(void); +static int pf_clear_tables(void); +static void pf_clear_srcnodes(void); +/* + * XXX - These are new and need to be checked when moveing to a new version + */ + +/* + * Wrapper functions for pfil(9) hooks + */ +static int pf_check_in(void *arg, struct mbuf **m, struct ifnet *ifp, + int dir, struct inpcb *inp); +static int pf_check_out(void *arg, struct mbuf **m, struct ifnet *ifp, + int dir, struct inpcb *inp); +#ifdef INET6 +static int pf_check6_in(void *arg, struct mbuf **m, struct ifnet *ifp, + int dir, struct inpcb *inp); +static int pf_check6_out(void *arg, struct mbuf **m, struct ifnet *ifp, + int dir, struct inpcb *inp); +#endif + +static int hook_pf(void); +static int dehook_pf(void); +static int shutdown_pf(void); +static int pf_load(void); +static int pf_unload(void); + +static VNET_DEFINE(struct cdevsw, pf_cdevsw); +#define pf_cdevsw VNET(pf_cdevsw) + +static volatile VNET_DEFINE(int, pf_pfil_hooked); +#define pf_pfil_hooked VNET(pf_pfil_hooked) +VNET_DEFINE(int, pf_end_threads); +#define pf_end_threads VNET(pf_end_threads) +struct mtx pf_task_mtx; + +/* pfsync */ +VNET_DEFINE(pfsync_state_import_t, *pfsync_state_import_ptr); +VNET_DEFINE(pfsync_insert_state_t, *pfsync_insert_state_ptr); +VNET_DEFINE(pfsync_update_state_t, *pfsync_update_state_ptr); +VNET_DEFINE(pfsync_delete_state_t, *pfsync_delete_state_ptr); +VNET_DEFINE(pfsync_clear_states_t, *pfsync_clear_states_ptr); +VNET_DEFINE(pfsync_state_in_use_t, *pfsync_state_in_use_ptr); +VNET_DEFINE(pfsync_defer_t, *pfsync_defer_ptr); +VNET_DEFINE(pfsync_up_t, *pfsync_up_ptr); +/* pflow */ +VNET_DEFINE(export_pflow_t, *export_pflow_ptr); +/* pflog */ +VNET_DEFINE(pflog_packet_t, *pflog_packet_ptr); + +VNET_DEFINE(int, debug_pfugidhack); +SYSCTL_VNET_INT(_debug, OID_AUTO, pfugidhack, CTLFLAG_RW, + &debug_pfugidhack, 0, + "Enable/disable pf user/group rules mpsafe hack"); + +void +init_pf_mutex(void) +{ + mtx_init(&pf_task_mtx, "pf task mtx", NULL, MTX_DEF); +} + +void +destroy_pf_mutex(void) +{ + mtx_destroy(&pf_task_mtx); +} +void +init_zone_var(void) +{ + pf_src_tree_pl = pf_rule_pl = NULL; + pf_state_pl = pf_state_key_pl = pf_state_item_pl = NULL; pf_altq_pl = pf_pooladdr_pl = NULL; - pf_frent_pl = pf_frag_pl = pf_cache_pl = pf_cent_pl = NULL; - pf_state_scrub_pl = NULL; - pfr_ktable_pl = pfr_kentry_pl = NULL; - } - - void - cleanup_pf_zone(void) - { - UMA_DESTROY(pf_src_tree_pl); - UMA_DESTROY(pf_rule_pl); - UMA_DESTROY(pf_state_pl); - UMA_DESTROY(pf_state_key_pl); - UMA_DESTROY(pf_state_item_pl); - UMA_DESTROY(pf_altq_pl); - UMA_DESTROY(pf_pooladdr_pl); - UMA_DESTROY(pf_frent_pl); - UMA_DESTROY(pf_frag_pl); - UMA_DESTROY(pf_cache_pl); - UMA_DESTROY(pf_cent_pl); - UMA_DESTROY(pfr_ktable_pl); - UMA_DESTROY(pfr_kentry_pl); - UMA_DESTROY(pf_state_scrub_pl); - UMA_DESTROY(pfi_addr_pl); - } + pf_frent_pl = pf_frag_pl = pf_cache_pl = pf_cent_pl = NULL; + pf_state_scrub_pl = NULL; + pfr_ktable_pl = pfr_kentry_pl = NULL; +} + +void +cleanup_pf_zone(void) +{ + UMA_DESTROY(pf_src_tree_pl); + UMA_DESTROY(pf_rule_pl); + UMA_DESTROY(pf_state_pl); + UMA_DESTROY(pf_state_key_pl); + UMA_DESTROY(pf_state_item_pl); + UMA_DESTROY(pf_altq_pl); + UMA_DESTROY(pf_pooladdr_pl); + UMA_DESTROY(pf_frent_pl); + UMA_DESTROY(pf_frag_pl); + UMA_DESTROY(pf_cache_pl); + UMA_DESTROY(pf_cent_pl); + UMA_DESTROY(pfr_ktable_pl); + UMA_DESTROY(pfr_kentry_pl); + UMA_DESTROY(pf_state_scrub_pl); + UMA_DESTROY(pfi_addr_pl); +} int - pfattach(void) - { - u_int32_t *my_timeout = pf_default_rule.timeout; - int error = 1; - +pfattach(void) +{ + u_int32_t *my_timeout = pf_default_rule.timeout; + int error = 1; + do { - UMA_CREATE(pf_src_tree_pl,struct pf_src_node, "pfsrctrpl"); + UMA_CREATE(pf_src_tree_pl,struct pf_src_node, "pfsrctrpl"); UMA_CREATE(pf_rule_pl, struct pf_rule, "pfrulepl"); UMA_CREATE(pf_state_pl, struct pf_state, "pfstatepl"); UMA_CREATE(pf_state_key_pl, struct pf_state, "pfstatekeypl"); @@ -410,9 +423,9 @@ int if (kproc_create(pf_purge_thread, NULL, NULL, 0, 0, "pfpurge")) return (ENXIO); - return (error); - } - #else /* !__FreeBSD__ */ + return (error); +} +#else /* !__FreeBSD__ */ void pfattach(int num) @@ -3463,7 +3476,7 @@ fail: return (error); } - #ifdef __FreeBSD__ +#ifdef __FreeBSD__ void pfsync_state_export(struct pfsync_state *sp, struct pf_state *st) { @@ -3525,34 +3538,34 @@ pfsync_state_export(struct pfsync_state } - /* - * XXX - Check for version missmatch!!! - */ - static void - pf_clear_states(void) - { +/* + * XXX - Check for version missmatch!!! + */ +static void +pf_clear_states(void) +{ struct pf_state *state; RB_FOREACH(state, pf_state_tree_id, &tree_id) { state->timeout = PFTM_PURGE; - #if NPFSYNC +#if NPFSYNC /* don't send out individual delete messages */ state->sync_state = PFSTATE_NOSYNC; - #endif +#endif pf_unlink_state(state); } #if 0 /* NPFSYNC */ - /* - * XXX This is called on module unload, we do not want to sync that over? */ - */ - pfsync_clear_states(pf_status.hostid, psk->psk_ifname); - #endif - } +/* + * XXX This is called on module unload, we do not want to sync that over? */ + */ + pfsync_clear_states(pf_status.hostid, psk->psk_ifname); +#endif +} - static int - pf_clear_tables(void) - { +static int +pf_clear_tables(void) +{ struct pfioc_table io; int error; @@ -3562,11 +3575,11 @@ pfsync_state_export(struct pfsync_state io.pfrio_flags); return (error); - } +} - static void - pf_clear_srcnodes(void) - { +static void +pf_clear_srcnodes(void) +{ struct pf_src_node *n; struct pf_state *state; @@ -3578,17 +3591,17 @@ pfsync_state_export(struct pfsync_state n->expire = 1; n->states = 0; } - } - /* - * XXX - Check for version missmatch!!! - */ - - /* - * Duplicate pfctl -Fa operation to get rid of as much as we can. - */ - static int - shutdown_pf(void) - { +} +/* + * XXX - Check for version missmatch!!! + */ + +/* + * Duplicate pfctl -Fa operation to get rid of as much as we can. + */ +static int +shutdown_pf(void) +{ int error = 0; u_int32_t t[5]; char nn = '\0'; @@ -3631,13 +3644,13 @@ pfsync_state_export(struct pfsync_state if ((error = pf_clear_tables()) != 0) break; - #ifdef ALTQ +#ifdef ALTQ if ((error = pf_begin_altq(&t[0])) != 0) { DPFPRINTF(PF_DEBUG_MISC, ("shutdown_pf: ALTQ\n")); break; } pf_commit_altq(t[0]); - #endif +#endif pf_clear_states(); @@ -3648,12 +3661,13 @@ pfsync_state_export(struct pfsync_state } while(0); return (error); - } +} - static int - pf_check_in(void *arg, struct mbuf **m, struct ifnet *ifp, int dir, - struct inpcb *inp) - { +#ifdef INET +static int +pf_check_in(void *arg, struct mbuf **m, struct ifnet *ifp, int dir, + struct inpcb *inp) +{ /* * XXX Wed Jul 9 22:03:16 2003 UTC * OpenBSD has changed its byte ordering convention on ip_len/ip_off @@ -3683,12 +3697,12 @@ pfsync_state_export(struct pfsync_state NTOHS(h->ip_off); } return chk; - } +} - static int - pf_check_out(void *arg, struct mbuf **m, struct ifnet *ifp, int dir, - struct inpcb *inp) - { +static int +pf_check_out(void *arg, struct mbuf **m, struct ifnet *ifp, int dir, + struct inpcb *inp) +{ /* * XXX Wed Jul 9 22:03:16 2003 UTC * OpenBSD has changed its byte ordering convention on ip_len/ip_off @@ -3724,12 +3738,13 @@ pfsync_state_export(struct pfsync_state } return chk; } +#endif - #ifdef INET6 - static int - pf_check6_in(void *arg, struct mbuf **m, struct ifnet *ifp, int dir, - struct inpcb *inp) - { +#ifdef INET6 +static int +pf_check6_in(void *arg, struct mbuf **m, struct ifnet *ifp, int dir, + struct inpcb *inp) +{ /* * IPv6 is not affected by ip_len/ip_off byte order changes. @@ -3748,12 +3763,12 @@ pfsync_state_export(struct pfsync_state *m = NULL; } return chk; - } +} - static int - pf_check6_out(void *arg, struct mbuf **m, struct ifnet *ifp, int dir, - struct inpcb *inp) - { +static int +pf_check6_out(void *arg, struct mbuf **m, struct ifnet *ifp, int dir, + struct inpcb *inp) +{ /* * IPv6 does not affected ip_len/ip_off byte order changes. */ @@ -3770,28 +3785,32 @@ pfsync_state_export(struct pfsync_state *m = NULL; } return chk; - } - #endif /* INET6 */ +} +#endif /* INET6 */ - static int - hook_pf(void) - { +static int +hook_pf(void) +{ +#ifdef INET struct pfil_head *pfh_inet; - #ifdef INET6 +#endif +#ifdef INET6 struct pfil_head *pfh_inet6; - #endif +#endif PF_ASSERT(MA_NOTOWNED); if (pf_pfil_hooked) return (0); +#ifdef INET pfh_inet = pfil_head_get(PFIL_TYPE_AF, AF_INET); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Mon Oct 12 16:53:49 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BFF551065670; Mon, 12 Oct 2009 16:53:49 +0000 (UTC) (envelope-from eri@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B082A8FC13; Mon, 12 Oct 2009 16:53:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n9CGrn3U077522; Mon, 12 Oct 2009 16:53:49 GMT (envelope-from eri@svn.freebsd.org) Received: (from eri@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9CGrnls077520; Mon, 12 Oct 2009 16:53:49 GMT (envelope-from eri@svn.freebsd.org) Message-Id: <200910121653.n9CGrnls077520@svn.freebsd.org> From: Ermal Luçi Date: Mon, 12 Oct 2009 16:53:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r197989 - user/eri/pf45/head/sys/contrib/pf/net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Oct 2009 16:53:49 -0000 Author: eri Date: Mon Oct 12 16:53:49 2009 New Revision: 197989 URL: http://svn.freebsd.org/changeset/base/197989 Log: Missed conversion. Modified: user/eri/pf45/head/sys/contrib/pf/net/pf.c Modified: user/eri/pf45/head/sys/contrib/pf/net/pf.c ============================================================================== --- user/eri/pf45/head/sys/contrib/pf/net/pf.c Mon Oct 12 16:51:48 2009 (r197988) +++ user/eri/pf45/head/sys/contrib/pf/net/pf.c Mon Oct 12 16:53:49 2009 (r197989) @@ -168,7 +168,7 @@ __FBSDID("$FreeBSD$"); #include extern int ip_optcopy(struct ip *, struct ip *); -extern int debug_pfugidhack; +VNET_DECLARE(int, debug_pfugidhack); #endif #define DPFPRINTF(n, x) if (pf_status.debug >= (n)) printf x From owner-svn-src-user@FreeBSD.ORG Mon Oct 12 16:55:19 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6E9CA106568B; Mon, 12 Oct 2009 16:55:19 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5F3D18FC1F; Mon, 12 Oct 2009 16:55:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n9CGtJfs077606; Mon, 12 Oct 2009 16:55:19 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9CGtJ3C077604; Mon, 12 Oct 2009 16:55:19 GMT (envelope-from des@svn.freebsd.org) Message-Id: <200910121655.n9CGtJ3C077604@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Mon, 12 Oct 2009 16:55:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r197990 - user/des/svnsup/src/distill X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Oct 2009 16:55:19 -0000 Author: des Date: Mon Oct 12 16:55:19 2009 New Revision: 197990 URL: http://svn.freebsd.org/changeset/base/197990 Log: svn_client_get_username_prompt_provider() is deprecated, use svn_auth_get_username_prompt_provider() instead. Modified: user/des/svnsup/src/distill/distill.c Modified: user/des/svnsup/src/distill/distill.c ============================================================================== --- user/des/svnsup/src/distill/distill.c Mon Oct 12 16:53:49 2009 (r197989) +++ user/des/svnsup/src/distill/distill.c Mon Oct 12 16:55:19 2009 (r197990) @@ -57,7 +57,7 @@ distill(const char *url, unsigned long r /* set up our authentication system */ /* XXX check for errors */ auth_providers = apr_array_make(pool, 1, sizeof auth_provider); - svn_client_get_username_prompt_provider(&auth_provider, + svn_auth_get_username_prompt_provider(&auth_provider, username_prompt_callback, NULL, 0, pool); APR_ARRAY_PUSH(auth_providers, svn_auth_provider_object_t *) = auth_provider; From owner-svn-src-user@FreeBSD.ORG Mon Oct 12 16:56:07 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5035E106568D; Mon, 12 Oct 2009 16:56:07 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4117A8FC08; Mon, 12 Oct 2009 16:56:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n9CGu7MG077766; Mon, 12 Oct 2009 16:56:07 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9CGu7uS077764; Mon, 12 Oct 2009 16:56:07 GMT (envelope-from des@svn.freebsd.org) Message-Id: <200910121656.n9CGu7uS077764@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Mon, 12 Oct 2009 16:56:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r197991 - user/des/svnsup X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Oct 2009 16:56:07 -0000 Author: des Date: Mon Oct 12 16:56:06 2009 New Revision: 197991 URL: http://svn.freebsd.org/changeset/base/197991 Log: Don't discard user-provided CPPFLAGS. Modified: user/des/svnsup/configure.ac Modified: user/des/svnsup/configure.ac ============================================================================== --- user/des/svnsup/configure.ac Mon Oct 12 16:55:19 2009 (r197990) +++ user/des/svnsup/configure.ac Mon Oct 12 16:56:06 2009 (r197991) @@ -66,7 +66,7 @@ PKG_CHECK_MODULES([APR_1], [apr-1]) # Subersion remote access library # saved_CPPFLAGS="${CPPFLAGS}" -CPPFLAGS="${APR_1_CFLAGS}" +CPPFLAGS="${CPPFLAGS} ${APR_1_CFLAGS}" AC_CHECK_HEADER([subversion-1/svn_ra.h], [], [ AC_MSG_ERROR([cannot proceed without ]) ]) @@ -84,7 +84,7 @@ AC_SUBST([SVN_RA_1_LIBS]) # Subversion delta library # saved_CPPFLAGS="${CPPFLAGS}" -CPPFLAGS="${APR_1_CFLAGS}" +CPPFLAGS="${CPPFLAGS} ${APR_1_CFLAGS}" AC_CHECK_HEADER([subversion-1/svn_delta.h], [], [ AC_MSG_ERROR([cannot proceed without ]) ]) @@ -101,7 +101,7 @@ AC_SUBST([SVN_DELTA_1_LIBS]) # Subversion client library # saved_CPPFLAGS="${CPPFLAGS}" -CPPFLAGS="${APR_1_CFLAGS}" +CPPFLAGS="${CPPFLAGS} ${APR_1_CFLAGS}" AC_CHECK_HEADER([subversion-1/svn_client.h], [], [ AC_MSG_ERROR([cannot proceed without ]) ]) From owner-svn-src-user@FreeBSD.ORG Mon Oct 12 16:56:28 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A91491065700; Mon, 12 Oct 2009 16:56:28 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 808118FC0A; Mon, 12 Oct 2009 16:56:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n9CGuSfF077857; Mon, 12 Oct 2009 16:56:28 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9CGuSgd077855; Mon, 12 Oct 2009 16:56:28 GMT (envelope-from des@svn.freebsd.org) Message-Id: <200910121656.n9CGuSgd077855@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Mon, 12 Oct 2009 16:56:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r197992 - user/des/svnsup X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Oct 2009 16:56:28 -0000 Author: des Date: Mon Oct 12 16:56:28 2009 New Revision: 197992 URL: http://svn.freebsd.org/changeset/base/197992 Log: We need /usr/local/* in FreeBSD. Modified: user/des/svnsup/autogen.des Modified: user/des/svnsup/autogen.des ============================================================================== --- user/des/svnsup/autogen.des Mon Oct 12 16:56:06 2009 (r197991) +++ user/des/svnsup/autogen.des Mon Oct 12 16:56:28 2009 (r197992) @@ -1,5 +1,8 @@ #!/bin/sh +export CPPFLAGS=-I/usr/local/include +export LDFLAGS=-L/usr/local/lib + sh -x ./autogen.sh set -x ./configure --enable-wall --enable-wextra --enable-werror "$@" From owner-svn-src-user@FreeBSD.ORG Mon Oct 12 17:03:58 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 27A6F1065670; Mon, 12 Oct 2009 17:03:58 +0000 (UTC) (envelope-from eri@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F29EF8FC15; Mon, 12 Oct 2009 17:03:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n9CH3vHN078254; Mon, 12 Oct 2009 17:03:57 GMT (envelope-from eri@svn.freebsd.org) Received: (from eri@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9CH3vEc078251; Mon, 12 Oct 2009 17:03:57 GMT (envelope-from eri@svn.freebsd.org) Message-Id: <200910121703.n9CH3vEc078251@svn.freebsd.org> From: Ermal Luçi Date: Mon, 12 Oct 2009 17:03:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r197993 - user/eri/pf45/head/sys/contrib/pf/net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Oct 2009 17:03:58 -0000 Author: eri Date: Mon Oct 12 17:03:57 2009 New Revision: 197993 URL: http://svn.freebsd.org/changeset/base/197993 Log: Finish converting all global variables to virtualize declarations. Modified: user/eri/pf45/head/sys/contrib/pf/net/pf_ruleset.c user/eri/pf45/head/sys/contrib/pf/net/pf_table.c Modified: user/eri/pf45/head/sys/contrib/pf/net/pf_ruleset.c ============================================================================== --- user/eri/pf45/head/sys/contrib/pf/net/pf_ruleset.c Mon Oct 12 16:56:28 2009 (r197992) +++ user/eri/pf45/head/sys/contrib/pf/net/pf_ruleset.c Mon Oct 12 17:03:57 2009 (r197993) @@ -91,8 +91,13 @@ __FBSDID("$FreeBSD$"); #endif /* _KERNEL */ +#ifdef __FreeBSD__ +VNET_DEFINE(struct pf_anchor_global, pf_anchors); +VNET_DEFINE(struct pf_anchor, pf_main_anchor); +#else struct pf_anchor_global pf_anchors; struct pf_anchor pf_main_anchor; +#endif static __inline int pf_anchor_compare(struct pf_anchor *, struct pf_anchor *); Modified: user/eri/pf45/head/sys/contrib/pf/net/pf_table.c ============================================================================== --- user/eri/pf45/head/sys/contrib/pf/net/pf_table.c Mon Oct 12 16:56:28 2009 (r197992) +++ user/eri/pf45/head/sys/contrib/pf/net/pf_table.c Mon Oct 12 17:03:57 2009 (r197993) @@ -175,19 +175,28 @@ struct pfr_walktree { #define senderr(e) do { rv = (e); goto _bad; } while (0) - #ifdef __FreeBSD__ - uma_zone_t pfr_ktable_pl; - uma_zone_t pfr_kentry_pl; - uma_zone_t pfr_kcounters_pl; - #else +#ifdef __FreeBSD__ +VNET_DEFINE(uma_zone_t, pfr_ktable_pl); +VNET_DEFINE(uma_zone_t, pfr_kentry_pl); +VNET_DEFINE(uma_zone_t, pfr_kcounters_pl); +#define pfr_kcounters_pl VNET(pfr_kcounters_pl) +VNET_DEFINE(struct sockaddr_in, pfr_sin); +#define pfr_sin VNET(pfr_sin) +VNET_DEFINE(struct sockaddr_in6, pfr_sin6); +#define pfr_sin6 VNET(pfr_sin6) +VNET_DEFINE(union sockaddr_union, pfr_mask); +#define pfr_mask VNET(pfr_mask) +VNET_DEFINE(struct pf_addr, pfr_ffaddr); +#define pfr_ffaddr VNET(pfr_ffaddr) +#else struct pool pfr_ktable_pl; struct pool pfr_kentry_pl; struct pool pfr_kcounters_pl; -#endif struct sockaddr_in pfr_sin; struct sockaddr_in6 pfr_sin6; union sockaddr_union pfr_mask; struct pf_addr pfr_ffaddr; +#endif void pfr_copyout_addr(struct pfr_addr *, struct pfr_kentry *ke); From owner-svn-src-user@FreeBSD.ORG Mon Oct 12 17:09:35 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CFA391065698; Mon, 12 Oct 2009 17:09:35 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C05C98FC16; Mon, 12 Oct 2009 17:09:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n9CH9Zs3078462; Mon, 12 Oct 2009 17:09:35 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9CH9ZKJ078460; Mon, 12 Oct 2009 17:09:35 GMT (envelope-from des@svn.freebsd.org) Message-Id: <200910121709.n9CH9ZKJ078460@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Mon, 12 Oct 2009 17:09:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r197994 - user/des/svnsup/src/distill X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Oct 2009 17:09:35 -0000 Author: des Date: Mon Oct 12 17:09:35 2009 New Revision: 197994 URL: http://svn.freebsd.org/changeset/base/197994 Log: libsvn 1.6 segfaults if the config argument to svn_ra_open3() is NULL. Pass in an empty hash instead. Modified: user/des/svnsup/src/distill/distill.c Modified: user/des/svnsup/src/distill/distill.c ============================================================================== --- user/des/svnsup/src/distill/distill.c Mon Oct 12 17:03:57 2009 (r197993) +++ user/des/svnsup/src/distill/distill.c Mon Oct 12 17:09:35 2009 (r197994) @@ -43,6 +43,7 @@ int verbose; static int distill(const char *url, unsigned long revision) { + apr_hash_t *config; apr_pool_t *pool; apr_status_t status; svn_auth_provider_object_t *auth_provider; @@ -64,8 +65,9 @@ distill(const char *url, unsigned long r svn_auth_open(&ra_callbacks.auth_baton, auth_providers, pool); /* open a connection to the repo */ + config = apr_hash_make(pool); error = svn_ra_open3(&ra_session, url, NULL, &ra_callbacks, - NULL, NULL, pool); + NULL, config, pool); SVNSUP_SVN_ERROR(error, "svn_ra_open3()"); /* get revision metadata */ From owner-svn-src-user@FreeBSD.ORG Mon Oct 12 17:12:00 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BA6011065693; Mon, 12 Oct 2009 17:12:00 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 659838FC34; Mon, 12 Oct 2009 17:12:00 +0000 (UTC) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id EAA3C46B23; Mon, 12 Oct 2009 13:11:59 -0400 (EDT) Date: Mon, 12 Oct 2009 18:11:59 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Ermal LuXi In-Reply-To: <200910121651.n9CGpm4L077443@svn.freebsd.org> Message-ID: References: <200910121651.n9CGpm4L077443@svn.freebsd.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: Re: svn commit: r197988 - user/eri/pf45/head/sys/contrib/pf/net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Oct 2009 17:12:00 -0000 On Mon, 12 Oct 2009, Ermal LuXi wrote: > Author: eri > Date: Mon Oct 12 16:51:48 2009 > New Revision: 197988 > URL: http://svn.freebsd.org/changeset/base/197988 > > Log: > * First pass at adding virtualization to pf(4). > * The rule of V_ is not followed in an attempt to minimize the diff with upstream(hopefully it works). I've found that this sometimes work -- the usual risk is namespace collisions where the macro wrapping VNET() happens to match another useful C token, such as a structure name. If it compiles, it probably works, but it's worth looking fairly closely to be sure. Robert > * Fix some whitespaces around. > > NOTE: The tree might not build now. > > Modified: > user/eri/pf45/head/sys/contrib/pf/net/pf.c > user/eri/pf45/head/sys/contrib/pf/net/pf_if.c > user/eri/pf45/head/sys/contrib/pf/net/pf_ioctl.c > user/eri/pf45/head/sys/contrib/pf/net/pf_lb.c > user/eri/pf45/head/sys/contrib/pf/net/pf_norm.c > user/eri/pf45/head/sys/contrib/pf/net/pf_osfp.c > user/eri/pf45/head/sys/contrib/pf/net/pfvar.h > > Modified: user/eri/pf45/head/sys/contrib/pf/net/pf.c > ============================================================================== > --- user/eri/pf45/head/sys/contrib/pf/net/pf.c Mon Oct 12 16:47:55 2009 (r197987) > +++ user/eri/pf45/head/sys/contrib/pf/net/pf.c Mon Oct 12 16:51:48 2009 (r197988) > @@ -88,20 +88,20 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > - #ifdef __FreeBSD__ > - #include > - #include > - #include > - #define betoh64 be64toh > - #else > +#ifdef __FreeBSD__ > +#include > +#include > +#include > +#define betoh64 be64toh > +#else > #include > #endif > #include > - #ifdef __FreeBSD__ > - #include > - #include > - #include > - #else > +#ifdef __FreeBSD__ > +#include > +#include > +#include > +#else > #include > #endif > > @@ -155,21 +155,21 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > - #ifdef __FreeBSD__ > - #include > - #include > - #endif > +#ifdef __FreeBSD__ > +#include > +#include > +#endif > #endif /* INET6 */ > > #ifdef __FreeBSD__ > - #include > - #include > - #include > - #include > +#include > +#include > +#include > +#include > > - extern int ip_optcopy(struct ip *, struct ip *); > - extern int debug_pfugidhack; > - #endif > +extern int ip_optcopy(struct ip *, struct ip *); > +extern int debug_pfugidhack; > +#endif > > #define DPFPRINTF(n, x) if (pf_status.debug >= (n)) printf x > > @@ -178,6 +178,41 @@ __FBSDID("$FreeBSD$"); > */ > > /* state tables */ > +#ifdef __FreeBSD__ > +VNET_DEFINE(struct pf_state_tree, pf_statetbl); > + > +VNET_DEFINE(struct pf_altqqueue, pf_altqs[2]); > +VNET_DEFINE(struct pf_palist, pf_pabuf); > +VNET_DEFINE(struct pf_altqqueue, *pf_altqs_active); > +VNET_DEFINE(struct pf_altqqueue, *pf_altqs_inactive); > +VNET_DEFINE(struct pf_status, pf_status); > + > +VNET_DEFINE(u_int32_t, ticket_altqs_active); > +VNET_DEFINE(u_int32_t, ticket_altqs_inactive); > +VNET_DEFINE(int, altqs_inactive_open); > +VNET_DEFINE(u_int32_t, ticket_pabuf); > + > +VNET_DEFINE(MD5_CTX, pf_tcp_secret_ctx); > +VNET_DEFINE(u_char, pf_tcp_secret[16]); > +VNET_DEFINE(int, pf_tcp_secret_init); > +VNET_DEFINE(int, pf_tcp_iss_off); > + > +struct pf_anchor_stackframe { > + struct pf_ruleset *rs; > + struct pf_rule *r; > + struct pf_anchor_node *parent; > + struct pf_anchor *child; > +}; > +VNET_DEFINE(struct pf_anchor_stackframe, pf_anchor_stack[64]); > + > +VNET_DEFINE(uma_zone_t, pf_src_tree_pl); > +VNET_DEFINE(uma_zone_t, pf_rule_pl); > +VNET_DEFINE(uma_zone_t, pf_pooladdr_pl); > +VNET_DEFINE(uma_zone_t, pf_state_pl); > +VNET_DEFINE(uma_zone_t, pf_state_key_pl); > +VNET_DEFINE(uma_zone_t, pf_state_item_pl); > +VNET_DEFINE(uma_zone_t, pf_altq_pl); > +#else > struct pf_state_tree pf_statetbl; > > struct pf_altqqueue pf_altqs[2]; > @@ -203,11 +238,6 @@ struct pf_anchor_stackframe { > struct pf_anchor *child; > } pf_anchor_stack[64]; > > - #ifdef __FreeBSD__ > - uma_zone_t pf_src_tree_pl, pf_rule_pl, pf_pooladdr_pl; > - uma_zone_t pf_state_pl, pf_state_key_pl, pf_state_item_pl; > -uma_zone_t pf_altq_pl; > - #else > struct pool pf_src_tree_pl, pf_rule_pl, pf_pooladdr_pl; > struct pool pf_state_pl, pf_state_key_pl, pf_state_item_pl; > struct pool pf_altq_pl; > @@ -323,12 +353,12 @@ int pf_src_connlimit(struct pf_state > int pf_check_congestion(struct ifqueue *); > > #ifdef __FreeBSD__ > - int in4_cksum(struct mbuf *m, u_int8_t nxt, int off, int len); > +int in4_cksum(struct mbuf *m, u_int8_t nxt, int off, int len); > > - extern int pf_end_threads; > +VNET_DECLARE(int, pf_end_threads); > > - struct pf_pool_limit pf_pool_limits[PF_LIMIT_MAX]; > - #else > +VNET_DEFINE(struct pf_pool_limit, pf_pool_limits[PF_LIMIT_MAX]); > +#else > extern struct pool pfr_ktable_pl; > extern struct pool pfr_kentry_pl; > > @@ -405,10 +435,17 @@ static __inline int pf_state_compare_key > static __inline int pf_state_compare_id(struct pf_state *, > struct pf_state *); > > +#ifdef __FreeBSD__ > +VNET_DEFINE(struct pf_src_tree, tree_src_tracking); > + > +VNET_DEFINE(struct pf_state_tree_id, tree_id); > +VNET_DEFINE(struct pf_state_queue, state_list); > +#else > struct pf_src_tree tree_src_tracking; > > struct pf_state_tree_id tree_id; > struct pf_state_queue state_list; > +#endif > > RB_GENERATE(pf_src_tree, pf_src_node, entry, pf_src_compare); > RB_GENERATE(pf_state_tree, pf_state_key, entry, pf_state_compare_key); > @@ -1233,10 +1270,10 @@ pf_state_expires(const struct pf_state * > return (state->expire + timeout); > } > > - #ifdef __FreeBSD__ > - int > - pf_purge_expired_src_nodes(int waslocked) > - #else > +#ifdef __FreeBSD__ > +int > +pf_purge_expired_src_nodes(int waslocked) > +#else > void > pf_purge_expired_src_nodes(int waslocked) > #endif > @@ -1315,7 +1352,7 @@ pf_src_tree_remove_state(struct pf_state > void > pf_unlink_state(struct pf_state *cur) > { > - #ifdef __FreeBSD__ > +#ifdef __FreeBSD__ > if (cur->local_flags & PFSTATE_EXPIRING) > return; > cur->local_flags |= PFSTATE_EXPIRING; > @@ -1378,10 +1415,10 @@ pf_free_state(struct pf_state *cur) > #endif > return; > #endif > - #ifdef __FreeBSD__ > +#ifdef __FreeBSD__ > KASSERT(cur->timeout == PFTM_UNLINKED, > ("pf_free_state: cur->timeout != PFTM_UNLINKED")); > - #else > +#else > KASSERT(cur->timeout == PFTM_UNLINKED); > #endif > if (--cur->rule.ptr->states_cur <= 0 && > @@ -1404,10 +1441,10 @@ pf_free_state(struct pf_state *cur) > pf_status.states--; > } > > - #ifdef __FreeBSD__ > - int > - pf_purge_expired_states(u_int32_t maxcheck, int waslocked) > - #else > +#ifdef __FreeBSD__ > +int > +pf_purge_expired_states(u_int32_t maxcheck, int waslocked) > +#else > void > pf_purge_expired_states(u_int32_t maxcheck) > #endif > @@ -1947,9 +1984,9 @@ pf_modulate_sack(struct mbuf *m, int off > struct tcphdr *th, struct pf_state_peer *dst) > { > int hlen = (th->th_off << 2) - sizeof(*th), thoptlen = hlen; > - #ifdef __FreeBSD__ > +#ifdef __FreeBSD__ > u_int8_t opts[TCP_MAXOLEN], *opt = opts; > - #else > +#else > u_int8_t opts[MAX_TCPOPTLEN], *opt = opts; > #endif > int copyback = 0, i, olen; > @@ -2004,9 +2041,9 @@ pf_modulate_sack(struct mbuf *m, int off > } > > void > - #ifdef __FreeBSD__ > - pf_send_tcp(struct mbuf *replyto, const struct pf_rule *r, sa_family_t af, > - #else > +#ifdef __FreeBSD__ > +pf_send_tcp(struct mbuf *replyto, const struct pf_rule *r, sa_family_t af, > +#else > pf_send_tcp(const struct pf_rule *r, sa_family_t af, > #endif > const struct pf_addr *saddr, const struct pf_addr *daddr, > @@ -2245,40 +2282,40 @@ pf_send_icmp(struct mbuf *m, u_int8_t ty > struct pf_rule *r) > { > struct mbuf *m0; > - #ifdef __FreeBSD__ > +#ifdef __FreeBSD__ > struct ip *ip; > struct pf_mtag *pf_mtag; > - #endif > +#endif > > - #ifdef __FreeBSD__ > +#ifdef __FreeBSD__ > m0 = m_copypacket(m, M_DONTWAIT); > if (m0 == NULL) > return; > - #else > +#else > if ((m0 = m_copy(m, 0, M_COPYALL)) == NULL) > return; > #endif > > - #ifdef __FreeBSD__ > +#ifdef __FreeBSD__ > if ((pf_mtag = pf_get_mtag(m0)) == NULL) > return; > /* XXX: revisit */ > m0->m_flags |= M_SKIP_FIREWALL; > - #else > +#else > m0->m_pkthdr.pf.flags |= PF_TAG_GENERATED; > #endif > > if (r->rtableid >= 0) > - #ifdef __FreeBSD__ > +#ifdef __FreeBSD__ > { > M_SETFIB(m0, r->rtableid); > pf_mtag->rtableid = r->rtableid; > - #else > +#else > m0->m_pkthdr.pf.rtableid = r->rtableid; > - #endif > - #ifdef __FreeBSD__ > +#endif > +#ifdef __FreeBSD__ > } > - #endif > +#endif > > #ifdef ALTQ > if (r->qid) { > @@ -2297,7 +2334,7 @@ pf_send_icmp(struct mbuf *m, u_int8_t ty > switch (af) { > #ifdef INET > case AF_INET: > - #ifdef __FreeBSD__ > +#ifdef __FreeBSD__ > /* icmp_error() expects host byte ordering */ > ip = mtod(m0, struct ip *); > NTOHS(ip->ip_len); > @@ -2305,20 +2342,20 @@ pf_send_icmp(struct mbuf *m, u_int8_t ty > PF_UNLOCK(); > icmp_error(m0, type, code, 0, 0); > PF_LOCK(); > - #else > +#else > icmp_error(m0, type, code, 0, 0); > #endif > break; > #endif /* INET */ > #ifdef INET6 > case AF_INET6: > - #ifdef __FreeBSD__ > +#ifdef __FreeBSD__ > PF_UNLOCK(); > - #endif > +#endif > icmp6_error(m0, type, code, 0); > - #ifdef __FreeBSD__ > +#ifdef __FreeBSD__ > PF_LOCK(); > - #endif > +#endif > break; > #endif /* INET6 */ > } > @@ -2639,17 +2676,17 @@ pf_addr_inc(struct pf_addr *addr, sa_fam > #endif /* INET6 */ > > int > - #ifdef __FreeBSD__ > - pf_socket_lookup(int direction, struct pf_pdesc *pd, struct inpcb *inp_arg) > - #else > +#ifdef __FreeBSD__ > +pf_socket_lookup(int direction, struct pf_pdesc *pd, struct inpcb *inp_arg) > +#else > pf_socket_lookup(int direction, struct pf_pdesc *pd) > #endif > { > struct pf_addr *saddr, *daddr; > u_int16_t sport, dport; > - #ifdef __FreeBSD__ > +#ifdef __FreeBSD__ > struct inpcbinfo *pi; > - #else > +#else > struct inpcbtable *tb; > #endif > struct inpcb *inp; > @@ -2763,11 +2800,11 @@ pf_socket_lookup(int direction, struct p > default: > return (-1); > } > - #ifdef __FreeBSD__ > +#ifdef __FreeBSD__ > pd->lookup.uid = inp->inp_cred->cr_uid; > pd->lookup.gid = inp->inp_cred->cr_groups[0]; > INP_INFO_RUNLOCK(pi); > - #else > +#else > pd->lookup.uid = inp->inp_socket->so_euid; > pd->lookup.gid = inp->inp_socket->so_egid; > pd->lookup.pid = inp->inp_socket->so_cpid; > > Modified: user/eri/pf45/head/sys/contrib/pf/net/pf_if.c > ============================================================================== > --- user/eri/pf45/head/sys/contrib/pf/net/pf_if.c Mon Oct 12 16:47:55 2009 (r197987) > +++ user/eri/pf45/head/sys/contrib/pf/net/pf_if.c Mon Oct 12 16:51:48 2009 (r197988) > @@ -32,37 +32,37 @@ > * POSSIBILITY OF SUCH DAMAGE. > */ > > - #if defined(__FreeBSD__) > - #include "opt_inet.h" > - #include "opt_inet6.h" > +#if defined(__FreeBSD__) > +#include "opt_inet.h" > +#include "opt_inet6.h" > > - #include > +#include > __FBSDID("$FreeBSD$"); > - #endif > +#endif > > #include > #include > - #ifdef __FreeBSD__ > - #include > - #endif > +#ifdef __FreeBSD__ > +#include > +#endif > #include > #include > #include > #include > #include > - #ifndef __FreeBSD__ > +#ifndef __FreeBSD__ > #include > #endif > #include > - #ifndef __FreeBSD__ > +#ifndef __FreeBSD__ > #include > #endif > > #include > #include > - #ifdef __FreeBSD__ > - #include > - #endif > +#ifdef __FreeBSD__ > +#include > +#endif > > #include > #include > @@ -76,25 +76,36 @@ __FBSDID("$FreeBSD$"); > #include > #endif /* INET6 */ > > +#ifdef __FreeBSD__ > +VNET_DEFINE(struct pfi_kif, *pfi_all); > +VNET_DEFINE(uma_zone_t, pfi_addr_pl); > +VNET_DEFINE(struct pfi_ifhead, pfi_ifs); > +#define pfi_ifs VNET(pfi_ifs) > +VNET_DEFINE(long, pfi_update); > +#define pfi_update VNET(pfi_update) > +VNET_DEFINE(struct pfr_addr, *pfi_buffer); > +#define pfi_buffer VNET(pfi_buffer) > +VNET_DEFINE(int, pfi_buffer_cnt); > +#define pfi_buffer_cnt VNET(pfi_buffer_cnt) > +VNET_DEFINE(int, pfi_buffer_max); > +#define pfi_buffer_max VNET(pfi_buffer_max) > +#else > struct pfi_kif *pfi_all = NULL; > - #ifdef __FreeBSD__ > - uma_zone_t pfi_addr_pl; > - #else > struct pool pfi_addr_pl; > -#endif > struct pfi_ifhead pfi_ifs; > long pfi_update = 1; > struct pfr_addr *pfi_buffer; > int pfi_buffer_cnt; > int pfi_buffer_max; > - #ifdef __FreeBSD__ > - eventhandler_tag pfi_attach_cookie = NULL; > - eventhandler_tag pfi_detach_cookie = NULL; > - eventhandler_tag pfi_attach_group_cookie = NULL; > - eventhandler_tag pfi_change_group_cookie = NULL; > - eventhandler_tag pfi_detach_group_cookie = NULL; > - eventhandler_tag pfi_ifaddr_event_cookie = NULL; > - #endif > +#endif > +#ifdef __FreeBSD__ > +VNET_DEFINE(eventhandler_tag, pfi_attach_cookie); > +VNET_DEFINE(eventhandler_tag, pfi_detach_cookie); > +VNET_DEFINE(eventhandler_tag, pfi_attach_group_cookie); > +VNET_DEFINE(eventhandler_tag, pfi_change_group_cookie); > +VNET_DEFINE(eventhandler_tag, pfi_detach_group_cookie); > +VNET_DEFINE(eventhandler_tag, pfi_ifaddr_event_cookie); > +#endif > > void pfi_kif_update(struct pfi_kif *); > void pfi_dynaddr_update(struct pfi_dynaddr *dyn); > @@ -106,15 +117,15 @@ void pfi_address_add(struct sockaddr * > int pfi_if_compare(struct pfi_kif *, struct pfi_kif *); > int pfi_skip_if(const char *, struct pfi_kif *); > int pfi_unmask(void *); > - #ifdef __FreeBSD__ > - void pfi_attach_ifnet_event(void * __unused, struct ifnet *); > - void pfi_detach_ifnet_event(void * __unused, struct ifnet *); > - void pfi_attach_group_event(void * __unused, struct ifg_group *); > - void pfi_change_group_event(void * __unused, char *); > - void pfi_detach_group_event(void * __unused, struct ifg_group *); > - void pfi_ifaddr_event(void * __unused, struct ifnet *); > +#ifdef __FreeBSD__ > +void pfi_attach_ifnet_event(void * __unused, struct ifnet *); > +void pfi_detach_ifnet_event(void * __unused, struct ifnet *); > +void pfi_attach_group_event(void * __unused, struct ifg_group *); > +void pfi_change_group_event(void * __unused, char *); > +void pfi_detach_group_event(void * __unused, struct ifg_group *); > +void pfi_ifaddr_event(void * __unused, struct ifnet *); > > - #endif > +#endif > > RB_PROTOTYPE(pfi_ifhead, pfi_kif, pfik_tree, pfi_if_compare); > RB_GENERATE(pfi_ifhead, pfi_kif, pfik_tree, pfi_if_compare); > > Modified: user/eri/pf45/head/sys/contrib/pf/net/pf_ioctl.c > ============================================================================== > --- user/eri/pf45/head/sys/contrib/pf/net/pf_ioctl.c Mon Oct 12 16:47:55 2009 (r197987) > +++ user/eri/pf45/head/sys/contrib/pf/net/pf_ioctl.c Mon Oct 12 16:51:48 2009 (r197988) > @@ -176,24 +176,41 @@ int pf_addr_setup(struct pf_ruleset * > struct pf_addr_wrap *, sa_family_t); > void pf_addr_copyout(struct pf_addr_wrap *); > > -struct pf_rule pf_default_rule; > +#define TAGID_MAX 50000 > #ifdef __FreeBSD__ > -struct sx pf_consistency_lock; > -SX_SYSINIT(pf_consistency_lock, &pf_consistency_lock, "pf_statetbl_lock"); > -#else > -struct rwlock pf_consistency_lock = RWLOCK_INITIALIZER("pfcnslk"); > +VNET_DEFINE(struct pf_rule, pf_default_rule); > +#define pf_default_rule VNET(pf_default_rule); > +VNET_DEFINE(struct sx, pf_consistency_lock); > +#define pf_consistency_lock VNET(pf_consistency_lock); > +SX_SYSINIT(pf_consistency_lock, &pf_consistency_lock, > + "pf_statetbl_lock"); > +#ifdef ALTQ > +static VNET_DEFINE(int, pf_altq_running); > +#define pf_altq_running VNET(pf_altq_running) > #endif > + > +TAILQ_HEAD(pf_tags, pf_tagname); > + > +VNET_DEFINE(struct pf_tags, pf_tags); > +#define pf_tags VNET(pf_tags) > +VNET_DEFINE(struct pf_tags, pf_qids); > +#define pf_qids VNET(pf_qids); > + > +#else /* !__FreeBSD__ */ > +struct pf_rule pf_default_rule; > +struct rwlock pf_consistency_lock = RWLOCK_INITIALIZER("pfcnslk"); > #ifdef ALTQ > -static int pf_altq_running; > +static int pf_altq_running; > #endif > > -#define TAGID_MAX 50000 > TAILQ_HEAD(pf_tags, pf_tagname) pf_tags = TAILQ_HEAD_INITIALIZER(pf_tags), > pf_qids = TAILQ_HEAD_INITIALIZER(pf_qids); > +#endif /* __FreeBSD__ */ > > #if (PF_QNAME_SIZE != PF_TAG_NAME_SIZE) > #error PF_QNAME_SIZE must be equal to PF_TAG_NAME_SIZE > #endif > + > u_int16_t tagname2tag(struct pf_tags *, char *); > void tag2tagname(struct pf_tags *, u_int16_t, char *); > void tag_unref(struct pf_tags *, u_int16_t); > @@ -204,120 +221,116 @@ void pf_rtlabel_copyout(struct pf_add > #define DPFPRINTF(n, x) if (pf_status.debug >= (n)) printf x > > #ifdef __FreeBSD__ > - static struct cdev *pf_dev; > - > - /* > - * XXX - These are new and need to be checked when moveing to a new version > - */ > - static void pf_clear_states(void); > - static int pf_clear_tables(void); > - static void pf_clear_srcnodes(void); > - /* > - * XXX - These are new and need to be checked when moveing to a new version > - */ > - > - /* > - * Wrapper functions for pfil(9) hooks > - */ > - static int pf_check_in(void *arg, struct mbuf **m, struct ifnet *ifp, > - int dir, struct inpcb *inp); > - static int pf_check_out(void *arg, struct mbuf **m, struct ifnet *ifp, > - int dir, struct inpcb *inp); > - #ifdef INET6 > - static int pf_check6_in(void *arg, struct mbuf **m, struct ifnet *ifp, > - int dir, struct inpcb *inp); > - static int pf_check6_out(void *arg, struct mbuf **m, struct ifnet *ifp, > - int dir, struct inpcb *inp); > - #endif > - > - static int hook_pf(void); > - static int dehook_pf(void); > - static int shutdown_pf(void); > - static int pf_load(void); > - static int pf_unload(void); > - > -static struct cdevsw pf_cdevsw = { > - .d_ioctl = pfioctl, > - .d_name = PF_NAME, > - .d_version = D_VERSION, > - }; > - > - static volatile int pf_pfil_hooked = 0; > - int pf_end_threads = 0; > - struct mtx pf_task_mtx; > - #ifdef __FreeBSD__ > - /* pfsync */ > - pfsync_state_import_t *pfsync_state_import_ptr = NULL; > - pfsync_insert_state_t *pfsync_insert_state_ptr = NULL; > - pfsync_update_state_t *pfsync_update_state_ptr = NULL; > - pfsync_delete_state_t *pfsync_delete_state_ptr = NULL; > - pfsync_clear_states_t *pfsync_clear_states_ptr = NULL; > - pfsync_state_in_use_t *pfsync_state_in_use_ptr = NULL; > - pfsync_defer_t *pfsync_defer_ptr = NULL; > - pfsync_up_t *pfsync_up_ptr = NULL; > - /* pflow */ > - export_pflow_t *export_pflow_ptr = NULL; > - #if NPFLOG >0 > - pflog_packet_t *pflog_packet_ptr = NULL; > - #endif > - #else > - pflog_packet_t *pflog_packet_ptr = NULL; > - #endif > - > - int debug_pfugidhack = 0; > - SYSCTL_INT(_debug, OID_AUTO, pfugidhack, CTLFLAG_RW, &debug_pfugidhack, 0, > - "Enable/disable pf user/group rules mpsafe hack"); > - > - void > - init_pf_mutex(void) > - { > - mtx_init(&pf_task_mtx, "pf task mtx", NULL, MTX_DEF); > - } > +static VNET_DEFINE(struct cdev, *pf_dev); > > - void > - destroy_pf_mutex(void) > - { > - mtx_destroy(&pf_task_mtx); > - } > - void > - init_zone_var(void) > - { > - pf_src_tree_pl = pf_rule_pl = NULL; > - pf_state_pl = pf_state_key_pl = pf_state_item_pl = NULL; > +/* > + * XXX - These are new and need to be checked when moveing to a new version > + */ > +static void pf_clear_states(void); > +static int pf_clear_tables(void); > +static void pf_clear_srcnodes(void); > +/* > + * XXX - These are new and need to be checked when moveing to a new version > + */ > + > +/* > + * Wrapper functions for pfil(9) hooks > + */ > +static int pf_check_in(void *arg, struct mbuf **m, struct ifnet *ifp, > + int dir, struct inpcb *inp); > +static int pf_check_out(void *arg, struct mbuf **m, struct ifnet *ifp, > + int dir, struct inpcb *inp); > +#ifdef INET6 > +static int pf_check6_in(void *arg, struct mbuf **m, struct ifnet *ifp, > + int dir, struct inpcb *inp); > +static int pf_check6_out(void *arg, struct mbuf **m, struct ifnet *ifp, > + int dir, struct inpcb *inp); > +#endif > + > +static int hook_pf(void); > +static int dehook_pf(void); > +static int shutdown_pf(void); > +static int pf_load(void); > +static int pf_unload(void); > + > +static VNET_DEFINE(struct cdevsw, pf_cdevsw); > +#define pf_cdevsw VNET(pf_cdevsw) > + > +static volatile VNET_DEFINE(int, pf_pfil_hooked); > +#define pf_pfil_hooked VNET(pf_pfil_hooked) > +VNET_DEFINE(int, pf_end_threads); > +#define pf_end_threads VNET(pf_end_threads) > +struct mtx pf_task_mtx; > + > +/* pfsync */ > +VNET_DEFINE(pfsync_state_import_t, *pfsync_state_import_ptr); > +VNET_DEFINE(pfsync_insert_state_t, *pfsync_insert_state_ptr); > +VNET_DEFINE(pfsync_update_state_t, *pfsync_update_state_ptr); > +VNET_DEFINE(pfsync_delete_state_t, *pfsync_delete_state_ptr); > +VNET_DEFINE(pfsync_clear_states_t, *pfsync_clear_states_ptr); > +VNET_DEFINE(pfsync_state_in_use_t, *pfsync_state_in_use_ptr); > +VNET_DEFINE(pfsync_defer_t, *pfsync_defer_ptr); > +VNET_DEFINE(pfsync_up_t, *pfsync_up_ptr); > +/* pflow */ > +VNET_DEFINE(export_pflow_t, *export_pflow_ptr); > +/* pflog */ > +VNET_DEFINE(pflog_packet_t, *pflog_packet_ptr); > + > +VNET_DEFINE(int, debug_pfugidhack); > +SYSCTL_VNET_INT(_debug, OID_AUTO, pfugidhack, CTLFLAG_RW, > + &debug_pfugidhack, 0, > + "Enable/disable pf user/group rules mpsafe hack"); > + > +void > +init_pf_mutex(void) > +{ > + mtx_init(&pf_task_mtx, "pf task mtx", NULL, MTX_DEF); > +} > + > +void > +destroy_pf_mutex(void) > +{ > + mtx_destroy(&pf_task_mtx); > +} > +void > +init_zone_var(void) > +{ > + pf_src_tree_pl = pf_rule_pl = NULL; > + pf_state_pl = pf_state_key_pl = pf_state_item_pl = NULL; > pf_altq_pl = pf_pooladdr_pl = NULL; > - pf_frent_pl = pf_frag_pl = pf_cache_pl = pf_cent_pl = NULL; > - pf_state_scrub_pl = NULL; > - pfr_ktable_pl = pfr_kentry_pl = NULL; > - } > - > - void > - cleanup_pf_zone(void) > - { > - UMA_DESTROY(pf_src_tree_pl); > - UMA_DESTROY(pf_rule_pl); > - UMA_DESTROY(pf_state_pl); > - UMA_DESTROY(pf_state_key_pl); > - UMA_DESTROY(pf_state_item_pl); > - UMA_DESTROY(pf_altq_pl); > - UMA_DESTROY(pf_pooladdr_pl); > - UMA_DESTROY(pf_frent_pl); > - UMA_DESTROY(pf_frag_pl); > - UMA_DESTROY(pf_cache_pl); > - UMA_DESTROY(pf_cent_pl); > - UMA_DESTROY(pfr_ktable_pl); > - UMA_DESTROY(pfr_kentry_pl); > - UMA_DESTROY(pf_state_scrub_pl); > - UMA_DESTROY(pfi_addr_pl); > - } > + pf_frent_pl = pf_frag_pl = pf_cache_pl = pf_cent_pl = NULL; > + pf_state_scrub_pl = NULL; > + pfr_ktable_pl = pfr_kentry_pl = NULL; > +} > + > +void > +cleanup_pf_zone(void) > +{ > + UMA_DESTROY(pf_src_tree_pl); > + UMA_DESTROY(pf_rule_pl); > + UMA_DESTROY(pf_state_pl); > + UMA_DESTROY(pf_state_key_pl); > + UMA_DESTROY(pf_state_item_pl); > + UMA_DESTROY(pf_altq_pl); > + UMA_DESTROY(pf_pooladdr_pl); > + UMA_DESTROY(pf_frent_pl); > + UMA_DESTROY(pf_frag_pl); > + UMA_DESTROY(pf_cache_pl); > + UMA_DESTROY(pf_cent_pl); > + UMA_DESTROY(pfr_ktable_pl); > + UMA_DESTROY(pfr_kentry_pl); > + UMA_DESTROY(pf_state_scrub_pl); > + UMA_DESTROY(pfi_addr_pl); > +} > > int > - pfattach(void) > - { > - u_int32_t *my_timeout = pf_default_rule.timeout; > - int error = 1; > - > +pfattach(void) > +{ > + u_int32_t *my_timeout = pf_default_rule.timeout; > + int error = 1; > + > do { > - UMA_CREATE(pf_src_tree_pl,struct pf_src_node, "pfsrctrpl"); > + UMA_CREATE(pf_src_tree_pl,struct pf_src_node, "pfsrctrpl"); > UMA_CREATE(pf_rule_pl, struct pf_rule, "pfrulepl"); > UMA_CREATE(pf_state_pl, struct pf_state, "pfstatepl"); > UMA_CREATE(pf_state_key_pl, struct pf_state, "pfstatekeypl"); > @@ -410,9 +423,9 @@ int > if (kproc_create(pf_purge_thread, NULL, NULL, 0, 0, "pfpurge")) > return (ENXIO); > > - return (error); > - } > - #else /* !__FreeBSD__ */ > + return (error); > +} > +#else /* !__FreeBSD__ */ > > void > pfattach(int num) > @@ -3463,7 +3476,7 @@ fail: > return (error); > } > > - #ifdef __FreeBSD__ > +#ifdef __FreeBSD__ > void > pfsync_state_export(struct pfsync_state *sp, struct pf_state *st) > { > @@ -3525,34 +3538,34 @@ pfsync_state_export(struct pfsync_state > > } > > - /* > - * XXX - Check for version missmatch!!! > - */ > - static void > - pf_clear_states(void) > - { > +/* > + * XXX - Check for version missmatch!!! > + */ > +static void > +pf_clear_states(void) > +{ > struct pf_state *state; > > RB_FOREACH(state, pf_state_tree_id, &tree_id) { > state->timeout = PFTM_PURGE; > - #if NPFSYNC > +#if NPFSYNC > /* don't send out individual delete messages */ > state->sync_state = PFSTATE_NOSYNC; > - #endif > +#endif > pf_unlink_state(state); > } > > #if 0 /* NPFSYNC */ > - /* > - * XXX This is called on module unload, we do not want to sync that over? */ > - */ > - pfsync_clear_states(pf_status.hostid, psk->psk_ifname); > - #endif > - } > +/* > + * XXX This is called on module unload, we do not want to sync that over? */ > + */ > + pfsync_clear_states(pf_status.hostid, psk->psk_ifname); > +#endif > +} > > - static int > - pf_clear_tables(void) > - { > +static int > +pf_clear_tables(void) > +{ > struct pfioc_table io; > int error; > > @@ -3562,11 +3575,11 @@ pfsync_state_export(struct pfsync_state > io.pfrio_flags); > > return (error); > - } > +} > > - static void > - pf_clear_srcnodes(void) > - { > +static void > +pf_clear_srcnodes(void) > +{ > struct pf_src_node *n; > struct pf_state *state; > > @@ -3578,17 +3591,17 @@ pfsync_state_export(struct pfsync_state > n->expire = 1; > n->states = 0; > } > - } > - /* > - * XXX - Check for version missmatch!!! > - */ > - > - /* > - * Duplicate pfctl -Fa operation to get rid of as much as we can. > - */ > - static int > - shutdown_pf(void) > - { > +} > +/* > + * XXX - Check for version missmatch!!! > + */ > + > +/* > + * Duplicate pfctl -Fa operation to get rid of as much as we can. > + */ > +static int > +shutdown_pf(void) > +{ > int error = 0; > u_int32_t t[5]; > char nn = '\0'; > @@ -3631,13 +3644,13 @@ pfsync_state_export(struct pfsync_state > if ((error = pf_clear_tables()) != 0) > break; > > - #ifdef ALTQ > +#ifdef ALTQ > if ((error = pf_begin_altq(&t[0])) != 0) { > DPFPRINTF(PF_DEBUG_MISC, ("shutdown_pf: ALTQ\n")); > break; > } > pf_commit_altq(t[0]); > - #endif > +#endif > > pf_clear_states(); > > @@ -3648,12 +3661,13 @@ pfsync_state_export(struct pfsync_state > } while(0); > > return (error); > - } > +} > > - static int > - pf_check_in(void *arg, struct mbuf **m, struct ifnet *ifp, int dir, > - struct inpcb *inp) > - { > +#ifdef INET > +static int > +pf_check_in(void *arg, struct mbuf **m, struct ifnet *ifp, int dir, > + struct inpcb *inp) > +{ > /* > * XXX Wed Jul 9 22:03:16 2003 UTC > * OpenBSD has changed its byte ordering convention on ip_len/ip_off > @@ -3683,12 +3697,12 @@ pfsync_state_export(struct pfsync_state > NTOHS(h->ip_off); > } > return chk; > - } > +} > > - static int > - pf_check_out(void *arg, struct mbuf **m, struct ifnet *ifp, int dir, > - struct inpcb *inp) > - { > +static int > +pf_check_out(void *arg, struct mbuf **m, struct ifnet *ifp, int dir, > + struct inpcb *inp) > +{ > /* > * XXX Wed Jul 9 22:03:16 2003 UTC > * OpenBSD has changed its byte ordering convention on ip_len/ip_off > @@ -3724,12 +3738,13 @@ pfsync_state_export(struct pfsync_state > } > return chk; > } > +#endif > > - #ifdef INET6 > - static int > - pf_check6_in(void *arg, struct mbuf **m, struct ifnet *ifp, int dir, > - struct inpcb *inp) > - { > +#ifdef INET6 > +static int > +pf_check6_in(void *arg, struct mbuf **m, struct ifnet *ifp, int dir, > + struct inpcb *inp) > +{ > > /* > * IPv6 is not affected by ip_len/ip_off byte order changes. > @@ -3748,12 +3763,12 @@ pfsync_state_export(struct pfsync_state > *m = NULL; > } > return chk; > - } > +} > > - static int > - pf_check6_out(void *arg, struct mbuf **m, struct ifnet *ifp, int dir, > - struct inpcb *inp) > - { > +static int > +pf_check6_out(void *arg, struct mbuf **m, struct ifnet *ifp, int dir, > + struct inpcb *inp) > +{ > /* > * IPv6 does not affected ip_len/ip_off byte order changes. > */ > @@ -3770,28 +3785,32 @@ pfsync_state_export(struct pfsync_state > *m = NULL; > } > return chk; > - } > - #endif /* INET6 */ > +} > +#endif /* INET6 */ > > - static int > - hook_pf(void) > - { > +static int > +hook_pf(void) > +{ > +#ifdef INET > struct pfil_head *pfh_inet; > - #ifdef INET6 > +#endif > +#ifdef INET6 > struct pfil_head *pfh_inet6; > - #endif > +#endif > > PF_ASSERT(MA_NOTOWNED); > > if (pf_pfil_hooked) > return (0); > > +#ifdef INET > pfh_inet = pfil_head_get(PFIL_TYPE_AF, AF_INET); > > *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** > From owner-svn-src-user@FreeBSD.ORG Mon Oct 12 18:37:36 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 060DC106566B; Mon, 12 Oct 2009 18:37:36 +0000 (UTC) (envelope-from ivoras@gmail.com) Received: from ey-out-2122.google.com (ey-out-2122.google.com [74.125.78.27]) by mx1.freebsd.org (Postfix) with ESMTP id 60FCD8FC1A; Mon, 12 Oct 2009 18:37:35 +0000 (UTC) Received: by ey-out-2122.google.com with SMTP id 4so2117830eyf.9 for ; Mon, 12 Oct 2009 11:37:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:from:date:x-google-sender-auth:message-id:subject:to:cc :content-type:content-transfer-encoding; bh=qpR3RhPyHOZkTtFaefCrtgcwb1mueD0x7XvqTfZEnAo=; b=ODs9B56MPTf7t3A6L83ipBxEagHQAF5DWvVq6lJOjPuoLVdHrT+6Gu35BcI18dKEm9 p5vwmfVn0HeHOq623pNNk/ELVciarJK+YRB7MSTcJGQpYXFIbOuYeSrCSjr0Wa95cl4j 9dtXJySFHAzOFgz1hv73GPYJ2AI5szTix5iDY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding; b=pXuubjWR6kPW8sPHfNFsdxnwFZWdAaJhjroCx8TOXjmPfb6CkS+GmK3VrxWGbAwhuG gnFOnQ7u7QNhKXkF3FOs5DQZDL/eSYTOPYtJj1pvjPTKTwUGuL2C6ZbeJ80P/aBBt4wR oRj9qA8QkeipAC/kWr8/h5VmJdfZhOyft+gs0= MIME-Version: 1.0 Sender: ivoras@gmail.com Received: by 10.216.91.84 with SMTP id g62mr1939462wef.216.1255371126245; Mon, 12 Oct 2009 11:12:06 -0700 (PDT) In-Reply-To: <200910121647.n9CGlttl077323@svn.freebsd.org> References: <200910121647.n9CGlttl077323@svn.freebsd.org> From: Ivan Voras Date: Mon, 12 Oct 2009 20:11:46 +0200 X-Google-Sender-Auth: 6fa3cf54e66b7dc4 Message-ID: <9bbcef730910121111v23fce6aem204d54d314277492@mail.gmail.com> To: Dag-Erling Smorgrav Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: Re: svn commit: r197987 - in user/des/svnsup: . src src/apply src/distill X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Oct 2009 18:37:36 -0000 2009/10/12 Dag-Erling Smorgrav : > Author: des > Date: Mon Oct 12 16:47:55 2009 > New Revision: 197987 > URL: http://svn.freebsd.org/changeset/base/197987 > > Log: > =C2=A0Witness the birth of svnsup! It is glorious! From owner-svn-src-user@FreeBSD.ORG Mon Oct 12 19:41:57 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A6A8C106568B; Mon, 12 Oct 2009 19:41:57 +0000 (UTC) (envelope-from eri@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 95C498FC13; Mon, 12 Oct 2009 19:41:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n9CJfvO7083659; Mon, 12 Oct 2009 19:41:57 GMT (envelope-from eri@svn.freebsd.org) Received: (from eri@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9CJfvdX083653; Mon, 12 Oct 2009 19:41:57 GMT (envelope-from eri@svn.freebsd.org) Message-Id: <200910121941.n9CJfvdX083653@svn.freebsd.org> From: Ermal Luçi Date: Mon, 12 Oct 2009 19:41:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r198000 - user/eri/pf45/head/sys/contrib/pf/net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Oct 2009 19:41:57 -0000 Author: eri Date: Mon Oct 12 19:41:57 2009 New Revision: 198000 URL: http://svn.freebsd.org/changeset/base/198000 Log: Prepend V_ to variables with the same name as their type. Modified: user/eri/pf45/head/sys/contrib/pf/net/if_pflog.h user/eri/pf45/head/sys/contrib/pf/net/if_pfsync.c user/eri/pf45/head/sys/contrib/pf/net/pf.c user/eri/pf45/head/sys/contrib/pf/net/pf_ioctl.c user/eri/pf45/head/sys/contrib/pf/net/pf_lb.c user/eri/pf45/head/sys/contrib/pf/net/pf_norm.c user/eri/pf45/head/sys/contrib/pf/net/pf_osfp.c user/eri/pf45/head/sys/contrib/pf/net/pf_ruleset.c user/eri/pf45/head/sys/contrib/pf/net/pfvar.h Modified: user/eri/pf45/head/sys/contrib/pf/net/if_pflog.h ============================================================================== --- user/eri/pf45/head/sys/contrib/pf/net/if_pflog.h Mon Oct 12 19:19:08 2009 (r197999) +++ user/eri/pf45/head/sys/contrib/pf/net/if_pflog.h Mon Oct 12 19:41:57 2009 (r198000) @@ -80,10 +80,12 @@ struct old_pfloghdr { struct pfi_kif; struct pf_pdesc; - typedef int pflog_packet_t(struct pfi_kif *, struct mbuf *, sa_family_t, - u_int8_t, u_int8_t, struct pf_rule *, struct pf_rule *, - struct pf_ruleset *, struct pf_pdesc *); - extern pflog_packet_t *pflog_packet_ptr; +#if 0 +typedef int pflog_packet_t(struct pfi_kif *, struct mbuf *, sa_family_t, + u_int8_t, u_int8_t, struct pf_rule *, struct pf_rule *, + struct pf_ruleset *, struct pf_pdesc *); +extern pflog_packet_t *pflog_packet_ptr; +#endif #define PFLOG_PACKET(i,x,a,b,c,d,e,f,g,h) do { \ if (pflog_packet_ptr != NULL) \ pflog_packet_ptr(i,a,b,c,d,e,f,g,h); \ Modified: user/eri/pf45/head/sys/contrib/pf/net/if_pfsync.c ============================================================================== --- user/eri/pf45/head/sys/contrib/pf/net/if_pfsync.c Mon Oct 12 19:19:08 2009 (r197999) +++ user/eri/pf45/head/sys/contrib/pf/net/if_pfsync.c Mon Oct 12 19:41:57 2009 (r198000) @@ -674,14 +674,22 @@ pfsync_state_import(struct pfsync_state int pool_flags; int error; +#ifdef __FreeBSD__ + if (sp->creatorid == 0 && V_pf_status.debug >= PF_DEBUG_MISC) { +#else if (sp->creatorid == 0 && pf_status.debug >= PF_DEBUG_MISC) { +#endif printf("pfsync_state_import: invalid creator id:" " %08x\n", ntohl(sp->creatorid)); return (EINVAL); } if ((kif = pfi_kif_get(sp->ifname)) == NULL) { +#ifdef __FreeBSD__ + if (V_pf_status.debug >= PF_DEBUG_MISC) +#else if (pf_status.debug >= PF_DEBUG_MISC) +#endif printf("pfsync_state_import: " "unknown interface: %s\n", sp->ifname); if (flags & PFSYNC_SI_IOCTL) @@ -845,7 +853,11 @@ pfsync_input(struct mbuf *m, ...) pfsyncstats.pfsyncs_ipackets++; /* verify that we have a sync interface configured */ +#ifdef __FreeBSD__ + if (!sc || !sc->sc_sync_if || !V_pf_status.running) +#else if (!sc || !sc->sc_sync_if || !pf_status.running) +#endif goto done; /* verify that the packet came in on the right interface */ @@ -900,7 +912,11 @@ pfsync_input(struct mbuf *m, ...) pkt.src = ip->ip_src; pkt.flags = 0; +#ifdef __FreeBSD__ + if (!bcmp(&ph->pfcksum, &V_pf_status.pf_chksum, PF_MD5_DIGEST_LENGTH)) +#else if (!bcmp(&ph->pfcksum, &pf_status.pf_chksum, PF_MD5_DIGEST_LENGTH)) +#endif pkt.flags |= PFSYNC_SI_CKSUM; offset += sizeof(*ph); @@ -1019,7 +1035,11 @@ pfsync_in_ins(struct pfsync_pkt *pkt, st sp->dst.state > PF_TCPS_PROXY_DST || sp->direction > PF_OUT || (sp->af != AF_INET && sp->af != AF_INET6)) { +#ifdef __FreeBSD__ + if (V_pf_status.debug >= PF_DEBUG_MISC) { +#else if (pf_status.debug >= PF_DEBUG_MISC) { +#endif printf("pfsync_input: PFSYNC5_ACT_INS: " "invalid value\n"); } @@ -1154,7 +1174,11 @@ pfsync_in_upd(struct pfsync_pkt *pkt, st if (sp->timeout >= PFTM_MAX || sp->src.state > PF_TCPS_PROXY_DST || sp->dst.state > PF_TCPS_PROXY_DST) { +#ifdef __FreeBSD__ + if (V_pf_status.debug >= PF_DEBUG_MISC) { +#else if (pf_status.debug >= PF_DEBUG_MISC) { +#endif printf("pfsync_input: PFSYNC_ACT_UPD: " "invalid value\n"); } @@ -1192,7 +1216,11 @@ pfsync_in_upd(struct pfsync_pkt *pkt, st } if (sfail) { +#ifdef __FreeBSD__ + if (V_pf_status.debug >= PF_DEBUG_MISC) { +#else if (pf_status.debug >= PF_DEBUG_MISC) { +#endif printf("pfsync: %s stale update (%d)" " id: %016llx creatorid: %08x\n", (sfail < 7 ? "ignoring" : "partial"), @@ -1253,7 +1281,11 @@ pfsync_in_upd_c(struct pfsync_pkt *pkt, if (up->timeout >= PFTM_MAX || up->src.state > PF_TCPS_PROXY_DST || up->dst.state > PF_TCPS_PROXY_DST) { +#ifdef __FreeBSD__ + if (V_pf_status.debug >= PF_DEBUG_MISC) { +#else if (pf_status.debug >= PF_DEBUG_MISC) { +#endif printf("pfsync_input: " "PFSYNC_ACT_UPD_C: " "invalid value\n"); @@ -1290,7 +1322,11 @@ pfsync_in_upd_c(struct pfsync_pkt *pkt, } if (sfail) { +#ifdef __FreeBSD__ + if (V_pf_status.debug >= PF_DEBUG_MISC) { +#else if (pf_status.debug >= PF_DEBUG_MISC) { +#endif printf("pfsync: ignoring stale update " "(%d) id: %016llx " "creatorid: %08x\n", sfail, @@ -1481,7 +1517,11 @@ pfsync_in_bus(struct pfsync_pkt *pkt, st pf_pool_limits[PF_LIMIT_STATES].limit / (PFSYNC_BULKPACKETS * sc->sc_maxcount)); #endif +#ifdef __FreeBSD__ + if (V_pf_status.debug >= PF_DEBUG_MISC) +#else if (pf_status.debug >= PF_DEBUG_MISC) +#endif printf("pfsync: received bulk update start\n"); break; @@ -1499,11 +1539,19 @@ pfsync_in_bus(struct pfsync_pkt *pkt, st #endif #endif pfsync_sync_ok = 1; +#ifdef __FreeBSD__ + if (V_pf_status.debug >= PF_DEBUG_MISC) +#else if (pf_status.debug >= PF_DEBUG_MISC) +#endif printf("pfsync: received valid " "bulk update end\n"); } else { +#ifdef __FreeBSD__ + if (V_pf_status.debug >= PF_DEBUG_MISC) +#else if (pf_status.debug >= PF_DEBUG_MISC) +#endif printf("pfsync: received invalid " "bulk update end: bad timestamp\n"); } @@ -1581,7 +1629,11 @@ pfsync_update_net_tdb(struct pfsync_tdb return; bad: +#ifdef __FreeBSD__ + if (V_pf_status.debug >= PF_DEBUG_MISC) +#else if (pf_status.debug >= PF_DEBUG_MISC) +#endif printf("pfsync_insert: PFSYNC_ACT_TDB_UPD: " "invalid value\n"); pfsyncstats.pfsyncs_badstate++; @@ -1827,7 +1879,11 @@ pfsyncioctl(struct ifnet *ifp, u_long cm #endif #endif pfsync_sync_ok = 0; +#ifdef __FreeBSD__ + if (V_pf_status.debug >= PF_DEBUG_MISC) +#else if (pf_status.debug >= PF_DEBUG_MISC) +#endif printf("pfsync: requesting bulk update\n"); #ifdef __FreeBSD__ callout_reset(&sc->sc_bulkfail_tmo, 5 * hz, @@ -2057,7 +2113,11 @@ pfsync_sendout(void) ph->version = PFSYNC_VERSION; ph->len = htons(sc->sc_len - sizeof(*ip)); +#ifdef __FreeBSD__ + bcopy(V_pf_status.pf_chksum, ph->pfcksum, PF_MD5_DIGEST_LENGTH); +#else bcopy(pf_status.pf_chksum, ph->pfcksum, PF_MD5_DIGEST_LENGTH); +#endif /* walk the queues */ for (q = 0; q < PFSYNC_S_COUNT; q++) { @@ -2751,7 +2811,11 @@ pfsync_bulk_start(void) sc->sc_bulk_next = TAILQ_FIRST(&state_list); sc->sc_bulk_last = sc->sc_bulk_next; +#ifdef __FreeBSD__ + if (V_pf_status.debug >= PF_DEBUG_MISC) +#else if (pf_status.debug >= PF_DEBUG_MISC) +#endif printf("pfsync: received bulk update request\n"); pfsync_bulk_status(PFSYNC_BUS_START); @@ -2821,7 +2885,11 @@ pfsync_bulk_status(u_int8_t status) r.subh.action = PFSYNC_ACT_BUS; r.subh.count = htons(1); +#ifdef __FreeBSD__ + r.bus.creatorid = V_pf_status.hostid; +#else r.bus.creatorid = pf_status.hostid; +#endif r.bus.endtime = htonl(time_uptime - sc->sc_ureq_received); r.bus.status = status; @@ -2853,7 +2921,11 @@ pfsync_bulk_fail(void *arg) #endif #endif pfsync_sync_ok = 1; +#ifdef __FreeBSD__ + if (V_pf_status.debug >= PF_DEBUG_MISC) +#else if (pf_status.debug >= PF_DEBUG_MISC) +#endif printf("pfsync: failed to receive bulk update\n"); } } Modified: user/eri/pf45/head/sys/contrib/pf/net/pf.c ============================================================================== --- user/eri/pf45/head/sys/contrib/pf/net/pf.c Mon Oct 12 19:19:08 2009 (r197999) +++ user/eri/pf45/head/sys/contrib/pf/net/pf.c Mon Oct 12 19:41:57 2009 (r198000) @@ -171,7 +171,11 @@ extern int ip_optcopy(struct ip *, struc VNET_DECLARE(int, debug_pfugidhack); #endif +#ifdef __FreeBSD__ +#define DPFPRINTF(n, x) if (V_pf_status.debug >= (n)) printf x +#else #define DPFPRINTF(n, x) if (pf_status.debug >= (n)) printf x +#endif /* * Global variables @@ -558,13 +562,21 @@ pf_src_connlimit(struct pf_state **state if ((*state)->rule.ptr->max_src_conn && (*state)->rule.ptr->max_src_conn < (*state)->src_node->conn) { +#ifdef __FreeBSD__ + V_pf_status.lcounters[LCNT_SRCCONN]++; +#else pf_status.lcounters[LCNT_SRCCONN]++; +#endif bad++; } if ((*state)->rule.ptr->max_src_conn_rate.limit && pf_check_threshold(&(*state)->src_node->conn_rate)) { +#ifdef __FreeBSD__ + V_pf_status.lcounters[LCNT_SRCCONNRATE]++; +#else pf_status.lcounters[LCNT_SRCCONNRATE]++; +#endif bad++; } @@ -575,8 +587,13 @@ pf_src_connlimit(struct pf_state **state struct pfr_addr p; u_int32_t killed = 0; +#ifdef __FreeBSD__ + V_pf_status.lcounters[LCNT_OVERLOAD_TABLE]++; + if (V_pf_status.debug >= PF_DEBUG_MISC) { +#else pf_status.lcounters[LCNT_OVERLOAD_TABLE]++; if (pf_status.debug >= PF_DEBUG_MISC) { +#endif printf("pf_src_connlimit: blocking address "); pf_print_host(&(*state)->src_node->addr, 0, (*state)->key[PF_SK_WIRE]->af); @@ -607,7 +624,11 @@ pf_src_connlimit(struct pf_state **state struct pf_state_key *sk; struct pf_state *st; +#ifdef __FreeBSD__ + V_pf_status.lcounters[LCNT_OVERLOAD_FLUSH]++; +#else pf_status.lcounters[LCNT_OVERLOAD_FLUSH]++; +#endif RB_FOREACH(st, pf_state_tree_id, &tree_id) { sk = st->key[PF_SK_WIRE]; /* @@ -632,10 +653,18 @@ pf_src_connlimit(struct pf_state **state killed++; } } +#ifdef __FreeBSD__ + if (V_pf_status.debug >= PF_DEBUG_MISC) +#else if (pf_status.debug >= PF_DEBUG_MISC) +#endif printf(", %u states killed", killed); } +#ifdef __FreeBSD__ + if (V_pf_status.debug >= PF_DEBUG_MISC) +#else if (pf_status.debug >= PF_DEBUG_MISC) +#endif printf("\n"); } @@ -659,7 +688,11 @@ pf_insert_src_node(struct pf_src_node ** k.rule.ptr = rule; else k.rule.ptr = NULL; +#ifdef __FreeBSD__ + V_pf_status.scounters[SCNT_SRC_NODE_SEARCH]++; +#else pf_status.scounters[SCNT_SRC_NODE_SEARCH]++; +#endif *sn = RB_FIND(pf_src_tree, &tree_src_tracking, &k); } if (*sn == NULL) { @@ -667,7 +700,11 @@ pf_insert_src_node(struct pf_src_node ** rule->src_nodes < rule->max_src_nodes) (*sn) = pool_get(&pf_src_tree_pl, PR_NOWAIT | PR_ZERO); else +#ifdef __FreeBSD__ + V_pf_status.lcounters[LCNT_SRCNODES]++; +#else pf_status.lcounters[LCNT_SRCNODES]++; +#endif if ((*sn) == NULL) return (-1); @@ -684,7 +721,11 @@ pf_insert_src_node(struct pf_src_node ** PF_ACPY(&(*sn)->addr, src, af); if (RB_INSERT(pf_src_tree, &tree_src_tracking, *sn) != NULL) { +#ifdef __FreeBSD__ + if (V_pf_status.debug >= PF_DEBUG_MISC) { +#else if (pf_status.debug >= PF_DEBUG_MISC) { +#endif printf("pf: src_tree insert failed: "); pf_print_host(&(*sn)->addr, 0, af); printf("\n"); @@ -696,12 +737,21 @@ pf_insert_src_node(struct pf_src_node ** (*sn)->ruletype = rule->action; if ((*sn)->rule.ptr != NULL) (*sn)->rule.ptr->src_nodes++; +#ifdef __FreeBSD__ + V_pf_status.scounters[SCNT_SRC_NODE_INSERT]++; + V_pf_status.src_nodes++; +#else pf_status.scounters[SCNT_SRC_NODE_INSERT]++; pf_status.src_nodes++; +#endif } else { if (rule->max_src_states && (*sn)->states >= rule->max_src_states) { +#ifdef __FreeBSD__ + V_pf_status.lcounters[LCNT_SRCSTATES]++; +#else pf_status.lcounters[LCNT_SRCSTATES]++; +#endif return (-1); } } @@ -819,7 +869,11 @@ pf_state_key_attach(struct pf_state_key /* unlink late or sks can go away */ olds = si->s; } else { +#ifdef __FreeBSD__ + if (V_pf_status.debug >= PF_DEBUG_MISC) { +#else if (pf_status.debug >= PF_DEBUG_MISC) { +#endif printf("pf: %s key attach " "failed on %s: ", (idx == PF_SK_WIRE) ? @@ -994,11 +1048,20 @@ pf_state_insert(struct pfi_kif *kif, str } if (s->id == 0 && s->creatorid == 0) { +#ifdef __FreeBSD__ + s->id = htobe64(V_pf_status.stateid++); + s->creatorid = V_pf_status.hostid; +#else s->id = htobe64(pf_status.stateid++); s->creatorid = pf_status.hostid; +#endif } if (RB_INSERT(pf_state_tree_id, &tree_id, s) != NULL) { +#ifdef __FreeBSD__ + if (V_pf_status.debug >= PF_DEBUG_MISC) { +#else if (pf_status.debug >= PF_DEBUG_MISC) { +#endif printf("pf: state insert failed: " "id: %016llx creatorid: %08x", betoh64(s->id), ntohl(s->creatorid)); @@ -1008,8 +1071,13 @@ pf_state_insert(struct pfi_kif *kif, str return (-1); } TAILQ_INSERT_TAIL(&state_list, s, entry_list); +#ifdef __FreeBSD__ + V_pf_status.fcounters[FCNT_STATE_INSERT]++; + V_pf_status.states++; +#else pf_status.fcounters[FCNT_STATE_INSERT]++; pf_status.states++; +#endif pfi_kif_ref(kif, PFI_KIF_REF_STATE); #if NPFSYNC > 0 #ifdef __FreeBSD__ @@ -1025,7 +1093,11 @@ pf_state_insert(struct pfi_kif *kif, str struct pf_state * pf_find_state_byid(struct pf_state_cmp *key) { +#ifdef __FreeBSD__ + V_pf_status.fcounters[FCNT_STATE_SEARCH]++; +#else pf_status.fcounters[FCNT_STATE_SEARCH]++; +#endif return (RB_FIND(pf_state_tree_id, &tree_id, (struct pf_state *)key)); } @@ -1073,7 +1145,11 @@ pf_find_state(struct pfi_kif *kif, struc struct pf_state_key *sk; struct pf_state_item *si; +#ifdef __FreeBSD__ + V_pf_status.fcounters[FCNT_STATE_SEARCH]++; +#else pf_status.fcounters[FCNT_STATE_SEARCH]++; +#endif #ifdef __FreeBSD__ if (dir == PF_OUT && pftag->statekey && @@ -1132,7 +1208,11 @@ pf_find_state_all(struct pf_state_key_cm struct pf_state_key *sk; struct pf_state_item *si, *ret = NULL; +#ifdef __FreeBSD__ + V_pf_status.fcounters[FCNT_STATE_SEARCH]++; +#else pf_status.fcounters[FCNT_STATE_SEARCH]++; +#endif sk = RB_FIND(pf_state_tree, &pf_statetbl, (struct pf_state_key *)key); @@ -1177,7 +1257,11 @@ pf_purge_thread(void *v) sx_sunlock(&pf_consistency_lock); sx_xlock(&pf_consistency_lock); PF_LOCK(); +#ifdef __FreeBSD__ + pf_purge_expired_states(V_pf_status.states, 1); +#else pf_purge_expired_states(pf_status.states, 1); +#endif pf_purge_expired_fragments(); pf_purge_expired_src_nodes(1); pf_end_threads++; @@ -1192,7 +1276,7 @@ pf_purge_thread(void *v) /* process a fraction of the state table every second */ #ifdef __FreeBSD__ - if(!pf_purge_expired_states(1 + (pf_status.states + if(!pf_purge_expired_states(1 + (V_pf_status.states / pf_default_rule.timeout[PFTM_INTERVAL]), 0)) { PF_UNLOCK(); sx_sunlock(&pf_consistency_lock); @@ -1200,7 +1284,7 @@ pf_purge_thread(void *v) PF_LOCK(); locked = 1; - pf_purge_expired_states(1 + (pf_status.states + pf_purge_expired_states(1 + (V_pf_status.states / pf_default_rule.timeout[PFTM_INTERVAL]), 1); } #else @@ -1258,7 +1342,11 @@ pf_state_expires(const struct pf_state * } else { start = pf_default_rule.timeout[PFTM_ADAPTIVE_START]; end = pf_default_rule.timeout[PFTM_ADAPTIVE_END]; +#ifdef __FreeBSD__ + states = V_pf_status.states; +#else states = pf_status.states; +#endif } if (end && states > start && start < end) { if (states < end) @@ -1303,8 +1391,13 @@ pf_purge_expired_src_nodes(int waslocked pf_rm_rule(NULL, cur->rule.ptr); } RB_REMOVE(pf_src_tree, &tree_src_tracking, cur); +#ifdef __FreeBSD__ + V_pf_status.scounters[SCNT_SRC_NODE_REMOVALS]++; + V_pf_status.src_nodes--; +#else pf_status.scounters[SCNT_SRC_NODE_REMOVALS]++; pf_status.src_nodes--; +#endif pool_put(&pf_src_tree_pl, cur); } } @@ -1437,8 +1530,13 @@ pf_free_state(struct pf_state *cur) if (cur->tag) pf_tag_unref(cur->tag); pool_put(&pf_state_pl, cur); +#ifdef __FreeBSD__ + V_pf_status.fcounters[FCNT_STATE_REMOVALS]++; + V_pf_status.states--; +#else pf_status.fcounters[FCNT_STATE_REMOVALS]++; pf_status.states--; +#endif } #ifdef __FreeBSD__ @@ -3513,7 +3611,11 @@ pf_create_state(struct pf_rule *r, struc /* check maximums */ if (r->max_states && (r->states_cur >= r->max_states)) { +#ifdef __FreeBSD__ + V_pf_status.lcounters[LCNT_STATES]++; +#else pf_status.lcounters[LCNT_STATES]++; +#endif REASON_SET(&reason, PFRES_MAXSTATES); return (PF_DROP); } @@ -3706,14 +3808,24 @@ csfailed: if (sn != NULL && sn->states == 0 && sn->expire == 0) { RB_REMOVE(pf_src_tree, &tree_src_tracking, sn); +#ifdef __FreeBSD__ + V_pf_status.scounters[SCNT_SRC_NODE_REMOVALS]++; + V_pf_status.src_nodes--; +#else pf_status.scounters[SCNT_SRC_NODE_REMOVALS]++; pf_status.src_nodes--; +#endif pool_put(&pf_src_tree_pl, sn); } if (nsn != sn && nsn != NULL && nsn->states == 0 && nsn->expire == 0) { RB_REMOVE(pf_src_tree, &tree_src_tracking, nsn); +#ifdef __FreeBSD__ + V_pf_status.scounters[SCNT_SRC_NODE_REMOVALS]++; + V_pf_status.src_nodes--; +#else pf_status.scounters[SCNT_SRC_NODE_REMOVALS]++; pf_status.src_nodes--; +#endif pool_put(&pf_src_tree_pl, nsn); } return (PF_DROP); @@ -4061,7 +4173,11 @@ pf_tcp_track_full(struct pf_state_peer * * and keep updating the state TTL. */ +#ifdef __FreeBSD__ + if (V_pf_status.debug >= PF_DEBUG_MISC) { +#else if (pf_status.debug >= PF_DEBUG_MISC) { +#endif printf("pf: loose state match: "); pf_print_state(*state); pf_print_flags(th->th_flags); @@ -4120,7 +4236,11 @@ pf_tcp_track_full(struct pf_state_peer * src->seqlo = 0; src->seqhi = 1; src->max_win = 1; +#ifdef __FreeBSD__ + } else if (V_pf_status.debug >= PF_DEBUG_MISC) { +#else } else if (pf_status.debug >= PF_DEBUG_MISC) { +#endif printf("pf: BAD state: "); pf_print_state(*state); pf_print_flags(th->th_flags); @@ -4359,7 +4479,11 @@ pf_test_state_tcp(struct pf_state **stat if (((th->th_flags & (TH_SYN|TH_ACK)) == TH_SYN) && dst->state >= TCPS_FIN_WAIT_2 && src->state >= TCPS_FIN_WAIT_2) { +#ifdef __FreeBSD__ + if (V_pf_status.debug >= PF_DEBUG_MISC) { +#else if (pf_status.debug >= PF_DEBUG_MISC) { +#endif printf("pf: state reuse "); pf_print_state(*state); pf_print_flags(th->th_flags); @@ -4790,7 +4914,11 @@ pf_test_state_icmp(struct pf_state **sta if (!((*state)->state_flags & PFSTATE_SLOPPY) && (!SEQ_GEQ(src->seqhi, seq) || !SEQ_GEQ(seq, src->seqlo - (dst->max_win << dws)))) { +#ifdef __FreeBSD__ + if (V_pf_status.debug >= PF_DEBUG_MISC) { +#else if (pf_status.debug >= PF_DEBUG_MISC) { +#endif printf("pf: BAD ICMP %d:%d ", icmptype, pd->hdr.icmp->icmp_code); pf_print_host(pd->src, 0, pd->af); @@ -4803,7 +4931,11 @@ pf_test_state_icmp(struct pf_state **sta REASON_SET(reason, PFRES_BADSTATE); return (PF_DROP); } else { +#ifdef __FreeBSD__ + if (V_pf_status.debug >= PF_DEBUG_MISC) { +#else if (pf_status.debug >= PF_DEBUG_MISC) { +#endif printf("pf: OK ICMP %d:%d ", icmptype, pd->hdr.icmp->icmp_code); pf_print_host(pd->src, 0, pd->af); @@ -6230,15 +6362,14 @@ pf_test(int dir, struct ifnet *ifp, stru #ifdef __FreeBSD__ PF_LOCK(); -#endif - if (!pf_status.running) - #ifdef __FreeBSD__ + if (!V_pf_status.running) { PF_UNLOCK(); - #endif return (PF_PASS); - #ifdef __FreeBSD__ } + #else + if (!pf_status.running) + return (PF_PASS); #endif memset(&pd, 0, sizeof(pd)); @@ -6655,15 +6786,14 @@ pf_test6(int dir, struct ifnet *ifp, str #ifdef __FreeBSD__ PF_LOCK(); - #endif if (!pf_status.running) - #ifdef __FreeBSD__ { PF_UNLOCK(); - #endif return (PF_PASS); - #ifdef __FreeBSD__ } + #else + if (!pf_status.running) + return (PF_PASS); #endif memset(&pd, 0, sizeof(pd)); Modified: user/eri/pf45/head/sys/contrib/pf/net/pf_ioctl.c ============================================================================== --- user/eri/pf45/head/sys/contrib/pf/net/pf_ioctl.c Mon Oct 12 19:19:08 2009 (r197999) +++ user/eri/pf45/head/sys/contrib/pf/net/pf_ioctl.c Mon Oct 12 19:41:57 2009 (r198000) @@ -178,10 +178,8 @@ void pf_addr_copyout(struct pf_addr_w #define TAGID_MAX 50000 #ifdef __FreeBSD__ -VNET_DEFINE(struct pf_rule, pf_default_rule); -#define pf_default_rule VNET(pf_default_rule); -VNET_DEFINE(struct sx, pf_consistency_lock); -#define pf_consistency_lock VNET(pf_consistency_lock); +VNET_DEFINE(struct pf_rule, pf_default_rule); +VNET_DEFINE(struct sx, pf_consistency_lock); SX_SYSINIT(pf_consistency_lock, &pf_consistency_lock, "pf_statetbl_lock"); #ifdef ALTQ @@ -191,9 +189,11 @@ static VNET_DEFINE(int, pf_altq_running) TAILQ_HEAD(pf_tags, pf_tagname); -VNET_DEFINE(struct pf_tags, pf_tags); -#define pf_tags VNET(pf_tags) -VNET_DEFINE(struct pf_tags, pf_qids); +#define V_pf_tags VNET(pf_tags) +VNET_DEFINE(struct pf_tags, pf_tags) = + TAILQ_HEAD_INITIALIZER(V_pf_tags); +VNET_DEFINE(struct pf_tags, pf_qids) = + TAILQ_HEAD_INITIALIZER(pf_qids); #define pf_qids VNET(pf_qids); #else /* !__FreeBSD__ */ @@ -218,7 +218,11 @@ int pf_rtlabel_add(struct pf_addr_wra void pf_rtlabel_remove(struct pf_addr_wrap *); void pf_rtlabel_copyout(struct pf_addr_wrap *); +#ifdef __FreeBSD__ +#define DPFPRINTF(n, x) if (V_pf_status.debug >= (n)) printf x +#else #define DPFPRINTF(n, x) if (pf_status.debug >= (n)) printf x +#endif #ifdef __FreeBSD__ static VNET_DEFINE(struct cdev, *pf_dev); @@ -253,7 +257,11 @@ static int shutdown_pf(void static int pf_load(void); static int pf_unload(void); -static VNET_DEFINE(struct cdevsw, pf_cdevsw); +static VNET_DEFINE(struct cdevsw, pf_cdevsw) = { + .d_ioctl = pfioctl, + .d_name = PF_NAME, + .d_version = D_VERSION, +}; #define pf_cdevsw VNET(pf_cdevsw) static volatile VNET_DEFINE(int, pf_pfil_hooked); @@ -412,13 +420,22 @@ pfattach(void) my_timeout[PFTM_ADAPTIVE_END] = PFSTATE_ADAPT_END; pf_normalize_init(); +#ifdef __FreeBSD__ + bzero(&V_pf_status, sizeof(pf_status)); + V_pf_status.debug = PF_DEBUG_URGENT; +#else bzero(&pf_status, sizeof(pf_status)); pf_status.debug = PF_DEBUG_URGENT; +#endif pf_pfil_hooked = 0; /* XXX do our best to avoid a conflict */ +#ifdef __FreeBSD__ + V_pf_status.hostid = arc4random(); +#else pf_status.hostid = arc4random(); +#endif if (kproc_create(pf_purge_thread, NULL, NULL, 0, 0, "pfpurge")) return (ENXIO); @@ -723,13 +740,21 @@ tag_unref(struct pf_tags *head, u_int16_ u_int16_t pf_tagname2tag(char *tagname) { +#ifdef __FreeBSD__ + return (tagname2tag(&V_pf_tags, tagname)); +#else return (tagname2tag(&pf_tags, tagname)); +#endif } void pf_tag2tagname(u_int16_t tagid, char *p) { +#ifdef __FreeBSD__ + tag2tagname(&V_pf_tags, tagid, p); +#else tag2tagname(&pf_tags, tagid, p); +#endif } void @@ -737,7 +762,11 @@ pf_tag_ref(u_int16_t tag) { struct pf_tagname *t; +#ifdef __FreeBSD__ + TAILQ_FOREACH(t, &V_pf_tags, entries) +#else TAILQ_FOREACH(t, &pf_tags, entries) +#endif if (t->tag == tag) break; if (t != NULL) @@ -747,7 +776,11 @@ pf_tag_ref(u_int16_t tag) void pf_tag_unref(u_int16_t tag) { +#ifdef __FreeBSD__ + tag_unref(&V_pf_tags, tag); +#else tag_unref(&pf_tags, tag); +#endif } int @@ -1288,7 +1321,11 @@ pf_setup_pfsync_matching(struct pf_rules } MD5Final(digest, &ctx); +#ifdef __FreeBSD__ + memcpy(V_pf_status.pf_chksum, digest, sizeof(V_pf_status.pf_chksum)); +#else memcpy(pf_status.pf_chksum, digest, sizeof(pf_status.pf_chksum)); +#endif return (0); } @@ -1455,7 +1492,11 @@ pfioctl(dev_t dev, u_long cmd, caddr_t a switch (cmd) { case DIOCSTART: +#ifdef __FreeBSD__ + if (V_pf_status.running) +#else if (pf_status.running) +#endif error = EEXIST; else { #ifdef __FreeBSD__ @@ -1467,33 +1508,48 @@ pfioctl(dev_t dev, u_long cmd, caddr_t a ("pf: pfil registeration fail\n")); break; } - #endif + V_pf_status.running = 1; + V_pf_status.since = time_second; + + if (V_pf_status.stateid == 0) { + V_pf_status.stateid = time_second; + V_pf_status.stateid = V_pf_status.stateid << 32; + } +#else pf_status.running = 1; pf_status.since = time_second; + if (pf_status.stateid == 0) { pf_status.stateid = time_second; pf_status.stateid = pf_status.stateid << 32; } + #endif DPFPRINTF(PF_DEBUG_MISC, ("pf: started\n")); } break; case DIOCSTOP: - if (!pf_status.running) +#ifdef __FreeBSD__ + if (!V_pf_status.running) error = ENOENT; else { - pf_status.running = 0; -#ifdef __FreeBSD__ + V_pf_status.running = 0; PF_UNLOCK(); error = dehook_pf(); PF_LOCK(); if (error) { - pf_status.running = 1; + V_pf_status.running = 1; DPFPRINTF(PF_DEBUG_MISC, ("pf: pfil unregisteration failed\n")); } - #endif + V_pf_status.since = time_second; +#else + if (!pf_status.running) + error = ENOENT; + else { + pf_status.running = 0; pf_status.since = time_second; +#endif DPFPRINTF(PF_DEBUG_MISC, ("pf: stopped\n")); } break; @@ -2012,7 +2068,7 @@ pfioctl(dev_t dev, u_long cmd, caddr_t a #if NPFSYNC > 0 #ifdef __FreeBSD__ if (pfsync_clear_states_ptr != NULL) - pfsync_clear_states_ptr(pf_status.hostid, psk->psk_ifname); + pfsync_clear_states_ptr(V_pf_status.hostid, psk->psk_ifname); #else pfsync_clear_states(pf_status.hostid, psk->psk_ifname); #endif @@ -2030,7 +2086,11 @@ pfioctl(dev_t dev, u_long cmd, caddr_t a if (psk->psk_pfcmp.id) { if (psk->psk_pfcmp.creatorid == 0) +#ifdef __FreeBSD__ + psk->psk_pfcmp.creatorid = V_pf_status.hostid; +#else psk->psk_pfcmp.creatorid = pf_status.hostid; +#endif if ((s = pf_find_state_byid(&psk->psk_pfcmp))) { pf_unlink_state(s); psk->psk_killed = 1; @@ -2128,7 +2188,11 @@ pfioctl(dev_t dev, u_long cmd, caddr_t a u_int32_t nr = 0; if (ps->ps_len == 0) { +#ifdef __FreeBSD__ + nr = V_pf_status.states; +#else nr = pf_status.states; +#endif ps->ps_len = sizeof(struct pfsync_state) * nr; break; } @@ -2172,7 +2236,11 @@ pfioctl(dev_t dev, u_long cmd, caddr_t a case DIOCGETSTATUS: { struct pf_status *s = (struct pf_status *)addr; +#ifdef __FreeBSD__ + bcopy(&V_pf_status, s, sizeof(struct pf_status)); +#else bcopy(&pf_status, s, sizeof(struct pf_status)); +#endif pfi_update_status(s->ifname, s); break; } @@ -2181,20 +2249,37 @@ pfioctl(dev_t dev, u_long cmd, caddr_t a struct pfioc_if *pi = (struct pfioc_if *)addr; if (pi->ifname[0] == 0) { +#ifdef __FreeBSD__ + bzero(V_pf_status.ifname, IFNAMSIZ); +#else bzero(pf_status.ifname, IFNAMSIZ); +#endif break; } +#ifdef __FreeBSD__ + strlcpy(V_pf_status.ifname, pi->ifname, IFNAMSIZ); +#else strlcpy(pf_status.ifname, pi->ifname, IFNAMSIZ); +#endif break; } case DIOCCLRSTATUS: { +#ifdef __FreeBSD__ + bzero(V_pf_status.counters, sizeof(V_pf_status.counters)); + bzero(V_pf_status.fcounters, sizeof(V_pf_status.fcounters)); + bzero(V_pf_status.scounters, sizeof(V_pf_status.scounters)); + V_pf_status.since = time_second; + if (*V_pf_status.ifname) + pfi_update_status(V_pf_status.ifname, NULL); +#else bzero(pf_status.counters, sizeof(pf_status.counters)); bzero(pf_status.fcounters, sizeof(pf_status.fcounters)); bzero(pf_status.scounters, sizeof(pf_status.scounters)); pf_status.since = time_second; if (*pf_status.ifname) pfi_update_status(pf_status.ifname, NULL); +#endif break; } @@ -2309,7 +2394,11 @@ pfioctl(dev_t dev, u_long cmd, caddr_t a case DIOCSETDEBUG: { u_int32_t *level = (u_int32_t *)addr; +#ifdef __FreeBSD__ + V_pf_status.debug = *level; +#else pf_status.debug = *level; +#endif break; } @@ -3178,18 +3267,18 @@ pfioctl(dev_t dev, u_long cmd, caddr_t a } #ifdef __FreeBSD__ PF_UNLOCK(); - #endif +#endif ioe = malloc(sizeof(*ioe), M_TEMP, M_WAITOK); table = malloc(sizeof(*table), M_TEMP, M_WAITOK); #ifdef __FreeBSD__ PF_LOCK(); - #endif +#endif /* first makes sure everything will succeed */ for (i = 0; i < io->size; i++) { #ifdef __FreeBSD__ PF_COPYIN(io->array+i, ioe, sizeof(*ioe), error); if (error) { - #else +#else if (copyin(io->array+i, ioe, sizeof(*ioe))) { #endif free(table, M_TEMP); @@ -3371,7 +3460,11 @@ pfioctl(dev_t dev, u_long cmd, caddr_t a n->states = 0; } pf_purge_expired_src_nodes(1); +#ifdef __FreeBSD__ + V_pf_status.src_nodes = 0; +#else pf_status.src_nodes = 0; +#endif break; } @@ -3417,10 +3510,17 @@ pfioctl(dev_t dev, u_long cmd, caddr_t a case DIOCSETHOSTID: { u_int32_t *hostid = (u_int32_t *)addr; +#ifdef __FreeBSD__ + if (*hostid == 0) + V_pf_status.hostid = arc4random(); + else *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Mon Oct 12 22:26:10 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B2F9E106566B; Mon, 12 Oct 2009 22:26:10 +0000 (UTC) (envelope-from eri@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A21F08FC13; Mon, 12 Oct 2009 22:26:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n9CMQAOG087386; Mon, 12 Oct 2009 22:26:10 GMT (envelope-from eri@svn.freebsd.org) Received: (from eri@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9CMQAYr087381; Mon, 12 Oct 2009 22:26:10 GMT (envelope-from eri@svn.freebsd.org) Message-Id: <200910122226.n9CMQAYr087381@svn.freebsd.org> From: Ermal Luçi Date: Mon, 12 Oct 2009 22:26:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r198007 - user/eri/pf45/head/sys/contrib/pf/net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Oct 2009 22:26:10 -0000 Author: eri Date: Mon Oct 12 22:26:10 2009 New Revision: 198007 URL: http://svn.freebsd.org/changeset/base/198007 Log: * Prefix some other variables with V_ since their name is the same as their struct type. * For being virtualization ready only contexes should be considered especially in event handlers. NOTE: GENERIC builds again now Modified: user/eri/pf45/head/sys/contrib/pf/net/pf.c user/eri/pf45/head/sys/contrib/pf/net/pf_ioctl.c user/eri/pf45/head/sys/contrib/pf/net/pf_norm.c user/eri/pf45/head/sys/contrib/pf/net/pf_ruleset.c Modified: user/eri/pf45/head/sys/contrib/pf/net/pf.c ============================================================================== --- user/eri/pf45/head/sys/contrib/pf/net/pf.c Mon Oct 12 21:11:50 2009 (r198006) +++ user/eri/pf45/head/sys/contrib/pf/net/pf.c Mon Oct 12 22:26:10 2009 (r198007) @@ -145,10 +145,7 @@ __FBSDID("$FreeBSD$"); #include #include #include - -#if NPFSYNC > 0 #include -#endif /* NPFSYNC > 0 */ #ifdef INET6 #include Modified: user/eri/pf45/head/sys/contrib/pf/net/pf_ioctl.c ============================================================================== --- user/eri/pf45/head/sys/contrib/pf/net/pf_ioctl.c Mon Oct 12 21:11:50 2009 (r198006) +++ user/eri/pf45/head/sys/contrib/pf/net/pf_ioctl.c Mon Oct 12 22:26:10 2009 (r198007) @@ -115,9 +115,7 @@ __FBSDID("$FreeBSD$"); #endif #include -#if NPFSYNC > 0 #include -#endif /* NPFSYNC > 0 */ #if NPFLOG > 0 #include Modified: user/eri/pf45/head/sys/contrib/pf/net/pf_norm.c ============================================================================== --- user/eri/pf45/head/sys/contrib/pf/net/pf_norm.c Mon Oct 12 21:11:50 2009 (r198006) +++ user/eri/pf45/head/sys/contrib/pf/net/pf_norm.c Mon Oct 12 22:26:10 2009 (r198007) @@ -120,9 +120,9 @@ struct pf_fragment { TAILQ_HEAD(pf_fragqueue, pf_fragment); TAILQ_HEAD(pf_cachequeue, pf_fragment); VNET_DEFINE(struct pf_fragqueue, pf_fragqueue); -#define V_pf_fragqueue VNET(pf_fragqueue); +#define V_pf_fragqueue VNET(pf_fragqueue) VNET_DEFINE(struct pf_cachequeue, pf_cachequeue); -#define pf_cachequeue VNET(pf_cachequeue) +#define V_pf_cachequeue VNET(pf_cachequeue) #else TAILQ_HEAD(pf_fragqueue, pf_fragment) pf_fragqueue; TAILQ_HEAD(pf_cachequeue, pf_fragment) pf_cachequeue; @@ -202,7 +202,7 @@ int pf_nfrents, pf_ncache; void pf_normalize_init(void) { - #ifdef __FreeBSD__ +#ifdef __FreeBSD__ /* * XXX * No high water mark support(It's hint not hard limit). @@ -231,10 +231,11 @@ pf_normalize_init(void) #ifdef __FreeBSD__ TAILQ_INIT(&V_pf_fragqueue); + TAILQ_INIT(&V_pf_cachequeue); #else TAILQ_INIT(&pf_fragqueue); -#endif TAILQ_INIT(&pf_cachequeue); +#endif } #ifdef __FreeBSD__ @@ -283,11 +284,12 @@ pf_purge_expired_fragments(void) pf_free_fragment(frag); } - while ((frag = TAILQ_LAST(&pf_cachequeue, pf_cachequeue)) != NULL) { #ifdef __FreeBSD__ + while ((frag = TAILQ_LAST(&V_pf_cachequeue, pf_cachequeue)) != NULL) { KASSERT((!BUFFER_FRAGMENTS(frag)), ("BUFFER_FRAGMENTS(frag) != 0: %s", __FUNCTION__)); #else + while ((frag = TAILQ_LAST(&pf_cachequeue, pf_cachequeue)) != NULL) { KASSERT(!BUFFER_FRAGMENTS(frag)); #endif if (frag->fr_timeout > expire) @@ -296,8 +298,8 @@ pf_purge_expired_fragments(void) DPFPRINTF(("expiring %d(%p)\n", frag->fr_id, frag)); pf_free_fragment(frag); #ifdef __FreeBSD__ - KASSERT((TAILQ_EMPTY(&pf_cachequeue) || - TAILQ_LAST(&pf_cachequeue, pf_cachequeue) != frag), + KASSERT((TAILQ_EMPTY(&V_pf_cachequeue) || + TAILQ_LAST(&V_pf_cachequeue, pf_cachequeue) != frag), ("!(TAILQ_EMPTY() || TAILQ_LAST() == farg): %s", __FUNCTION__)); #else @@ -336,7 +338,11 @@ pf_flush_fragments(void) DPFPRINTF(("trying to free > %d cache entries\n", pf_ncache - goal)); while (goal < pf_ncache) { +#ifdef __FreeBSD__ + frag = TAILQ_LAST(&V_pf_cachequeue, pf_cachequeue); +#else frag = TAILQ_LAST(&pf_cachequeue, pf_cachequeue); +#endif if (frag == NULL) break; pf_free_fragment(frag); @@ -416,8 +422,13 @@ pf_find_fragment(struct ip *ip, struct p TAILQ_INSERT_HEAD(&pf_fragqueue, frag, frag_next); #endif } else { +#ifdef __FreeBSD__ + TAILQ_REMOVE(&V_pf_cachequeue, frag, frag_next); + TAILQ_INSERT_HEAD(&V_pf_cachequeue, frag, frag_next); +#else TAILQ_REMOVE(&pf_cachequeue, frag, frag_next); TAILQ_INSERT_HEAD(&pf_cachequeue, frag, frag_next); +#endif } } @@ -440,7 +451,11 @@ pf_remove_fragment(struct pf_fragment *f pool_put(&pf_frag_pl, frag); } else { RB_REMOVE(pf_frag_tree, &pf_cache_tree, frag); +#ifdef __FreeBSD__ + TAILQ_REMOVE(&V_pf_cachequeue, frag, frag_next); +#else TAILQ_REMOVE(&pf_cachequeue, frag, frag_next); +#endif pool_put(&pf_cache_pl, frag); } } @@ -724,7 +739,11 @@ pf_fragcache(struct mbuf **m0, struct ip LIST_INSERT_HEAD(&(*frag)->fr_cache, cur, fr_next); RB_INSERT(pf_frag_tree, &pf_cache_tree, *frag); +#ifdef __FreeBSD__ + TAILQ_INSERT_HEAD(&V_pf_cachequeue, *frag, frag_next); +#else TAILQ_INSERT_HEAD(&pf_cachequeue, *frag, frag_next); +#endif DPFPRINTF(("fragcache[%d]: new %d-%d\n", h->ip_id, off, max)); Modified: user/eri/pf45/head/sys/contrib/pf/net/pf_ruleset.c ============================================================================== --- user/eri/pf45/head/sys/contrib/pf/net/pf_ruleset.c Mon Oct 12 21:11:50 2009 (r198006) +++ user/eri/pf45/head/sys/contrib/pf/net/pf_ruleset.c Mon Oct 12 22:26:10 2009 (r198007) @@ -53,6 +53,9 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef __FreeBSD__ +#include +#endif #include #ifdef INET6 From owner-svn-src-user@FreeBSD.ORG Mon Oct 12 22:40:43 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BCD03106568D; Mon, 12 Oct 2009 22:40:43 +0000 (UTC) (envelope-from eri@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9313F8FC19; Mon, 12 Oct 2009 22:40:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n9CMeh0R087657; Mon, 12 Oct 2009 22:40:43 GMT (envelope-from eri@svn.freebsd.org) Received: (from eri@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9CMehnL087654; Mon, 12 Oct 2009 22:40:43 GMT (envelope-from eri@svn.freebsd.org) Message-Id: <200910122240.n9CMehnL087654@svn.freebsd.org> From: Ermal Luçi Date: Mon, 12 Oct 2009 22:40:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r198008 - user/eri/pf45/head/sys/contrib/pf/net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Oct 2009 22:40:43 -0000 Author: eri Date: Mon Oct 12 22:40:43 2009 New Revision: 198008 URL: http://svn.freebsd.org/changeset/base/198008 Log: Unbreak building of userland utilities. Modified: user/eri/pf45/head/sys/contrib/pf/net/pf_ruleset.c user/eri/pf45/head/sys/contrib/pf/net/pfvar.h Modified: user/eri/pf45/head/sys/contrib/pf/net/pf_ruleset.c ============================================================================== --- user/eri/pf45/head/sys/contrib/pf/net/pf_ruleset.c Mon Oct 12 22:26:10 2009 (r198007) +++ user/eri/pf45/head/sys/contrib/pf/net/pf_ruleset.c Mon Oct 12 22:40:43 2009 (r198008) @@ -53,9 +53,6 @@ __FBSDID("$FreeBSD$"); #include #include -#ifdef __FreeBSD__ -#include -#endif #include #ifdef INET6 @@ -100,7 +97,7 @@ __FBSDID("$FreeBSD$"); #endif /* _KERNEL */ -#ifdef __FreeBSD__ +#if defined(__FreeBSD__) && defined(_KERNEL) VNET_DEFINE(struct pf_anchor_global, pf_anchors); VNET_DEFINE(struct pf_anchor, pf_main_anchor); #else Modified: user/eri/pf45/head/sys/contrib/pf/net/pfvar.h ============================================================================== --- user/eri/pf45/head/sys/contrib/pf/net/pfvar.h Mon Oct 12 22:26:10 2009 (r198007) +++ user/eri/pf45/head/sys/contrib/pf/net/pfvar.h Mon Oct 12 22:40:43 2009 (r198008) @@ -934,6 +934,7 @@ struct pfsync_state { } __packed; #ifdef __FreeBSD__ +#ifdef _KERNEL /* pfsync */ typedef int pfsync_state_import_t(struct pfsync_state *, u_int8_t); typedef void pfsync_insert_state_t(struct pf_state *); @@ -981,6 +982,7 @@ VNET_DECLARE(pflog_packet_t, *pflog_pac /* pf uid hack */ #define debug_pfugidhack VNET(debug_pfugidhack) +#endif /* Macros to set/clear/test flags. */ #ifdef _KERNEL @@ -1218,8 +1220,10 @@ RB_HEAD(pfi_ifhead, pfi_kif); /* state tables */ #ifdef __FreeBSD__ +#ifdef _KERNEL VNET_DECLARE(struct pf_state_tree, pf_statetbl); #define pf_statetbl VNET(pf_statetbl) +#endif #else extern struct pf_state_tree pf_statetbl; #endif @@ -2143,10 +2147,12 @@ struct pf_fragment { #endif /* _KERNEL */ #ifdef __FreeBSD__ +#ifdef _KERNEL VNET_DECLARE(struct pf_anchor_global, pf_anchors); #define pf_anchors VNET(pf_anchors) VNET_DECLARE(struct pf_anchor, pf_main_anchor); #define pf_main_anchor VNET(pf_main_anchor) +#endif #else extern struct pf_anchor_global pf_anchors; extern struct pf_anchor pf_main_anchor; From owner-svn-src-user@FreeBSD.ORG Tue Oct 13 01:15:24 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 293491065700; Tue, 13 Oct 2009 01:15:24 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 173B98FC14; Tue, 13 Oct 2009 01:15:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n9D1FOsp090762; Tue, 13 Oct 2009 01:15:24 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9D1FNST090748; Tue, 13 Oct 2009 01:15:23 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200910130115.n9D1FNST090748@svn.freebsd.org> From: Kip Macy Date: Tue, 13 Oct 2009 01:15:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r198010 - in user/kmacy/releng_8_fcs/sys: amd64/amd64 amd64/include sys vm X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Oct 2009 01:15:24 -0000 Author: kmacy Date: Tue Oct 13 01:15:23 2009 New Revision: 198010 URL: http://svn.freebsd.org/changeset/base/198010 Log: - add support for excluding portions of wired memory from core dumps Modified: user/kmacy/releng_8_fcs/sys/amd64/amd64/minidump_machdep.c user/kmacy/releng_8_fcs/sys/amd64/amd64/pmap.c user/kmacy/releng_8_fcs/sys/amd64/amd64/uma_machdep.c user/kmacy/releng_8_fcs/sys/amd64/include/md_var.h user/kmacy/releng_8_fcs/sys/amd64/include/vmparam.h user/kmacy/releng_8_fcs/sys/sys/malloc.h user/kmacy/releng_8_fcs/sys/vm/pmap.h user/kmacy/releng_8_fcs/sys/vm/uma.h user/kmacy/releng_8_fcs/sys/vm/uma_core.c user/kmacy/releng_8_fcs/sys/vm/vm.h user/kmacy/releng_8_fcs/sys/vm/vm_glue.c user/kmacy/releng_8_fcs/sys/vm/vm_kern.c user/kmacy/releng_8_fcs/sys/vm/vnode_pager.c Modified: user/kmacy/releng_8_fcs/sys/amd64/amd64/minidump_machdep.c ============================================================================== --- user/kmacy/releng_8_fcs/sys/amd64/amd64/minidump_machdep.c Tue Oct 13 00:43:31 2009 (r198009) +++ user/kmacy/releng_8_fcs/sys/amd64/amd64/minidump_machdep.c Tue Oct 13 01:15:23 2009 (r198010) @@ -56,6 +56,7 @@ CTASSERT(sizeof(struct kerneldumpheader) extern uint64_t KPDPphys; uint64_t *vm_page_dump; +uint64_t *vm_page_dump_exclude; int vm_page_dump_size; static struct kerneldumpheader kdh; @@ -71,10 +72,16 @@ CTASSERT(sizeof(*vm_page_dump) == 8); static int is_dumpable(vm_paddr_t pa) { - int i; + int i, idx, bit, isdata; + uint64_t pfn = pa; + + pfn >>= PAGE_SHIFT; + idx = pfn >> 6; /* 2^6 = 64 */ + bit = pfn & 63; + isdata = ((vm_page_dump_exclude[idx] & (1ul << bit)) == 0); for (i = 0; dump_avail[i] != 0 || dump_avail[i + 1] != 0; i += 2) { - if (pa >= dump_avail[i] && pa < dump_avail[i + 1]) + if (pa >= dump_avail[i] && pa < dump_avail[i + 1] && isdata) return (1); } return (0); @@ -226,6 +233,7 @@ minidumpsys(struct dumperinfo *di) dumpsize = ptesize; dumpsize += round_page(msgbufp->msg_size); dumpsize += round_page(vm_page_dump_size); + printf("dumpsize: "); for (i = 0; i < vm_page_dump_size / sizeof(*vm_page_dump); i++) { bits = vm_page_dump[i]; while (bits) { @@ -238,10 +246,13 @@ minidumpsys(struct dumperinfo *di) dump_drop_page(pa); } bits &= ~(1ul << bit); + if ((dumpsize % (1<<29)) == 0) + printf("%ldMB ", (dumpsize>>20)); } } dumpsize += PAGE_SIZE; + printf("\n"); /* Determine dump offset on device. */ if (di->mediasize < SIZEOF_METADATA + dumpsize + sizeof(kdh) * 2) { error = ENOSPC; @@ -273,6 +284,7 @@ minidumpsys(struct dumperinfo *di) goto fail; dumplo += sizeof(kdh); + printf("write header\n"); /* Dump my header */ bzero(&fakept, sizeof(fakept)); bcopy(&mdhdr, &fakept, sizeof(mdhdr)); @@ -280,16 +292,19 @@ minidumpsys(struct dumperinfo *di) if (error) goto fail; + printf("write msgbuf\n"); /* Dump msgbuf up front */ error = blk_write(di, (char *)msgbufp->msg_ptr, 0, round_page(msgbufp->msg_size)); if (error) goto fail; + printf("write bitmap\n"); /* Dump bitmap */ error = blk_write(di, (char *)vm_page_dump, 0, round_page(vm_page_dump_size)); if (error) goto fail; + printf("\nDump kernel page table pages\n"); /* Dump kernel page table pages */ pdp = (uint64_t *)PHYS_TO_DMAP(KPDPphys); for (va = VM_MIN_KERNEL_ADDRESS; va < MAX(KERNBASE + NKPT * NBPDR, @@ -343,8 +358,10 @@ minidumpsys(struct dumperinfo *di) /* Dump memory chunks */ /* XXX cluster it up and use blk_dump() */ - for (i = 0; i < vm_page_dump_size / sizeof(*vm_page_dump); i++) { - bits = vm_page_dump[i]; + printf("\nclustering memory chunks\n"); + for (i = 0; + i < vm_page_dump_size / sizeof(*vm_page_dump); i++) { + bits = vm_page_dump[i] & ~(vm_page_dump_exclude[i]); while (bits) { bit = bsfq(bits); pa = (((uint64_t)i * sizeof(*vm_page_dump) * NBBY) + bit) * PAGE_SIZE; @@ -354,7 +371,6 @@ minidumpsys(struct dumperinfo *di) bits &= ~(1ul << bit); } } - error = blk_flush(di); if (error) goto fail; @@ -365,6 +381,7 @@ minidumpsys(struct dumperinfo *di) goto fail; dumplo += sizeof(kdh); + printf("\nstarting dump\n"); /* Signal completion, signoff and exit stage left. */ dump_write(di, NULL, 0, 0, 0); printf("\nDump complete\n"); @@ -403,3 +420,25 @@ dump_drop_page(vm_paddr_t pa) bit = pa & 63; atomic_clear_long(&vm_page_dump[idx], 1ul << bit); } + +void +dump_exclude_page(vm_paddr_t pa) +{ + int idx, bit; + + pa >>= PAGE_SHIFT; + idx = pa >> 6; /* 2^6 = 64 */ + bit = pa & 63; + atomic_set_long(&vm_page_dump_exclude[idx], 1ul << bit); +} + +void +dump_unexclude_page(vm_paddr_t pa) +{ + int idx, bit; + + pa >>= PAGE_SHIFT; + idx = pa >> 6; /* 2^6 = 64 */ + bit = pa & 63; + atomic_clear_long(&vm_page_dump_exclude[idx], 1ul << bit); +} Modified: user/kmacy/releng_8_fcs/sys/amd64/amd64/pmap.c ============================================================================== --- user/kmacy/releng_8_fcs/sys/amd64/amd64/pmap.c Tue Oct 13 00:43:31 2009 (r198009) +++ user/kmacy/releng_8_fcs/sys/amd64/amd64/pmap.c Tue Oct 13 01:15:23 2009 (r198010) @@ -1132,10 +1132,16 @@ pmap_map(vm_offset_t *virt, vm_paddr_t s * Note: SMP coherent. Uses a ranged shootdown IPI. */ void -pmap_qenter(vm_offset_t sva, vm_page_t *ma, int count) +pmap_qenter_prot(vm_offset_t sva, vm_page_t *ma, int count, vm_prot_t prot) { pt_entry_t *endpte, oldpte, *pte; + uint64_t flags = PG_V; + if (prot & VM_PROT_WRITE) + flags |= PG_RW; + if ((prot & VM_PROT_EXECUTE) == 0) + flags |= PG_NX; + oldpte = 0; pte = vtopte(sva); endpte = pte + count; @@ -1143,6 +1149,9 @@ pmap_qenter(vm_offset_t sva, vm_page_t * oldpte |= *pte; pte_store(pte, VM_PAGE_TO_PHYS(*ma) | PG_G | pmap_cache_bits((*ma)->md.pat_mode, 0) | PG_RW | PG_V); + pte_store(pte, VM_PAGE_TO_PHYS(*ma) | PG_G | flags); + if (prot & VM_PROT_EXCLUDE) + dump_exclude_page(VM_PAGE_TO_PHYS(*ma)); pte++; ma++; } @@ -1151,6 +1160,16 @@ pmap_qenter(vm_offset_t sva, vm_page_t * PAGE_SIZE); } +void +pmap_qenter(vm_offset_t sva, vm_page_t *ma, int count) +{ + + pmap_qenter_prot(sva, ma, count, + VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE); + +} + + /* * This routine tears out page mappings from the * kernel -- it is meant only for temporary mappings. @@ -1163,6 +1182,7 @@ pmap_qremove(vm_offset_t sva, int count) va = sva; while (count-- > 0) { + dump_unexclude_page(pmap_kextract(va)); pmap_kremove(va); va += PAGE_SIZE; } Modified: user/kmacy/releng_8_fcs/sys/amd64/amd64/uma_machdep.c ============================================================================== --- user/kmacy/releng_8_fcs/sys/amd64/amd64/uma_machdep.c Tue Oct 13 00:43:31 2009 (r198009) +++ user/kmacy/releng_8_fcs/sys/amd64/amd64/uma_machdep.c Tue Oct 13 01:15:23 2009 (r198010) @@ -66,7 +66,8 @@ uma_small_alloc(uma_zone_t zone, int byt break; } pa = m->phys_addr; - dump_add_page(pa); + if ((wait & M_NODUMP) == 0) + dump_add_page(pa); va = (void *)PHYS_TO_DMAP(pa); if ((wait & M_ZERO) && (m->flags & PG_ZERO) == 0) pagezero(va); Modified: user/kmacy/releng_8_fcs/sys/amd64/include/md_var.h ============================================================================== --- user/kmacy/releng_8_fcs/sys/amd64/include/md_var.h Tue Oct 13 00:43:31 2009 (r198009) +++ user/kmacy/releng_8_fcs/sys/amd64/include/md_var.h Tue Oct 13 01:15:23 2009 (r198010) @@ -60,6 +60,7 @@ extern char kstack[]; extern char sigcode[]; extern int szsigcode; extern uint64_t *vm_page_dump; +extern uint64_t *vm_page_dump_exclude; extern int vm_page_dump_size; extern int _udatasel; extern int _ucodesel; @@ -88,6 +89,8 @@ void fs_load_fault(void) __asm(__STRING( void gs_load_fault(void) __asm(__STRING(gs_load_fault)); void dump_add_page(vm_paddr_t); void dump_drop_page(vm_paddr_t); +void dump_exclude_page(vm_paddr_t); +void dump_unexclude_page(vm_paddr_t); void initializecpu(void); void fillw(int /*u_short*/ pat, void *base, size_t cnt); void fpstate_drop(struct thread *td); Modified: user/kmacy/releng_8_fcs/sys/amd64/include/vmparam.h ============================================================================== --- user/kmacy/releng_8_fcs/sys/amd64/include/vmparam.h Tue Oct 13 00:43:31 2009 (r198009) +++ user/kmacy/releng_8_fcs/sys/amd64/include/vmparam.h Tue Oct 13 01:15:23 2009 (r198010) @@ -88,6 +88,11 @@ #define UMA_MD_SMALL_ALLOC /* + * We machine specific sparse kernel dump + */ +#define VM_MD_MINIDUMP + +/* * The physical address space is densely populated. */ #define VM_PHYSSEG_DENSE Modified: user/kmacy/releng_8_fcs/sys/sys/malloc.h ============================================================================== --- user/kmacy/releng_8_fcs/sys/sys/malloc.h Tue Oct 13 00:43:31 2009 (r198009) +++ user/kmacy/releng_8_fcs/sys/sys/malloc.h Tue Oct 13 01:15:23 2009 (r198010) @@ -50,6 +50,7 @@ #define M_ZERO 0x0100 /* bzero the allocation */ #define M_NOVM 0x0200 /* don't ask VM for pages */ #define M_USE_RESERVE 0x0400 /* can alloc out of reserve memory */ +#define M_NODUMP 0x0800 /* don't dump pages in this allocation */ #define M_MAGIC 877983977 /* time when first defined :-) */ Modified: user/kmacy/releng_8_fcs/sys/vm/pmap.h ============================================================================== --- user/kmacy/releng_8_fcs/sys/vm/pmap.h Tue Oct 13 00:43:31 2009 (r198009) +++ user/kmacy/releng_8_fcs/sys/vm/pmap.h Tue Oct 13 01:15:23 2009 (r198010) @@ -127,6 +127,7 @@ int pmap_pinit(pmap_t); void pmap_pinit0(pmap_t); void pmap_protect(pmap_t, vm_offset_t, vm_offset_t, vm_prot_t); void pmap_qenter(vm_offset_t, vm_page_t *, int); +void pmap_qenter_prot(vm_offset_t, vm_page_t *, int, vm_prot_t); void pmap_qremove(vm_offset_t, int); void pmap_release(pmap_t); void pmap_remove(pmap_t, vm_offset_t, vm_offset_t); Modified: user/kmacy/releng_8_fcs/sys/vm/uma.h ============================================================================== --- user/kmacy/releng_8_fcs/sys/vm/uma.h Tue Oct 13 00:43:31 2009 (r198009) +++ user/kmacy/releng_8_fcs/sys/vm/uma.h Tue Oct 13 01:15:23 2009 (r198010) @@ -248,6 +248,9 @@ int uma_zsecond_add(uma_zone_t zone, uma * backend pages and can fail early. */ #define UMA_ZONE_VTOSLAB 0x2000 /* Zone uses vtoslab for lookup. */ +#define UMA_ZONE_NODUMP 0x4000 /* Zone's pages will not be included in + * mini-dumps + */ /* * These flags are shared between the keg and zone. In zones wishing to add Modified: user/kmacy/releng_8_fcs/sys/vm/uma_core.c ============================================================================== --- user/kmacy/releng_8_fcs/sys/vm/uma_core.c Tue Oct 13 00:43:31 2009 (r198009) +++ user/kmacy/releng_8_fcs/sys/vm/uma_core.c Tue Oct 13 01:15:23 2009 (r198010) @@ -842,6 +842,9 @@ keg_alloc_slab(uma_keg_t keg, uma_zone_t else wait &= ~M_ZERO; + if (keg->uk_flags & UMA_ZONE_NODUMP) + wait |= M_NODUMP; + /* zone is passed for legacy reasons. */ mem = allocf(zone, keg->uk_ppera * UMA_SLAB_SIZE, &flags, wait); if (mem == NULL) { Modified: user/kmacy/releng_8_fcs/sys/vm/vm.h ============================================================================== --- user/kmacy/releng_8_fcs/sys/vm/vm.h Tue Oct 13 00:43:31 2009 (r198009) +++ user/kmacy/releng_8_fcs/sys/vm/vm.h Tue Oct 13 01:15:23 2009 (r198010) @@ -83,6 +83,7 @@ typedef u_char vm_prot_t; /* protection #define VM_PROT_WRITE ((vm_prot_t) 0x02) #define VM_PROT_EXECUTE ((vm_prot_t) 0x04) #define VM_PROT_OVERRIDE_WRITE ((vm_prot_t) 0x08) /* copy-on-write */ +#define VM_PROT_EXCLUDE ((vm_prot_t) 0x10) /* don't include in core-dump */ #define VM_PROT_ALL (VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE) #define VM_PROT_RW (VM_PROT_READ|VM_PROT_WRITE) Modified: user/kmacy/releng_8_fcs/sys/vm/vm_glue.c ============================================================================== --- user/kmacy/releng_8_fcs/sys/vm/vm_glue.c Tue Oct 13 00:43:31 2009 (r198009) +++ user/kmacy/releng_8_fcs/sys/vm/vm_glue.c Tue Oct 13 01:15:23 2009 (r198010) @@ -405,7 +405,8 @@ vm_thread_new(struct thread *td, int pag m->valid = VM_PAGE_BITS_ALL; } VM_OBJECT_UNLOCK(ksobj); - pmap_qenter(ks, ma, pages); + pmap_qenter_prot(ks, ma, pages, + (VM_PROT_READ|VM_PROT_WRITE)); return (1); } @@ -546,7 +547,8 @@ vm_thread_swapin(struct thread *td) vm_page_wakeup(m); } VM_OBJECT_UNLOCK(ksobj); - pmap_qenter(td->td_kstack, ma, pages); + pmap_qenter_prot(td->td_kstack, ma, pages, + (VM_PROT_READ|VM_PROT_WRITE)); cpu_thread_swapin(td); } Modified: user/kmacy/releng_8_fcs/sys/vm/vm_kern.c ============================================================================== --- user/kmacy/releng_8_fcs/sys/vm/vm_kern.c Tue Oct 13 00:43:31 2009 (r198009) +++ user/kmacy/releng_8_fcs/sys/vm/vm_kern.c Tue Oct 13 01:15:23 2009 (r198010) @@ -85,6 +85,10 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef VM_MD_MINIDUMP +#include +#endif + vm_map_t kernel_map=0; vm_map_t kmem_map=0; vm_map_t exec_map=0; @@ -207,8 +211,15 @@ kmem_free(map, addr, size) vm_offset_t addr; vm_size_t size; { - - (void) vm_map_remove(map, trunc_page(addr), round_page(addr + size)); + vm_offset_t start = trunc_page(addr); + vm_offset_t end = round_page(addr + size); +#ifdef VM_MD_MINIDUMP + vm_offset_t temp = start; + + for (; temp < end; temp += PAGE_SIZE) + dump_add_page(pmap_kextract(temp)); +#endif + (void) vm_map_remove(map, start, end); } /* @@ -363,6 +374,10 @@ retry: } if (flags & M_ZERO && (m->flags & PG_ZERO) == 0) pmap_zero_page(m); +#ifdef VM_MD_MINIDUMP + if (flags & M_NODUMP) + dump_drop_page(VM_PAGE_TO_PHYS(m)); +#endif m->valid = VM_PAGE_BITS_ALL; KASSERT((m->flags & PG_UNMANAGED) != 0, ("kmem_malloc: page %p is managed", m)); Modified: user/kmacy/releng_8_fcs/sys/vm/vnode_pager.c ============================================================================== --- user/kmacy/releng_8_fcs/sys/vm/vnode_pager.c Tue Oct 13 00:43:31 2009 (r198009) +++ user/kmacy/releng_8_fcs/sys/vm/vnode_pager.c Tue Oct 13 01:15:23 2009 (r198010) @@ -885,7 +885,8 @@ vnode_pager_generic_getpages(vp, m, byte /* * and map the pages to be read into the kva */ - pmap_qenter(kva, m, count); + pmap_qenter_prot(kva, m, count, + (VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXCLUDE)); /* build a minimal buffer header */ bp->b_iocmd = BIO_READ; From owner-svn-src-user@FreeBSD.ORG Tue Oct 13 01:48:01 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CDCF91065670; Tue, 13 Oct 2009 01:48:01 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A335B8FC1D; Tue, 13 Oct 2009 01:48:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n9D1m1Em091451; Tue, 13 Oct 2009 01:48:01 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9D1m1CP091447; Tue, 13 Oct 2009 01:48:01 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200910130148.n9D1m1CP091447@svn.freebsd.org> From: Kip Macy Date: Tue, 13 Oct 2009 01:48:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r198011 - user/kmacy/releng_8_fcs/sys/vm X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Oct 2009 01:48:01 -0000 Author: kmacy Date: Tue Oct 13 01:48:01 2009 New Revision: 198011 URL: http://svn.freebsd.org/changeset/base/198011 Log: add setup for conditionally excluding pages from core dump Modified: user/kmacy/releng_8_fcs/sys/vm/vm_contig.c user/kmacy/releng_8_fcs/sys/vm/vm_kern.c user/kmacy/releng_8_fcs/sys/vm/vm_page.c Modified: user/kmacy/releng_8_fcs/sys/vm/vm_contig.c ============================================================================== --- user/kmacy/releng_8_fcs/sys/vm/vm_contig.c Tue Oct 13 01:15:23 2009 (r198010) +++ user/kmacy/releng_8_fcs/sys/vm/vm_contig.c Tue Oct 13 01:48:01 2009 (r198011) @@ -87,6 +87,10 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef VM_MD_MINIDUMP +#include +#endif + static int vm_contig_launder_page(vm_page_t m, vm_page_t *next) { @@ -219,6 +223,10 @@ contigmapping(vm_map_t map, vm_size_t si pmap_zero_page(m); m->valid = VM_PAGE_BITS_ALL; m++; +#ifdef VM_MD_MINIDUMP + if (flags & M_NODUMP) + dump_exclude_page(VM_PAGE_TO_PHYS(m)); +#endif } VM_OBJECT_UNLOCK(object); vm_map_wire(map, addr, addr + size, Modified: user/kmacy/releng_8_fcs/sys/vm/vm_kern.c ============================================================================== --- user/kmacy/releng_8_fcs/sys/vm/vm_kern.c Tue Oct 13 01:15:23 2009 (r198010) +++ user/kmacy/releng_8_fcs/sys/vm/vm_kern.c Tue Oct 13 01:48:01 2009 (r198011) @@ -217,7 +217,7 @@ kmem_free(map, addr, size) vm_offset_t temp = start; for (; temp < end; temp += PAGE_SIZE) - dump_add_page(pmap_kextract(temp)); + dump_unexclude_page(pmap_kextract(temp)); #endif (void) vm_map_remove(map, start, end); } @@ -376,7 +376,7 @@ retry: pmap_zero_page(m); #ifdef VM_MD_MINIDUMP if (flags & M_NODUMP) - dump_drop_page(VM_PAGE_TO_PHYS(m)); + dump_exclude_page(VM_PAGE_TO_PHYS(m)); #endif m->valid = VM_PAGE_BITS_ALL; KASSERT((m->flags & PG_UNMANAGED) != 0, Modified: user/kmacy/releng_8_fcs/sys/vm/vm_page.c ============================================================================== --- user/kmacy/releng_8_fcs/sys/vm/vm_page.c Tue Oct 13 01:15:23 2009 (r198010) +++ user/kmacy/releng_8_fcs/sys/vm/vm_page.c Tue Oct 13 01:48:01 2009 (r198011) @@ -310,6 +310,10 @@ vm_page_startup(vm_offset_t vaddr) vm_page_dump = (void *)(uintptr_t)pmap_map(&vaddr, new_end, new_end + vm_page_dump_size, VM_PROT_READ | VM_PROT_WRITE); bzero((void *)vm_page_dump, vm_page_dump_size); + new_end -= vm_page_dump_size; + vm_page_dump_exclude = (void *)(uintptr_t)pmap_map(&vaddr, new_end, + new_end + vm_page_dump_size, VM_PROT_READ | VM_PROT_WRITE); + bzero((void *)vm_page_dump, vm_page_dump_size); #endif /* * Compute the number of pages of memory that will be available for From owner-svn-src-user@FreeBSD.ORG Tue Oct 13 01:58:51 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3035C1065672; Tue, 13 Oct 2009 01:58:51 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1EC3F8FC14; Tue, 13 Oct 2009 01:58:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n9D1woKq091666; Tue, 13 Oct 2009 01:58:50 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9D1woTU091663; Tue, 13 Oct 2009 01:58:50 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200910130158.n9D1woTU091663@svn.freebsd.org> From: Kip Macy Date: Tue, 13 Oct 2009 01:58:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r198012 - in user/kmacy/releng_8_fcs/sys/cddl: compat/opensolaris/sys contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Oct 2009 01:58:51 -0000 Author: kmacy Date: Tue Oct 13 01:58:50 2009 New Revision: 198012 URL: http://svn.freebsd.org/changeset/base/198012 Log: exclude ZFS data buffers from minidumps Modified: user/kmacy/releng_8_fcs/sys/cddl/compat/opensolaris/sys/kmem.h user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Modified: user/kmacy/releng_8_fcs/sys/cddl/compat/opensolaris/sys/kmem.h ============================================================================== --- user/kmacy/releng_8_fcs/sys/cddl/compat/opensolaris/sys/kmem.h Tue Oct 13 01:48:01 2009 (r198011) +++ user/kmacy/releng_8_fcs/sys/cddl/compat/opensolaris/sys/kmem.h Tue Oct 13 01:58:50 2009 (r198012) @@ -40,7 +40,8 @@ #define KM_SLEEP M_WAITOK #define KM_PUSHPAGE M_WAITOK #define KM_NOSLEEP M_NOWAIT -#define KMC_NODEBUG 0 +#define KMC_NODEBUG UMA_ZONE_NODUMP +#define KM_NODEBUG M_NODUMP typedef struct kmem_cache { char kc_name[32]; Modified: user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c ============================================================================== --- user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Tue Oct 13 01:48:01 2009 (r198011) +++ user/kmacy/releng_8_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Tue Oct 13 01:58:50 2009 (r198012) @@ -121,7 +121,7 @@ zio_init(void) char name[36]; (void) sprintf(name, "zio_buf_%lu", (ulong_t)size); zio_buf_cache[c] = kmem_cache_create(name, size, - align, NULL, NULL, NULL, NULL, NULL, KMC_NODEBUG); + align, NULL, NULL, NULL, NULL, NULL, 0); (void) sprintf(name, "zio_data_buf_%lu", (ulong_t)size); zio_data_buf_cache[c] = kmem_cache_create(name, size, @@ -214,7 +214,7 @@ zio_data_buf_alloc(size_t size) return (kmem_cache_alloc(zio_data_buf_cache[c], KM_PUSHPAGE)); #else - return (kmem_alloc(size, KM_SLEEP)); + return (kmem_alloc(size, KM_SLEEP|KM_NODEBUG)); #endif } From owner-svn-src-user@FreeBSD.ORG Tue Oct 13 03:55:58 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 320CE106568B; Tue, 13 Oct 2009 03:55:58 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 07F458FC1B; Tue, 13 Oct 2009 03:55:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n9D3tv3k094036; Tue, 13 Oct 2009 03:55:57 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9D3tvaF094033; Tue, 13 Oct 2009 03:55:57 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200910130355.n9D3tvaF094033@svn.freebsd.org> From: Kip Macy Date: Tue, 13 Oct 2009 03:55:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r198013 - user/kmacy/releng_8_fcs/sys/kern X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Oct 2009 03:55:58 -0000 Author: kmacy Date: Tue Oct 13 03:55:57 2009 New Revision: 198013 URL: http://svn.freebsd.org/changeset/base/198013 Log: remove residual bg sendfile socket references before destroying socket buffer Modified: user/kmacy/releng_8_fcs/sys/kern/uipc_socket.c user/kmacy/releng_8_fcs/sys/kern/uipc_syscalls.c Modified: user/kmacy/releng_8_fcs/sys/kern/uipc_socket.c ============================================================================== --- user/kmacy/releng_8_fcs/sys/kern/uipc_socket.c Tue Oct 13 01:58:50 2009 (r198012) +++ user/kmacy/releng_8_fcs/sys/kern/uipc_socket.c Tue Oct 13 03:55:57 2009 (r198013) @@ -166,6 +166,7 @@ static struct filterops sowrite_filtops uma_zone_t socket_zone; so_gen_t so_gencnt; /* generation count for sockets */ +extern int bg_sendfile_enable; int maxsockets; MALLOC_DEFINE(M_SONAME, "soname", "socket name"); @@ -620,6 +621,16 @@ sofree(struct socket *so) if (pr->pr_usrreqs->pru_detach != NULL) (*pr->pr_usrreqs->pru_detach)(so); + if (bg_sendfile_enable) { + SOCKBUF_LOCK(&so->so_snd); + if ((so->so_snd.sb_flags & (SB_SENDING|SB_SENDING_TASK)) == + (SB_SENDING|SB_SENDING_TASK)) + sbwait(&so->so_snd); + else if (so->so_snd.sb_flags & SB_SENDING) + sosendingwakeup(&so->so_snd); + SOCKBUF_UNLOCK(&so->so_snd); + } + /* * From this point on, we assume that no other references to this * socket exist anywhere else in the stack. Therefore, no locks need Modified: user/kmacy/releng_8_fcs/sys/kern/uipc_syscalls.c ============================================================================== --- user/kmacy/releng_8_fcs/sys/kern/uipc_syscalls.c Tue Oct 13 01:58:50 2009 (r198012) +++ user/kmacy/releng_8_fcs/sys/kern/uipc_syscalls.c Tue Oct 13 03:55:57 2009 (r198013) @@ -116,7 +116,7 @@ SYSCTL_INT(_kern_ipc, OID_AUTO, nsfbufsu /* XXX move to header */ int getsock(struct filedesc *fdp, int fd, struct file **fpp, u_int *fflagp); -static int bg_sendfile_enable = 0; +int bg_sendfile_enable = 0; SYSCTL_INT(_kern_ipc, OID_AUTO, bg_sendfile_enable, CTLFLAG_RW, &bg_sendfile_enable, 0, "Enable background sendfile"); From owner-svn-src-user@FreeBSD.ORG Tue Oct 13 04:13:39 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ADAAF1065676; Tue, 13 Oct 2009 04:13:39 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9D0E68FC0C; Tue, 13 Oct 2009 04:13:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n9D4DdsA094360; Tue, 13 Oct 2009 04:13:39 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9D4DdTD094358; Tue, 13 Oct 2009 04:13:39 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200910130413.n9D4DdTD094358@svn.freebsd.org> From: Kip Macy Date: Tue, 13 Oct 2009 04:13:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r198014 - user/kmacy/releng_8_fcs/sys/conf X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Oct 2009 04:13:39 -0000 Author: kmacy Date: Tue Oct 13 04:13:39 2009 New Revision: 198014 URL: http://svn.freebsd.org/changeset/base/198014 Log: use UMA for ZFS buffers to allow for additional policy Modified: user/kmacy/releng_8_fcs/sys/conf/kern.pre.mk Modified: user/kmacy/releng_8_fcs/sys/conf/kern.pre.mk ============================================================================== --- user/kmacy/releng_8_fcs/sys/conf/kern.pre.mk Tue Oct 13 03:55:57 2009 (r198013) +++ user/kmacy/releng_8_fcs/sys/conf/kern.pre.mk Tue Oct 13 04:13:39 2009 (r198014) @@ -140,6 +140,7 @@ CFLAGS+= --param large-function-growth=1 ZFS_CFLAGS+= -fno-common -finline-limit=${INLINE_LIMIT} ZFS_CFLAGS+= --param inline-unit-growth=100 ZFS_CFLAGS+= --param large-function-growth=1000 +ZFS_CFLAGS+= -DZIO_USE_UMA .if ${MACHINE_ARCH} == "amd64" || ${MACHINE} == "i386" || \ ${MACHINE_ARCH} == "ia64" || ${MACHINE_ARCH} == "powerpc" || \ From owner-svn-src-user@FreeBSD.ORG Tue Oct 13 04:14:49 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 05898106568D; Tue, 13 Oct 2009 04:14:49 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E79A08FC1F; Tue, 13 Oct 2009 04:14:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n9D4EmMi094419; Tue, 13 Oct 2009 04:14:48 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9D4Emgk094414; Tue, 13 Oct 2009 04:14:48 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200910130414.n9D4Emgk094414@svn.freebsd.org> From: Kip Macy Date: Tue, 13 Oct 2009 04:14:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r198015 - in user/kmacy/releng_8_fcs/sys: kern sys X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Oct 2009 04:14:49 -0000 Author: kmacy Date: Tue Oct 13 04:14:48 2009 New Revision: 198015 URL: http://svn.freebsd.org/changeset/base/198015 Log: - fix fp sendfile offset accounting - eliminate gratuitous sbdrop wakeup attempts Modified: user/kmacy/releng_8_fcs/sys/kern/uipc_sockbuf.c user/kmacy/releng_8_fcs/sys/kern/uipc_socket.c user/kmacy/releng_8_fcs/sys/kern/uipc_syscalls.c user/kmacy/releng_8_fcs/sys/sys/sockbuf.h Modified: user/kmacy/releng_8_fcs/sys/kern/uipc_sockbuf.c ============================================================================== --- user/kmacy/releng_8_fcs/sys/kern/uipc_sockbuf.c Tue Oct 13 04:13:39 2009 (r198014) +++ user/kmacy/releng_8_fcs/sys/kern/uipc_sockbuf.c Tue Oct 13 04:14:48 2009 (r198015) @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); #include #include /* for aio_swake proto */ #include +#include #include #include #include @@ -905,11 +906,13 @@ sbdrop_internal(struct sockbuf *sb, int void sbdrop_locked(struct sockbuf *sb, int len) { + int flags; SOCKBUF_LOCK_ASSERT(sb); sbdrop_internal(sb, len); - if (sb->sb_flags & SB_SENDING) + if ((sb->sb_flags & (SB_SENDING|SB_SENDING_TASK)) == SB_SENDING && + sbspace(sb) >= sb->sb_lowat) sosendingwakeup(sb); } Modified: user/kmacy/releng_8_fcs/sys/kern/uipc_socket.c ============================================================================== --- user/kmacy/releng_8_fcs/sys/kern/uipc_socket.c Tue Oct 13 04:13:39 2009 (r198014) +++ user/kmacy/releng_8_fcs/sys/kern/uipc_socket.c Tue Oct 13 04:14:48 2009 (r198015) @@ -3370,7 +3370,7 @@ struct taskqueue *sendfile_tq; extern int getsock(struct filedesc *fdp, int fd, struct file **fpp, u_int *fflagp); static void sendfile_task_func(void *context, int pending __unused); -static int srsendingwakeup(struct socketref *sr); +static int srsendingwakeup(struct socketref *sr, int external); MALLOC_DEFINE(M_SOCKREF, "sockref", "socket reference memory"); @@ -3462,7 +3462,7 @@ soissending(struct socket *so, struct th ref->sr_uap.sbytes = NULL; ref->sr_sock_fp->f_sfbytes = 0; CTR4(KTR_SPARE2, "sock %p off %ld sbytes %ld total_sbytes %ld", - so, ref->sr_uap.offset, sbytes, ref->sr_fp->f_sfbytes); + so, ref->sr_uap.offset, sbytes, ref->sr_sock_fp->f_sfbytes); ref->sr_uap.offset += sbytes; if (uap->nbytes) ref->sr_uap.nbytes -= sbytes; @@ -3506,7 +3506,6 @@ sendfile_task_func(void *context, int pe off_t sbytes = 0; sr = context; - CTR0(KTR_SPARE2, "task_func running"); if (sr->sr_magic != 0xCAFEBABE) { printf("bad magic! 0x%x\n", sr->sr_magic); /* XXX memory leak */ @@ -3515,13 +3514,10 @@ sendfile_task_func(void *context, int pe sock_fp = sr->sr_sock_fp; fp = sr->sr_fp; - CTR2(KTR_SPARE2, "processing sr %p sock_fp %p", sr, sock_fp); if (sock_fp->f_type != DTYPE_SOCKET) goto done; so = sock_fp->f_data; - CTR1(KTR_SPARE2, "task processing socket %p", so); - if ((so->so_state & SS_ISCONNECTED) == 0) goto done; @@ -3532,13 +3528,13 @@ sendfile_task_func(void *context, int pe sb = &so->so_snd; SOCKBUF_UNLOCK_ASSERT(sb); SOCKBUF_LOCK(sb); - sb->sb_flags &= ~SB_SENDING; + sb->sb_flags &= ~(SB_SENDING|SB_SENDING_TASK); if (sb->sb_state & SBS_CANTSENDMORE) { CTR1(KTR_SPARE2, "SBS_CANTSENDMORE - socket %p", so); sowwakeup_locked(so); goto done; } else if (sowriteable(so)) { - sb->sb_flags |= SB_SENDING; + sb->sb_flags |= (SB_SENDING|SB_SENDING_TASK); SOCKBUF_UNLOCK(sb); if (sr->sr_hdr_uio.uio_td != NULL) hdr_uio = &sr->sr_hdr_uio; @@ -3547,39 +3543,36 @@ sendfile_task_func(void *context, int pe sr->sr_uap.sbytes = &sbytes; sr->sr_uap.flags |= SF_TASKQ; - CTR1(KTR_SPARE2, "task sending on socket %p", so); - + error = kern_sendfile(curthread, &sr->sr_uap, hdr_uio, trl_uio, sr->sr_compat, fp, so, sr->sr_ucred); - CTR4(KTR_SPARE2, "sock %p off %ld sbytes %ld total_sbytes %ld", - so, sr->sr_uap.offset, sbytes, fp->f_sfbytes); - atomic_add_long(&fp->f_sfbytes, sbytes); + CTR5(KTR_SPARE2, "sock %p error %d off %ld sbytes %ld total_sbytes %ld", + so, error, sr->sr_uap.offset, sbytes, sock_fp->f_sfbytes); + SOCKBUF_LOCK(sb); + atomic_add_long(&sock_fp->f_sfbytes, sbytes); sr->sr_uap.offset += sbytes; if (sr->sr_uap.nbytes) sr->sr_uap.nbytes -= sbytes; - if (error == EAGAIN && - (sr->sr_uap.offset + sbytes == sr->sr_vnp_size)) { - CTR0(KTR_SPARE2, "EAGAIN on full send"); - error = 0; + sb->sb_flags &= ~(SB_SENDING|SB_SENDING_TASK); + if (error == EAGAIN) { + if (sr->sr_uap.offset + sbytes == sr->sr_vnp_size) { + CTR0(KTR_SPARE2, "EAGAIN on full send"); + error = 0; + } + if (srsendingwakeup(sr, 0) != ENOTCONN) { + SOCKBUF_UNLOCK(sb); + return; + } } - SOCKBUF_LOCK(sb); - } -#ifdef KTR - else - CTR2(KTR_SPARE2, "sock %p off %ld - not writeable in task_func", - so, sr->sr_uap.offset); -#endif - if (error == EAGAIN && srsendingwakeup(sr) != ENOTCONN) { - SOCKBUF_UNLOCK(sb); - return; + } + #ifdef KTR if (error && error != EAGAIN && error != EPIPE) CTR1(KTR_SPARE2, "error %d", error); #endif - sb->sb_flags &= ~SB_SENDING; sowwakeup_locked(so); done: SOCKBUF_UNLOCK_ASSERT(sb); @@ -3587,7 +3580,7 @@ done: } static int -srsendingwakeup(struct socketref *sr) +srsendingwakeup(struct socketref *sr, int external) { struct socket *so; struct file *fp; @@ -3604,30 +3597,29 @@ srsendingwakeup(struct socketref *sr) } fp = sr->sr_sock_fp; - CTR2(KTR_SPARE2, "processing s %d sock_fp %p", sr->sr_uap.s, fp); if (fp->f_type != DTYPE_SOCKET) { CTR1(KTR_SPARE2, "not socket - type %d", fp->f_type); goto error; } so = fp->f_data; + sb = &so->so_snd; + SOCKBUF_LOCK_ASSERT(sb); + sb->sb_flags &= ~(SB_SENDING|SB_SENDING_TASK); if ((so->so_state & SS_ISCONNECTED) == 0) { CTR1(KTR_SPARE2, "not connected %p", so); goto error; } - CTR1(KTR_SPARE2, "processing socket %p", so); - sb = &so->so_snd; - SOCKBUF_LOCK_ASSERT(sb); - sb->sb_flags &= ~SB_SENDING; if (sb->sb_state & SBS_CANTSENDMORE) { CTR1(KTR_SPARE2, "SBS_CANTSENDMORE %p", so); } else if (sowriteable(so)) { CTR2(KTR_SPARE2, "enqueue socket to task %p sr %p", so, sr); - sb->sb_flags |= SB_SENDING; + sb->sb_flags |= (SB_SENDING|SB_SENDING_TASK); taskqueue_enqueue(sendfile_tq, &sr->sr_task); } else { - CTR2(KTR_SPARE2, "sock %p off %ld - not writeable in srsendingwakeup", - so, sr->sr_uap.offset); + if (external) + CTR3(KTR_SPARE2, "sock %p off %ld sbspace %ld - not writeable in srsendingwakeup", + so, sr->sr_uap.offset, sbspace(sb)); sb->sb_flags |= SB_SENDING; mtx_lock(&sendfile_bg_lock); TAILQ_INSERT_TAIL(sendfile_bg_queue, sr, entry); @@ -3648,7 +3640,8 @@ sosendingwakeup(struct sockbuf *sb) if (!TAILQ_EMPTY(sendfile_bg_queue)) { TAILQ_FOREACH(sr, sendfile_bg_queue, entry) { if (sb == &sr->sr_so->so_snd) { - sb->sb_flags &= ~SB_SENDING; + CTR3(KTR_SPARE2, + "dequeueing socket %p sock_fp %p s %d", sr->sr_so, sr->sr_sock_fp, sr->sr_uap.s); TAILQ_REMOVE(sendfile_bg_queue, sr, entry); break; } @@ -3657,10 +3650,13 @@ sosendingwakeup(struct sockbuf *sb) } mtx_unlock(&sendfile_bg_lock); + if (sb->sb_flags & SB_SENDING_TASK) + panic("task flag set while task not running"); + /* * Buffer in flight */ - if (sr != NULL && srsendingwakeup(sr) == ENOTCONN) { + if (sr != NULL && srsendingwakeup(sr, 1) == ENOTCONN) { CTR2(KTR_SPARE2, "freeing expired socket %p ref %p", sr->sr_so, sr); socketref_free(sr); Modified: user/kmacy/releng_8_fcs/sys/kern/uipc_syscalls.c ============================================================================== --- user/kmacy/releng_8_fcs/sys/kern/uipc_syscalls.c Tue Oct 13 04:13:39 2009 (r198014) +++ user/kmacy/releng_8_fcs/sys/kern/uipc_syscalls.c Tue Oct 13 04:14:48 2009 (r198015) @@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -1906,22 +1907,20 @@ kern_sendfile(struct thread *td, struct error = ENOTCONN; goto out; } - } else { + if (sock_fp->f_sfbytes != 0) { + if (uap->sbytes != NULL) + CTR2(KTR_SPARE2, "sock %p f_sfbytes %ld", + so, sock_fp->f_sfbytes); + else + CTR2(KTR_SPARE2, "sock %p !sbytes f_sfbytes %ld", + so, sock_fp->f_sfbytes); + error = 0; + goto out; + } + } else so = bgso; - } - if ((uap->flags & SF_TASKQ) == 0 && - sock_fp->f_sfbytes != 0) { - SOCKBUF_UNLOCK(&so->so_snd); - if (uap->sbytes != NULL) { - copyout(&sbytes, uap->sbytes, sizeof(off_t)); - sock_fp->f_sfbytes = 0; - } - error = 0; - goto out; - } - /* * Do not wait on memory allocations but return ENOMEM for * caller to retry later. @@ -2297,9 +2296,12 @@ out: td->td_retval[0] = 0; } if (uap->sbytes != NULL) { - if ((uap->flags & SF_TASKQ) == 0) - copyout(&sbytes, uap->sbytes, sizeof(off_t)); - else + if ((uap->flags & SF_TASKQ) == 0) { + if (sock_fp != NULL && sock_fp->f_sfbytes != 0) + copyout(&sock_fp->f_sfbytes, uap->sbytes, sizeof(off_t)); + else + copyout(&sbytes, uap->sbytes, sizeof(off_t)); + } else *(uap->sbytes) = sbytes; } if (obj != NULL) Modified: user/kmacy/releng_8_fcs/sys/sys/sockbuf.h ============================================================================== --- user/kmacy/releng_8_fcs/sys/sys/sockbuf.h Tue Oct 13 04:13:39 2009 (r198014) +++ user/kmacy/releng_8_fcs/sys/sys/sockbuf.h Tue Oct 13 04:14:48 2009 (r198015) @@ -53,6 +53,7 @@ #define SB_IN_TOE 0x400 /* socket buffer is in the middle of an operation */ #define SB_AUTOSIZE 0x800 /* automatically size socket buffer */ #define SB_SENDING 0x1000 /* socket is owned by sendfile thread */ +#define SB_SENDING_TASK 0x2000 /* socket is in taskqueue queue */ #define SBS_CANTSENDMORE 0x0010 /* can't send more data to peer */ #define SBS_CANTRCVMORE 0x0020 /* can't receive more data from peer */ From owner-svn-src-user@FreeBSD.ORG Tue Oct 13 04:26:05 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3E9651065670; Tue, 13 Oct 2009 04:26:05 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2DF158FC13; Tue, 13 Oct 2009 04:26:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n9D4Q58B094648; Tue, 13 Oct 2009 04:26:05 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9D4Q59x094646; Tue, 13 Oct 2009 04:26:05 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200910130426.n9D4Q59x094646@svn.freebsd.org> From: Kip Macy Date: Tue, 13 Oct 2009 04:26:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r198016 - user/kmacy/releng_8_fcs/sys/kern X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Oct 2009 04:26:05 -0000 Author: kmacy Date: Tue Oct 13 04:26:04 2009 New Revision: 198016 URL: http://svn.freebsd.org/changeset/base/198016 Log: continue to wait until the residual ref is dropped Modified: user/kmacy/releng_8_fcs/sys/kern/uipc_socket.c Modified: user/kmacy/releng_8_fcs/sys/kern/uipc_socket.c ============================================================================== --- user/kmacy/releng_8_fcs/sys/kern/uipc_socket.c Tue Oct 13 04:14:48 2009 (r198015) +++ user/kmacy/releng_8_fcs/sys/kern/uipc_socket.c Tue Oct 13 04:26:04 2009 (r198016) @@ -624,9 +624,10 @@ sofree(struct socket *so) if (bg_sendfile_enable) { SOCKBUF_LOCK(&so->so_snd); if ((so->so_snd.sb_flags & (SB_SENDING|SB_SENDING_TASK)) == - (SB_SENDING|SB_SENDING_TASK)) - sbwait(&so->so_snd); - else if (so->so_snd.sb_flags & SB_SENDING) + (SB_SENDING|SB_SENDING_TASK)) { + while (so->so_snd.sb_flags & SB_SENDING) + sbwait(&so->so_snd); + } else if (so->so_snd.sb_flags & SB_SENDING) sosendingwakeup(&so->so_snd); SOCKBUF_UNLOCK(&so->so_snd); } From owner-svn-src-user@FreeBSD.ORG Tue Oct 13 04:40:21 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3102B1065679; Tue, 13 Oct 2009 04:40:21 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 201228FC1E; Tue, 13 Oct 2009 04:40:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n9D4eKli094971; Tue, 13 Oct 2009 04:40:20 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9D4eKOb094969; Tue, 13 Oct 2009 04:40:20 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200910130440.n9D4eKOb094969@svn.freebsd.org> From: Kip Macy Date: Tue, 13 Oct 2009 04:40:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r198017 - user/kmacy/releng_8_fcs/sys/kern X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Oct 2009 04:40:21 -0000 Author: kmacy Date: Tue Oct 13 04:40:20 2009 New Revision: 198017 URL: http://svn.freebsd.org/changeset/base/198017 Log: clear SB_SENDING flag in socketref_free to avoid race with sofree Modified: user/kmacy/releng_8_fcs/sys/kern/uipc_socket.c Modified: user/kmacy/releng_8_fcs/sys/kern/uipc_socket.c ============================================================================== --- user/kmacy/releng_8_fcs/sys/kern/uipc_socket.c Tue Oct 13 04:26:04 2009 (r198016) +++ user/kmacy/releng_8_fcs/sys/kern/uipc_socket.c Tue Oct 13 04:40:20 2009 (r198017) @@ -3393,10 +3393,13 @@ socketref_free(struct socketref *sr) struct file *sock_fp = sr->sr_sock_fp; struct proc *p = sr->sr_proc; struct ucred *cred = sr->sr_ucred; + struct sockbuf *sb = &sr->sr_so->so_snd; if (cred != NULL) crfree(cred); vrele(fp->f_vnode); + sb->sb_flags &= ~(SB_SENDING|SB_SENDING_TASK); + SOCKBUF_UNLOCK(sb); fdrop(fp, NULL); fdrop(sock_fp, NULL); PRELE(p); @@ -3515,10 +3518,16 @@ sendfile_task_func(void *context, int pe sock_fp = sr->sr_sock_fp; fp = sr->sr_fp; - if (sock_fp->f_type != DTYPE_SOCKET) - goto done; - + if (sock_fp->f_type != DTYPE_SOCKET) { + printf("bad socket type 0x%x\n", sock_fp->f_type); + /* XXX memory leak */ + return; + } + so = sock_fp->f_data; + sb = &so->so_snd; + SOCKBUF_UNLOCK_ASSERT(sb); + SOCKBUF_LOCK(sb); if ((so->so_state & SS_ISCONNECTED) == 0) goto done; @@ -3526,13 +3535,9 @@ sendfile_task_func(void *context, int pe (sr->sr_ucred = crdup(sr->sr_proc->p_ucred)) == NULL) goto done; - sb = &so->so_snd; - SOCKBUF_UNLOCK_ASSERT(sb); - SOCKBUF_LOCK(sb); sb->sb_flags &= ~(SB_SENDING|SB_SENDING_TASK); if (sb->sb_state & SBS_CANTSENDMORE) { CTR1(KTR_SPARE2, "SBS_CANTSENDMORE - socket %p", so); - sowwakeup_locked(so); goto done; } else if (sowriteable(so)) { sb->sb_flags |= (SB_SENDING|SB_SENDING_TASK); @@ -3555,7 +3560,6 @@ sendfile_task_func(void *context, int pe sr->sr_uap.offset += sbytes; if (sr->sr_uap.nbytes) sr->sr_uap.nbytes -= sbytes; - sb->sb_flags &= ~(SB_SENDING|SB_SENDING_TASK); if (error == EAGAIN) { if (sr->sr_uap.offset + sbytes == sr->sr_vnp_size) { CTR0(KTR_SPARE2, "EAGAIN on full send"); @@ -3574,9 +3578,9 @@ sendfile_task_func(void *context, int pe CTR1(KTR_SPARE2, "error %d", error); #endif - sowwakeup_locked(so); done: - SOCKBUF_UNLOCK_ASSERT(sb); + SOCKBUF_LOCK_ASSERT(sb); + sowwakeup_locked(so); socketref_free(sr); } From owner-svn-src-user@FreeBSD.ORG Tue Oct 13 04:54:13 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D2361106566B; Tue, 13 Oct 2009 04:54:13 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C16028FC15; Tue, 13 Oct 2009 04:54:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n9D4sDQF095232; Tue, 13 Oct 2009 04:54:13 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9D4sDfq095230; Tue, 13 Oct 2009 04:54:13 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200910130454.n9D4sDfq095230@svn.freebsd.org> From: Kip Macy Date: Tue, 13 Oct 2009 04:54:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r198018 - user/kmacy/releng_8_fcs/sys/kern X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Oct 2009 04:54:13 -0000 Author: kmacy Date: Tue Oct 13 04:54:13 2009 New Revision: 198018 URL: http://svn.freebsd.org/changeset/base/198018 Log: don't call sowwakeup_locked (dropping the sockbuf lock) until socketref_free is called Modified: user/kmacy/releng_8_fcs/sys/kern/uipc_socket.c Modified: user/kmacy/releng_8_fcs/sys/kern/uipc_socket.c ============================================================================== --- user/kmacy/releng_8_fcs/sys/kern/uipc_socket.c Tue Oct 13 04:40:20 2009 (r198017) +++ user/kmacy/releng_8_fcs/sys/kern/uipc_socket.c Tue Oct 13 04:54:13 2009 (r198018) @@ -3398,8 +3398,6 @@ socketref_free(struct socketref *sr) if (cred != NULL) crfree(cred); vrele(fp->f_vnode); - sb->sb_flags &= ~(SB_SENDING|SB_SENDING_TASK); - SOCKBUF_UNLOCK(sb); fdrop(fp, NULL); fdrop(sock_fp, NULL); PRELE(p); @@ -3580,8 +3578,9 @@ sendfile_task_func(void *context, int pe done: SOCKBUF_LOCK_ASSERT(sb); - sowwakeup_locked(so); + sb->sb_flags &= ~(SB_SENDING|SB_SENDING_TASK); socketref_free(sr); + sowwakeup_locked(so); } static int From owner-svn-src-user@FreeBSD.ORG Tue Oct 13 05:05:55 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 33B3E106566B; Tue, 13 Oct 2009 05:05:55 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 22A068FC15; Tue, 13 Oct 2009 05:05:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n9D55so5095479; Tue, 13 Oct 2009 05:05:54 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9D55sfo095477; Tue, 13 Oct 2009 05:05:54 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200910130505.n9D55sfo095477@svn.freebsd.org> From: Kip Macy Date: Tue, 13 Oct 2009 05:05:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r198019 - user/kmacy/releng_8_fcs/sys/kern X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Oct 2009 05:05:55 -0000 Author: kmacy Date: Tue Oct 13 05:05:54 2009 New Revision: 198019 URL: http://svn.freebsd.org/changeset/base/198019 Log: crdup without sockbuf held Modified: user/kmacy/releng_8_fcs/sys/kern/uipc_socket.c Modified: user/kmacy/releng_8_fcs/sys/kern/uipc_socket.c ============================================================================== --- user/kmacy/releng_8_fcs/sys/kern/uipc_socket.c Tue Oct 13 04:54:13 2009 (r198018) +++ user/kmacy/releng_8_fcs/sys/kern/uipc_socket.c Tue Oct 13 05:05:54 2009 (r198019) @@ -3525,14 +3525,15 @@ sendfile_task_func(void *context, int pe so = sock_fp->f_data; sb = &so->so_snd; SOCKBUF_UNLOCK_ASSERT(sb); + if (sr->sr_ucred == NULL && + (sr->sr_ucred = crdup(sr->sr_proc->p_ucred)) == NULL) { + SOCKBUF_LOCK(sb); + goto done; + } SOCKBUF_LOCK(sb); if ((so->so_state & SS_ISCONNECTED) == 0) goto done; - if (sr->sr_ucred == NULL && - (sr->sr_ucred = crdup(sr->sr_proc->p_ucred)) == NULL) - goto done; - sb->sb_flags &= ~(SB_SENDING|SB_SENDING_TASK); if (sb->sb_state & SBS_CANTSENDMORE) { CTR1(KTR_SPARE2, "SBS_CANTSENDMORE - socket %p", so); From owner-svn-src-user@FreeBSD.ORG Tue Oct 13 09:21:16 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 455351065670; Tue, 13 Oct 2009 09:21:16 +0000 (UTC) (envelope-from eri@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3379F8FC14; Tue, 13 Oct 2009 09:21:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n9D9LGnu000288; Tue, 13 Oct 2009 09:21:16 GMT (envelope-from eri@svn.freebsd.org) Received: (from eri@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9D9LGMx000286; Tue, 13 Oct 2009 09:21:16 GMT (envelope-from eri@svn.freebsd.org) Message-Id: <200910130921.n9D9LGMx000286@svn.freebsd.org> From: Ermal Luçi Date: Tue, 13 Oct 2009 09:21:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r198023 - user/eri/pf45/head/sys/contrib/pf/net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Oct 2009 09:21:16 -0000 Author: eri Date: Tue Oct 13 09:21:15 2009 New Revision: 198023 URL: http://svn.freebsd.org/changeset/base/198023 Log: * Activate the support for radix multipath when compiled in the kernel. * Some more whitespace fixes. Modified: user/eri/pf45/head/sys/contrib/pf/net/pf.c Modified: user/eri/pf45/head/sys/contrib/pf/net/pf.c ============================================================================== --- user/eri/pf45/head/sys/contrib/pf/net/pf.c Tue Oct 13 07:00:17 2009 (r198022) +++ user/eri/pf45/head/sys/contrib/pf/net/pf.c Tue Oct 13 09:21:15 2009 (r198023) @@ -35,48 +35,46 @@ * */ - #ifdef __FreeBSD__ - #include "opt_inet.h" - #include "opt_inet6.h" - - #include +#ifdef __FreeBSD__ +#include "opt_inet.h" +#include "opt_inet6.h" + +#include __FBSDID("$FreeBSD$"); - #endif +#endif - #ifdef __FreeBSD__ - #include "opt_bpf.h" - #include "opt_pf.h" - - #ifdef DEV_BPF - #define NBPFILTER DEV_BPF - #else - #define NBPFILTER 0 - #endif - - #ifdef DEV_PFLOG - #define NPFLOG DEV_PFLOG - #else - #define NPFLOG 0 - #endif - - #ifdef DEV_PFSYNC - #define NPFSYNC DEV_PFSYNC - #else - #define NPFSYNC 0 - #endif - - #ifdef DEV_PFLOW - #define NPFLOW DEV_PFLOW - #else - #define NPFLOW 0 - #endif +#ifdef __FreeBSD__ +#include "opt_bpf.h" +#include "opt_pf.h" - #else +#ifdef DEV_BPF +#define NBPFILTER DEV_BPF +#else +#define NBPFILTER 0 +#endif + +#ifdef DEV_PFLOG +#define NPFLOG DEV_PFLOG +#else +#define NPFLOG 0 +#endif + +#ifdef DEV_PFSYNC +#define NPFSYNC DEV_PFSYNC +#else +#define NPFSYNC 0 +#endif + +#ifdef DEV_PFLOW +#define NPFLOW DEV_PFLOW +#else +#define NPFLOW 0 +#endif + +#else #include "bpfilter.h" #include "pflog.h" #include "pfsync.h" -#endif -#ifdef notyet #include "pflow.h" #endif @@ -5450,22 +5448,19 @@ pf_pull_hdr(struct mbuf *m, int off, voi int pf_routable(struct pf_addr *addr, sa_family_t af, struct pfi_kif *kif) { - struct sockaddr_in *dst; - int ret = 1; - int check_mpath; #ifdef __FreeBSD__ #ifdef RADIX_MPATH - extern int ipmultipath; + struct radix_node_head *rnh; #endif -#else +#endif + struct sockaddr_in *dst; + int ret = 1; + int check_mpath; +#ifndef __FreeBSD__ extern int ipmultipath; #endif #ifdef INET6 -#ifdef __FreeBSD__ -#ifdef RADIX_MPATH - extern int ip6_multipath; -#endif -#else +#ifndef __FreeBSD__ extern int ip6_multipath; #endif struct sockaddr_in6 *dst6; @@ -5478,6 +5473,14 @@ pf_routable(struct pf_addr *addr, sa_fam struct ifnet *ifp; check_mpath = 0; +#ifdef __FreeBSD__ +#ifdef RADIX_MPATH + /* XXX: stick to table 0 for now */ + rnh = rt_tables_get_rnh(0, af); + if (rnh != NULL && rn_mpath_capable(rnh)) + check_mpath = 1; +#endif +#endif bzero(&ro, sizeof(ro)); switch (af) { case AF_INET: @@ -5485,7 +5488,7 @@ pf_routable(struct pf_addr *addr, sa_fam dst->sin_family = AF_INET; dst->sin_len = sizeof(*dst); dst->sin_addr = addr->v4; -#ifdef notyet +#ifndef __FreeBSD__ if (ipmultipath) check_mpath = 1; #endif @@ -5502,7 +5505,7 @@ pf_routable(struct pf_addr *addr, sa_fam dst6->sin6_family = AF_INET6; dst6->sin6_len = sizeof(*dst6); dst6->sin6_addr = addr->v6; -#ifdef notyet +#ifndef __FreeBSD__ if (ip6_multipath) check_mpath = 1; #endif @@ -5516,13 +5519,13 @@ pf_routable(struct pf_addr *addr, sa_fam if (kif != NULL && kif->pfik_ifp->if_type == IFT_ENC) goto out; - #ifdef __FreeBSD__ - /* XXX MRT not always INET */ /* stick with table 0 though */ +#ifdef __FreeBSD__ +/* XXX MRT not always INET */ /* stick with table 0 though */ if (af == AF_INET) in_rtalloc_ign((struct route *)&ro, 0, 0); else rtalloc_ign((struct route *)&ro, 0); - #else /* ! __FreeBSD__ */ +#else /* ! __FreeBSD__ */ rtalloc_noclone((struct route *)&ro, NO_CLONING); #endif @@ -5541,7 +5544,7 @@ pf_routable(struct pf_addr *addr, sa_fam rn = (struct radix_node *)ro.ro_rt; do { rt = (struct rtentry *)rn; - #ifndef __FreeBSD__ /* CARPDEV */ +#ifndef __FreeBSD__ /* CARPDEV */ if (rt->rt_ifp->if_type == IFT_CARP) ifp = rt->rt_ifp->if_carpdev; else From owner-svn-src-user@FreeBSD.ORG Tue Oct 13 11:55:56 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ADBF610656C0 for ; Tue, 13 Oct 2009 11:55:56 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.freebsd.org (Postfix) with ESMTP id 6F1158FC14 for ; Tue, 13 Oct 2009 11:55:56 +0000 (UTC) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id 011476D41B; Tue, 13 Oct 2009 11:40:43 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id B30B284503; Tue, 13 Oct 2009 13:40:43 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Ivan Voras References: <200910121647.n9CGlttl077323@svn.freebsd.org> <9bbcef730910121111v23fce6aem204d54d314277492@mail.gmail.com> Date: Tue, 13 Oct 2009 13:40:43 +0200 In-Reply-To: <9bbcef730910121111v23fce6aem204d54d314277492@mail.gmail.com> (Ivan Voras's message of "Mon, 12 Oct 2009 20:11:46 +0200") Message-ID: <86y6nf8qtg.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.95 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: Re: svn commit: r197987 - in user/des/svnsup: . src src/apply src/distill X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Oct 2009 11:55:56 -0000 Ivan Voras writes: > Dag-Erling Smorgrav writes: > > Witness the birth of svnsup! > It is glorious! Well, it will be when it's done :) Currently, all it does is extract a single revision from a repo and dump the delta to stderr. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-user@FreeBSD.ORG Tue Oct 13 13:08:05 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F1BCC10656A5; Tue, 13 Oct 2009 13:08:05 +0000 (UTC) (envelope-from eri@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E176F8FC1B; Tue, 13 Oct 2009 13:08:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n9DD85pY006485; Tue, 13 Oct 2009 13:08:05 GMT (envelope-from eri@svn.freebsd.org) Received: (from eri@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9DD855O006482; Tue, 13 Oct 2009 13:08:05 GMT (envelope-from eri@svn.freebsd.org) Message-Id: <200910131308.n9DD855O006482@svn.freebsd.org> From: Ermal Luçi Date: Tue, 13 Oct 2009 13:08:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r198031 - user/eri/pf45/head/sys/contrib/pf/net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Oct 2009 13:08:06 -0000 Author: eri Date: Tue Oct 13 13:08:05 2009 New Revision: 198031 URL: http://svn.freebsd.org/changeset/base/198031 Log: * Change flags of memory allocation to NOWAIT to avoid LORs. Modified: user/eri/pf45/head/sys/contrib/pf/net/pf_ioctl.c Modified: user/eri/pf45/head/sys/contrib/pf/net/pf_ioctl.c ============================================================================== --- user/eri/pf45/head/sys/contrib/pf/net/pf_ioctl.c Tue Oct 13 13:03:31 2009 (r198030) +++ user/eri/pf45/head/sys/contrib/pf/net/pf_ioctl.c Tue Oct 13 13:08:05 2009 (r198031) @@ -1593,7 +1593,7 @@ pfioctl(dev_t dev, u_long cmd, caddr_t a break; } #ifdef __FreeBSD__ - rule = pool_get(&pf_rule_pl, PR_WAITOK); + rule = pool_get(&pf_rule_pl, PR_NOWAIT); #else rule = pool_get(&pf_rule_pl, PR_WAITOK|PR_LIMITFAIL); #endif @@ -1857,7 +1857,7 @@ pfioctl(dev_t dev, u_long cmd, caddr_t a if (pcr->action != PF_CHANGE_REMOVE) { #ifdef __FreeBSD__ - newrule = pool_get(&pf_rule_pl, PR_WAITOK); + newrule = pool_get(&pf_rule_pl, PR_NOWAIT); #else newrule = pool_get(&pf_rule_pl, PR_WAITOK|PR_LIMITFAIL); #endif @@ -2487,7 +2487,11 @@ pfioctl(dev_t dev, u_long cmd, caddr_t a error = EBUSY; break; } +#ifdef __FreeBSD__ + altq = pool_get(&pf_altq_pl, PR_NOWAIT); +#else altq = pool_get(&pf_altq_pl, PR_WAITOK|PR_LIMITFAIL); +#endif if (altq == NULL) { error = ENOMEM; break; @@ -2654,7 +2658,7 @@ pfioctl(dev_t dev, u_long cmd, caddr_t a break; } #ifdef __FreeBSD__ - pa = pool_get(&pf_pooladdr_pl, PR_WAITOK); + pa = pool_get(&pf_pooladdr_pl, PR_NOWAIT); #else pa = pool_get(&pf_pooladdr_pl, PR_WAITOK|PR_LIMITFAIL); #endif @@ -2753,7 +2757,7 @@ pfioctl(dev_t dev, u_long cmd, caddr_t a if (pca->action != PF_CHANGE_REMOVE) { newpa = pool_get(&pf_pooladdr_pl, #ifdef __FreeBSD__ - PR_WAITOK); + PR_NOWAIT); #else PR_WAITOK|PR_LIMITFAIL); #endif From owner-svn-src-user@FreeBSD.ORG Tue Oct 13 14:42:11 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F127C10656F5; Tue, 13 Oct 2009 14:42:11 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id C2F1A8FC25; Tue, 13 Oct 2009 14:42:11 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id EC9DA46B2C; Tue, 13 Oct 2009 10:42:10 -0400 (EDT) Received: from jhbbsd.hudson-trading.com (unknown [209.249.190.8]) by bigwig.baldwin.cx (Postfix) with ESMTPA id 3B58F8A01B; Tue, 13 Oct 2009 10:42:10 -0400 (EDT) From: John Baldwin To: Ermal LuXi Date: Tue, 13 Oct 2009 07:56:32 -0400 User-Agent: KMail/1.9.7 References: <200910122226.n9CMQAYr087381@svn.freebsd.org> In-Reply-To: <200910122226.n9CMQAYr087381@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200910130756.32986.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Tue, 13 Oct 2009 10:42:10 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.5 required=4.2 tests=AWL,BAYES_00,RDNS_NONE autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: Re: svn commit: r198007 - user/eri/pf45/head/sys/contrib/pf/net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Oct 2009 14:42:12 -0000 On Monday 12 October 2009 6:26:10 pm Ermal LuXi wrote: > Author: eri > Date: Mon Oct 12 22:26:10 2009 > New Revision: 198007 > URL: http://svn.freebsd.org/changeset/base/198007 > > Log: > * Prefix some other variables with V_ since their name is the same as their struct type. > * For being virtualization ready only contexes should be considered especially in event handlers. FWIW, I think it will be simpler to just have all virtualized variables start with V_ rather than having a partial mix. They should either all have V_ or none of them have V_ as anything else will just be confusing. And since the case of none of them having V_ doesn't compile that narrows it down. :) -- John Baldwin From owner-svn-src-user@FreeBSD.ORG Tue Oct 13 15:59:25 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4C51D1065694; Tue, 13 Oct 2009 15:59:25 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 22FCF8FC1F; Tue, 13 Oct 2009 15:59:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n9DFxOwF009681; Tue, 13 Oct 2009 15:59:24 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9DFxOCI009679; Tue, 13 Oct 2009 15:59:24 GMT (envelope-from des@svn.freebsd.org) Message-Id: <200910131559.n9DFxOCI009679@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Tue, 13 Oct 2009 15:59:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r198033 - user/des/svnsup X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Oct 2009 15:59:25 -0000 Author: des Date: Tue Oct 13 15:59:24 2009 New Revision: 198033 URL: http://svn.freebsd.org/changeset/base/198033 Log: Pass CPPFLAGS and LDFLAGS to 'make distcheck'. Modified: user/des/svnsup/Makefile.am Modified: user/des/svnsup/Makefile.am ============================================================================== --- user/des/svnsup/Makefile.am Tue Oct 13 13:47:30 2009 (r198032) +++ user/des/svnsup/Makefile.am Tue Oct 13 15:59:24 2009 (r198033) @@ -1,3 +1,5 @@ # $Id$ +DISTCHECK_CONFIGURE_FLAGS = CPPFLAGS=${CPPFLAGS} LDFLAGS=${LDFLAGS} + SUBDIRS = src From owner-svn-src-user@FreeBSD.ORG Tue Oct 13 16:00:19 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0D86910657AA; Tue, 13 Oct 2009 16:00:19 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EECA88FC2F; Tue, 13 Oct 2009 16:00:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n9DG0IKd009768; Tue, 13 Oct 2009 16:00:18 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9DG0ICF009765; Tue, 13 Oct 2009 16:00:18 GMT (envelope-from des@svn.freebsd.org) Message-Id: <200910131600.n9DG0ICF009765@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Tue, 13 Oct 2009 16:00:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r198034 - in user/des/svnsup: . src X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Oct 2009 16:00:19 -0000 Author: des Date: Tue Oct 13 16:00:18 2009 New Revision: 198034 URL: http://svn.freebsd.org/changeset/base/198034 Log: Allow the user to choose which program(s) to build. Modified: user/des/svnsup/configure.ac user/des/svnsup/src/Makefile.am Modified: user/des/svnsup/configure.ac ============================================================================== --- user/des/svnsup/configure.ac Tue Oct 13 15:59:24 2009 (r198033) +++ user/des/svnsup/configure.ac Tue Oct 13 16:00:18 2009 (r198034) @@ -18,6 +18,20 @@ AC_PROG_MAKE_SET PKG_PROG_PKG_CONFIG +AC_ARG_ENABLE(distill, + AS_HELP_STRING([--enable-distill], + [build svnsup-distill (default is YES)]), + [], [enable_distill=yes] +) +AM_CONDITIONAL([ENABLE_DISTILL], [test x"$enable_distill" = xyes]) + +AC_ARG_ENABLE(apply, + AS_HELP_STRING([--enable-apply], + [build svnsup-apply (default is YES)]), + [], [enable_apply=yes] +) +AM_CONDITIONAL([ENABLE_APPLY], [test x"$enable_apply" = xyes]) + AC_ARG_ENABLE(debugging, AS_HELP_STRING([--enable-debugging], [enable debugging (default is NO)]), Modified: user/des/svnsup/src/Makefile.am ============================================================================== --- user/des/svnsup/src/Makefile.am Tue Oct 13 15:59:24 2009 (r198033) +++ user/des/svnsup/src/Makefile.am Tue Oct 13 16:00:18 2009 (r198034) @@ -1,3 +1,11 @@ # $Id$ -SUBDIRS = distill apply +if ENABLE_DISTILL +DISTILL_SUBDIR = distill +endif + +if ENABLE_APPLY +APPLY_SUBDIR = apply +endif + +SUBDIRS = ${DISTILL_SUBDIR} ${APPLY_SUBDIR} From owner-svn-src-user@FreeBSD.ORG Tue Oct 13 16:15:19 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 62CFA106568D; Tue, 13 Oct 2009 16:15:19 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 52BD38FC08; Tue, 13 Oct 2009 16:15:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n9DGFJNr010127; Tue, 13 Oct 2009 16:15:19 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9DGFJEU010125; Tue, 13 Oct 2009 16:15:19 GMT (envelope-from des@svn.freebsd.org) Message-Id: <200910131615.n9DGFJEU010125@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Tue, 13 Oct 2009 16:15:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r198035 - user/des/svnsup X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Oct 2009 16:15:19 -0000 Author: des Date: Tue Oct 13 16:15:19 2009 New Revision: 198035 URL: http://svn.freebsd.org/changeset/base/198035 Log: Don't look for libapr* or libsvn* unless we're going to build -distill. Modified: user/des/svnsup/configure.ac Modified: user/des/svnsup/configure.ac ============================================================================== --- user/des/svnsup/configure.ac Tue Oct 13 16:00:18 2009 (r198034) +++ user/des/svnsup/configure.ac Tue Oct 13 16:15:19 2009 (r198035) @@ -16,8 +16,6 @@ AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_MAKE_SET -PKG_PROG_PKG_CONFIG - AC_ARG_ENABLE(distill, AS_HELP_STRING([--enable-distill], [build svnsup-distill (default is YES)]), @@ -72,61 +70,53 @@ AC_ARG_ENABLE(werror, ) # -# APR +# APR -- needed for svnsup-distill # -PKG_CHECK_MODULES([APR_1], [apr-1]) +AS_IF([test x"$enable_distill" = x"yes"], [ + PKG_PROG_PKG_CONFIG + PKG_CHECK_MODULES([APR_1], [apr-1]) +]) # -# Subersion remote access library +# Helper for Subversion libraries # -saved_CPPFLAGS="${CPPFLAGS}" -CPPFLAGS="${CPPFLAGS} ${APR_1_CFLAGS}" -AC_CHECK_HEADER([subversion-1/svn_ra.h], [], [ - AC_MSG_ERROR([cannot proceed without ]) -]) -CPPFLAGS="${saved_CPPFLAGS}" -saved_LIBS="${LIBS}" -LIBS="" -AC_CHECK_LIB([svn_ra-1], [svn_ra_version], [], [ - AC_MSG_ERROR([cannot proceed without libsvn_ra-1]) +m4_define([check_subversion], [ + saved_CPPFLAGS="${CPPFLAGS}" + CPPFLAGS="${CPPFLAGS} ${APR_1_CFLAGS}" + AC_CHECK_HEADER([subversion-1/$2.h], [], [ + AC_MSG_ERROR([cannot proceed without ]) + ]) + CPPFLAGS="${saved_CPPFLAGS}" + saved_LIBS="${LIBS}" + LIBS="" + AC_CHECK_LIB([$2-1], [$2_version], [], [ + AC_MSG_ERROR([cannot proceed without lib$2-1]) + ]) + $1_1_LIBS="${LIBS}" + LIBS="${saved_LIBS}" + AC_SUBST([$1_1_LIBS]) ]) -SVN_RA_1_LIBS="${LIBS}" -LIBS="${saved_LIBS}" -AC_SUBST([SVN_RA_1_LIBS]) # -# Subversion delta library +# Subersion remote access library -- needed for svnsup-distill # -saved_CPPFLAGS="${CPPFLAGS}" -CPPFLAGS="${CPPFLAGS} ${APR_1_CFLAGS}" -AC_CHECK_HEADER([subversion-1/svn_delta.h], [], [ - AC_MSG_ERROR([cannot proceed without ]) +AS_IF([test x"$enable_distill" = x"yes"], [ + check_subversion([SVN_RA], [svn_ra]) ]) -CPPFLAGS="${saved_CPPFLAGS}" -saved_LIBS="${LIBS}" -AC_CHECK_LIB([svn_delta-1], [svn_delta_version], [], [ - AC_MSG_ERROR([cannot proceed without libsvn_delta-1]) -]) -SVN_DELTA_1_LIBS="${LIBS}" -LIBS="${saved_LIBS}" -AC_SUBST([SVN_DELTA_1_LIBS]) # -# Subversion client library +# Subversion delta library -- needed for svnsup-distill # -saved_CPPFLAGS="${CPPFLAGS}" -CPPFLAGS="${CPPFLAGS} ${APR_1_CFLAGS}" -AC_CHECK_HEADER([subversion-1/svn_client.h], [], [ - AC_MSG_ERROR([cannot proceed without ]) +AS_IF([test x"$enable_distill" = x"yes"], [ + check_subversion([SVN_DELTA], [svn_delta]) ]) -CPPFLAGS="${saved_CPPFLAGS}" -saved_LIBS="${LIBS}" -AC_CHECK_LIB([svn_client-1], [svn_client_version], [], [ - AC_MSG_ERROR([cannot proceed without libsvn_client-1]) + +# +# Subversion client library -- needed for svnsup-distill +# +AS_IF([test x"$enable_distill" = x"yes"], [ + check_subversion([SVN_CLIENT], [svn_client]) ]) -SVN_CLIENT_1_LIBS="${LIBS}" -LIBS="${saved_LIBS}" -AC_SUBST([SVN_CLIENT_1_LIBS]) # # Output From owner-svn-src-user@FreeBSD.ORG Tue Oct 13 17:41:46 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7978C106568B; Tue, 13 Oct 2009 17:41:46 +0000 (UTC) (envelope-from eri@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4FFB48FC1C; Tue, 13 Oct 2009 17:41:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n9DHfkPj011911; Tue, 13 Oct 2009 17:41:46 GMT (envelope-from eri@svn.freebsd.org) Received: (from eri@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9DHfk5C011909; Tue, 13 Oct 2009 17:41:46 GMT (envelope-from eri@svn.freebsd.org) Message-Id: <200910131741.n9DHfk5C011909@svn.freebsd.org> From: Ermal Luçi Date: Tue, 13 Oct 2009 17:41:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r198037 - user/eri/pf45/head/sys/contrib/pf/net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Oct 2009 17:41:46 -0000 Author: eri Date: Tue Oct 13 17:41:46 2009 New Revision: 198037 URL: http://svn.freebsd.org/changeset/base/198037 Log: Use M_SKIP_FIREWALL for FreeBSD. Modified: user/eri/pf45/head/sys/contrib/pf/net/pf.c Modified: user/eri/pf45/head/sys/contrib/pf/net/pf.c ============================================================================== --- user/eri/pf45/head/sys/contrib/pf/net/pf.c Tue Oct 13 17:33:55 2009 (r198036) +++ user/eri/pf45/head/sys/contrib/pf/net/pf.c Tue Oct 13 17:41:46 2009 (r198037) @@ -2158,19 +2158,19 @@ pf_send_tcp(const struct pf_rule *r, sa_ struct pf_mtag *pf_mtag; #endif - #ifdef __FreeBSD__ +#ifdef __FreeBSD__ KASSERT( - #ifdef INET +#ifdef INET af == AF_INET - #else +#else 0 - #endif +#endif || - #ifdef INET6 +#ifdef INET6 af == AF_INET6 - #else +#else 0 - #endif +#endif , ("Unsupported AF %d", af)); len = 0; th = NULL; @@ -2206,7 +2206,7 @@ pf_send_tcp(const struct pf_rule *r, sa_ return; #ifdef __FreeBSD__ #ifdef MAC - mac_netinet_firewall_send(m); + mac_netinet_firewall_send(m); #endif if ((pf_mtag = pf_get_mtag(m)) == NULL) { m_freem(m); @@ -6338,10 +6338,10 @@ pf_get_divert(struct mbuf *m) #ifdef INET int - #ifdef __FreeBSD__ - pf_test(int dir, struct ifnet *ifp, struct mbuf **m0, - struct ether_header *eh, struct inpcb *inp) - #else +#ifdef __FreeBSD__ +pf_test(int dir, struct ifnet *ifp, struct mbuf **m0, + struct ether_header *eh, struct inpcb *inp) +#else pf_test(int dir, struct ifnet *ifp, struct mbuf **m0, struct ether_header *eh) #endif @@ -6665,7 +6665,7 @@ done: s->nat_rule.ptr->action == PF_BINAT) && (ntohl(pd.dst->v4.s_addr) >> IN_CLASSA_NSHIFT) == IN_LOOPBACKNET) #ifdef __FreeBSD__ - pd.pf_mtag->flags |= PF_TAG_TRANSLATE_LOCALHOST; + m->m_flags |= M_SKIP_FIREWALL; #else m->m_pkthdr.pf.flags |= PF_TAG_TRANSLATE_LOCALHOST; #endif @@ -7151,7 +7151,7 @@ done: s->nat_rule.ptr->action == PF_BINAT) && IN6_IS_ADDR_LOOPBACK(&pd.dst->v6)) #ifdef __FreeBSD__ - pd.pf_mtag->flags |= PF_TAG_TRANSLATE_LOCALHOST; + m->m_flags |= M_SKIP_FIREWALL; #else m->m_pkthdr.pf.flags |= PF_TAG_TRANSLATE_LOCALHOST; #endif From owner-svn-src-user@FreeBSD.ORG Tue Oct 13 19:49:33 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9EA8C1065676; Tue, 13 Oct 2009 19:49:33 +0000 (UTC) (envelope-from eri@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8C1248FC20; Tue, 13 Oct 2009 19:49:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n9DJnXDC014726; Tue, 13 Oct 2009 19:49:33 GMT (envelope-from eri@svn.freebsd.org) Received: (from eri@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9DJnXsp014720; Tue, 13 Oct 2009 19:49:33 GMT (envelope-from eri@svn.freebsd.org) Message-Id: <200910131949.n9DJnXsp014720@svn.freebsd.org> From: Ermal Luçi Date: Tue, 13 Oct 2009 19:49:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r198045 - in user/eri/pf45/head/sys: contrib/pf/net netinet netinet/ipfw X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Oct 2009 19:49:33 -0000 Author: eri Date: Tue Oct 13 19:49:33 2009 New Revision: 198045 URL: http://svn.freebsd.org/changeset/base/198045 Log: Make pf(4) divert target usable with FreeBSD divert(4). The AF_INET only divert(4) limitation is inherited. The divert(4) for pf(4) implementation has been tested/used on pfSense.org since long time and is belived to be stable. As a side not the divert(4) module is not anymore dependent on ipfw(4). TODO: Update the man page of divert(4). Modified: user/eri/pf45/head/sys/contrib/pf/net/pf.c user/eri/pf45/head/sys/netinet/ip_divert.c user/eri/pf45/head/sys/netinet/ip_divert.h user/eri/pf45/head/sys/netinet/ip_input.c user/eri/pf45/head/sys/netinet/ipfw/ip_fw_pfil.c Modified: user/eri/pf45/head/sys/contrib/pf/net/pf.c ============================================================================== --- user/eri/pf45/head/sys/contrib/pf/net/pf.c Tue Oct 13 19:04:01 2009 (r198044) +++ user/eri/pf45/head/sys/contrib/pf/net/pf.c Tue Oct 13 19:49:33 2009 (r198045) @@ -136,6 +136,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#ifdef __FreeBSD__ +#include +#endif #ifndef __FreeBSD__ #include @@ -371,6 +374,13 @@ struct pf_pool_limit pf_pool_limits[PF_L #endif #ifdef __FreeBSD__ +#define PF_FREEBSD_DIVERT() \ + do { \ + r = (*state)->rule.ptr; \ + if (r->divert.port && !(pd->pf_mtag->flags & PF_TAG_DIVERTED)) \ + return (PF_PASS); \ + } while (0) + #define STATE_LOOKUP(i, k, d, s, m, pt) \ do { \ s = pf_find_state(i, k, d, m, pt); \ @@ -4342,6 +4352,9 @@ pf_test_state_tcp(struct pf_state **stat int copyback = 0; struct pf_state_peer *src, *dst; struct pf_state_key *sk; +#ifdef __FreeBSD__ + struct pf_rule *r; +#endif key.af = pd->af; key.proto = IPPROTO_TCP; @@ -4359,6 +4372,8 @@ pf_test_state_tcp(struct pf_state **stat #ifdef __FreeBSD__ STATE_LOOKUP(kif, &key, direction, *state, m, pd->pf_mtag); + + PF_FREEBSD_DIVERT(); #else STATE_LOOKUP(kif, &key, direction, *state, m); #endif @@ -4371,6 +4386,19 @@ pf_test_state_tcp(struct pf_state **stat dst = &(*state)->src; } +#ifdef __FreeBSD__ + /* + * The inital state is created when searching in the ruleset when + * the packet reloops the state checking will drop it. + * We take measure here for this special case. + */ + if ((th->th_flags & TH_SYN) && src->state == TCPS_SYN_SENT && + dst->state == TCPS_CLOSED) { + if (pd->pf_mtag->flags & PF_TAG_DIVERTED) + return (PF_PASS); + } +#endif + sk = (*state)->key[pd->didx]; if ((*state)->src.state == PF_TCPS_PROXY_SRC) { @@ -4536,6 +4564,9 @@ pf_test_state_udp(struct pf_state **stat struct pf_state_peer *src, *dst; struct pf_state_key_cmp key; struct udphdr *uh = pd->hdr.udp; +#ifdef __FreeBSD__ + struct pf_rule *r; +#endif key.af = pd->af; key.proto = IPPROTO_UDP; @@ -4553,6 +4584,8 @@ pf_test_state_udp(struct pf_state **stat #ifdef __FreeBSD__ STATE_LOOKUP(kif, &key, direction, *state, m, pd->pf_mtag); + + PF_FREEBSD_DIVERT(); #else STATE_LOOKUP(kif, &key, direction, *state, m); #endif @@ -4609,6 +4642,7 @@ pf_test_state_icmp(struct pf_state **sta { struct pf_addr *saddr = pd->src, *daddr = pd->dst; #ifdef __FreeBSD__ + struct pf_rule *r; u_int16_t icmpid = 0, *icmpsum; #else u_int16_t icmpid, *icmpsum; @@ -4666,6 +4700,8 @@ pf_test_state_icmp(struct pf_state **sta #ifdef __FreeBSD__ STATE_LOOKUP(kif, &key, direction, *state, m, pd->pf_mtag); + + PF_FREEBSD_DIVERT(); #else STATE_LOOKUP(kif, &key, direction, *state, m); #endif @@ -4881,6 +4917,8 @@ pf_test_state_icmp(struct pf_state **sta #ifdef __FreeBSD__ STATE_LOOKUP(kif, &key, direction, *state, m, pd->pf_mtag); + + PF_FREEBSD_DIVERT(); #else STATE_LOOKUP(kif, &key, direction, *state, m); #endif @@ -5031,6 +5069,8 @@ pf_test_state_icmp(struct pf_state **sta #ifdef __FreeBSD__ STATE_LOOKUP(kif, &key, direction, *state, m, pd->pf_mtag); + + PF_FREEBSD_DIVERT(); #else STATE_LOOKUP(kif, &key, direction, *state, m); #endif @@ -5120,6 +5160,8 @@ pf_test_state_icmp(struct pf_state **sta #ifdef __FreeBSD__ STATE_LOOKUP(kif, &key, direction, *state, m, pd->pf_mtag); + + PF_FREEBSD_DIVERT(); #else STATE_LOOKUP(kif, &key, direction, *state, m); #endif @@ -5183,6 +5225,8 @@ pf_test_state_icmp(struct pf_state **sta #ifdef __FreeBSD__ STATE_LOOKUP(kif, &key, direction, *state, m, pd->pf_mtag); + + PF_FREEBSD_DIVERT(); #else STATE_LOOKUP(kif, &key, direction, *state, m); #endif @@ -5239,6 +5283,8 @@ pf_test_state_icmp(struct pf_state **sta #ifdef __FreeBSD__ STATE_LOOKUP(kif, &key, direction, *state, m, pd->pf_mtag); + + PF_FREEBSD_DIVERT(); #else STATE_LOOKUP(kif, &key, direction, *state, m); #endif @@ -5308,6 +5354,9 @@ pf_test_state_other(struct pf_state **st { struct pf_state_peer *src, *dst; struct pf_state_key_cmp key; +#ifdef __FreeBSD__ + struct pf_rule *r; +#endif key.af = pd->af; key.proto = pd->proto; @@ -5323,6 +5372,8 @@ pf_test_state_other(struct pf_state **st #ifdef __FreeBSD__ STATE_LOOKUP(kif, &key, direction, *state, m, pd->pf_mtag); + + PF_FREEBSD_DIVERT(); #else STATE_LOOKUP(kif, &key, direction, *state, m); #endif @@ -6351,6 +6402,7 @@ pf_test(int dir, struct ifnet *ifp, stru struct mbuf *m = *m0; #ifdef __FreeBSD__ struct ip *h = NULL; + struct m_tag *dvtag; #else struct ip *h; #endif @@ -6431,7 +6483,14 @@ pf_test(int dir, struct ifnet *ifp, stru if (m->m_pkthdr.pf.flags & PF_TAG_GENERATED) return (PF_PASS); #endif - + +#ifdef __FreeBSD__ + if (ip_divert_ptr != NULL && + ((dvtag = m_tag_find(m, PACKET_TAG_DIVERT, NULL)) != NULL)) { + pd.pf_mtag->flags |= PF_TAG_DIVERTED; + m_tag_delete(m, dvtag); + } else +#endif /* We do IP header normalization and packet reassembly here */ if (pf_normalize_ip(m0, dir, kif, &reason, &pd) != PF_PASS) { action = PF_DROP; @@ -6670,19 +6729,48 @@ done: m->m_pkthdr.pf.flags |= PF_TAG_TRANSLATE_LOCALHOST; #endif +#ifdef __FreeBSD__ + if (action == PF_PASS && r->divert.port && + ip_divert_ptr != NULL && !(pd.pf_mtag->flags & PF_TAG_DIVERTED)) { + struct divert_tag *dt; + + dvtag = m_tag_get(PACKET_TAG_DIVERT, + sizeof(struct divert_tag), M_NOWAIT); + if (dvtag != NULL) { + dt = (struct divert_tag *)(dvtag+1); + dt->cookie = 0; + dt->info = r->divert.port; + m_tag_prepend(m, dvtag); + + pd.pf_mtag->flags |= PF_TAG_DIVERTED; + + PF_UNLOCK(); + + ip_divert_ptr(*m0, + dir == PF_IN ? DIV_DIR_IN : DIV_DIR_OUT); + + *m0 = NULL; + return (action); + } else { + /* XXX: ipfw has the same behaviour! */ + action = PF_DROP; + REASON_SET(&reason, PFRES_MEMORY); + log = 1; + DPFPRINTF(PF_DEBUG_MISC, + ("pf: failed to allocate divert tag\n")); + } + } +#else if (dir == PF_IN && action == PF_PASS && r->divert.port) { struct pf_divert *divert; if ((divert = pf_get_divert(m))) { -#ifdef __FreeBSD__ - pd.pf_mtag->flags |= PF_TAG_DIVERTED; -#else m->m_pkthdr.pf.flags |= PF_TAG_DIVERTED; -#endif divert->port = r->divert.port; divert->addr.ipv4 = r->divert.addr.v4; } } +#endif if (log) { struct pf_rule *lr; @@ -7156,19 +7244,21 @@ done: m->m_pkthdr.pf.flags |= PF_TAG_TRANSLATE_LOCALHOST; #endif +#ifdef __FreeBSD__ + /* XXX: Anybody working on it?! */ + if (r->divert.port) + printf("pf: divert(9) is not supported for IPv6\n"); +#else if (dir == PF_IN && action == PF_PASS && r->divert.port) { struct pf_divert *divert; if ((divert = pf_get_divert(m))) { -#ifdef __FreeBSD__ - pd.pf_mtag->flags |= PF_TAG_DIVERTED; -#else m->m_pkthdr.pf.flags |= PF_TAG_DIVERTED; -#endif divert->port = r->divert.port; divert->addr.ipv6 = r->divert.addr.v6; } } +#endif if (log) { struct pf_rule *lr; Modified: user/eri/pf45/head/sys/netinet/ip_divert.c ============================================================================== --- user/eri/pf45/head/sys/netinet/ip_divert.c Tue Oct 13 19:04:01 2009 (r198044) +++ user/eri/pf45/head/sys/netinet/ip_divert.c Tue Oct 13 19:49:33 2009 (r198045) @@ -800,5 +800,4 @@ static moduledata_t ipdivertmod = { }; DECLARE_MODULE(ipdivert, ipdivertmod, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY); -MODULE_DEPEND(dummynet, ipfw, 2, 2, 2); MODULE_VERSION(ipdivert, 1); Modified: user/eri/pf45/head/sys/netinet/ip_divert.h ============================================================================== --- user/eri/pf45/head/sys/netinet/ip_divert.h Tue Oct 13 19:04:01 2009 (r198044) +++ user/eri/pf45/head/sys/netinet/ip_divert.h Tue Oct 13 19:49:33 2009 (r198045) @@ -50,6 +50,9 @@ struct divert_tag { u_int16_t cookie; /* ipfw rule number */ }; +#define DIV_DIR_IN 1 +#define DIV_DIR_OUT 0 + /* * Return the divert cookie associated with the mbuf; if any. */ Modified: user/eri/pf45/head/sys/netinet/ip_input.c ============================================================================== --- user/eri/pf45/head/sys/netinet/ip_input.c Tue Oct 13 19:04:01 2009 (r198044) +++ user/eri/pf45/head/sys/netinet/ip_input.c Tue Oct 13 19:49:33 2009 (r198045) @@ -80,6 +80,7 @@ __FBSDID("$FreeBSD$"); #ifdef IPSEC #include #endif /* IPSEC */ +#include #include @@ -183,6 +184,9 @@ extern struct domain inetdomain; extern struct protosw inetsw[]; u_char ip_protox[IPPROTO_MAX]; +/* Divert hooks. */ +ip_divert_packet_t *ip_divert_ptr = NULL; + SYSCTL_VNET_STRUCT(_net_inet_ip, IPCTL_STATS, stats, CTLFLAG_RW, &VNET_NAME(ipstat), ipstat, "IP statistics (struct ipstat, netinet/ip_var.h)"); Modified: user/eri/pf45/head/sys/netinet/ipfw/ip_fw_pfil.c ============================================================================== --- user/eri/pf45/head/sys/netinet/ipfw/ip_fw_pfil.c Tue Oct 13 19:04:01 2009 (r198044) +++ user/eri/pf45/head/sys/netinet/ipfw/ip_fw_pfil.c Tue Oct 13 19:49:33 2009 (r198045) @@ -74,16 +74,11 @@ VNET_DEFINE(int, fw6_enable) = 1; int ipfw_chg_hook(SYSCTL_HANDLER_ARGS); -/* Divert hooks. */ -ip_divert_packet_t *ip_divert_ptr = NULL; - /* ng_ipfw hooks. */ ng_ipfw_input_t *ng_ipfw_input_p = NULL; /* Forward declarations. */ static int ipfw_divert(struct mbuf **, int, int); -#define DIV_DIR_IN 1 -#define DIV_DIR_OUT 0 int ipfw_check_in(void *arg, struct mbuf **m0, struct ifnet *ifp, int dir, From owner-svn-src-user@FreeBSD.ORG Tue Oct 13 20:01:37 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 817F3106568F; Tue, 13 Oct 2009 20:01:37 +0000 (UTC) (envelope-from eri@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 708768FC0C; Tue, 13 Oct 2009 20:01:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n9DK1b8F015051; Tue, 13 Oct 2009 20:01:37 GMT (envelope-from eri@svn.freebsd.org) Received: (from eri@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9DK1buS015049; Tue, 13 Oct 2009 20:01:37 GMT (envelope-from eri@svn.freebsd.org) Message-Id: <200910132001.n9DK1buS015049@svn.freebsd.org> From: Ermal Luçi Date: Tue, 13 Oct 2009 20:01:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r198047 - user/eri/pf45/head/sys/contrib/pf/net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Oct 2009 20:01:37 -0000 Author: eri Date: Tue Oct 13 20:01:37 2009 New Revision: 198047 URL: http://svn.freebsd.org/changeset/base/198047 Log: Prevent pf(4) from handling ipfw(4) tagged packets. This is based on the following assumption that ipfw puts the rule number in the divert cookie while pf itself just puts zero. Should the same check be done in ipfw(4) divert!? Modified: user/eri/pf45/head/sys/contrib/pf/net/pf.c Modified: user/eri/pf45/head/sys/contrib/pf/net/pf.c ============================================================================== --- user/eri/pf45/head/sys/contrib/pf/net/pf.c Tue Oct 13 19:51:31 2009 (r198046) +++ user/eri/pf45/head/sys/contrib/pf/net/pf.c Tue Oct 13 20:01:37 2009 (r198047) @@ -6487,8 +6487,16 @@ pf_test(int dir, struct ifnet *ifp, stru #ifdef __FreeBSD__ if (ip_divert_ptr != NULL && ((dvtag = m_tag_find(m, PACKET_TAG_DIVERT, NULL)) != NULL)) { - pd.pf_mtag->flags |= PF_TAG_DIVERTED; - m_tag_delete(m, dvtag); + /* + * Ipfw puts the rule number in the divert cookie + * while pf itself just puts zero. + * Use this fact to detect if this is pf created divert tag + * or ipfw one. + */ + if (!divert_cookie(dvtag)) { + pd.pf_mtag->flags |= PF_TAG_DIVERTED; + m_tag_delete(m, dvtag); + } } else #endif /* We do IP header normalization and packet reassembly here */ From owner-svn-src-user@FreeBSD.ORG Tue Oct 13 20:07:34 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8B1C61065670 for ; Tue, 13 Oct 2009 20:07:34 +0000 (UTC) (envelope-from julian@elischer.org) Received: from outQ.internet-mail-service.net (outq.internet-mail-service.net [216.240.47.240]) by mx1.freebsd.org (Postfix) with ESMTP id 715AF8FC0A for ; Tue, 13 Oct 2009 20:07:34 +0000 (UTC) Received: from idiom.com (mx0.idiom.com [216.240.32.160]) by out.internet-mail-service.net (Postfix) with ESMTP id B14C6D2525; Tue, 13 Oct 2009 12:56:22 -0700 (PDT) X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e Received: from julian-mac.elischer.org (home.elischer.org [216.240.48.38]) by idiom.com (Postfix) with ESMTP id 03F692D6019; Tue, 13 Oct 2009 12:56:21 -0700 (PDT) Message-ID: <4AD4DB68.2060202@elischer.org> Date: Tue, 13 Oct 2009 12:56:24 -0700 From: Julian Elischer User-Agent: Thunderbird 2.0.0.23 (Macintosh/20090812) MIME-Version: 1.0 To: John Baldwin References: <200910122226.n9CMQAYr087381@svn.freebsd.org> <200910130756.32986.jhb@freebsd.org> In-Reply-To: <200910130756.32986.jhb@freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: Ermal LuXi , src-committers@freebsd.org, svn-src-user@freebsd.org Subject: Re: svn commit: r198007 - user/eri/pf45/head/sys/contrib/pf/net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Oct 2009 20:07:34 -0000 John Baldwin wrote: > On Monday 12 October 2009 6:26:10 pm Ermal LuXi wrote: >> Author: eri >> Date: Mon Oct 12 22:26:10 2009 >> New Revision: 198007 >> URL: http://svn.freebsd.org/changeset/base/198007 >> >> Log: >> * Prefix some other variables with V_ since their name is the same as > their struct type. >> * For being virtualization ready only contexes should be considered > especially in event handlers. > > FWIW, I think it will be simpler to just have all virtualized variables start > with V_ rather than having a partial mix. They should either all have V_ or > none of them have V_ as anything else will just be confusing. And since the > case of none of them having V_ doesn't compile that narrows it down. :) > Ermal, have you asked the OpenBSD guys if they'd accept any changes from us that would make it easier? The SCTP guys agreed to put "SCTP_GLOBAL(name)" around their globals with the comment that it would help them in their user-land version. I do know that OpenBSD agreeing to do something purely for someone else would be a rather drastic departure from their normal M.O. but you won't know until you ask. Julian From owner-svn-src-user@FreeBSD.ORG Tue Oct 13 20:37:32 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E07EE1065676; Tue, 13 Oct 2009 20:37:32 +0000 (UTC) (envelope-from ermal.luci@gmail.com) Received: from mail-gx0-f214.google.com (mail-gx0-f214.google.com [209.85.217.214]) by mx1.freebsd.org (Postfix) with ESMTP id 7E1C38FC13; Tue, 13 Oct 2009 20:37:32 +0000 (UTC) Received: by gxk6 with SMTP id 6so9679835gxk.13 for ; Tue, 13 Oct 2009 13:37:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:from:date:x-google-sender-auth:message-id:subject:to:cc :content-type:content-transfer-encoding; bh=Ljs277JabHRkqeZzbOZKXUnMJHupf1YwqLI+cLODONI=; b=d4muJjCzWYbmCrCPGDx/265oCSfhO0ieb2mOkPWp55l7ja7V2Z7Lzwg9UUXMXqiecs boGpW0tb/gP+TiJk1bJt6/c4xodv+zEJf9LxJoHk0XHUOkTOouKyQhkunIkG84yjcFO9 2nDJf8WXv4gP0KmN/1KJ47kzD14qpq7J0Rtdk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding; b=KXaoe1ALoUgKWVADKP0kOQVeUa4sfl/HHT6YyMzg5FJVnAlSORq2LiTXTZG9wuAx4L np7ZobVlpbfMdlP8I4ORLzH6Y7sNMrQHSxzzL7pgLO7b3ka//yNaGmgiFfTiKfsCi/+R 3CdxmQwX2nhbvzTOLDUlYTEsVUANe1t/ssT1M= MIME-Version: 1.0 Sender: ermal.luci@gmail.com Received: by 10.150.35.18 with SMTP id i18mr13235943ybi.153.1255464338188; Tue, 13 Oct 2009 13:05:38 -0700 (PDT) In-Reply-To: <4AD4DB68.2060202@elischer.org> References: <200910122226.n9CMQAYr087381@svn.freebsd.org> <200910130756.32986.jhb@freebsd.org> <4AD4DB68.2060202@elischer.org> From: =?ISO-8859-1?Q?Ermal_Lu=E7i?= Date: Tue, 13 Oct 2009 22:05:18 +0200 X-Google-Sender-Auth: f1604aab5e43afef Message-ID: <9a542da30910131305o2f247f62oa8c38ce908456568@mail.gmail.com> To: Julian Elischer Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: Max Laier , src-committers@freebsd.org, John Baldwin , svn-src-user@freebsd.org Subject: Re: svn commit: r198007 - user/eri/pf45/head/sys/contrib/pf/net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Oct 2009 20:37:33 -0000 On Tue, Oct 13, 2009 at 9:56 PM, Julian Elischer wrot= e: > John Baldwin wrote: >> >> On Monday 12 October 2009 6:26:10 pm Ermal LuXi wrote: >>> >>> Author: eri >>> Date: Mon Oct 12 22:26:10 2009 >>> New Revision: 198007 >>> URL: http://svn.freebsd.org/changeset/base/198007 >>> >>> Log: >>> =A0* Prefix some other variables with V_ since their name is the same a= s >> >> their struct type. >>> >>> =A0* For being virtualization ready only contexes should be considered >> >> especially in event handlers. >> >> FWIW, I think it will be simpler to just have all virtualized variables >> start with V_ rather than having a partial mix. =A0They should either al= l have >> V_ or none of them have V_ as anything else will just be confusing. =A0A= nd >> since the case of none of them having V_ doesn't compile that narrows it >> down. :) >> > > Ermal, have you asked the OpenBSD guys if they'd accept any changes from = us > that would make it easier? > > > The SCTP guys agreed to put "SCTP_GLOBAL(name)" around their globals > with the comment that it would help them in their user-land version. > I do know that OpenBSD agreeing to do something purely for someone > else would be a rather drastic departure from their normal M.O. but > you won't know until you ask. > To my knowledge Max Laier(cc'd) is the better person to ask for this! Since his previous relation with pf(4) and OpenBSD guys. Max? --=20 Ermal From owner-svn-src-user@FreeBSD.ORG Tue Oct 13 22:20:06 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 562021065672; Tue, 13 Oct 2009 22:20:06 +0000 (UTC) (envelope-from eri@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 41AFF8FC16; Tue, 13 Oct 2009 22:20:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n9DMK69E018509; Tue, 13 Oct 2009 22:20:06 GMT (envelope-from eri@svn.freebsd.org) Received: (from eri@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9DMK5GR018479; Tue, 13 Oct 2009 22:20:05 GMT (envelope-from eri@svn.freebsd.org) Message-Id: <200910132220.n9DMK5GR018479@svn.freebsd.org> From: Ermal Luçi Date: Tue, 13 Oct 2009 22:20:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r198060 - in user/eri/pf45/head: . bin/ls games/number kerberos5/lib/libgssapi_krb5 kerberos5/lib/libgssapi_spnego lib/libc/gen lib/libc/nls sbin/ifconfig sys/amd64/conf sys/arm/conf sy... X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Oct 2009 22:20:06 -0000 Author: eri Date: Tue Oct 13 22:20:05 2009 New Revision: 198060 URL: http://svn.freebsd.org/changeset/base/198060 Log: IFH Modified: user/eri/pf45/head/ (props changed) user/eri/pf45/head/Makefile.inc1 user/eri/pf45/head/ObsoleteFiles.inc user/eri/pf45/head/bin/ls/ls.c user/eri/pf45/head/games/number/Makefile user/eri/pf45/head/games/number/number.c user/eri/pf45/head/kerberos5/lib/libgssapi_krb5/Makefile user/eri/pf45/head/kerberos5/lib/libgssapi_spnego/Makefile user/eri/pf45/head/lib/libc/gen/getcwd.c user/eri/pf45/head/lib/libc/nls/C.msg user/eri/pf45/head/sbin/ifconfig/af_nd6.c user/eri/pf45/head/sbin/ifconfig/ifieee80211.c user/eri/pf45/head/sys/amd64/conf/GENERIC user/eri/pf45/head/sys/arm/conf/HL200 user/eri/pf45/head/sys/arm/conf/KB920X user/eri/pf45/head/sys/dev/bge/if_bge.c user/eri/pf45/head/sys/dev/ppbus/lpt.c user/eri/pf45/head/sys/dev/usb/input/ukbd.c user/eri/pf45/head/sys/i386/conf/GENERIC user/eri/pf45/head/sys/kern/kern_sig.c user/eri/pf45/head/sys/modules/ubser/Makefile user/eri/pf45/head/sys/net80211/ieee80211_hwmp.c user/eri/pf45/head/sys/net80211/ieee80211_mesh.c user/eri/pf45/head/sys/net80211/ieee80211_mesh.h user/eri/pf45/head/sys/netinet/ip_icmp.c user/eri/pf45/head/sys/netinet6/in6_ifattach.c user/eri/pf45/head/sys/nfsclient/nfs_kdtrace.c user/eri/pf45/head/sys/pc98/conf/GENERIC user/eri/pf45/head/sys/sparc64/conf/GENERIC user/eri/pf45/head/usr.sbin/mfiutil/mfiutil.8 (props changed) user/eri/pf45/head/usr.sbin/ntp/doc/ntpd.8 Modified: user/eri/pf45/head/Makefile.inc1 ============================================================================== --- user/eri/pf45/head/Makefile.inc1 Tue Oct 13 22:17:29 2009 (r198059) +++ user/eri/pf45/head/Makefile.inc1 Tue Oct 13 22:20:05 2009 (r198060) @@ -1122,7 +1122,7 @@ lib/libradius__L secure/lib/libssl__L: s _secure_lib_libssh= secure/lib/libssh secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L .if ${MK_KERBEROS} != "no" -kerberos5/lib/libgssapi_krb5__L: kerberos5/lib/libkrb5__L \ +kerberos5/lib/libgssapi_krb5__L: lib/libgssapi__L kerberos5/lib/libkrb5__L \ kerberos5/lib/libhx509__L kerberos5/lib/libasn1__L lib/libcom_err__L \ lib/libmd__L kerberos5/lib/libroken__L secure/lib/libcrypto__L \ lib/libcrypt__L Modified: user/eri/pf45/head/ObsoleteFiles.inc ============================================================================== --- user/eri/pf45/head/ObsoleteFiles.inc Tue Oct 13 22:17:29 2009 (r198059) +++ user/eri/pf45/head/ObsoleteFiles.inc Tue Oct 13 22:20:05 2009 (r198060) @@ -503,6 +503,8 @@ OLD_FILES+=usr/include/dev/usb/usb_quirk OLD_FILES+=usr/include/dev/usb/usbcdc.h OLD_FILES+=usr/include/dev/usb/usbdivar.h OLD_FILES+=usr/include/dev/usb/uxb360gp_rdesc.h +OLD_FILES+=usr/sbin/usbdevs +OLD_FILES+=usr/share/man/man8/usbdevs.8.gz # 20090203: removal of pccard header files OLD_FILES+=usr/include/pccard/cardinfo.h OLD_FILES+=usr/include/pccard/cis.h Modified: user/eri/pf45/head/bin/ls/ls.c ============================================================================== --- user/eri/pf45/head/bin/ls/ls.c Tue Oct 13 22:17:29 2009 (r198059) +++ user/eri/pf45/head/bin/ls/ls.c Tue Oct 13 22:20:05 2009 (r198060) @@ -399,7 +399,7 @@ main(int argc, char *argv[]) * If not -F, -d or -l options, follow any symbolic links listed on * the command line. */ - if (!f_longform && !f_listdir && !f_type) + if (!f_longform && !f_listdir && (!f_type || f_slash)) fts_options |= FTS_COMFOLLOW; /* Modified: user/eri/pf45/head/games/number/Makefile ============================================================================== --- user/eri/pf45/head/games/number/Makefile Tue Oct 13 22:17:29 2009 (r198059) +++ user/eri/pf45/head/games/number/Makefile Tue Oct 13 22:20:05 2009 (r198060) @@ -4,4 +4,6 @@ PROG= number MAN= number.6 +WARNS?= 6 + .include Modified: user/eri/pf45/head/games/number/number.c ============================================================================== --- user/eri/pf45/head/games/number/number.c Tue Oct 13 22:17:29 2009 (r198059) +++ user/eri/pf45/head/games/number/number.c Tue Oct 13 22:20:05 2009 (r198060) @@ -88,9 +88,7 @@ void usage(void); int lflag; int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { int ch, first; char line[256]; @@ -275,7 +273,7 @@ void pfract(len) int len; { - static char *pref[] = { "", "ten-", "hundred-" }; + static char const * const pref[] = { "", "ten-", "hundred-" }; switch(len) { case 1: Modified: user/eri/pf45/head/kerberos5/lib/libgssapi_krb5/Makefile ============================================================================== --- user/eri/pf45/head/kerberos5/lib/libgssapi_krb5/Makefile Tue Oct 13 22:17:29 2009 (r198059) +++ user/eri/pf45/head/kerberos5/lib/libgssapi_krb5/Makefile Tue Oct 13 22:20:05 2009 (r198060) @@ -2,8 +2,8 @@ LIB= gssapi_krb5 LDFLAGS= -Wl,-Bsymbolic -LDADD= -lkrb5 -lhx509 -lcrypto -lroken -lasn1 -lcom_err -lcrypt -DPADD= ${LIBKRB5} ${LIBHX509} ${LIBCRYPTO} ${LIBROKEN} ${LIBASN1} \ +LDADD= -lgssapi -lkrb5 -lhx509 -lcrypto -lroken -lasn1 -lcom_err -lcrypt +DPADD= ${LIBGSSAPI} ${LIBKRB5} ${LIBHX509} ${LIBCRYPTO} ${LIBROKEN} ${LIBASN1} \ ${LIBCOM_ERR} ${LIBCRYPT} INCS= ${KRB5DIR}/lib/gssapi/gssapi/gssapi_krb5.h Modified: user/eri/pf45/head/kerberos5/lib/libgssapi_spnego/Makefile ============================================================================== --- user/eri/pf45/head/kerberos5/lib/libgssapi_spnego/Makefile Tue Oct 13 22:17:29 2009 (r198059) +++ user/eri/pf45/head/kerberos5/lib/libgssapi_spnego/Makefile Tue Oct 13 22:20:05 2009 (r198060) @@ -2,8 +2,8 @@ LIB= gssapi_spnego LDFLAGS= -Wl,-Bsymbolic -LDADD= -lasn1 -DPADD= ${LIBASN1} +LDADD= -lgssapi -lasn1 +DPADD= ${LIBGSSAPI} ${LIBASN1} SRCS= accept_sec_context.c \ compat.c \ Modified: user/eri/pf45/head/lib/libc/gen/getcwd.c ============================================================================== --- user/eri/pf45/head/lib/libc/gen/getcwd.c Tue Oct 13 22:17:29 2009 (r198059) +++ user/eri/pf45/head/lib/libc/gen/getcwd.c Tue Oct 13 22:20:05 2009 (r198060) @@ -62,13 +62,14 @@ getcwd(pt, size) dev_t dev; ino_t ino; int first; - char *bpt, *bup; + char *bpt; struct stat s; dev_t root_dev; ino_t root_ino; - size_t ptsize, upsize; + size_t ptsize; int save_errno; - char *ept, *eup, *up, c; + char *ept, c; + int fd; /* * If no buffer specified by the user, allocate one as necessary. @@ -106,18 +107,6 @@ getcwd(pt, size) bpt = ept - 1; *bpt = '\0'; - /* - * Allocate 1024 bytes for the string of "../"'s. - * Should always be enough. If it's not, allocate - * as necessary. Special case the first stat, it's ".", not "..". - */ - if ((up = malloc(upsize = 1024)) == NULL) - goto err; - eup = up + upsize; - bup = up; - up[0] = '.'; - up[1] = '\0'; - /* Save root values, so know when to stop. */ if (stat("/", &s)) goto err; @@ -128,7 +117,7 @@ getcwd(pt, size) for (first = 1;; first = 0) { /* Stat the current level. */ - if (lstat(up, &s)) + if (dir != NULL ? _fstat(dirfd(dir), &s) : lstat(".", &s)) goto err; /* Save current node values. */ @@ -144,32 +133,22 @@ getcwd(pt, size) * been that way and stuff would probably break. */ bcopy(bpt, pt, ept - bpt); - free(up); + if (dir) + (void) closedir(dir); return (pt); } - /* - * Build pointer to the parent directory, allocating memory - * as necessary. Max length is 3 for "../", the largest - * possible component name, plus a trailing NUL. - */ - while (bup + 3 + MAXNAMLEN + 1 >= eup) { - if ((up = reallocf(up, upsize *= 2)) == NULL) - goto err; - bup = up; - eup = up + upsize; - } - *bup++ = '.'; - *bup++ = '.'; - *bup = '\0'; - /* Open and stat parent directory. */ - if (!(dir = opendir(up)) || _fstat(dirfd(dir), &s)) + fd = _openat(dir != NULL ? dirfd(dir) : AT_FDCWD, + "..", O_RDONLY); + if (fd == -1) goto err; - - /* Add trailing slash for next directory. */ - *bup++ = '/'; - *bup = '\0'; + if (dir) + (void) closedir(dir); + if (!(dir = fdopendir(fd)) || _fstat(dirfd(dir), &s)) { + _close(fd); + goto err; + } /* * If it's a mount point, have to stat each element because @@ -190,10 +169,10 @@ getcwd(pt, size) goto notfound; if (ISDOT(dp)) continue; - bcopy(dp->d_name, bup, dp->d_namlen + 1); /* Save the first error for later. */ - if (lstat(up, &s)) { + if (fstatat(dirfd(dir), dp->d_name, &s, + AT_SYMLINK_NOFOLLOW)) { if (!save_errno) save_errno = errno; errno = 0; @@ -227,11 +206,6 @@ getcwd(pt, size) *--bpt = '/'; bpt -= dp->d_namlen; bcopy(dp->d_name, bpt, dp->d_namlen); - (void) closedir(dir); - dir = NULL; - - /* Truncate any file name. */ - *bup = '\0'; } notfound: @@ -250,7 +224,6 @@ err: free(pt); if (dir) (void) closedir(dir); - free(up); errno = save_errno; return (NULL); Modified: user/eri/pf45/head/lib/libc/nls/C.msg ============================================================================== --- user/eri/pf45/head/lib/libc/nls/C.msg Tue Oct 13 22:17:29 2009 (r198059) +++ user/eri/pf45/head/lib/libc/nls/C.msg Tue Oct 13 22:20:05 2009 (r198060) @@ -181,6 +181,16 @@ $ ENOATTR 87 Attribute not found $ EDOOFUS 88 Programming error +$ EBADMSG +89 Bad message +$ EMULTIHOP +90 Multihop attempted +$ ENOLINK +91 Link has been severed +$ EPROTO +92 Protocol error +$ ENOTCAPABLE +93 Capabilities insufficient $ $ strsignal() support catalog $ Modified: user/eri/pf45/head/sbin/ifconfig/af_nd6.c ============================================================================== --- user/eri/pf45/head/sbin/ifconfig/af_nd6.c Tue Oct 13 22:17:29 2009 (r198059) +++ user/eri/pf45/head/sbin/ifconfig/af_nd6.c Tue Oct 13 22:20:05 2009 (r198060) @@ -56,17 +56,9 @@ static const char rcsid[] = #include "ifconfig.h" #define MAX_SYSCTL_TRY 5 - -static struct nd6_opt_list { - const char *label; - u_int mask; -} nd6_opts[] = { - { "IFDISABLED", ND6_IFF_IFDISABLED, }, - { "PERFORMNUD", ND6_IFF_PERFORMNUD, }, - { "ACCEPT_RTADV", ND6_IFF_ACCEPT_RTADV, }, - { "PREFER_SOURCE", ND6_IFF_PREFER_SOURCE, }, - { "AUTO_LINKLOCAL", ND6_IFF_AUTO_LINKLOCAL, }, -}; +#define ND6BITS "\020\001PERFORMNUD\002ACCEPT_RTADV\003PREFER_SOURCE" \ + "\004IFDISABLED\005DONT_SET_IFROUTE\006AUTO_LINKLOCAL" \ + "\020DEFAULTIF" static int isnd6defif(int); void setnd6flags(const char *, int, int, const struct afswtch *); @@ -153,9 +145,8 @@ nd6_status(int s) char *buf, *next; int mib[6], ntry; int s6; - int i, error; + int error; int isinet6, isdefif; - int nopts; /* Check if the interface has at least one IPv6 address. */ mib[0] = CTL_NET; @@ -220,22 +211,9 @@ nd6_status(int s) close(s6); if (nd.ndi.flags == 0 && !isdefif) return; - - nopts = 0; - printf("\tnd6 options=%d<", nd.ndi.flags); - for (i=0; i < sizeof(nd6_opts)/sizeof(nd6_opts[0]); i++) { - if (nd.ndi.flags & nd6_opts[i].mask) { - if (nopts++) - printf(","); - printf("%s", nd6_opts[i].label); - } - } - if (isdefif) { - if (nopts) - printf(","); - printf("DEFAULTIF"); - } - printf(">\n"); + printb("\tnd6 options", + (unsigned int)(nd.ndi.flags | (isdefif << 15)), ND6BITS); + putchar('\n'); } static struct afswtch af_nd6 = { Modified: user/eri/pf45/head/sbin/ifconfig/ifieee80211.c ============================================================================== --- user/eri/pf45/head/sbin/ifconfig/ifieee80211.c Tue Oct 13 22:17:29 2009 (r198059) +++ user/eri/pf45/head/sbin/ifconfig/ifieee80211.c Tue Oct 13 22:20:05 2009 (r198060) @@ -2624,25 +2624,31 @@ do { \ if (verbose) { const struct ieee80211_meshconf_ie *mconf = (const struct ieee80211_meshconf_ie *)ie; - const uint8_t null[4] = IEEE80211_MESHCONF_NULL; - const uint8_t hwmp[4] = IEEE80211_MESHCONF_HWMP; - const uint8_t airtime[4] = IEEE80211_MESHCONF_AIRTIME; - const uint8_t ccsig[4] = IEEE80211_MESHCONF_CCSIG; - const uint8_t sae[4] = IEEE80211_MESHCONF_SAE; - const uint8_t neighoff[4] = IEEE80211_MESHCONF_SAE; - printf("conf_ver); - MATCHOUI(mconf->conf_pselid, hwmp, "HWMP"); + printf("conf_pselid == IEEE80211_MESHCONF_PATH_HWMP) + printf("HWMP"); + else + printf("UNKNOWN"); printf(" LINK:"); - MATCHOUI(mconf->conf_pmetid, airtime, "AIRTIME"); + if (mconf->conf_pmetid == IEEE80211_MESHCONF_METRIC_AIRTIME) + printf("AIRTIME"); + else + printf("UNKNOWN"); printf(" CONGESTION:"); - MATCHOUI(mconf->conf_ccid, ccsig, "SIG"); - MATCHOUI(mconf->conf_ccid, null, "NULL"); + if (mconf->conf_ccid == IEEE80211_MESHCONF_CC_DISABLED) + printf("DISABLED"); + else + printf("UNKNOWN"); printf(" SYNC:"); - MATCHOUI(mconf->conf_syncid, neighoff, "NEIGHOFF"); - MATCHOUI(mconf->conf_syncid, null, "NULL"); + if (mconf->conf_syncid == IEEE80211_MESHCONF_SYNC_NEIGHOFF) + printf("NEIGHOFF"); + else + printf("UNKNOWN"); printf(" AUTH:"); - MATCHOUI(mconf->conf_authid, sae, "SAE"); - MATCHOUI(mconf->conf_authid, null, "NULL"); + if (mconf->conf_authid == IEEE80211_MESHCONF_AUTH_DISABLED) + printf("DISABLED"); + else + printf("UNKNOWN"); printf(" FORM:0x%x CAPS:0x%x>", mconf->conf_form, mconf->conf_cap); } Modified: user/eri/pf45/head/sys/amd64/conf/GENERIC ============================================================================== --- user/eri/pf45/head/sys/amd64/conf/GENERIC Tue Oct 13 22:17:29 2009 (r198059) +++ user/eri/pf45/head/sys/amd64/conf/GENERIC Tue Oct 13 22:20:05 2009 (r198060) @@ -297,10 +297,6 @@ device ukbd # Keyboard device ulpt # Printer device umass # Disks/Mass storage - Requires scbus and da device ums # Mouse -device rum # Ralink Technology RT2501USB wireless NICs -device uath # Atheros AR5523 wireless NICs -device ural # Ralink Technology RT2500USB wireless NICs -device zyd # ZyDAS zb1211/zb1211b wireless NICs device urio # Diamond Rio 500 MP3 player # USB Serial devices device uark # Technologies ARK3116 based serial adapters @@ -319,6 +315,11 @@ device cue # CATC USB Ethernet device kue # Kawasaki LSI USB Ethernet device rue # RealTek RTL8150 USB Ethernet device udav # Davicom DM9601E USB +# USB Wireless +device rum # Ralink Technology RT2501USB wireless NICs +device uath # Atheros AR5523 wireless NICs +device ural # Ralink Technology RT2500USB wireless NICs +device zyd # ZyDAS zb1211/zb1211b wireless NICs # FireWire support device firewire # FireWire bus code Modified: user/eri/pf45/head/sys/arm/conf/HL200 ============================================================================== --- user/eri/pf45/head/sys/arm/conf/HL200 Tue Oct 13 22:17:29 2009 (r198059) +++ user/eri/pf45/head/sys/arm/conf/HL200 Tue Oct 13 22:20:05 2009 (r198060) @@ -100,9 +100,17 @@ device usb # USB Bus (required) device uhid # "Human Interface Devices" device ulpt # Printer device umass # Disks/Mass storage - Requires scbus and da -device ural # Ralink Technology RT2500USB wireless NICs -device rum # Ralink Technology RT2501USB wireless NICs device urio # Diamond Rio 500 MP3 player +# USB Serial devices +device uark # Technologies ARK3116 based serial adapters +device ubsa # Belkin F5U103 and compatible serial adapters +#device ubser # not yet converted. +device uftdi # For FTDI usb serial adapters +device uipaq # Some WinCE based devices +device uplcom # Prolific PL-2303 serial adapters +device uslcom # SI Labs CP2101/CP2102 serial adapters +device uvisor # Visor and Palm devices +device uvscom # USB serial support for DDI pocket's PHS # USB Ethernet, requires miibus device miibus device aue # ADMtek USB Ethernet @@ -111,16 +119,12 @@ device cdce # Generic USB over Etherne device cue # CATC USB Ethernet device kue # Kawasaki LSI USB Ethernet device rue # RealTek RTL8150 USB Ethernet -device udav -# usb serial -device uark -device ubsa -#device ubser # not yet converted. -device uftdi -device uipaq -device uplcom -device uvisor -device uvscom +device udav # Davicom DM9601E USB +# USB Wireless +device rum # Ralink Technology RT2501USB wireless NICs +device uath # Atheros AR5523 wireless NICs +device ural # Ralink Technology RT2500USB wireless NICs +device zyd # ZyDAS zb1211/zb1211b wireless NICs # SCSI peripherals device scbus # SCSI bus (required for SCSI) device da # Direct Access (disks) Modified: user/eri/pf45/head/sys/arm/conf/KB920X ============================================================================== --- user/eri/pf45/head/sys/arm/conf/KB920X Tue Oct 13 22:17:29 2009 (r198059) +++ user/eri/pf45/head/sys/arm/conf/KB920X Tue Oct 13 22:20:05 2009 (r198060) @@ -101,9 +101,16 @@ device usb # USB Bus (required) device uhid # "Human Interface Devices" device ulpt # Printer device umass # Disks/Mass storage - Requires scbus and da -device ural # Ralink Technology RT2500USB wireless NICs -device rum # Ralink Technology RT2501USB wireless NICs device urio # Diamond Rio 500 MP3 player +# USB Serial devices +device uark # Technologies ARK3116 based serial adapters +device ubsa # Belkin F5U103 and compatible serial adapters +device uftdi # For FTDI usb serial adapters +device uipaq # Some WinCE based devices +device uplcom # Prolific PL-2303 serial adapters +device uslcom # SI Labs CP2101/CP2102 serial adapters +device uvisor # Visor and Palm devices +device uvscom # USB serial support for DDI pocket's PHS # USB Ethernet, requires miibus device miibus device aue # ADMtek USB Ethernet @@ -112,15 +119,12 @@ device cdce # Generic USB over Etherne device cue # CATC USB Ethernet device kue # Kawasaki LSI USB Ethernet device rue # RealTek RTL8150 USB Ethernet -device udav -# usb serial -device uark -device ubsa -device uftdi -device uipaq -device uplcom -device uvisor -device uvscom +device udav # Davicom DM9601E USB +# USB Wireless +device rum # Ralink Technology RT2501USB wireless NICs +device uath # Atheros AR5523 wireless NICs +device ural # Ralink Technology RT2500USB wireless NICs +device zyd # ZyDAS zb1211/zb1211b wireless NICs # SCSI peripherals device scbus # SCSI bus (required for SCSI) device da # Direct Access (disks) Modified: user/eri/pf45/head/sys/dev/bge/if_bge.c ============================================================================== --- user/eri/pf45/head/sys/dev/bge/if_bge.c Tue Oct 13 22:17:29 2009 (r198059) +++ user/eri/pf45/head/sys/dev/bge/if_bge.c Tue Oct 13 22:20:05 2009 (r198060) @@ -4270,6 +4270,16 @@ bge_stop(struct bge_softc *sc) callout_stop(&sc->bge_stat_ch); + /* Disable host interrupts. */ + BGE_SETBIT(sc, BGE_PCI_MISC_CTL, BGE_PCIMISCCTL_MASK_PCI_INTR); + bge_writembx(sc, BGE_MBX_IRQ0_LO, 1); + + /* + * Tell firmware we're shutting down. + */ + bge_stop_fw(sc); + bge_sig_pre_reset(sc, BGE_RESET_STOP); + /* * Disable all of the receiver blocks. */ @@ -4309,16 +4319,6 @@ bge_stop(struct bge_softc *sc) BGE_CLRBIT(sc, BGE_MARB_MODE, BGE_MARBMODE_ENABLE); } - /* Disable host interrupts. */ - BGE_SETBIT(sc, BGE_PCI_MISC_CTL, BGE_PCIMISCCTL_MASK_PCI_INTR); - bge_writembx(sc, BGE_MBX_IRQ0_LO, 1); - - /* - * Tell firmware we're shutting down. - */ - - bge_stop_fw(sc); - bge_sig_pre_reset(sc, BGE_RESET_STOP); bge_reset(sc); bge_sig_legacy(sc, BGE_RESET_STOP); bge_sig_post_reset(sc, BGE_RESET_STOP); Modified: user/eri/pf45/head/sys/dev/ppbus/lpt.c ============================================================================== --- user/eri/pf45/head/sys/dev/ppbus/lpt.c Tue Oct 13 22:17:29 2009 (r198059) +++ user/eri/pf45/head/sys/dev/ppbus/lpt.c Tue Oct 13 22:20:05 2009 (r198060) @@ -624,7 +624,7 @@ lptclose(struct cdev *dev, int flags, in while ((ppb_rstr(ppbus) & (LPS_SEL|LPS_OUT|LPS_NBSY|LPS_NERR)) != (LPS_SEL|LPS_NBSY|LPS_NERR) || sc->sc_xfercnt) - /* wait 1/4 second, give up if we get a signal */ + /* wait 1 second, give up if we get a signal */ if (ppb_sleep(ppbus, lptdev, LPPRI | PCATCH, "lpclose", hz) != EWOULDBLOCK) break; Modified: user/eri/pf45/head/sys/dev/usb/input/ukbd.c ============================================================================== --- user/eri/pf45/head/sys/dev/usb/input/ukbd.c Tue Oct 13 22:17:29 2009 (r198059) +++ user/eri/pf45/head/sys/dev/usb/input/ukbd.c Tue Oct 13 22:20:05 2009 (r198060) @@ -247,8 +247,8 @@ static const uint8_t ukbd_trtab[256] = { NN, NN, NN, NN, NN, NN, NN, NN, /* 68 - 6F */ NN, NN, NN, NN, 115, 108, 111, 113, /* 70 - 77 */ 109, 110, 112, 118, 114, 116, 117, 119, /* 78 - 7F */ - 121, 120, NN, NN, NN, NN, NN, 115, /* 80 - 87 */ - 112, 125, 121, 123, NN, NN, NN, NN, /* 88 - 8F */ + 121, 120, NN, NN, NN, NN, NN, 123, /* 80 - 87 */ + 124, 125, 126, 127, 128, NN, NN, NN, /* 88 - 8F */ NN, NN, NN, NN, NN, NN, NN, NN, /* 90 - 97 */ NN, NN, NN, NN, NN, NN, NN, NN, /* 98 - 9F */ NN, NN, NN, NN, NN, NN, NN, NN, /* A0 - A7 */ @@ -1636,20 +1636,59 @@ static int ukbd_key2scan(struct ukbd_softc *sc, int code, int shift, int up) { static const int scan[] = { - 0x1c, 0x1d, 0x35, - 0x37 | SCAN_PREFIX_SHIFT, /* PrintScreen */ - 0x38, 0x47, 0x48, 0x49, 0x4b, 0x4d, 0x4f, - 0x50, 0x51, 0x52, 0x53, - 0x46, /* XXX Pause/Break */ - 0x5b, 0x5c, 0x5d, + /* 89 */ + 0x11c, /* Enter */ + /* 90-99 */ + 0x11d, /* Ctrl-R */ + 0x135, /* Divide */ + 0x137 | SCAN_PREFIX_SHIFT, /* PrintScreen */ + 0x138, /* Alt-R */ + 0x147, /* Home */ + 0x148, /* Up */ + 0x149, /* PageUp */ + 0x14b, /* Left */ + 0x14d, /* Right */ + 0x14f, /* End */ + /* 100-109 */ + 0x150, /* Down */ + 0x151, /* PageDown */ + 0x152, /* Insert */ + 0x153, /* Delete */ + 0x146, /* XXX Pause/Break */ + 0x15b, /* Win_L(Super_L) */ + 0x15c, /* Win_R(Super_R) */ + 0x15d, /* Application(Menu) */ + /* SUN TYPE 6 USB KEYBOARD */ - 0x68, 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63, - 0x64, 0x65, 0x66, 0x67, 0x25, 0x1f, 0x1e, - 0x20, + 0x168, /* Sun Type 6 Help */ + 0x15e, /* Sun Type 6 Stop */ + /* 110 - 119 */ + 0x15f, /* Sun Type 6 Again */ + 0x160, /* Sun Type 6 Props */ + 0x161, /* Sun Type 6 Undo */ + 0x162, /* Sun Type 6 Front */ + 0x163, /* Sun Type 6 Copy */ + 0x164, /* Sun Type 6 Open */ + 0x165, /* Sun Type 6 Paste */ + 0x166, /* Sun Type 6 Find */ + 0x167, /* Sun Type 6 Cut */ + 0x125, /* Sun Type 6 Mute */ + /* 120 - 128 */ + 0x11f, /* Sun Type 6 VolumeDown */ + 0x11e, /* Sun Type 6 VolumeUp */ + 0x120, /* Sun Type 6 PowerDown */ + + /* Japanese 106/109 keyboard */ + 0x73, /* Keyboard Intl' 1 (backslash / underscore) */ + 0x70, /* Keyboard Intl' 2 (Katakana / Hiragana) */ + 0x7d, /* Keyboard Intl' 3 (Yen sign) (Not using in jp106/109) */ + 0x79, /* Keyboard Intl' 4 (Henkan) */ + 0x7b, /* Keyboard Intl' 5 (Muhenkan) */ + 0x5c, /* Keyboard Intl' 6 (Keypad ,) (For PC-9821 layout) */ }; if ((code >= 89) && (code < (89 + (sizeof(scan) / sizeof(scan[0]))))) { - code = scan[code - 89] | SCAN_PREFIX_E0; + code = scan[code - 89]; } /* Pause/Break */ if ((code == 104) && (!(shift & (MOD_CONTROL_L | MOD_CONTROL_R)))) { Modified: user/eri/pf45/head/sys/i386/conf/GENERIC ============================================================================== --- user/eri/pf45/head/sys/i386/conf/GENERIC Tue Oct 13 22:17:29 2009 (r198059) +++ user/eri/pf45/head/sys/i386/conf/GENERIC Tue Oct 13 22:20:05 2009 (r198060) @@ -310,10 +310,6 @@ device ukbd # Keyboard device ulpt # Printer device umass # Disks/Mass storage - Requires scbus and da device ums # Mouse -device rum # Ralink Technology RT2501USB wireless NICs -device ural # Ralink Technology RT2500USB wireless NICs -device uath # Atheros AR5523 wireless NICs -device zyd # ZyDAS zb1211/zb1211b wireless NICs device urio # Diamond Rio 500 MP3 player # USB Serial devices device u3g # USB-based 3G modems (Option, Huawei, Sierra) @@ -333,6 +329,11 @@ device cue # CATC USB Ethernet device kue # Kawasaki LSI USB Ethernet device rue # RealTek RTL8150 USB Ethernet device udav # Davicom DM9601E USB +# USB Wireless +device rum # Ralink Technology RT2501USB wireless NICs +device uath # Atheros AR5523 wireless NICs +device ural # Ralink Technology RT2500USB wireless NICs +device zyd # ZyDAS zb1211/zb1211b wireless NICs # FireWire support device firewire # FireWire bus code Modified: user/eri/pf45/head/sys/kern/kern_sig.c ============================================================================== --- user/eri/pf45/head/sys/kern/kern_sig.c Tue Oct 13 22:17:29 2009 (r198059) +++ user/eri/pf45/head/sys/kern/kern_sig.c Tue Oct 13 22:20:05 2009 (r198060) @@ -162,7 +162,7 @@ SYSINIT(signal, SI_SUB_P1003_1B, SI_ORDE int sugid_coredump; SYSCTL_INT(_kern, OID_AUTO, sugid_coredump, CTLFLAG_RW, - &sugid_coredump, 0, "Enable coredumping set user/group ID processes"); + &sugid_coredump, 0, "Allow setuid and setgid processes to dump core"); static int do_coredump = 1; SYSCTL_INT(_kern, OID_AUTO, coredump, CTLFLAG_RW, @@ -1014,7 +1014,7 @@ kern_sigprocmask(struct thread *td, int } /* - * The new_block set contains signals that were not previosly + * The new_block set contains signals that were not previously * blocked, but are blocked now. * * In case we block any signal that was not previously blocked Modified: user/eri/pf45/head/sys/modules/ubser/Makefile ============================================================================== --- user/eri/pf45/head/sys/modules/ubser/Makefile Tue Oct 13 22:17:29 2009 (r198059) +++ user/eri/pf45/head/sys/modules/ubser/Makefile Tue Oct 13 22:20:05 2009 (r198060) @@ -1,9 +1,9 @@ # $FreeBSD$ S= ${.CURDIR}/../.. -.PATH: $S/dev/usb +.PATH: $S/dev/usb/serial KMOD= ubser -SRCS= ubser.c ubser.h opt_usb.h device_if.h bus_if.h usbdevs.h +SRCS= ubser.c opt_usb.h device_if.h bus_if.h usbdevs.h .include Modified: user/eri/pf45/head/sys/net80211/ieee80211_hwmp.c ============================================================================== --- user/eri/pf45/head/sys/net80211/ieee80211_hwmp.c Tue Oct 13 22:17:29 2009 (r198059) +++ user/eri/pf45/head/sys/net80211/ieee80211_hwmp.c Tue Oct 13 22:20:05 2009 (r198060) @@ -192,7 +192,7 @@ static ieee80211_recv_action_func hwmp_r static struct ieee80211_mesh_proto_path mesh_proto_hwmp = { .mpp_descr = "HWMP", - .mpp_ie = IEEE80211_MESHCONF_HWMP, + .mpp_ie = IEEE80211_MESHCONF_PATH_HWMP, .mpp_discover = hwmp_discover, .mpp_peerdown = hwmp_peerdown, .mpp_vattach = hwmp_vattach, Modified: user/eri/pf45/head/sys/net80211/ieee80211_mesh.c ============================================================================== --- user/eri/pf45/head/sys/net80211/ieee80211_mesh.c Tue Oct 13 22:17:29 2009 (r198059) +++ user/eri/pf45/head/sys/net80211/ieee80211_mesh.c Tue Oct 13 22:20:05 2009 (r198060) @@ -132,7 +132,7 @@ static ieee80211_send_action_func mesh_s static const struct ieee80211_mesh_proto_metric mesh_metric_airtime = { .mpm_descr = "AIRTIME", - .mpm_ie = IEEE80211_MESHCONF_AIRTIME, + .mpm_ie = IEEE80211_MESHCONF_METRIC_AIRTIME, .mpm_metric = mesh_airtime_calc, }; @@ -344,18 +344,18 @@ int ieee80211_mesh_register_proto_path(const struct ieee80211_mesh_proto_path *mpp) { int i, firstempty = -1; - static const uint8_t emptyie[4] = { 0, 0, 0, 0 }; for (i = 0; i < N(mesh_proto_paths); i++) { - if (memcmp(mpp->mpp_ie, mesh_proto_paths[i].mpp_ie, 4) == 0) + if (strncmp(mpp->mpp_descr, mesh_proto_paths[i].mpp_descr, + IEEE80211_MESH_PROTO_DSZ) == 0) return EEXIST; - if (memcmp(mesh_proto_paths[i].mpp_ie, emptyie, 4) == 0 && - firstempty == -1) + if (!mesh_proto_paths[i].mpp_active && firstempty == -1) firstempty = i; } if (firstempty < 0) return ENOSPC; memcpy(&mesh_proto_paths[firstempty], mpp, sizeof(*mpp)); + mesh_proto_paths[firstempty].mpp_active = 1; return 0; } @@ -364,18 +364,18 @@ ieee80211_mesh_register_proto_metric(con ieee80211_mesh_proto_metric *mpm) { int i, firstempty = -1; - static const uint8_t emptyie[4] = { 0, 0, 0, 0 }; for (i = 0; i < N(mesh_proto_metrics); i++) { - if (memcmp(mpm->mpm_ie, mesh_proto_metrics[i].mpm_ie, 4) == 0) + if (strncmp(mpm->mpm_descr, mesh_proto_metrics[i].mpm_descr, + IEEE80211_MESH_PROTO_DSZ) == 0) return EEXIST; - if (memcmp(mesh_proto_metrics[i].mpm_ie, emptyie, 4) == 0 && - firstempty == -1) + if (!mesh_proto_metrics[i].mpm_active && firstempty == -1) firstempty = i; } if (firstempty < 0) return ENOSPC; memcpy(&mesh_proto_metrics[firstempty], mpm, sizeof(*mpm)); + mesh_proto_metrics[firstempty].mpm_active = 1; return 0; } @@ -2282,51 +2282,40 @@ mesh_verify_meshid(struct ieee80211vap * static int mesh_verify_meshconf(struct ieee80211vap *vap, const uint8_t *ie) { - static const uint8_t null[4] = IEEE80211_MESHCONF_NULL; const struct ieee80211_meshconf_ie *meshconf = (const struct ieee80211_meshconf_ie *) ie; const struct ieee80211_mesh_state *ms = vap->iv_mesh; if (meshconf == NULL) return 1; - if (meshconf->conf_ver != IEEE80211_MESHCONF_VERSION) { + if (meshconf->conf_pselid != ms->ms_ppath->mpp_ie) { IEEE80211_DPRINTF(vap, IEEE80211_MSG_MESH, - "wrong mesh conf version: %d\n", meshconf->conf_ver); + "unknown path selection algorithm: 0x%x\n", + meshconf->conf_pselid); return 1; } - if (memcmp(meshconf->conf_pselid, ms->ms_ppath->mpp_ie, 4) != 0) { + if (meshconf->conf_pmetid != ms->ms_pmetric->mpm_ie) { IEEE80211_DPRINTF(vap, IEEE80211_MSG_MESH, - "unknown path selection algorithm: 0x%x%x%x%x\n", - meshconf->conf_pselid[0], meshconf->conf_pselid[1], - meshconf->conf_pselid[2], meshconf->conf_pselid[3]); + "unknown path metric algorithm: 0x%x\n", + meshconf->conf_pmetid); return 1; } - if (memcmp(meshconf->conf_pmetid, ms->ms_pmetric->mpm_ie, 4) != 0) { + if (meshconf->conf_ccid != 0) { IEEE80211_DPRINTF(vap, IEEE80211_MSG_MESH, - "unknown path metric algorithm: 0x%x%x%x%x\n", - meshconf->conf_pmetid[0], meshconf->conf_pmetid[1], - meshconf->conf_pmetid[2], meshconf->conf_pmetid[3]); + "unknown congestion control algorithm: 0x%x\n", + meshconf->conf_ccid); return 1; } - if (memcmp(meshconf->conf_ccid, null, 4) != 0) { + if (meshconf->conf_syncid != IEEE80211_MESHCONF_SYNC_NEIGHOFF) { IEEE80211_DPRINTF(vap, IEEE80211_MSG_MESH, - "unknown congestion sig algorithm: 0x%x%x%x%x\n", - meshconf->conf_ccid[0], meshconf->conf_ccid[1], - meshconf->conf_ccid[2], meshconf->conf_ccid[3]); + "unknown sync algorithm: 0x%x\n", + meshconf->conf_syncid); return 1; } - if (memcmp(meshconf->conf_syncid, null, 4) != 0) { + if (meshconf->conf_authid != 0) { IEEE80211_DPRINTF(vap, IEEE80211_MSG_MESH, - "unknown sync algorithm: 0x%x%x%x%x\n", - meshconf->conf_syncid[0], meshconf->conf_syncid[1], - meshconf->conf_syncid[2], meshconf->conf_syncid[3]); - return 1; - } - if (memcmp(meshconf->conf_authid, null, 4) != 0) { - IEEE80211_DPRINTF(vap, IEEE80211_MSG_MESH, - "unknown auth auth algorithm: 0x%x%x%x%x\n", - meshconf->conf_pselid[0], meshconf->conf_pselid[1], - meshconf->conf_pselid[2], meshconf->conf_pselid[3]); + "unknown auth auth algorithm: 0x%x\n", + meshconf->conf_pselid); return 1; } /* Not accepting peers */ @@ -2394,29 +2383,22 @@ uint8_t * ieee80211_add_meshconf(uint8_t *frm, struct ieee80211vap *vap) { const struct ieee80211_mesh_state *ms = vap->iv_mesh; - static const uint8_t null[4] = IEEE80211_MESHCONF_NULL; KASSERT(vap->iv_opmode == IEEE80211_M_MBSS, ("not a MBSS vap")); *frm++ = IEEE80211_ELEMID_MESHCONF; *frm++ = sizeof(struct ieee80211_meshconf_ie) - 2; - *frm++ = IEEE80211_MESHCONF_VERSION; - memcpy(frm, ms->ms_ppath->mpp_ie, 4); /* path selection */ - frm += 4; - memcpy(frm, ms->ms_pmetric->mpm_ie, 4); /* link metric */ - frm += 4; - /* XXX null for now */ - memcpy(frm, null, 4); /* congestion control */ - frm += 4; - memcpy(frm, null, 4); /* sync */ - frm += 4; - memcpy(frm, null, 4); /* auth */ - frm += 4; + *frm++ = ms->ms_ppath->mpp_ie; /* path selection */ + *frm++ = ms->ms_pmetric->mpm_ie; /* link metric */ + *frm++ = IEEE80211_MESHCONF_CC_DISABLED; + *frm++ = IEEE80211_MESHCONF_SYNC_NEIGHOFF; + *frm++ = IEEE80211_MESHCONF_AUTH_DISABLED; /* NB: set the number of neighbors before the rest */ *frm = (ms->ms_neighbors > 15 ? 15 : ms->ms_neighbors) << 1; if (ms->ms_flags & IEEE80211_MESHFLAGS_PORTAL) *frm |= IEEE80211_MESHCONF_FORM_MP; frm += 1; + *frm = 0; if (ms->ms_flags & IEEE80211_MESHFLAGS_AP) *frm |= IEEE80211_MESHCONF_CAP_AP; if (ms->ms_flags & IEEE80211_MESHFLAGS_FWD) Modified: user/eri/pf45/head/sys/net80211/ieee80211_mesh.h ============================================================================== --- user/eri/pf45/head/sys/net80211/ieee80211_mesh.h Tue Oct 13 22:17:29 2009 (r198059) +++ user/eri/pf45/head/sys/net80211/ieee80211_mesh.h Tue Oct 13 22:20:05 2009 (r198060) @@ -43,47 +43,27 @@ struct ieee80211_meshconf_ie { uint8_t conf_ie; /* IEEE80211_ELEMID_MESHCONF */ uint8_t conf_len; - uint8_t conf_ver; - uint8_t conf_pselid[4]; /* Active Path Sel. Proto. ID */ - uint8_t conf_pmetid[4]; /* APS Metric Identifier */ - uint8_t conf_ccid[4]; /* Congestion Control Mode ID */ - uint8_t conf_syncid[4]; /* Sync. Protocol ID */ - uint8_t conf_authid[4]; /* Auth. Protocol ID */ + uint8_t conf_pselid; /* Active Path Sel. Proto. ID */ + uint8_t conf_pmetid; /* Active Metric Identifier */ + uint8_t conf_ccid; /* Congestion Control Mode ID */ + uint8_t conf_syncid; /* Sync. Protocol ID */ + uint8_t conf_authid; /* Auth. Protocol ID */ uint8_t conf_form; /* Formation Information */ uint8_t conf_cap; } __packed; -#define IEEE80211_MESHCONF_VERSION 1 -/* Null Protocol */ -#define IEEE80211_MESHCONF_NULL_OUI 0x00, 0x0f, 0xac -#define IEEE80211_MESHCONF_NULL_VALUE 0xff -#define IEEE80211_MESHCONF_NULL { IEEE80211_MESHCONF_NULL_OUI, \ - IEEE80211_MESHCONF_NULL_VALUE } /* Hybrid Wireless Mesh Protocol */ -#define IEEE80211_MESHCONF_HWMP_OUI 0x00, 0x0f, 0xac -#define IEEE80211_MESHCONF_HWMP_VALUE 0x00 -#define IEEE80211_MESHCONF_HWMP { IEEE80211_MESHCONF_HWMP_OUI, \ - IEEE80211_MESHCONF_HWMP_VALUE } +#define IEEE80211_MESHCONF_PATH_HWMP 0x00 /* Airtime Link Metric */ -#define IEEE80211_MESHCONF_AIRTIME_OUI 0x00, 0x0f, 0xac -#define IEEE80211_MESHCONF_AIRTIME_VALUE 0x00 -#define IEEE80211_MESHCONF_AIRTIME { IEEE80211_MESHCONF_AIRTIME_OUI, \ - IEEE80211_MESHCONF_AIRTIME_VALUE } -/* Congestion Control Signaling */ -#define IEEE80211_MESHCONF_CCSIG_OUI 0x00, 0x0f, 0xac -#define IEEE80211_MESHCONF_CCSIG_VALUE 0x00 -#define IEEE80211_MESHCONF_CCSIG { IEEE80211_MESHCONF_CCSIG_OUI,\ - IEEE80211_MESHCONF_CCSIG_VALUE } +#define IEEE80211_MESHCONF_METRIC_AIRTIME 0x00 +/* Congestion Control */ +#define IEEE80211_MESHCONF_CC_DISABLED 0x00 +#define IEEE80211_MESHCONF_CC_SIG 0x01 /* Neighbour Offset */ -#define IEEE80211_MESHCONF_NEIGHOFF_OUI 0x00, 0x0f, 0xac -#define IEEE80211_MESHCONF_NEIGHOFF_VALUE 0x00 -#define IEEE80211_MESHCONF_NEIGHOFF { IEEE80211_MESHCONF_NEIGHOFF_OUI, \ - IEEE80211_MESHCONF_NEIGHOFF_VALUE } +#define IEEE80211_MESHCONF_SYNC_NEIGHOFF 0x00 +#define IEEE80211_MESHCONF_AUTH_DISABLED 0x00 /* Simultaneous Authenticaction of Equals */ -#define IEEE80211_MESHCONF_SAE_OUI 0x00, 0x0f, 0xac -#define IEEE80211_MESHCONF_SAE_VALUE 0x01 -#define IEEE80211_MESHCONF_SAE { IEEE80211_MESHCONF_SAE_OUI, \ - IEEE80211_MESHCONF_SAE_VALUE } +#define IEEE80211_MESHCONF_AUTH_SAE 0x01 #define IEEE80211_MESHCONF_FORM_MP 0x01 /* Connected to Portal */ #define IEEE80211_MESHCONF_FORM_NNEIGH_MASK 0x04 /* Number of Neighbours */ #define IEEE80211_MESHCONF_CAP_AP 0x01 /* Accepting Peers */ @@ -390,8 +370,9 @@ struct ieee80211_mesh_route { */ enum ieee80211_state; struct ieee80211_mesh_proto_path { + uint8_t mpp_active; char mpp_descr[IEEE80211_MESH_PROTO_DSZ]; - uint8_t mpp_ie[4]; + uint8_t mpp_ie; struct ieee80211_node * (*mpp_discover)(struct ieee80211vap *, const uint8_t [IEEE80211_ADDR_LEN], @@ -411,8 +392,9 @@ struct ieee80211_mesh_proto_path { * Mesh Link Metric Report Protocol. */ struct ieee80211_mesh_proto_metric { + uint8_t mpm_active; char mpm_descr[IEEE80211_MESH_PROTO_DSZ]; - uint8_t mpm_ie[4]; + uint8_t mpm_ie; uint32_t (*mpm_metric)(struct ieee80211_node *); }; Modified: user/eri/pf45/head/sys/netinet/ip_icmp.c ============================================================================== --- user/eri/pf45/head/sys/netinet/ip_icmp.c Tue Oct 13 22:17:29 2009 (r198059) +++ user/eri/pf45/head/sys/netinet/ip_icmp.c Tue Oct 13 22:20:05 2009 (r198060) @@ -367,7 +367,7 @@ icmp_input(struct mbuf *m, int off) goto freeit; } i = hlen + min(icmplen, ICMP_ADVLENMIN); - if (m->m_len < i && (m = m_pullup(m, i)) == 0) { + if (m->m_len < i && (m = m_pullup(m, i)) == NULL) { ICMPSTAT_INC(icps_tooshort); return; } Modified: user/eri/pf45/head/sys/netinet6/in6_ifattach.c ============================================================================== --- user/eri/pf45/head/sys/netinet6/in6_ifattach.c Tue Oct 13 22:17:29 2009 (r198059) +++ user/eri/pf45/head/sys/netinet6/in6_ifattach.c Tue Oct 13 22:20:05 2009 (r198060) @@ -751,16 +751,19 @@ in6_ifattach(struct ifnet *ifp, struct i * assign a link-local address, if there's none. */ if (ifp->if_type != IFT_BRIDGE && + !(ND_IFINFO(ifp)->flags & ND6_IFF_IFDISABLED) && ND_IFINFO(ifp)->flags & ND6_IFF_AUTO_LINKLOCAL) { int error; ia = in6ifa_ifpforlinklocal(ifp, 0); if (ia == NULL) { error = in6_ifattach_linklocal(ifp, altifp); +#if 0 if (error) log(LOG_NOTICE, "in6_ifattach_linklocal: " "failed to add a link-local addr to %s\n", if_name(ifp)); +#endif } else ifa_free(&ia->ia_ifa); } Modified: user/eri/pf45/head/sys/nfsclient/nfs_kdtrace.c ============================================================================== --- user/eri/pf45/head/sys/nfsclient/nfs_kdtrace.c Tue Oct 13 22:17:29 2009 (r198059) +++ user/eri/pf45/head/sys/nfsclient/nfs_kdtrace.c Tue Oct 13 22:20:05 2009 (r198060) @@ -543,3 +543,4 @@ DEV_MODULE(dtnfsclient, dtnfsclient_mode MODULE_VERSION(dtnfsclient, 1); MODULE_DEPEND(dtnfsclient, dtrace, 1, 1, 1); MODULE_DEPEND(dtnfsclient, opensolaris, 1, 1, 1); +MODULE_DEPEND(dtnfsclient, nfs, 1, 1, 1); Modified: user/eri/pf45/head/sys/pc98/conf/GENERIC ============================================================================== --- user/eri/pf45/head/sys/pc98/conf/GENERIC Tue Oct 13 22:17:29 2009 (r198059) +++ user/eri/pf45/head/sys/pc98/conf/GENERIC Tue Oct 13 22:20:05 2009 (r198060) @@ -264,10 +264,6 @@ device bpf # Berkeley packet filter #device ulpt # Printer #device umass # Disks/Mass storage - Requires scbus and da #device ums # Mouse -#device rum # Ralink Technology RT2501USB wireless NICs -#device uath # Atheros AR5523 wireless NICs -#device ural # Ralink Technology RT2500USB wireless NICs -#device zyd # ZyDAS zb1211/zb1211b wireless NICs #device urio # Diamond Rio 500 MP3 player # USB Serial devices #device uark # Technologies ARK3116 based serial adapters @@ -287,6 +283,11 @@ device bpf # Berkeley packet filter #device kue # Kawasaki LSI USB Ethernet #device rue # RealTek RTL8150 USB Ethernet #device udav # Davicom DM9601E USB +# USB Wireless +#device rum # Ralink Technology RT2501USB wireless NICs +#device uath # Atheros AR5523 wireless NICs +#device ural # Ralink Technology RT2500USB wireless NICs +#device zyd # ZyDAS zb1211/zb1211b wireless NICs # FireWire support #device firewire # FireWire bus code Modified: user/eri/pf45/head/sys/sparc64/conf/GENERIC ============================================================================== --- user/eri/pf45/head/sys/sparc64/conf/GENERIC Tue Oct 13 22:17:29 2009 (r198059) +++ user/eri/pf45/head/sys/sparc64/conf/GENERIC Tue Oct 13 22:20:05 2009 (r198060) @@ -239,10 +239,6 @@ device ukbd # Keyboard device ulpt # Printer device umass # Disks/Mass storage - Requires scbus and da device ums # Mouse -device rum # Ralink Technology RT2501USB wireless NICs -device uath # Atheros AR5523 wireless NICs -device ural # Ralink Technology RT2500USB wireless NICs -device zyd # ZyDAS zb1211/zb1211b wireless NICs device urio # Diamond Rio 500 MP3 player # USB Serial devices device uark # Technologies ARK3116 based serial adapters @@ -261,6 +257,11 @@ device cue # CATC USB Ethernet device kue # Kawasaki LSI USB Ethernet device rue # RealTek RTL8150 USB Ethernet device udav # Davicom DM9601E USB +# USB Wireless +device rum # Ralink Technology RT2501USB wireless NICs +device uath # Atheros AR5523 wireless NICs +device ural # Ralink Technology RT2500USB wireless NICs +device zyd # ZyDAS zb1211/zb1211b wireless NICs # FireWire support device firewire # FireWire bus code Modified: user/eri/pf45/head/usr.sbin/ntp/doc/ntpd.8 ============================================================================== --- user/eri/pf45/head/usr.sbin/ntp/doc/ntpd.8 Tue Oct 13 22:17:29 2009 (r198059) +++ user/eri/pf45/head/usr.sbin/ntp/doc/ntpd.8 Tue Oct 13 22:20:05 2009 (r198060) @@ -121,7 +121,7 @@ Normally, .Nm exits with a message to the system log if the offset exceeds the panic threshold, which is 1000 s by default. -This option allows thetime to be set to any value without restriction; +This option allows the time to be set to any value without restriction; however, this can happen only once. *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Tue Oct 13 23:21:53 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 710951065672; Tue, 13 Oct 2009 23:21:53 +0000 (UTC) (envelope-from eri@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2B3F78FC08; Tue, 13 Oct 2009 23:21:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n9DNLr8p019693; Tue, 13 Oct 2009 23:21:53 GMT (envelope-from eri@svn.freebsd.org) Received: (from eri@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9DNLqEH019688; Tue, 13 Oct 2009 23:21:52 GMT (envelope-from eri@svn.freebsd.org) Message-Id: <200910132321.n9DNLqEH019688@svn.freebsd.org> From: Ermal Luçi Date: Tue, 13 Oct 2009 23:21:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r198063 - in user/eri/pf45/head/sys/contrib: altq/altq pf/net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Oct 2009 23:21:53 -0000 Author: eri Date: Tue Oct 13 23:21:52 2009 New Revision: 198063 URL: http://svn.freebsd.org/changeset/base/198063 Log: Unbreak ALTQ build. Modified: user/eri/pf45/head/sys/contrib/altq/altq/altq_red.c user/eri/pf45/head/sys/contrib/pf/net/pf.c user/eri/pf45/head/sys/contrib/pf/net/pf_ioctl.c user/eri/pf45/head/sys/contrib/pf/net/pfvar.h Modified: user/eri/pf45/head/sys/contrib/altq/altq/altq_red.c ============================================================================== --- user/eri/pf45/head/sys/contrib/altq/altq/altq_red.c Tue Oct 13 22:28:55 2009 (r198062) +++ user/eri/pf45/head/sys/contrib/altq/altq/altq_red.c Tue Oct 13 23:21:52 2009 (r198063) @@ -516,11 +516,9 @@ mark_ecn(struct mbuf *m, struct altq_pkt struct mbuf *m0; struct pf_mtag *at; void *hdr; - int af; at = pf_find_mtag(m); if (at != NULL) { - af = at->af; hdr = at->hdr; #ifdef ALTQ3_COMPAT } else if (pktattr != NULL) { @@ -530,9 +528,6 @@ mark_ecn(struct mbuf *m, struct altq_pkt } else return (0); - if (af != AF_INET && af != AF_INET6) - return (0); - /* verify that pattr_hdr is within the mbuf data */ for (m0 = m; m0 != NULL; m0 = m0->m_next) if (((caddr_t)hdr >= m0->m_data) && @@ -543,8 +538,8 @@ mark_ecn(struct mbuf *m, struct altq_pkt return (0); } - switch (af) { - case AF_INET: + switch (((struct ip *)hdr)->ip_v) { + case 4: if (flags & REDF_ECN4) { struct ip *ip = hdr; u_int8_t otos; @@ -577,7 +572,7 @@ mark_ecn(struct mbuf *m, struct altq_pkt } break; #ifdef INET6 - case AF_INET6: + case 6: if (flags & REDF_ECN6) { struct ip6_hdr *ip6 = hdr; u_int32_t flowlabel; Modified: user/eri/pf45/head/sys/contrib/pf/net/pf.c ============================================================================== --- user/eri/pf45/head/sys/contrib/pf/net/pf.c Tue Oct 13 22:28:55 2009 (r198062) +++ user/eri/pf45/head/sys/contrib/pf/net/pf.c Tue Oct 13 23:21:52 2009 (r198063) @@ -2246,9 +2246,16 @@ pf_send_tcp(const struct pf_rule *r, sa_ #ifdef ALTQ if (r != NULL && r->qid) { +#ifdef __FreeBSD__ + pf_mtag->qid = r->qid; + + /* add hints for ecn */ + pf_mtag->hdr = mtod(m, struct ip *); +#else m->m_pkthdr.pf.qid = r->qid; /* add hints for ecn */ m->m_pkthdr.pf.hdr = mtod(m, struct ip *); +#endif } #endif /* ALTQ */ m->m_data += max_linkhdr; @@ -6712,12 +6719,22 @@ done: #ifdef ALTQ if (action == PF_PASS && r->qid) { +#ifdef __FreeBSD__ + if (pqid || (pd.tos & IPTOS_LOWDELAY)) + pd.pf_mtag->qid = r->pqid; + else + pd.pf_mtag->qid = r->qid; + /* add hints for ecn */ + pd.pf_mtag->hdr = h; + +#else if (pqid || (pd.tos & IPTOS_LOWDELAY)) m->m_pkthdr.pf.qid = r->pqid; else m->m_pkthdr.pf.qid = r->qid; /* add hints for ecn */ m->m_pkthdr.pf.hdr = h; +#endif } #endif /* ALTQ */ @@ -6873,7 +6890,11 @@ pf_test6(int dir, struct ifnet *ifp, str struct pfi_kif *kif; u_short action, reason = 0, log = 0; struct mbuf *m = *m0, *n = NULL; +#ifdef __FreeBSD__ + struct ip6_hdr *h = NULL; +#else struct ip6_hdr *h; +#endif struct pf_rule *a = NULL, *r = &pf_default_rule, *tr, *nr; struct pf_state *s = NULL; struct pf_ruleset *ruleset = NULL; @@ -7232,12 +7253,21 @@ done: #ifdef ALTQ if (action == PF_PASS && r->qid) { +#ifdef __FreeBSD__ + if (pd.tos & IPTOS_LOWDELAY) + pd.pf_mtag->qid = r->pqid; + else + pd.pf_mtag->qid = r->qid; + /* add hints for ecn */ + pd.pf_mtag->hdr = h; +#else if (pd.tos & IPTOS_LOWDELAY) m->m_pkthdr.pf.qid = r->pqid; else m->m_pkthdr.pf.qid = r->qid; /* add hints for ecn */ m->m_pkthdr.pf.hdr = h; +#endif } #endif /* ALTQ */ Modified: user/eri/pf45/head/sys/contrib/pf/net/pf_ioctl.c ============================================================================== --- user/eri/pf45/head/sys/contrib/pf/net/pf_ioctl.c Tue Oct 13 22:28:55 2009 (r198062) +++ user/eri/pf45/head/sys/contrib/pf/net/pf_ioctl.c Tue Oct 13 23:21:52 2009 (r198063) @@ -192,7 +192,7 @@ VNET_DEFINE(struct pf_tags, pf_tags) = TAILQ_HEAD_INITIALIZER(V_pf_tags); VNET_DEFINE(struct pf_tags, pf_qids) = TAILQ_HEAD_INITIALIZER(pf_qids); -#define pf_qids VNET(pf_qids); +#define pf_qids VNET(pf_qids) #else /* !__FreeBSD__ */ struct pf_rule pf_default_rule; Modified: user/eri/pf45/head/sys/contrib/pf/net/pfvar.h ============================================================================== --- user/eri/pf45/head/sys/contrib/pf/net/pfvar.h Tue Oct 13 22:28:55 2009 (r198062) +++ user/eri/pf45/head/sys/contrib/pf/net/pfvar.h Tue Oct 13 23:21:52 2009 (r198063) @@ -1855,7 +1855,7 @@ extern void pf_tbladdr_copyout(struct extern void pf_calc_skip_steps(struct pf_rulequeue *); #ifdef __FreeBSD__ #ifdef ALTQ -VNET_DECLARE(void pf_altq_ifnet_event(struct ifnet *, int)); +extern void pf_altq_ifnet_event(struct ifnet *, int); #endif VNET_DECLARE(uma_zone_t, pf_src_tree_pl); #define pf_src_tree_pl VNET(pf_src_tree_pl) From owner-svn-src-user@FreeBSD.ORG Tue Oct 13 23:44:33 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4AD381065679; Tue, 13 Oct 2009 23:44:33 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3A6CD8FC16; Tue, 13 Oct 2009 23:44:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n9DNiXTb020138; Tue, 13 Oct 2009 23:44:33 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9DNiXt2020136; Tue, 13 Oct 2009 23:44:33 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200910132344.n9DNiXt2020136@svn.freebsd.org> From: Kip Macy Date: Tue, 13 Oct 2009 23:44:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r198064 - user/kmacy/releng_8_fcs/sys/kern X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Oct 2009 23:44:33 -0000 Author: kmacy Date: Tue Oct 13 23:44:32 2009 New Revision: 198064 URL: http://svn.freebsd.org/changeset/base/198064 Log: drop sockbuf lock on last reference Modified: user/kmacy/releng_8_fcs/sys/kern/uipc_socket.c Modified: user/kmacy/releng_8_fcs/sys/kern/uipc_socket.c ============================================================================== --- user/kmacy/releng_8_fcs/sys/kern/uipc_socket.c Tue Oct 13 23:21:52 2009 (r198063) +++ user/kmacy/releng_8_fcs/sys/kern/uipc_socket.c Tue Oct 13 23:44:32 2009 (r198064) @@ -3386,7 +3386,7 @@ MALLOC_DEFINE(M_SOCKREF, "sockref", "soc } while (0) -static void +static int socketref_free(struct socketref *sr) { struct file *fp = sr->sr_fp; @@ -3394,10 +3394,14 @@ socketref_free(struct socketref *sr) struct proc *p = sr->sr_proc; struct ucred *cred = sr->sr_ucred; struct sockbuf *sb = &sr->sr_so->so_snd; + int refs; if (cred != NULL) crfree(cred); vrele(fp->f_vnode); + refs = sock_fp->f_count - 1; + if (refs == 0) + SOCKBUF_UNLOCK(sb); fdrop(fp, NULL); fdrop(sock_fp, NULL); PRELE(p); @@ -3405,6 +3409,7 @@ socketref_free(struct socketref *sr) bzero(sr, sizeof(*sr)); #endif free(sr, M_SOCKREF); + return (refs); } void @@ -3503,7 +3508,7 @@ sendfile_task_func(void *context, int pe struct socket *so; struct sockbuf *sb; struct file *sock_fp, *fp; - int error = EAGAIN; + int refs, error = EAGAIN; struct uio *hdr_uio = NULL, *trl_uio = NULL; off_t sbytes = 0; @@ -3580,8 +3585,9 @@ sendfile_task_func(void *context, int pe done: SOCKBUF_LOCK_ASSERT(sb); sb->sb_flags &= ~(SB_SENDING|SB_SENDING_TASK); - socketref_free(sr); - sowwakeup_locked(so); + refs = socketref_free(sr); + if (refs) + sowwakeup_locked(so); } static int From owner-svn-src-user@FreeBSD.ORG Wed Oct 14 01:25:28 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9F539106566B; Wed, 14 Oct 2009 01:25:28 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8F21C8FC14; Wed, 14 Oct 2009 01:25:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n9E1PSHk022039; Wed, 14 Oct 2009 01:25:28 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9E1PSVu022037; Wed, 14 Oct 2009 01:25:28 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200910140125.n9E1PSVu022037@svn.freebsd.org> From: Kip Macy Date: Wed, 14 Oct 2009 01:25:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r198065 - user/kmacy/releng_8_fcs/sys/kern X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Oct 2009 01:25:28 -0000 Author: kmacy Date: Wed Oct 14 01:25:28 2009 New Revision: 198065 URL: http://svn.freebsd.org/changeset/base/198065 Log: delay teardown if user is in the middle of changing fps statet Modified: user/kmacy/releng_8_fcs/sys/kern/uipc_socket.c Modified: user/kmacy/releng_8_fcs/sys/kern/uipc_socket.c ============================================================================== --- user/kmacy/releng_8_fcs/sys/kern/uipc_socket.c Tue Oct 13 23:44:32 2009 (r198064) +++ user/kmacy/releng_8_fcs/sys/kern/uipc_socket.c Wed Oct 14 01:25:28 2009 (r198065) @@ -3396,6 +3396,11 @@ socketref_free(struct socketref *sr) struct sockbuf *sb = &sr->sr_so->so_snd; int refs; + if (sock_fp->f_count != fp->f_count) { + sb->sb_flags |= (SB_SENDING|SB_SENDING_TASK); + taskqueue_enqueue(sendfile_tq, &sr->sr_task); + return (1); + } if (cred != NULL) crfree(cred); vrele(fp->f_vnode); From owner-svn-src-user@FreeBSD.ORG Wed Oct 14 01:54:36 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 722721065670; Wed, 14 Oct 2009 01:54:36 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4826E8FC1A; Wed, 14 Oct 2009 01:54:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n9E1saEB022621; Wed, 14 Oct 2009 01:54:36 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9E1sawY022619; Wed, 14 Oct 2009 01:54:36 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200910140154.n9E1sawY022619@svn.freebsd.org> From: Kip Macy Date: Wed, 14 Oct 2009 01:54:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r198067 - user/kmacy/releng_8_fcs/sys/kern X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Oct 2009 01:54:36 -0000 Author: kmacy Date: Wed Oct 14 01:54:35 2009 New Revision: 198067 URL: http://svn.freebsd.org/changeset/base/198067 Log: don't drop references outside of task_func context Modified: user/kmacy/releng_8_fcs/sys/kern/uipc_socket.c Modified: user/kmacy/releng_8_fcs/sys/kern/uipc_socket.c ============================================================================== --- user/kmacy/releng_8_fcs/sys/kern/uipc_socket.c Wed Oct 14 01:43:53 2009 (r198066) +++ user/kmacy/releng_8_fcs/sys/kern/uipc_socket.c Wed Oct 14 01:54:35 2009 (r198067) @@ -3371,7 +3371,7 @@ struct taskqueue *sendfile_tq; extern int getsock(struct filedesc *fdp, int fd, struct file **fpp, u_int *fflagp); static void sendfile_task_func(void *context, int pending __unused); -static int srsendingwakeup(struct socketref *sr, int external); +static void srsendingwakeup(struct socketref *sr, int external); MALLOC_DEFINE(M_SOCKREF, "sockref", "socket reference memory"); @@ -3574,12 +3574,10 @@ sendfile_task_func(void *context, int pe CTR0(KTR_SPARE2, "EAGAIN on full send"); error = 0; } - if (srsendingwakeup(sr, 0) != ENOTCONN) { - SOCKBUF_UNLOCK(sb); - return; - } + srsendingwakeup(sr, 0); + SOCKBUF_UNLOCK(sb); + return; } - } #ifdef KTR @@ -3595,7 +3593,7 @@ done: sowwakeup_locked(so); } -static int +static void srsendingwakeup(struct socketref *sr, int external) { struct socket *so; @@ -3609,26 +3607,21 @@ srsendingwakeup(struct socketref *sr, in * XXX leak - should be assert perhaps * */ - return (0); + return; } fp = sr->sr_sock_fp; if (fp->f_type != DTYPE_SOCKET) { - CTR1(KTR_SPARE2, "not socket - type %d", fp->f_type); - goto error; + printf("not socket - type %d\n", fp->f_type); + return; } so = fp->f_data; sb = &so->so_snd; SOCKBUF_LOCK_ASSERT(sb); sb->sb_flags &= ~(SB_SENDING|SB_SENDING_TASK); - if ((so->so_state & SS_ISCONNECTED) == 0) { - CTR1(KTR_SPARE2, "not connected %p", so); - goto error; - } - - if (sb->sb_state & SBS_CANTSENDMORE) { - CTR1(KTR_SPARE2, "SBS_CANTSENDMORE %p", so); - } else if (sowriteable(so)) { + if ((so->so_state & SS_ISCONNECTED) == 0 || + (sb->sb_state & SBS_CANTSENDMORE) || + (sowriteable(so))) { CTR2(KTR_SPARE2, "enqueue socket to task %p sr %p", so, sr); sb->sb_flags |= (SB_SENDING|SB_SENDING_TASK); taskqueue_enqueue(sendfile_tq, &sr->sr_task); @@ -3641,9 +3634,6 @@ srsendingwakeup(struct socketref *sr, in TAILQ_INSERT_TAIL(sendfile_bg_queue, sr, entry); mtx_unlock(&sendfile_bg_lock); } - return (0); -error: - return (ENOTCONN); } void @@ -3672,11 +3662,8 @@ sosendingwakeup(struct sockbuf *sb) /* * Buffer in flight */ - if (sr != NULL && srsendingwakeup(sr, 1) == ENOTCONN) { - CTR2(KTR_SPARE2, "freeing expired socket %p ref %p", - sr->sr_so, sr); - socketref_free(sr); - } + if (sr != NULL) + srsendingwakeup(sr, 1); } static void From owner-svn-src-user@FreeBSD.ORG Wed Oct 14 21:34:53 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0AB0E106568B; Wed, 14 Oct 2009 21:34:53 +0000 (UTC) (envelope-from eri@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ED1268FC20; Wed, 14 Oct 2009 21:34:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n9ELYqes049292; Wed, 14 Oct 2009 21:34:52 GMT (envelope-from eri@svn.freebsd.org) Received: (from eri@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9ELYqUo049280; Wed, 14 Oct 2009 21:34:52 GMT (envelope-from eri@svn.freebsd.org) Message-Id: <200910142134.n9ELYqUo049280@svn.freebsd.org> From: Ermal Luçi Date: Wed, 14 Oct 2009 21:34:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r198100 - in user/eri/pf45/head/sys: contrib/pf/net netinet netinet6 netipsec sys X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Oct 2009 21:34:53 -0000 Author: eri Date: Wed Oct 14 21:34:52 2009 New Revision: 198100 URL: http://svn.freebsd.org/changeset/base/198100 Log: Pf(4) needs a mechanism to be notified that the destination address changed after pf(4) has seen the packet on input path and might see it again in the output pathi(state match optimization). Since this needs to touch many subsystems implement a wrapper that will call all callbacks for other subsystems that might see this information useful. Basically they just place the callback in this wrapper rather than go through all the sources that this function will be. Idea and basic template from mlaier@. NOTE: With this commit pf 4.5 can be considered ported to FreeBSD with all its features. Modified: user/eri/pf45/head/sys/contrib/pf/net/pf.c user/eri/pf45/head/sys/contrib/pf/net/pf_ioctl.c user/eri/pf45/head/sys/netinet/in_gif.c user/eri/pf45/head/sys/netinet/ip_icmp.c user/eri/pf45/head/sys/netinet/raw_ip.c user/eri/pf45/head/sys/netinet6/icmp6.c user/eri/pf45/head/sys/netinet6/in6_gif.c user/eri/pf45/head/sys/netipsec/ipsec_input.c user/eri/pf45/head/sys/netipsec/ipsec_output.c user/eri/pf45/head/sys/netipsec/xform_ipip.c user/eri/pf45/head/sys/sys/mbuf.h Modified: user/eri/pf45/head/sys/contrib/pf/net/pf.c ============================================================================== --- user/eri/pf45/head/sys/contrib/pf/net/pf.c Wed Oct 14 20:30:27 2009 (r198099) +++ user/eri/pf45/head/sys/contrib/pf/net/pf.c Wed Oct 14 21:34:52 2009 (r198100) @@ -7391,7 +7391,6 @@ pf_check_congestion(struct ifqueue *ifq) #endif } -#ifdef notyet /* * must be called whenever any addressing information such as * address, port, protocol has changed @@ -7399,6 +7398,12 @@ pf_check_congestion(struct ifqueue *ifq) void pf_pkt_addr_changed(struct mbuf *m) { +#ifdef __FreeBSD__ + struct pf_mtag *pf_tag; + + if ((pf_tag = pf_find_mtag(m)) != NULL) + pf_tag->statekey = NULL; +#else m->m_pkthdr.pf.statekey = NULL; -} #endif +} Modified: user/eri/pf45/head/sys/contrib/pf/net/pf_ioctl.c ============================================================================== --- user/eri/pf45/head/sys/contrib/pf/net/pf_ioctl.c Wed Oct 14 20:30:27 2009 (r198099) +++ user/eri/pf45/head/sys/contrib/pf/net/pf_ioctl.c Wed Oct 14 21:34:52 2009 (r198100) @@ -438,6 +438,9 @@ pfattach(void) if (kproc_create(pf_purge_thread, NULL, NULL, 0, 0, "pfpurge")) return (ENXIO); +#ifdef __FreeBSD__ + m_addr_chg_pf_p = pf_pkt_addr_changed; +#endif return (error); } #else /* !__FreeBSD__ */ Modified: user/eri/pf45/head/sys/netinet/in_gif.c ============================================================================== --- user/eri/pf45/head/sys/netinet/in_gif.c Wed Oct 14 20:30:27 2009 (r198099) +++ user/eri/pf45/head/sys/netinet/in_gif.c Wed Oct 14 21:34:52 2009 (r198100) @@ -254,6 +254,8 @@ in_gif_output(struct ifnet *ifp, int fam #endif } + m_addr_changed(m); + error = ip_output(m, NULL, &sc->gif_ro, 0, NULL, NULL); if (!(GIF2IFP(sc)->if_flags & IFF_LINK0) && Modified: user/eri/pf45/head/sys/netinet/ip_icmp.c ============================================================================== --- user/eri/pf45/head/sys/netinet/ip_icmp.c Wed Oct 14 20:30:27 2009 (r198099) +++ user/eri/pf45/head/sys/netinet/ip_icmp.c Wed Oct 14 21:34:52 2009 (r198100) @@ -689,6 +689,8 @@ icmp_reflect(struct mbuf *m) goto done; /* Ip_output() will check for broadcast */ } + m_addr_changed(m); + t = ip->ip_dst; ip->ip_dst = ip->ip_src; Modified: user/eri/pf45/head/sys/netinet/raw_ip.c ============================================================================== --- user/eri/pf45/head/sys/netinet/raw_ip.c Wed Oct 14 20:30:27 2009 (r198099) +++ user/eri/pf45/head/sys/netinet/raw_ip.c Wed Oct 14 21:34:52 2009 (r198100) @@ -89,6 +89,9 @@ VNET_DEFINE(ip_fw_ctl_ptr_t, ip_fw_ctl_p int (*ip_dn_ctl_ptr)(struct sockopt *) = NULL; int (*ip_dn_io_ptr)(struct mbuf **m, int dir, struct ip_fw_args *fwa) = NULL; +/* Hook for telling pf that the destination address changed */ +void (*m_addr_chg_pf_p)(struct mbuf *m); + /* * Hooks for multicast routing. They all default to NULL, so leave them not * initialized and rely on BSS being set to 0. Modified: user/eri/pf45/head/sys/netinet6/icmp6.c ============================================================================== --- user/eri/pf45/head/sys/netinet6/icmp6.c Wed Oct 14 20:30:27 2009 (r198099) +++ user/eri/pf45/head/sys/netinet6/icmp6.c Wed Oct 14 21:34:52 2009 (r198100) @@ -1105,6 +1105,8 @@ icmp6_notify_error(struct mbuf **mp, int ip6cp.ip6c_src = &icmp6src; ip6cp.ip6c_nxt = nxt; + m_addr_changed(m); + if (icmp6type == ICMP6_PACKET_TOO_BIG) { notifymtu = ntohl(icmp6->icmp6_mtu); ip6cp.ip6c_cmdarg = (void *)¬ifymtu; @@ -2227,6 +2229,8 @@ icmp6_reflect(struct mbuf *m, size_t off m->m_flags &= ~(M_BCAST|M_MCAST); + m_addr_changed(m); + ip6_output(m, NULL, NULL, 0, NULL, &outif, NULL); if (outif) icmp6_ifoutstat_inc(outif, type, code); Modified: user/eri/pf45/head/sys/netinet6/in6_gif.c ============================================================================== --- user/eri/pf45/head/sys/netinet6/in6_gif.c Wed Oct 14 20:30:27 2009 (r198099) +++ user/eri/pf45/head/sys/netinet6/in6_gif.c Wed Oct 14 21:34:52 2009 (r198100) @@ -253,6 +253,8 @@ in6_gif_output(struct ifnet *ifp, #endif } + m_addr_changed(m); + #ifdef IPV6_MINMTU /* * force fragmentation to minimum MTU, to avoid path MTU discovery. Modified: user/eri/pf45/head/sys/netipsec/ipsec_input.c ============================================================================== --- user/eri/pf45/head/sys/netipsec/ipsec_input.c Wed Oct 14 20:30:27 2009 (r198099) +++ user/eri/pf45/head/sys/netipsec/ipsec_input.c Wed Oct 14 21:34:52 2009 (r198100) @@ -471,6 +471,7 @@ ipsec4_common_input_cb(struct mbuf *m, s key_sa_recordxfer(sav, m); /* record data transfer */ + m_addr_changed(m); #ifdef DEV_ENC encif->if_ipackets++; encif->if_ibytes += m->m_pkthdr.len; Modified: user/eri/pf45/head/sys/netipsec/ipsec_output.c ============================================================================== --- user/eri/pf45/head/sys/netipsec/ipsec_output.c Wed Oct 14 20:30:27 2009 (r198099) +++ user/eri/pf45/head/sys/netipsec/ipsec_output.c Wed Oct 14 21:34:52 2009 (r198100) @@ -169,6 +169,8 @@ ipsec_process_done(struct mbuf *m, struc } key_sa_recordxfer(sav, m); /* record data transfer */ + m_addr_changed(m); + /* * We're done with IPsec processing, transmit the packet using the * appropriate network protocol (IP or IPv6). SPD lookup will be Modified: user/eri/pf45/head/sys/netipsec/xform_ipip.c ============================================================================== --- user/eri/pf45/head/sys/netipsec/xform_ipip.c Wed Oct 14 20:30:27 2009 (r198099) +++ user/eri/pf45/head/sys/netipsec/xform_ipip.c Wed Oct 14 21:34:52 2009 (r198100) @@ -392,6 +392,8 @@ _ipip_input(struct mbuf *m, int iphlen, panic("%s: bogus ip version %u", __func__, v>>4); } + m_addr_changed(m); + if (netisr_queue(isr, m)) { /* (0) on success. */ V_ipipstat.ipips_qfull++; DPRINTF(("%s: packet dropped because of full queue\n", Modified: user/eri/pf45/head/sys/sys/mbuf.h ============================================================================== --- user/eri/pf45/head/sys/sys/mbuf.h Wed Oct 14 20:30:27 2009 (r198099) +++ user/eri/pf45/head/sys/sys/mbuf.h Wed Oct 14 21:34:52 2009 (r198100) @@ -656,6 +656,14 @@ m_last(struct mbuf *m) return (m); } +extern void (*m_addr_chg_pf_p)(struct mbuf *m); + +static __inline void +m_addr_changed(struct mbuf *m) { + if (m_addr_chg_pf_p) + m_addr_chg_pf_p(m); +} + /* * mbuf, cluster, and external object allocation macros (for compatibility * purposes). From owner-svn-src-user@FreeBSD.ORG Wed Oct 14 21:39:48 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 45A681065679; Wed, 14 Oct 2009 21:39:48 +0000 (UTC) (envelope-from eri@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1C24B8FC0A; Wed, 14 Oct 2009 21:39:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n9ELdl3o049411; Wed, 14 Oct 2009 21:39:47 GMT (envelope-from eri@svn.freebsd.org) Received: (from eri@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9ELdlqg049408; Wed, 14 Oct 2009 21:39:47 GMT (envelope-from eri@svn.freebsd.org) Message-Id: <200910142139.n9ELdlqg049408@svn.freebsd.org> From: Ermal Luçi Date: Wed, 14 Oct 2009 21:39:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r198101 - user/eri/pf45/head/sys/contrib/pf/net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Oct 2009 21:39:48 -0000 Author: eri Date: Wed Oct 14 21:39:47 2009 New Revision: 198101 URL: http://svn.freebsd.org/changeset/base/198101 Log: These functions are not used in FreeBSD(pf_find/pf_get)_divert). Modified: user/eri/pf45/head/sys/contrib/pf/net/pf.c user/eri/pf45/head/sys/contrib/pf/net/pfvar.h Modified: user/eri/pf45/head/sys/contrib/pf/net/pf.c ============================================================================== --- user/eri/pf45/head/sys/contrib/pf/net/pf.c Wed Oct 14 21:34:52 2009 (r198100) +++ user/eri/pf45/head/sys/contrib/pf/net/pf.c Wed Oct 14 21:39:47 2009 (r198101) @@ -336,7 +336,9 @@ void pf_set_rt_ifp(struct pf_state *, struct pf_addr *); int pf_check_proto_cksum(struct mbuf *, int, int, u_int8_t, sa_family_t); +#ifndef __FreeBSD__ struct pf_divert *pf_get_divert(struct mbuf *); +#endif void pf_print_state_parts(struct pf_state *, struct pf_state_key *, struct pf_state_key *); int pf_addr_wrap_neq(struct pf_addr_wrap *, @@ -6358,25 +6360,21 @@ pf_check_proto_cksum(struct mbuf *m, int } #endif +#ifndef __FreeBSD__ struct pf_divert * pf_find_divert(struct mbuf *m) { -#ifdef notyet struct m_tag *mtag; if ((mtag = m_tag_find(m, PACKET_TAG_PF_DIVERT, NULL)) == NULL) return (NULL); return ((struct pf_divert *)(mtag + 1)); -#else - return NULL; -#endif } struct pf_divert * pf_get_divert(struct mbuf *m) { -#ifdef notyet struct m_tag *mtag; if ((mtag = m_tag_find(m, PACKET_TAG_PF_DIVERT, NULL)) == NULL) { @@ -6389,10 +6387,8 @@ pf_get_divert(struct mbuf *m) } return ((struct pf_divert *)(mtag + 1)); -#else - return NULL; -#endif } +#endif #ifdef INET int Modified: user/eri/pf45/head/sys/contrib/pf/net/pfvar.h ============================================================================== --- user/eri/pf45/head/sys/contrib/pf/net/pfvar.h Wed Oct 14 21:34:52 2009 (r198100) +++ user/eri/pf45/head/sys/contrib/pf/net/pfvar.h Wed Oct 14 21:39:47 2009 (r198101) @@ -1928,7 +1928,9 @@ extern void pf_addrcpy(struct pf_addr u_int8_t); void pf_rm_rule(struct pf_rulequeue *, struct pf_rule *); +#ifndef __FreeBSD__ struct pf_divert *pf_find_divert(struct mbuf *); +#endif #ifdef INET #ifdef __FreeBSD__ From owner-svn-src-user@FreeBSD.ORG Wed Oct 14 21:48:29 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 585C21065672; Wed, 14 Oct 2009 21:48:29 +0000 (UTC) (envelope-from eri@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 47F768FC0A; Wed, 14 Oct 2009 21:48:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n9ELmTdK049619; Wed, 14 Oct 2009 21:48:29 GMT (envelope-from eri@svn.freebsd.org) Received: (from eri@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9ELmTK0049618; Wed, 14 Oct 2009 21:48:29 GMT (envelope-from eri@svn.freebsd.org) Message-Id: <200910142148.n9ELmTK0049618@svn.freebsd.org> From: Ermal Luçi Date: Wed, 14 Oct 2009 21:48:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r198102 - user/eri/pf45/head/sys/contrib/pf/net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Oct 2009 21:48:29 -0000 Author: eri Date: Wed Oct 14 21:48:28 2009 New Revision: 198102 URL: http://svn.freebsd.org/changeset/base/198102 Log: No need to virtualize this callback pointers rather the function themselves need to. Modified: user/eri/pf45/head/sys/contrib/pf/net/pf_ioctl.c user/eri/pf45/head/sys/contrib/pf/net/pfvar.h Modified: user/eri/pf45/head/sys/contrib/pf/net/pf_ioctl.c ============================================================================== --- user/eri/pf45/head/sys/contrib/pf/net/pf_ioctl.c Wed Oct 14 21:39:47 2009 (r198101) +++ user/eri/pf45/head/sys/contrib/pf/net/pf_ioctl.c Wed Oct 14 21:48:28 2009 (r198102) @@ -269,18 +269,18 @@ VNET_DEFINE(int, pf_end_threads); struct mtx pf_task_mtx; /* pfsync */ -VNET_DEFINE(pfsync_state_import_t, *pfsync_state_import_ptr); -VNET_DEFINE(pfsync_insert_state_t, *pfsync_insert_state_ptr); -VNET_DEFINE(pfsync_update_state_t, *pfsync_update_state_ptr); -VNET_DEFINE(pfsync_delete_state_t, *pfsync_delete_state_ptr); -VNET_DEFINE(pfsync_clear_states_t, *pfsync_clear_states_ptr); -VNET_DEFINE(pfsync_state_in_use_t, *pfsync_state_in_use_ptr); -VNET_DEFINE(pfsync_defer_t, *pfsync_defer_ptr); -VNET_DEFINE(pfsync_up_t, *pfsync_up_ptr); +pfsync_state_import_t *pfsync_state_import_ptr; +pfsync_insert_state_t *pfsync_insert_state_ptr; +pfsync_update_state_t *pfsync_update_state_ptr; +pfsync_delete_state_t *pfsync_delete_state_ptr; +pfsync_clear_states_t *pfsync_clear_states_ptr; +pfsync_state_in_use_t *pfsync_state_in_use_ptr; +pfsync_defer_t *pfsync_defer_ptr; +pfsync_up_t *pfsync_up_ptr; /* pflow */ -VNET_DEFINE(export_pflow_t, *export_pflow_ptr); +export_pflow_t *export_pflow_ptr; /* pflog */ -VNET_DEFINE(pflog_packet_t, *pflog_packet_ptr); +pflog_packet_t *pflog_packet_ptr; VNET_DEFINE(int, debug_pfugidhack); SYSCTL_VNET_INT(_debug, OID_AUTO, pfugidhack, CTLFLAG_RW, Modified: user/eri/pf45/head/sys/contrib/pf/net/pfvar.h ============================================================================== --- user/eri/pf45/head/sys/contrib/pf/net/pfvar.h Wed Oct 14 21:39:47 2009 (r198101) +++ user/eri/pf45/head/sys/contrib/pf/net/pfvar.h Wed Oct 14 21:48:28 2009 (r198102) @@ -945,22 +945,14 @@ typedef int pfsync_state_in_use_t(struc typedef int pfsync_defer_t(struct pf_state *, struct mbuf *); typedef int pfsync_up_t(void); -VNET_DECLARE(pfsync_state_import_t, *pfsync_state_import_ptr); -#define pfsync_state_import_ptr VNET(pfsync_state_import_ptr) -VNET_DECLARE(pfsync_insert_state_t, *pfsync_insert_state_ptr); -#define pfsync_insert_state_ptr VNET(pfsync_insert_state_ptr) -VNET_DECLARE(pfsync_update_state_t, *pfsync_update_state_ptr); -#define pfsync_update_state_ptr VNET(pfsync_update_state_ptr) -VNET_DECLARE(pfsync_delete_state_t, *pfsync_delete_state_ptr); -#define pfsync_delete_state_ptr VNET(pfsync_delete_state_ptr) -VNET_DECLARE(pfsync_clear_states_t, *pfsync_clear_states_ptr); -#define pfsync_clear_states_ptr VNET(pfsync_clear_states_ptr) -VNET_DECLARE(pfsync_state_in_use_t, *pfsync_state_in_use_ptr); -#define pfsync_state_in_use_ptr VNET(pfsync_state_in_use_ptr) -VNET_DECLARE(pfsync_defer_t, *pfsync_defer_ptr); -#define pfsync_defer_ptr VNET(pfsync_defer_ptr) -VNET_DECLARE(pfsync_up_t, *pfsync_up_ptr); -#define pfsync_up_ptr VNET(pfsync_up_ptr) +extern pfsync_state_import_t *pfsync_state_import_ptr; +extern pfsync_insert_state_t *pfsync_insert_state_ptr; +extern pfsync_update_state_t *pfsync_update_state_ptr; +extern pfsync_delete_state_t *pfsync_delete_state_ptr; +extern pfsync_clear_states_t *pfsync_clear_states_ptr; +extern pfsync_state_in_use_t *pfsync_state_in_use_ptr; +extern pfsync_defer_t *pfsync_defer_ptr; +extern pfsync_up_t *pfsync_up_ptr; void pfsync_state_export(struct pfsync_state *, struct pf_state *); @@ -968,8 +960,7 @@ void pfsync_state_exp /* pflow */ typedef int export_pflow_t(struct pf_state *); -VNET_DECLARE(export_pflow_t, *export_pflow_ptr); -#define export_pflow_ptr VNET(export_pflow_ptr) +extern export_pflow_t *export_pflow_ptr; /* pflog */ struct pf_ruleset; @@ -977,8 +968,8 @@ struct pf_pdesc; typedef int pflog_packet_t(struct pfi_kif *, struct mbuf *, sa_family_t, u_int8_t, u_int8_t, struct pf_rule *, struct pf_rule *, struct pf_ruleset *, struct pf_pdesc *); -VNET_DECLARE(pflog_packet_t, *pflog_packet_ptr); -#define pflog_packet_ptr VNET(pflog_packet_ptr) + +extern pflog_packet_t *pflog_packet_ptr; /* pf uid hack */ #define debug_pfugidhack VNET(debug_pfugidhack) From owner-svn-src-user@FreeBSD.ORG Wed Oct 14 21:54:28 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 28D77106566B; Wed, 14 Oct 2009 21:54:28 +0000 (UTC) (envelope-from eri@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 188F18FC12; Wed, 14 Oct 2009 21:54:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n9ELsRan049749; Wed, 14 Oct 2009 21:54:27 GMT (envelope-from eri@svn.freebsd.org) Received: (from eri@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9ELsRQQ049747; Wed, 14 Oct 2009 21:54:27 GMT (envelope-from eri@svn.freebsd.org) Message-Id: <200910142154.n9ELsRQQ049747@svn.freebsd.org> From: Ermal Luçi Date: Wed, 14 Oct 2009 21:54:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r198103 - user/eri/pf45/head/sys/contrib/pf/net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Oct 2009 21:54:28 -0000 Author: eri Date: Wed Oct 14 21:54:27 2009 New Revision: 198103 URL: http://svn.freebsd.org/changeset/base/198103 Log: Devirtualize even some event handlers. Modified: user/eri/pf45/head/sys/contrib/pf/net/pf_if.c user/eri/pf45/head/sys/contrib/pf/net/pf_ioctl.c Modified: user/eri/pf45/head/sys/contrib/pf/net/pf_if.c ============================================================================== --- user/eri/pf45/head/sys/contrib/pf/net/pf_if.c Wed Oct 14 21:48:28 2009 (r198102) +++ user/eri/pf45/head/sys/contrib/pf/net/pf_if.c Wed Oct 14 21:54:27 2009 (r198103) @@ -99,12 +99,12 @@ int pfi_buffer_cnt; int pfi_buffer_max; #endif #ifdef __FreeBSD__ -VNET_DEFINE(eventhandler_tag, pfi_attach_cookie); -VNET_DEFINE(eventhandler_tag, pfi_detach_cookie); -VNET_DEFINE(eventhandler_tag, pfi_attach_group_cookie); -VNET_DEFINE(eventhandler_tag, pfi_change_group_cookie); -VNET_DEFINE(eventhandler_tag, pfi_detach_group_cookie); -VNET_DEFINE(eventhandler_tag, pfi_ifaddr_event_cookie); +eventhandler_tag pfi_attach_cookie; +eventhandler_tag pfi_detach_cookie; +eventhandler_tag pfi_attach_group_cookie; +eventhandler_tag pfi_change_group_cookie; +eventhandler_tag pfi_detach_group_cookie; +eventhandler_tag pfi_ifaddr_event_cookie; #endif void pfi_kif_update(struct pfi_kif *); Modified: user/eri/pf45/head/sys/contrib/pf/net/pf_ioctl.c ============================================================================== --- user/eri/pf45/head/sys/contrib/pf/net/pf_ioctl.c Wed Oct 14 21:48:28 2009 (r198102) +++ user/eri/pf45/head/sys/contrib/pf/net/pf_ioctl.c Wed Oct 14 21:54:27 2009 (r198103) @@ -269,18 +269,18 @@ VNET_DEFINE(int, pf_end_threads); struct mtx pf_task_mtx; /* pfsync */ -pfsync_state_import_t *pfsync_state_import_ptr; -pfsync_insert_state_t *pfsync_insert_state_ptr; -pfsync_update_state_t *pfsync_update_state_ptr; -pfsync_delete_state_t *pfsync_delete_state_ptr; -pfsync_clear_states_t *pfsync_clear_states_ptr; -pfsync_state_in_use_t *pfsync_state_in_use_ptr; -pfsync_defer_t *pfsync_defer_ptr; -pfsync_up_t *pfsync_up_ptr; +pfsync_state_import_t *pfsync_state_import_ptr = NULL; +pfsync_insert_state_t *pfsync_insert_state_ptr = NULL; +pfsync_update_state_t *pfsync_update_state_ptr = NULL; +pfsync_delete_state_t *pfsync_delete_state_ptr = NULL; +pfsync_clear_states_t *pfsync_clear_states_ptr = NULL; +pfsync_state_in_use_t *pfsync_state_in_use_ptr = NULL; +pfsync_defer_t *pfsync_defer_ptr = NULL; +pfsync_up_t *pfsync_up_ptr = NULL; /* pflow */ -export_pflow_t *export_pflow_ptr; +export_pflow_t *export_pflow_ptr = NULL; /* pflog */ -pflog_packet_t *pflog_packet_ptr; +pflog_packet_t *pflog_packet_ptr = NULL; VNET_DEFINE(int, debug_pfugidhack); SYSCTL_VNET_INT(_debug, OID_AUTO, pfugidhack, CTLFLAG_RW, @@ -3977,32 +3977,8 @@ vnet_pf_init(const void *unused) pf_pfil_hooked = 0; pf_end_threads = 0; - /* pfsync */ - pfsync_state_import_ptr = NULL; - pfsync_insert_state_ptr = NULL; - pfsync_update_state_ptr = NULL; - pfsync_delete_state_ptr = NULL; - pfsync_clear_states_ptr = NULL; - pfsync_state_in_use_ptr = NULL; - pfsync_defer_ptr = NULL; - pfsync_up_ptr = NULL; - /* pflow */ - export_pflow_ptr = NULL; - /* pflog */ - pflog_packet_ptr = NULL; - debug_pfugidhack = 0; -#if 0 - /* XXX: Are they needed here?! */ - pfi_attach_cookie = NULL; - pfi_detach_cookie = NULL; - pfi_attach_group_cookie = NULL; - pfi_change_group_cookie = NULL; - pfi_detach_group_cookie = NULL; - pfi_ifaddr_event_cookie = NULL; -#endif - return (0); } From owner-svn-src-user@FreeBSD.ORG Wed Oct 14 21:56:21 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1C49110656A3; Wed, 14 Oct 2009 21:56:21 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0BF7E8FC22; Wed, 14 Oct 2009 21:56:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n9ELuKL4049940; Wed, 14 Oct 2009 21:56:20 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9ELuKrg049938; Wed, 14 Oct 2009 21:56:20 GMT (envelope-from des@svn.freebsd.org) Message-Id: <200910142156.n9ELuKrg049938@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Wed, 14 Oct 2009 21:56:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r198104 - user/des/svnsup/src/distill X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Oct 2009 21:56:21 -0000 Author: des Date: Wed Oct 14 21:56:20 2009 New Revision: 198104 URL: http://svn.freebsd.org/changeset/base/198104 Log: Reorder to match the header. Modified: user/des/svnsup/src/distill/error.c Modified: user/des/svnsup/src/distill/error.c ============================================================================== --- user/des/svnsup/src/distill/error.c Wed Oct 14 21:54:27 2009 (r198103) +++ user/des/svnsup/src/distill/error.c Wed Oct 14 21:56:20 2009 (r198104) @@ -37,16 +37,17 @@ #include "distill.h" void -svnsup_svn_error(svnsup_where_t *where, svn_error_t *error, const char *fmt, ...) +svnsup_apr_error(svnsup_where_t *where, apr_status_t status, const char *fmt, ...) { + char errbuf[1024]; va_list ap; fprintf(stderr, "svnsup: "); va_start(ap, fmt); vfprintf(stderr, fmt, ap); va_end(ap); - fprintf(stderr, "\n"); - svn_handle_error2(error, stderr, FALSE, "svnsup: "); + apr_strerror(status, errbuf, sizeof(errbuf)); + fprintf(stderr, "\nsvnsup: %s\n", errbuf); if (debug) fprintf(stderr, "svnsup: in %s() on line %d of %s\n", where->func, where->line, where->file); @@ -54,17 +55,16 @@ svnsup_svn_error(svnsup_where_t *where, } void -svnsup_apr_error(svnsup_where_t *where, apr_status_t status, const char *fmt, ...) +svnsup_svn_error(svnsup_where_t *where, svn_error_t *error, const char *fmt, ...) { - char errbuf[1024]; va_list ap; fprintf(stderr, "svnsup: "); va_start(ap, fmt); vfprintf(stderr, fmt, ap); va_end(ap); - apr_strerror(status, errbuf, sizeof(errbuf)); - fprintf(stderr, "\nsvnsup: %s\n", errbuf); + fprintf(stderr, "\n"); + svn_handle_error2(error, stderr, FALSE, "svnsup: "); if (debug) fprintf(stderr, "svnsup: in %s() on line %d of %s\n", where->func, where->line, where->file); From owner-svn-src-user@FreeBSD.ORG Wed Oct 14 22:22:54 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 977581065679; Wed, 14 Oct 2009 22:22:54 +0000 (UTC) (envelope-from eri@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3FF398FC29; Wed, 14 Oct 2009 22:22:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n9EMMr5P050641; Wed, 14 Oct 2009 22:22:53 GMT (envelope-from eri@svn.freebsd.org) Received: (from eri@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9EMMrPn050638; Wed, 14 Oct 2009 22:22:53 GMT (envelope-from eri@svn.freebsd.org) Message-Id: <200910142222.n9EMMrPn050638@svn.freebsd.org> From: Ermal Luçi Date: Wed, 14 Oct 2009 22:22:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r198105 - user/eri/pf45/head/contrib/pf/pfctl X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Oct 2009 22:22:54 -0000 Author: eri Date: Wed Oct 14 22:22:53 2009 New Revision: 198105 URL: http://svn.freebsd.org/changeset/base/198105 Log: Divert socket in FreeBSD is identified only by the port number. Fix the pfctl userland utility to propperly handle this and not complain about the address not specified, etc... Add even a shortcut to the syntax 'divert-to $port' instead of having to type 'divert-to $host port $port'. Make pfctl utitlity complain about divert-reply target it has no meaning in FreeBSD implementation. Modified: user/eri/pf45/head/contrib/pf/pfctl/parse.y user/eri/pf45/head/contrib/pf/pfctl/pfctl_parser.c Modified: user/eri/pf45/head/contrib/pf/pfctl/parse.y ============================================================================== --- user/eri/pf45/head/contrib/pf/pfctl/parse.y Wed Oct 14 21:56:20 2009 (r198104) +++ user/eri/pf45/head/contrib/pf/pfctl/parse.y Wed Oct 14 22:22:53 2009 (r198105) @@ -2220,6 +2220,9 @@ pfrule : action dir logquick interface } free($9.queues.pqname); } +#ifdef __FreeBSD__ + r.divert.port = $9.divert.port; +#else if ((r.divert.port = $9.divert.port)) { if (r.direction == PF_OUT) { if ($9.divert.addr) { @@ -2243,7 +2246,8 @@ pfrule : action dir logquick interface r.divert.addr = $9.divert.addr->addr.v.a.addr; } - } + } +#endif expand_rule(&r, $4, $5.host, $7, $8.src_os, $8.src.host, $8.src.port, $8.dst.host, $8.dst.port, @@ -2360,13 +2364,26 @@ filter_opt : USER uids { } filter_opts.rtableid = $2; } + | DIVERTTO portplain { +#ifdef __FreeBSD__ + filter_opts.divert.port = $2.a; + if (!filter_opts.divert.port) { + yyerror("invalid divert port: %u", ntohs($2.a)); + YYERROR; + } +#endif + } | DIVERTTO STRING PORT portplain { +#ifndef __FreeBSD__ if ((filter_opts.divert.addr = host($2)) == NULL) { yyerror("could not parse divert address: %s", $2); free($2); YYERROR; } +#else + if ($2) +#endif free($2); filter_opts.divert.port = $4.a; if (!filter_opts.divert.port) { @@ -2375,6 +2392,9 @@ filter_opt : USER uids { } } | DIVERTREPLY { +#ifdef __FreeBSD__ + yyerror("divert-reply has no meaning in FreeBSD pf(4)"); +#endif filter_opts.divert.port = 1; /* some random value */ } ; Modified: user/eri/pf45/head/contrib/pf/pfctl/pfctl_parser.c ============================================================================== --- user/eri/pf45/head/contrib/pf/pfctl/pfctl_parser.c Wed Oct 14 21:56:20 2009 (r198104) +++ user/eri/pf45/head/contrib/pf/pfctl/pfctl_parser.c Wed Oct 14 22:22:53 2009 (r198105) @@ -1010,6 +1010,9 @@ print_rule(struct pf_rule *r, const char if (r->rtableid != -1) printf(" rtable %u", r->rtableid); if (r->divert.port) { +#ifdef __FreeBSD__ + printf(" divert-to %u", ntohs(r->divert.port)); +#else if (PF_AZERO(&r->divert.addr, r->af)) { printf(" divert-reply"); } else { @@ -1024,6 +1027,7 @@ print_rule(struct pf_rule *r, const char printf("%s", buf); printf(" port %u", ntohs(r->divert.port)); } +#endif } if (!anchor_call[0] && (r->action == PF_NAT || r->action == PF_BINAT || r->action == PF_RDR)) { From owner-svn-src-user@FreeBSD.ORG Wed Oct 14 22:26:42 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D4E80106566B; Wed, 14 Oct 2009 22:26:42 +0000 (UTC) (envelope-from eri@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C4D9E8FC1D; Wed, 14 Oct 2009 22:26:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n9EMQgf0050750; Wed, 14 Oct 2009 22:26:42 GMT (envelope-from eri@svn.freebsd.org) Received: (from eri@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9EMQgV7050748; Wed, 14 Oct 2009 22:26:42 GMT (envelope-from eri@svn.freebsd.org) Message-Id: <200910142226.n9EMQgV7050748@svn.freebsd.org> From: Ermal Luçi Date: Wed, 14 Oct 2009 22:26:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r198106 - user/eri/pf45/head/contrib/pf/pfctl X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Oct 2009 22:26:42 -0000 Author: eri Date: Wed Oct 14 22:26:42 2009 New Revision: 198106 URL: http://svn.freebsd.org/changeset/base/198106 Log: Handle yyerror propperly. Modified: user/eri/pf45/head/contrib/pf/pfctl/parse.y Modified: user/eri/pf45/head/contrib/pf/pfctl/parse.y ============================================================================== --- user/eri/pf45/head/contrib/pf/pfctl/parse.y Wed Oct 14 22:22:53 2009 (r198105) +++ user/eri/pf45/head/contrib/pf/pfctl/parse.y Wed Oct 14 22:26:42 2009 (r198106) @@ -2394,8 +2394,10 @@ filter_opt : USER uids { | DIVERTREPLY { #ifdef __FreeBSD__ yyerror("divert-reply has no meaning in FreeBSD pf(4)"); -#endif + YYERROR; +#else filter_opts.divert.port = 1; /* some random value */ +#endif } ; From owner-svn-src-user@FreeBSD.ORG Thu Oct 15 00:59:08 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 97989106566B; Thu, 15 Oct 2009 00:59:08 +0000 (UTC) (envelope-from eri@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 85CE48FC1B; Thu, 15 Oct 2009 00:59:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n9F0x8nT054031; Thu, 15 Oct 2009 00:59:08 GMT (envelope-from eri@svn.freebsd.org) Received: (from eri@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9F0x8k9054026; Thu, 15 Oct 2009 00:59:08 GMT (envelope-from eri@svn.freebsd.org) Message-Id: <200910150059.n9F0x8k9054026@svn.freebsd.org> From: Ermal Luçi Date: Thu, 15 Oct 2009 00:59:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r198107 - user/eri/pf45/head/sys/contrib/pf/net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Oct 2009 00:59:08 -0000 Author: eri Date: Thu Oct 15 00:59:08 2009 New Revision: 198107 URL: http://svn.freebsd.org/changeset/base/198107 Log: Honor the rule of virtualization prepend V_ to variables that need it. Modified: user/eri/pf45/head/sys/contrib/pf/net/if_pfsync.c user/eri/pf45/head/sys/contrib/pf/net/pf.c user/eri/pf45/head/sys/contrib/pf/net/pf_if.c user/eri/pf45/head/sys/contrib/pf/net/pf_ioctl.c user/eri/pf45/head/sys/contrib/pf/net/pf_lb.c user/eri/pf45/head/sys/contrib/pf/net/pf_norm.c user/eri/pf45/head/sys/contrib/pf/net/pf_table.c user/eri/pf45/head/sys/contrib/pf/net/pfvar.h Modified: user/eri/pf45/head/sys/contrib/pf/net/if_pfsync.c ============================================================================== --- user/eri/pf45/head/sys/contrib/pf/net/if_pfsync.c Wed Oct 14 22:26:42 2009 (r198106) +++ user/eri/pf45/head/sys/contrib/pf/net/if_pfsync.c Thu Oct 15 00:59:08 2009 (r198107) @@ -593,7 +593,11 @@ pfsync_alloc_scrub_memory(struct pfsync_ struct pf_state_peer *d) { if (s->scrub.scrub_flag && d->scrub == NULL) { +#ifdef __FreeBSD__ + d->scrub = pool_get(&V_pf_state_scrub_pl, PR_NOWAIT | PR_ZERO); +#else d->scrub = pool_get(&pf_state_scrub_pl, PR_NOWAIT | PR_ZERO); +#endif if (d->scrub == NULL) return (ENOMEM); } @@ -717,15 +721,18 @@ pfsync_state_import(struct pfsync_state pool_flags = PR_WAITOK | PR_ZERO; else pool_flags = PR_ZERO; + + if ((st = pool_get(&V_pf_state_pl, pool_flags)) == NULL) + goto cleanup; #else if (flags & PFSYNC_SI_IOCTL) pool_flags = PR_WAITOK | PR_LIMITFAIL | PR_ZERO; else pool_flags = PR_LIMITFAIL | PR_ZERO; -#endif if ((st = pool_get(&pf_state_pl, pool_flags)) == NULL) goto cleanup; +#endif if ((skw = pf_alloc_state_key(pool_flags)) == NULL) goto cleanup; @@ -818,18 +825,33 @@ pfsync_state_import(struct pfsync_state error = ENOMEM; if (skw == sks) sks = NULL; +#ifdef __FreeBSD__ + if (skw != NULL) + pool_put(&V_pf_state_key_pl, skw); + if (sks != NULL) + pool_put(&V_pf_state_key_pl, sks); +#else if (skw != NULL) pool_put(&pf_state_key_pl, skw); if (sks != NULL) pool_put(&pf_state_key_pl, sks); +#endif cleanup_state: /* pf_state_insert frees the state keys */ if (st) { +#ifdef __FreeBSD__ + if (st->dst.scrub) + pool_put(&V_pf_state_scrub_pl, st->dst.scrub); + if (st->src.scrub) + pool_put(&V_pf_state_scrub_pl, st->src.scrub); + pool_put(&V_pf_state_pl, st); +#else if (st->dst.scrub) pool_put(&pf_state_scrub_pl, st->dst.scrub); if (st->src.scrub) pool_put(&pf_state_scrub_pl, st->src.scrub); pool_put(&pf_state_pl, st); +#endif } return (error); } @@ -970,9 +992,15 @@ pfsync_in_clr(struct pfsync_pkt *pkt, st creatorid = clr[i].creatorid; if (clr[i].ifname[0] == '\0') { +#ifdef __FreeBSD__ + for (st = RB_MIN(pf_state_tree_id, &V_tree_id); + st; st = nexts) { + nexts = RB_NEXT(pf_state_tree_id, &V_tree_id, st); +#else for (st = RB_MIN(pf_state_tree_id, &tree_id); st; st = nexts) { nexts = RB_NEXT(pf_state_tree_id, &tree_id, st); +#endif if (st->creatorid == creatorid) { SET(st->state_flags, PFSTATE_NOSYNC); pf_unlink_state(st); @@ -983,10 +1011,18 @@ pfsync_in_clr(struct pfsync_pkt *pkt, st continue; /* XXX correct? */ +#ifdef __FreeBSD__ + for (sk = RB_MIN(pf_state_tree, &V_pf_statetbl); +#else for (sk = RB_MIN(pf_state_tree, &pf_statetbl); +#endif sk; sk = nextsk) { nextsk = RB_NEXT(pf_state_tree, +#ifdef __FreeBSD__ + &V_pf_statetbl, sk); +#else &pf_statetbl, sk); +#endif TAILQ_FOREACH(si, &sk->states, entry) { if (si->s->creatorid == creatorid) { SET(si->s->state_flags, @@ -2808,7 +2844,11 @@ pfsync_bulk_start(void) sc->sc_ureq_received = time_uptime; if (sc->sc_bulk_next == NULL) +#ifdef __FreeBSD__ + sc->sc_bulk_next = TAILQ_FIRST(&V_state_list); +#else sc->sc_bulk_next = TAILQ_FIRST(&state_list); +#endif sc->sc_bulk_last = sc->sc_bulk_next; #ifdef __FreeBSD__ @@ -2844,7 +2884,11 @@ pfsync_bulk_update(void *arg) st = TAILQ_NEXT(st, entry_list); if (st == NULL) +#ifdef __FreeBSD__ + st = TAILQ_FIRST(&V_state_list); +#else st = TAILQ_FIRST(&state_list); +#endif if (i > 0 && TAILQ_EMPTY(&sc->sc_qs[PFSYNC_S_UPD])) { sc->sc_bulk_next = st; Modified: user/eri/pf45/head/sys/contrib/pf/net/pf.c ============================================================================== --- user/eri/pf45/head/sys/contrib/pf/net/pf.c Wed Oct 14 22:26:42 2009 (r198106) +++ user/eri/pf45/head/sys/contrib/pf/net/pf.c Thu Oct 15 00:59:08 2009 (r198107) @@ -166,7 +166,6 @@ __FBSDID("$FreeBSD$"); #include extern int ip_optcopy(struct ip *, struct ip *); -VNET_DECLARE(int, debug_pfugidhack); #endif #ifdef __FreeBSD__ @@ -185,8 +184,8 @@ VNET_DEFINE(struct pf_state_tree, pf_st VNET_DEFINE(struct pf_altqqueue, pf_altqs[2]); VNET_DEFINE(struct pf_palist, pf_pabuf); -VNET_DEFINE(struct pf_altqqueue, *pf_altqs_active); -VNET_DEFINE(struct pf_altqqueue, *pf_altqs_inactive); +VNET_DEFINE(struct pf_altqqueue *, pf_altqs_active); +VNET_DEFINE(struct pf_altqqueue *, pf_altqs_inactive); VNET_DEFINE(struct pf_status, pf_status); VNET_DEFINE(u_int32_t, ticket_altqs_active); @@ -195,9 +194,13 @@ VNET_DEFINE(int, altqs_inactive_open) VNET_DEFINE(u_int32_t, ticket_pabuf); VNET_DEFINE(MD5_CTX, pf_tcp_secret_ctx); +#define V_pf_tcp_secret_ctx VNET(pf_tcp_secret_ctx) VNET_DEFINE(u_char, pf_tcp_secret[16]); +#define V_pf_tcp_secret VNET(pf_tcp_secret) VNET_DEFINE(int, pf_tcp_secret_init); +#define V_pf_tcp_secret_init VNET(pf_tcp_secret_init) VNET_DEFINE(int, pf_tcp_iss_off); +#define V_pf_tcp_iss_off VNET(pf_tcp_iss_off) struct pf_anchor_stackframe { struct pf_ruleset *rs; @@ -206,6 +209,7 @@ struct pf_anchor_stackframe { struct pf_anchor *child; }; VNET_DEFINE(struct pf_anchor_stackframe, pf_anchor_stack[64]); +#define V_pf_anchor_stack VNET(pf_anchor_stack) VNET_DEFINE(uma_zone_t, pf_src_tree_pl); VNET_DEFINE(uma_zone_t, pf_rule_pl); @@ -414,8 +418,13 @@ struct pf_pool_limit pf_pool_limits[PF_L } while (0) #endif +#ifdef __FreeBSD__ +#define BOUND_IFACE(r, k) \ + ((r)->rule_flag & PFRULE_IFBOUND) ? (k) : V_pfi_all +#else #define BOUND_IFACE(r, k) \ ((r)->rule_flag & PFRULE_IFBOUND) ? (k) : pfi_all +#endif #define STATE_INC_COUNTERS(s) \ do { \ @@ -633,10 +642,11 @@ pf_src_connlimit(struct pf_state **state #ifdef __FreeBSD__ V_pf_status.lcounters[LCNT_OVERLOAD_FLUSH]++; + RB_FOREACH(st, pf_state_tree_id, &V_tree_id) { #else pf_status.lcounters[LCNT_OVERLOAD_FLUSH]++; -#endif RB_FOREACH(st, pf_state_tree_id, &tree_id) { +#endif sk = st->key[PF_SK_WIRE]; /* * Kill states from this source. (Only those @@ -697,15 +707,20 @@ pf_insert_src_node(struct pf_src_node ** k.rule.ptr = NULL; #ifdef __FreeBSD__ V_pf_status.scounters[SCNT_SRC_NODE_SEARCH]++; + *sn = RB_FIND(pf_src_tree, &V_tree_src_tracking, &k); #else pf_status.scounters[SCNT_SRC_NODE_SEARCH]++; -#endif *sn = RB_FIND(pf_src_tree, &tree_src_tracking, &k); +#endif } if (*sn == NULL) { if (!rule->max_src_nodes || rule->src_nodes < rule->max_src_nodes) +#ifdef __FreeBSD__ + (*sn) = pool_get(&V_pf_src_tree_pl, PR_NOWAIT | PR_ZERO); +#else (*sn) = pool_get(&pf_src_tree_pl, PR_NOWAIT | PR_ZERO); +#endif else #ifdef __FreeBSD__ V_pf_status.lcounters[LCNT_SRCNODES]++; @@ -727,17 +742,22 @@ pf_insert_src_node(struct pf_src_node ** (*sn)->rule.ptr = NULL; PF_ACPY(&(*sn)->addr, src, af); if (RB_INSERT(pf_src_tree, - &tree_src_tracking, *sn) != NULL) { #ifdef __FreeBSD__ + &V_tree_src_tracking, *sn) != NULL) { if (V_pf_status.debug >= PF_DEBUG_MISC) { #else + &tree_src_tracking, *sn) != NULL) { if (pf_status.debug >= PF_DEBUG_MISC) { #endif printf("pf: src_tree insert failed: "); pf_print_host(&(*sn)->addr, 0, af); printf("\n"); } +#ifdef __FreeBSD__ + pool_put(&V_pf_src_tree_pl, *sn); +#else pool_put(&pf_src_tree_pl, *sn); +#endif return (-1); } (*sn)->creation = time_second; @@ -863,7 +883,11 @@ pf_state_key_attach(struct pf_state_key KASSERT(s->key[idx] == NULL); /* XXX handle this? */ #endif +#ifdef __FreeBSD__ + if ((cur = RB_INSERT(pf_state_tree, &V_pf_statetbl, sk)) != NULL) { +#else if ((cur = RB_INSERT(pf_state_tree, &pf_statetbl, sk)) != NULL) { +#endif /* key exists. check for same kif, if none, add to key */ TAILQ_FOREACH(si, &cur->states, entry) if (si->s->kif == s->kif && @@ -899,23 +923,39 @@ pf_state_key_attach(struct pf_state_key sk : NULL); printf("\n"); } +#ifdef __FreeBSD__ + pool_put(&V_pf_state_key_pl, sk); +#else pool_put(&pf_state_key_pl, sk); +#endif return (-1); /* collision! */ } } +#ifdef __FreeBSD__ + pool_put(&V_pf_state_key_pl, sk); +#else pool_put(&pf_state_key_pl, sk); +#endif s->key[idx] = cur; } else s->key[idx] = sk; +#ifdef __FreeBSD__ + if ((si = pool_get(&V_pf_state_item_pl, PR_NOWAIT)) == NULL) { +#else if ((si = pool_get(&pf_state_item_pl, PR_NOWAIT)) == NULL) { +#endif pf_state_key_detach(s, idx); return (-1); } si->s = s; /* list is sorted, if-bound states before floating */ +#ifdef __FreeBSD__ + if (s->kif == V_pfi_all) +#else if (s->kif == pfi_all) +#endif TAILQ_INSERT_TAIL(&s->key[idx]->states, si, entry); else TAILQ_INSERT_HEAD(&s->key[idx]->states, si, entry); @@ -950,11 +990,19 @@ pf_state_key_detach(struct pf_state *s, if (si) { TAILQ_REMOVE(&s->key[idx]->states, si, entry); +#ifdef __FreeBSD__ + pool_put(&V_pf_state_item_pl, si); +#else pool_put(&pf_state_item_pl, si); +#endif } if (TAILQ_EMPTY(&s->key[idx]->states)) { +#ifdef __FreeBSD__ + RB_REMOVE(pf_state_tree, &V_pf_statetbl, s->key[idx]); +#else RB_REMOVE(pf_state_tree, &pf_statetbl, s->key[idx]); +#endif if (s->key[idx]->reverse) s->key[idx]->reverse->reverse = NULL; #ifdef __FreeBSD__ @@ -963,7 +1011,11 @@ pf_state_key_detach(struct pf_state *s, if (s->key[idx]->inp) s->key[idx]->inp->inp_pf_sk = NULL; #endif +#ifdef __FreeBSD__ + pool_put(&V_pf_state_key_pl, s->key[idx]); +#else pool_put(&pf_state_key_pl, s->key[idx]); +#endif } s->key[idx] = NULL; } @@ -973,7 +1025,11 @@ pf_alloc_state_key(int pool_flags) { struct pf_state_key *sk; +#ifdef __FreeBSD__ + if ((sk = pool_get(&V_pf_state_key_pl, pool_flags)) == NULL) +#else if ((sk = pool_get(&pf_state_key_pl, pool_flags)) == NULL) +#endif return (NULL); TAILQ_INIT(&sk->states); @@ -1045,7 +1101,11 @@ pf_state_insert(struct pfi_kif *kif, str s->key[PF_SK_STACK] = s->key[PF_SK_WIRE]; } else { if (pf_state_key_attach(skw, s, PF_SK_WIRE)) { +#ifdef __FreeBSD__ + pool_put(&V_pf_state_key_pl, sks); +#else pool_put(&pf_state_key_pl, sks); +#endif return (-1); } if (pf_state_key_attach(sks, s, PF_SK_STACK)) { @@ -1063,10 +1123,11 @@ pf_state_insert(struct pfi_kif *kif, str s->creatorid = pf_status.hostid; #endif } - if (RB_INSERT(pf_state_tree_id, &tree_id, s) != NULL) { #ifdef __FreeBSD__ + if (RB_INSERT(pf_state_tree_id, &V_tree_id, s) != NULL) { if (V_pf_status.debug >= PF_DEBUG_MISC) { #else + if (RB_INSERT(pf_state_tree_id, &tree_id, s) != NULL) { if (pf_status.debug >= PF_DEBUG_MISC) { #endif printf("pf: state insert failed: " @@ -1077,11 +1138,12 @@ pf_state_insert(struct pfi_kif *kif, str pf_detach_state(s); return (-1); } - TAILQ_INSERT_TAIL(&state_list, s, entry_list); #ifdef __FreeBSD__ + TAILQ_INSERT_TAIL(&V_state_list, s, entry_list); V_pf_status.fcounters[FCNT_STATE_INSERT]++; V_pf_status.states++; #else + TAILQ_INSERT_TAIL(&state_list, s, entry_list); pf_status.fcounters[FCNT_STATE_INSERT]++; pf_status.states++; #endif @@ -1102,11 +1164,13 @@ pf_find_state_byid(struct pf_state_cmp * { #ifdef __FreeBSD__ V_pf_status.fcounters[FCNT_STATE_SEARCH]++; + + return (RB_FIND(pf_state_tree_id, &V_tree_id, (struct pf_state *)key)); #else pf_status.fcounters[FCNT_STATE_SEARCH]++; -#endif return (RB_FIND(pf_state_tree_id, &tree_id, (struct pf_state *)key)); +#endif } /* XXX debug function, intended to be removed one day */ @@ -1163,7 +1227,11 @@ pf_find_state(struct pfi_kif *kif, struc ((struct pf_state_key *)pftag->statekey)->reverse) sk = ((struct pf_state_key *)pftag->statekey)->reverse; else { +#ifdef __FreeBSD__ + if ((sk = RB_FIND(pf_state_tree, &V_pf_statetbl, +#else if ((sk = RB_FIND(pf_state_tree, &pf_statetbl, +#endif (struct pf_state_key *)key)) == NULL) return (NULL); if (dir == PF_OUT && pftag->statekey && @@ -1179,7 +1247,11 @@ pf_find_state(struct pfi_kif *kif, struc ((struct pf_state_key *)m->m_pkthdr.pf.statekey)->reverse) sk = ((struct pf_state_key *)m->m_pkthdr.pf.statekey)->reverse; else { +#ifdef __FreeBSD__ + if ((sk = RB_FIND(pf_state_tree, &V_pf_statetbl, +#else if ((sk = RB_FIND(pf_state_tree, &pf_statetbl, +#endif (struct pf_state_key *)key)) == NULL) return (NULL); if (dir == PF_OUT && m->m_pkthdr.pf.statekey && @@ -1201,7 +1273,11 @@ pf_find_state(struct pfi_kif *kif, struc /* list is sorted, if-bound states before floating ones */ TAILQ_FOREACH(si, &sk->states, entry) +#ifdef __FreeBSD__ + if ((si->s->kif == V_pfi_all || si->s->kif == kif) && +#else if ((si->s->kif == pfi_all || si->s->kif == kif) && +#endif sk == (dir == PF_IN ? si->s->key[PF_SK_WIRE] : si->s->key[PF_SK_STACK])) return (si->s); @@ -1221,8 +1297,11 @@ pf_find_state_all(struct pf_state_key_cm pf_status.fcounters[FCNT_STATE_SEARCH]++; #endif +#ifdef __FreeBSD__ + sk = RB_FIND(pf_state_tree, &V_pf_statetbl, (struct pf_state_key *)key); +#else sk = RB_FIND(pf_state_tree, &pf_statetbl, (struct pf_state_key *)key); - +#endif if (sk != NULL) { TAILQ_FOREACH(si, &sk->states, entry) if (dir == PF_INOUT || @@ -1255,25 +1334,22 @@ pf_purge_thread(void *v) tsleep(pf_purge_thread, PWAIT, "pftm", 1 * hz); #ifdef __FreeBSD__ - sx_slock(&pf_consistency_lock); + sx_slock(&V_pf_consistency_lock); PF_LOCK(); locked = 0; - if (pf_end_threads) { + if (V_pf_end_threads) { PF_UNLOCK(); - sx_sunlock(&pf_consistency_lock); - sx_xlock(&pf_consistency_lock); + sx_sunlock(&V_pf_consistency_lock); + sx_xlock(&V_pf_consistency_lock); PF_LOCK(); -#ifdef __FreeBSD__ + pf_purge_expired_states(V_pf_status.states, 1); -#else - pf_purge_expired_states(pf_status.states, 1); -#endif pf_purge_expired_fragments(); pf_purge_expired_src_nodes(1); - pf_end_threads++; + V_pf_end_threads++; - sx_xunlock(&pf_consistency_lock); + sx_xunlock(&V_pf_consistency_lock); PF_UNLOCK(); wakeup(pf_purge_thread); kproc_exit(0); @@ -1284,15 +1360,15 @@ pf_purge_thread(void *v) /* process a fraction of the state table every second */ #ifdef __FreeBSD__ if(!pf_purge_expired_states(1 + (V_pf_status.states - / pf_default_rule.timeout[PFTM_INTERVAL]), 0)) { + / V_pf_default_rule.timeout[PFTM_INTERVAL]), 0)) { PF_UNLOCK(); - sx_sunlock(&pf_consistency_lock); - sx_xlock(&pf_consistency_lock); + sx_sunlock(&V_pf_consistency_lock); + sx_xlock(&V_pf_consistency_lock); PF_LOCK(); locked = 1; pf_purge_expired_states(1 + (V_pf_status.states - / pf_default_rule.timeout[PFTM_INTERVAL]), 1); + / V_pf_default_rule.timeout[PFTM_INTERVAL]), 1); } #else pf_purge_expired_states(1 + (pf_status.states @@ -1300,7 +1376,11 @@ pf_purge_thread(void *v) #endif /* purge other expired types every PFTM_INTERVAL seconds */ +#ifdef __FreeBSD__ + if (++nloops >= V_pf_default_rule.timeout[PFTM_INTERVAL]) { +#else if (++nloops >= pf_default_rule.timeout[PFTM_INTERVAL]) { +#endif pf_purge_expired_fragments(); pf_purge_expired_src_nodes(0); nloops = 0; @@ -1310,9 +1390,9 @@ pf_purge_thread(void *v) #ifdef __FreeBSD__ PF_UNLOCK(); if (locked) - sx_xunlock(&pf_consistency_lock); + sx_xunlock(&V_pf_consistency_lock); else - sx_sunlock(&pf_consistency_lock); + sx_sunlock(&V_pf_consistency_lock); #endif } } @@ -1341,17 +1421,23 @@ pf_state_expires(const struct pf_state * #endif timeout = state->rule.ptr->timeout[state->timeout]; if (!timeout) +#ifdef __FreeBSD__ + timeout = V_pf_default_rule.timeout[state->timeout]; +#else timeout = pf_default_rule.timeout[state->timeout]; +#endif start = state->rule.ptr->timeout[PFTM_ADAPTIVE_START]; if (start) { end = state->rule.ptr->timeout[PFTM_ADAPTIVE_END]; states = state->rule.ptr->states_cur; } else { - start = pf_default_rule.timeout[PFTM_ADAPTIVE_START]; - end = pf_default_rule.timeout[PFTM_ADAPTIVE_END]; #ifdef __FreeBSD__ + start = V_pf_default_rule.timeout[PFTM_ADAPTIVE_START]; + end = V_pf_default_rule.timeout[PFTM_ADAPTIVE_END]; states = V_pf_status.states; #else + start = pf_default_rule.timeout[PFTM_ADAPTIVE_START]; + end = pf_default_rule.timeout[PFTM_ADAPTIVE_END]; states = pf_status.states; #endif } @@ -1376,19 +1462,28 @@ pf_purge_expired_src_nodes(int waslocked struct pf_src_node *cur, *next; int locked = waslocked; +#ifdef __FreeBSD__ + for (cur = RB_MIN(pf_src_tree, &V_tree_src_tracking); cur; cur = next) { + next = RB_NEXT(pf_src_tree, &V_tree_src_tracking, cur); +#else for (cur = RB_MIN(pf_src_tree, &tree_src_tracking); cur; cur = next) { next = RB_NEXT(pf_src_tree, &tree_src_tracking, cur); +#endif if (cur->states <= 0 && cur->expire <= time_second) { if (! locked) { #ifdef __FreeBSD__ - if (!sx_try_upgrade(&pf_consistency_lock)) + if (!sx_try_upgrade(&V_pf_consistency_lock)) return (0); #else rw_enter_write(&pf_consistency_lock); #endif next = RB_NEXT(pf_src_tree, +#ifdef __FreeBSD__ + &V_tree_src_tracking, cur); +#else &tree_src_tracking, cur); +#endif locked = 1; } if (cur->rule.ptr != NULL) { @@ -1397,22 +1492,24 @@ pf_purge_expired_src_nodes(int waslocked cur->rule.ptr->max_src_nodes <= 0) pf_rm_rule(NULL, cur->rule.ptr); } - RB_REMOVE(pf_src_tree, &tree_src_tracking, cur); #ifdef __FreeBSD__ + RB_REMOVE(pf_src_tree, &V_tree_src_tracking, cur); V_pf_status.scounters[SCNT_SRC_NODE_REMOVALS]++; V_pf_status.src_nodes--; + pool_put(&V_pf_src_tree_pl, cur); #else + RB_REMOVE(pf_src_tree, &tree_src_tracking, cur); pf_status.scounters[SCNT_SRC_NODE_REMOVALS]++; pf_status.src_nodes--; -#endif pool_put(&pf_src_tree_pl, cur); +#endif } } if (locked && !waslocked) #ifdef __FreeBSD__ { - sx_downgrade(&pf_consistency_lock); + sx_downgrade(&V_pf_consistency_lock); } return (1); #else @@ -1432,7 +1529,11 @@ pf_src_tree_remove_state(struct pf_state timeout = s->rule.ptr->timeout[PFTM_SRC_NODE]; if (!timeout) timeout = +#ifdef __FreeBSD__ + V_pf_default_rule.timeout[PFTM_SRC_NODE]; +#else pf_default_rule.timeout[PFTM_SRC_NODE]; +#endif s->src_node->expire = time_second + timeout; } } @@ -1441,7 +1542,11 @@ pf_src_tree_remove_state(struct pf_state timeout = s->rule.ptr->timeout[PFTM_SRC_NODE]; if (!timeout) timeout = +#ifdef __FreeBSD__ + V_pf_default_rule.timeout[PFTM_SRC_NODE]; +#else pf_default_rule.timeout[PFTM_SRC_NODE]; +#endif s->nat_src_node->expire = time_second + timeout; } } @@ -1474,7 +1579,11 @@ pf_unlink_state(struct pf_state *cur) cur->src.seqhi, cur->src.seqlo + 1, TH_RST|TH_ACK, 0, 0, 0, 1, cur->tag, NULL, NULL); } +#ifdef __FreeBSD__ + RB_REMOVE(pf_state_tree_id, &V_tree_id, cur); +#else RB_REMOVE(pf_state_tree_id, &tree_id, cur); +#endif #if NPFLOW > 0 if (cur->state_flags & PFSTATE_PFLOW) #ifdef __FreeBSD__ @@ -1533,14 +1642,19 @@ pf_free_state(struct pf_state *cur) pf_rm_rule(NULL, cur->anchor.ptr); pf_normalize_tcp_cleanup(cur); pfi_kif_unref(cur->kif, PFI_KIF_REF_STATE); +#ifdef __FreeBSD__ + TAILQ_REMOVE(&V_state_list, cur, entry_list); +#else TAILQ_REMOVE(&state_list, cur, entry_list); +#endif if (cur->tag) pf_tag_unref(cur->tag); - pool_put(&pf_state_pl, cur); #ifdef __FreeBSD__ + pool_put(&V_pf_state_pl, cur); V_pf_status.fcounters[FCNT_STATE_REMOVALS]++; V_pf_status.states--; #else + pool_put(&pf_state_pl, cur); pf_status.fcounters[FCNT_STATE_REMOVALS]++; pf_status.states--; #endif @@ -1565,7 +1679,11 @@ pf_purge_expired_states(u_int32_t maxche while (maxcheck--) { /* wrap to start of list when we hit the end */ if (cur == NULL) { +#ifdef __FreeBSD__ + cur = TAILQ_FIRST(&V_state_list); +#else cur = TAILQ_FIRST(&state_list); +#endif if (cur == NULL) break; /* list empty */ } @@ -1577,7 +1695,7 @@ pf_purge_expired_states(u_int32_t maxche /* free unlinked state */ if (! locked) { #ifdef __FreeBSD__ - if (!sx_try_upgrade(&pf_consistency_lock)) + if (!sx_try_upgrade(&V_pf_consistency_lock)) return (0); #else rw_enter_write(&pf_consistency_lock); @@ -1590,7 +1708,7 @@ pf_purge_expired_states(u_int32_t maxche pf_unlink_state(cur); if (! locked) { #ifdef __FreeBSD__ - if (!sx_try_upgrade(&pf_consistency_lock)) + if (!sx_try_upgrade(&V_pf_consistency_lock)) return (0); #else rw_enter_write(&pf_consistency_lock); @@ -1604,7 +1722,7 @@ pf_purge_expired_states(u_int32_t maxche #ifdef __FreeBSD__ if (!waslocked && locked) - sx_downgrade(&pf_consistency_lock); + sx_downgrade(&V_pf_consistency_lock); return (1); #else @@ -2665,14 +2783,23 @@ pf_step_into_anchor(int *depth, struct p (*r)->anchor->match = 0; if (match) *match = 0; +#ifdef __FreeBSD__ + if (*depth >= sizeof(V_pf_anchor_stack) / + sizeof(V_pf_anchor_stack[0])) { +#else if (*depth >= sizeof(pf_anchor_stack) / sizeof(pf_anchor_stack[0])) { +#endif printf("pf_step_into_anchor: stack overflow\n"); *r = TAILQ_NEXT(*r, entries); return; } else if (*depth == 0 && a != NULL) *a = *r; +#ifdef __FreeBSD__ + f = V_pf_anchor_stack + (*depth)++; +#else f = pf_anchor_stack + (*depth)++; +#endif f->rs = *rs; f->r = *r; if ((*r)->anchor_wildcard) { @@ -2701,7 +2828,11 @@ pf_step_out_of_anchor(int *depth, struct do { if (*depth <= 0) break; +#ifdef __FreeBSD__ + f = V_pf_anchor_stack + *depth - 1; +#else f = pf_anchor_stack + *depth - 1; +#endif if (f->parent != NULL && f->child != NULL) { if (f->child->match || (match != NULL && *match)) { @@ -3106,18 +3237,27 @@ pf_tcp_iss(struct pf_pdesc *pd) MD5_CTX ctx; u_int32_t digest[4]; - if (pf_tcp_secret_init == 0) { #ifdef __FreeBSD__ - read_random(&pf_tcp_secret, sizeof(pf_tcp_secret)); + if (V_pf_tcp_secret_init == 0) { + read_random(&V_pf_tcp_secret, sizeof(pf_tcp_secret)); + MD5Init(&V_pf_tcp_secret_ctx); + MD5Update(&V_pf_tcp_secret_ctx, V_pf_tcp_secret, + sizeof(pf_tcp_secret)); + V_pf_tcp_secret_init = 1; + } + + ctx = V_pf_tcp_secret_ctx; #else + if (pf_tcp_secret_init == 0) { arc4random_buf(pf_tcp_secret, sizeof(pf_tcp_secret)); -#endif MD5Init(&pf_tcp_secret_ctx); MD5Update(&pf_tcp_secret_ctx, pf_tcp_secret, sizeof(pf_tcp_secret)); pf_tcp_secret_init = 1; } + ctx = pf_tcp_secret_ctx; +#endif MD5Update(&ctx, (char *)&pd->hdr.tcp->th_sport, sizeof(u_short)); MD5Update(&ctx, (char *)&pd->hdr.tcp->th_dport, sizeof(u_short)); @@ -3129,13 +3269,14 @@ pf_tcp_iss(struct pf_pdesc *pd) MD5Update(&ctx, (char *)&pd->dst->v4, sizeof(struct in_addr)); } MD5Final((u_char *)digest, &ctx); - pf_tcp_iss_off += 4096; #ifdef __FreeBSD__ + V_pf_tcp_iss_off += 4096; #define ISN_RANDOM_INCREMENT (4096 - 1) return (digest[0] + (arc4random() & ISN_RANDOM_INCREMENT) + - pf_tcp_iss_off); + V_pf_tcp_iss_off); #undef ISN_RANDOM_INCREMENT #else + pf_tcp_iss_off += 4096; return (digest[0] + tcp_iss + pf_tcp_iss_off); #endif } @@ -3183,7 +3324,7 @@ pf_test_rule(struct pf_rule **rm, struct #ifdef __FreeBSD__ if (inp != NULL) pd->lookup.done = pf_socket_lookup(direction, pd, inp); - else if (debug_pfugidhack) { + else if (V_debug_pfugidhack) { PF_UNLOCK(); DPFPRINTF(PF_DEBUG_MISC, ("pf: unlocked lookup\n")); pd->lookup.done = pf_socket_lookup(direction, pd, inp); @@ -3566,10 +3707,17 @@ pf_test_rule(struct pf_rule **rm, struct if (action != PF_PASS) return (action); } else { +#ifdef __FreeBSD__ + if (sk != NULL) + pool_put(&V_pf_state_key_pl, sk); + if (nk != NULL) + pool_put(&V_pf_state_key_pl, nk); +#else if (sk != NULL) pool_put(&pf_state_key_pl, sk); if (nk != NULL) pool_put(&pf_state_key_pl, nk); +#endif } /* copy back packet headers if we performed NAT operations */ @@ -3602,10 +3750,17 @@ pf_test_rule(struct pf_rule **rm, struct return (PF_PASS); cleanup: +#ifdef __FreeBSD__ + if (sk != NULL) + pool_put(&V_pf_state_key_pl, sk); + if (nk != NULL) + pool_put(&V_pf_state_key_pl, nk); +#else if (sk != NULL) pool_put(&pf_state_key_pl, sk); if (nk != NULL) pool_put(&pf_state_key_pl, nk); +#endif return (PF_DROP); } @@ -3646,7 +3801,11 @@ pf_create_state(struct pf_rule *r, struc REASON_SET(&reason, PFRES_SRCLIMIT); goto csfailed; } +#ifdef __FreeBSD__ + s = pool_get(&V_pf_state_pl, PR_NOWAIT | PR_ZERO); +#else s = pool_get(&pf_state_pl, PR_NOWAIT | PR_ZERO); +#endif if (s == NULL) { REASON_SET(&reason, PFRES_MEMORY); goto csfailed; @@ -3737,7 +3896,11 @@ pf_create_state(struct pf_rule *r, struc REASON_SET(&reason, PFRES_MEMORY); pf_src_tree_remove_state(s); STATE_DEC_COUNTERS(s); +#ifdef __FreeBSD__ + pool_put(&V_pf_state_pl, s); +#else pool_put(&pf_state_pl, s); +#endif return (PF_DROP); } if ((pd->flags & PFDESC_TCP_NORM) && s->src.scrub && @@ -3749,7 +3912,11 @@ pf_create_state(struct pf_rule *r, struc pf_normalize_tcp_cleanup(s); pf_src_tree_remove_state(s); STATE_DEC_COUNTERS(s); +#ifdef __FreeBSD__ + pool_put(&V_pf_state_pl, s); +#else pool_put(&pf_state_pl, s); +#endif return (PF_DROP); } } @@ -3765,7 +3932,11 @@ pf_create_state(struct pf_rule *r, struc REASON_SET(&reason, PFRES_STATEINS); pf_src_tree_remove_state(s); STATE_DEC_COUNTERS(s); +#ifdef __FreeBSD__ + pool_put(&V_pf_state_pl, s); +#else pool_put(&pf_state_pl, s); +#endif return (PF_DROP); } else *sm = s; @@ -3815,32 +3986,43 @@ pf_create_state(struct pf_rule *r, struc return (PF_PASS); csfailed: +#ifdef __FreeBSD__ + if (sk != NULL) + pool_put(&V_pf_state_key_pl, sk); + if (nk != NULL) + pool_put(&V_pf_state_key_pl, nk); +#else if (sk != NULL) pool_put(&pf_state_key_pl, sk); if (nk != NULL) pool_put(&pf_state_key_pl, nk); +#endif if (sn != NULL && sn->states == 0 && sn->expire == 0) { - RB_REMOVE(pf_src_tree, &tree_src_tracking, sn); #ifdef __FreeBSD__ + RB_REMOVE(pf_src_tree, &V_tree_src_tracking, sn); V_pf_status.scounters[SCNT_SRC_NODE_REMOVALS]++; V_pf_status.src_nodes--; + pool_put(&V_pf_src_tree_pl, sn); #else + RB_REMOVE(pf_src_tree, &tree_src_tracking, sn); pf_status.scounters[SCNT_SRC_NODE_REMOVALS]++; pf_status.src_nodes--; -#endif pool_put(&pf_src_tree_pl, sn); +#endif } if (nsn != sn && nsn != NULL && nsn->states == 0 && nsn->expire == 0) { - RB_REMOVE(pf_src_tree, &tree_src_tracking, nsn); #ifdef __FreeBSD__ + RB_REMOVE(pf_src_tree, &V_tree_src_tracking, nsn); V_pf_status.scounters[SCNT_SRC_NODE_REMOVALS]++; V_pf_status.src_nodes--; + pool_put(&V_pf_src_tree_pl, nsn); #else + RB_REMOVE(pf_src_tree, &tree_src_tracking, nsn); pf_status.scounters[SCNT_SRC_NODE_REMOVALS]++; pf_status.src_nodes--; -#endif pool_put(&pf_src_tree_pl, nsn); +#endif } return (PF_DROP); } @@ -6406,10 +6588,11 @@ pf_test(int dir, struct ifnet *ifp, stru #ifdef __FreeBSD__ struct ip *h = NULL; struct m_tag *dvtag; + struct pf_rule *a = NULL, *r = &V_pf_default_rule, *tr, *nr; #else struct ip *h; -#endif struct pf_rule *a = NULL, *r = &pf_default_rule, *tr, *nr; +#endif struct pf_state *s = NULL; struct pf_ruleset *ruleset = NULL; struct pf_pdesc pd; @@ -6835,7 +7018,11 @@ done: } tr = r; nr = (s != NULL) ? s->nat_rule.ptr : pd.nat_rule; +#ifdef __FreeBSD__ + if (nr != NULL && r == &V_pf_default_rule) +#else if (nr != NULL && r == &pf_default_rule) +#endif tr = nr; if (tr->src.addr.type == PF_ADDR_TABLE) pfr_update_stats(tr->src.addr.p.tbl, @@ -6888,10 +7075,11 @@ pf_test6(int dir, struct ifnet *ifp, str struct mbuf *m = *m0, *n = NULL; #ifdef __FreeBSD__ struct ip6_hdr *h = NULL; + struct pf_rule *a = NULL, *r = &V_pf_default_rule, *tr, *nr; #else struct ip6_hdr *h; -#endif struct pf_rule *a = NULL, *r = &pf_default_rule, *tr, *nr; +#endif struct pf_state *s = NULL; struct pf_ruleset *ruleset = NULL; struct pf_pdesc pd; @@ -7336,7 +7524,11 @@ done: } tr = r; nr = (s != NULL) ? s->nat_rule.ptr : pd.nat_rule; +#ifdef __FreeBSD__ + if (nr != NULL && r == &V_pf_default_rule) +#else if (nr != NULL && r == &pf_default_rule) +#endif tr = nr; if (tr->src.addr.type == PF_ADDR_TABLE) pfr_update_stats(tr->src.addr.p.tbl, Modified: user/eri/pf45/head/sys/contrib/pf/net/pf_if.c ============================================================================== --- user/eri/pf45/head/sys/contrib/pf/net/pf_if.c Wed Oct 14 22:26:42 2009 (r198106) +++ user/eri/pf45/head/sys/contrib/pf/net/pf_if.c Thu Oct 15 00:59:08 2009 (r198107) @@ -77,18 +77,18 @@ __FBSDID("$FreeBSD$"); #endif /* INET6 */ #ifdef __FreeBSD__ -VNET_DEFINE(struct pfi_kif, *pfi_all); +VNET_DEFINE(struct pfi_kif *, pfi_all); VNET_DEFINE(uma_zone_t, pfi_addr_pl); VNET_DEFINE(struct pfi_ifhead, pfi_ifs); -#define pfi_ifs VNET(pfi_ifs) +#define V_pfi_ifs VNET(pfi_ifs) VNET_DEFINE(long, pfi_update); -#define pfi_update VNET(pfi_update) -VNET_DEFINE(struct pfr_addr, *pfi_buffer); -#define pfi_buffer VNET(pfi_buffer) +#define V_pfi_update VNET(pfi_update) +VNET_DEFINE(struct pfr_addr *, pfi_buffer); +#define V_pfi_buffer VNET(pfi_buffer) VNET_DEFINE(int, pfi_buffer_cnt); -#define pfi_buffer_cnt VNET(pfi_buffer_cnt) +#define V_pfi_buffer_cnt VNET(pfi_buffer_cnt) VNET_DEFINE(int, pfi_buffer_max); -#define pfi_buffer_max VNET(pfi_buffer_max) +#define V_pfi_buffer_max VNET(pfi_buffer_max) #else *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Thu Oct 15 08:32:26 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 99C401065676; Thu, 15 Oct 2009 08:32:26 +0000 (UTC) (envelope-from eri@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 896178FC29; Thu, 15 Oct 2009 08:32:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n9F8WQAi065014; Thu, 15 Oct 2009 08:32:26 GMT (envelope-from eri@svn.freebsd.org) Received: (from eri@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9F8WQ87065012; Thu, 15 Oct 2009 08:32:26 GMT (envelope-from eri@svn.freebsd.org) Message-Id: <200910150832.n9F8WQ87065012@svn.freebsd.org> From: Ermal Luçi Date: Thu, 15 Oct 2009 08:32:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r198115 - user/eri/pf45/head/sys/contrib/pf/net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Oct 2009 08:32:26 -0000 Author: eri Date: Thu Oct 15 08:32:26 2009 New Revision: 198115 URL: http://svn.freebsd.org/changeset/base/198115 Log: Missed variables to be prepended V_. Modified: user/eri/pf45/head/sys/contrib/pf/net/pf_table.c Modified: user/eri/pf45/head/sys/contrib/pf/net/pf_table.c ============================================================================== --- user/eri/pf45/head/sys/contrib/pf/net/pf_table.c Thu Oct 15 07:58:01 2009 (r198114) +++ user/eri/pf45/head/sys/contrib/pf/net/pf_table.c Thu Oct 15 08:32:26 2009 (r198115) @@ -179,15 +179,15 @@ struct pfr_walktree { VNET_DEFINE(uma_zone_t, pfr_ktable_pl); VNET_DEFINE(uma_zone_t, pfr_kentry_pl); VNET_DEFINE(uma_zone_t, pfr_kcounters_pl); -#define pfr_kcounters_pl VNET(pfr_kcounters_pl) +#define V_pfr_kcounters_pl VNET(pfr_kcounters_pl) VNET_DEFINE(struct sockaddr_in, pfr_sin); -#define pfr_sin VNET(pfr_sin) +#define V_pfr_sin VNET(pfr_sin) VNET_DEFINE(struct sockaddr_in6, pfr_sin6); -#define pfr_sin6 VNET(pfr_sin6) +#define V_pfr_sin6 VNET(pfr_sin6) VNET_DEFINE(union sockaddr_union, pfr_mask); -#define pfr_mask VNET(pfr_mask) +#define V_pfr_mask VNET(pfr_mask) VNET_DEFINE(struct pf_addr, pfr_ffaddr); -#define pfr_ffaddr VNET(pfr_ffaddr) +#define V_pfr_ffaddr VNET(pfr_ffaddr) #else struct pool pfr_ktable_pl; struct pool pfr_kentry_pl; @@ -262,7 +262,6 @@ pfr_initialize(void) "pfrkentry", NULL); pool_init(&pfr_kcounters_pl, sizeof(struct pfr_kcounters), 0, 0, 0, "pfrkcounters", NULL); -#endif pfr_sin.sin_len = sizeof(pfr_sin); pfr_sin.sin_family = AF_INET; @@ -270,6 +269,14 @@ pfr_initialize(void) pfr_sin6.sin6_family = AF_INET6; memset(&pfr_ffaddr, 0xff, sizeof(pfr_ffaddr)); +#else + V_pfr_sin.sin_len = sizeof(V_pfr_sin); + V_pfr_sin.sin_family = AF_INET; + V_pfr_sin6.sin6_len = sizeof(V_pfr_sin6); + V_pfr_sin6.sin6_family = AF_INET6; + + memset(&V_pfr_ffaddr, 0xff, sizeof(V_pfr_ffaddr)); +#endif } int @@ -960,10 +967,11 @@ void pfr_destroy_kentry(struct pfr_kentry *ke) { if (ke->pfrke_counters) - pool_put(&pfr_kcounters_pl, ke->pfrke_counters); #ifdef __FreeBSD__ + pool_put(&V_pfr_kcounters_pl, ke->pfrke_counters); pool_put(&V_pfr_kentry_pl, ke); #else + pool_put(&pfr_kcounters_pl, ke->pfrke_counters); pool_put(&pfr_kentry_pl, ke); #endif } @@ -1047,7 +1055,11 @@ pfr_clstats_kentries(struct pfr_kentrywo if (negchange) p->pfrke_not = !p->pfrke_not; if (p->pfrke_counters) { +#ifdef __FreeBSD__ + pool_put(&V_pfr_kcounters_pl, p->pfrke_counters); +#else pool_put(&pfr_kcounters_pl, p->pfrke_counters); +#endif p->pfrke_counters = NULL; } splx(s); @@ -1259,19 +1271,35 @@ pfr_walktree(struct radix_node *rn, void if (ke->pfrke_af == AF_INET) { if (w->pfrw_dyn->pfid_acnt4++ > 0) break; +#ifdef __FreeBSD__ + pfr_prepare_network(&V_pfr_mask, AF_INET, ke->pfrke_net); +#else pfr_prepare_network(&pfr_mask, AF_INET, ke->pfrke_net); +#endif w->pfrw_dyn->pfid_addr4 = *SUNION2PF( &ke->pfrke_sa, AF_INET); w->pfrw_dyn->pfid_mask4 = *SUNION2PF( +#ifdef __FreeBSD__ + &V_pfr_mask, AF_INET); +#else &pfr_mask, AF_INET); +#endif } else if (ke->pfrke_af == AF_INET6){ if (w->pfrw_dyn->pfid_acnt6++ > 0) break; +#ifdef __FreeBSD__ + pfr_prepare_network(&V_pfr_mask, AF_INET6, ke->pfrke_net); +#else pfr_prepare_network(&pfr_mask, AF_INET6, ke->pfrke_net); +#endif w->pfrw_dyn->pfid_addr6 = *SUNION2PF( &ke->pfrke_sa, AF_INET6); w->pfrw_dyn->pfid_mask6 = *SUNION2PF( +#ifdef __FreeBSD__ + &V_pfr_mask, AF_INET6); +#else &pfr_mask, AF_INET6); +#endif } break; } @@ -2172,16 +2200,26 @@ pfr_match_addr(struct pfr_ktable *kt, st switch (af) { #ifdef INET case AF_INET: +#ifdef __FreeBSD__ + V_pfr_sin.sin_addr.s_addr = a->addr32[0]; + ke = (struct pfr_kentry *)rn_match(&V_pfr_sin, kt->pfrkt_ip4); +#else pfr_sin.sin_addr.s_addr = a->addr32[0]; ke = (struct pfr_kentry *)rn_match(&pfr_sin, kt->pfrkt_ip4); +#endif if (ke && KENTRY_RNF_ROOT(ke)) ke = NULL; break; #endif /* INET */ #ifdef INET6 case AF_INET6: +#ifdef __FreeBSD__ + bcopy(a, &V_pfr_sin6.sin6_addr, sizeof(V_pfr_sin6.sin6_addr)); + ke = (struct pfr_kentry *)rn_match(&V_pfr_sin6, kt->pfrkt_ip6); +#else bcopy(a, &pfr_sin6.sin6_addr, sizeof(pfr_sin6.sin6_addr)); ke = (struct pfr_kentry *)rn_match(&pfr_sin6, kt->pfrkt_ip6); +#endif if (ke && KENTRY_RNF_ROOT(ke)) ke = NULL; break; @@ -2209,16 +2247,26 @@ pfr_update_stats(struct pfr_ktable *kt, switch (af) { #ifdef INET case AF_INET: +#ifdef __FreeBSD__ + V_pfr_sin.sin_addr.s_addr = a->addr32[0]; + ke = (struct pfr_kentry *)rn_match(&V_pfr_sin, kt->pfrkt_ip4); +#else pfr_sin.sin_addr.s_addr = a->addr32[0]; ke = (struct pfr_kentry *)rn_match(&pfr_sin, kt->pfrkt_ip4); +#endif if (ke && KENTRY_RNF_ROOT(ke)) ke = NULL; break; #endif /* INET */ #ifdef INET6 case AF_INET6: +#ifdef __FreeBSD__ + bcopy(a, &V_pfr_sin6.sin6_addr, sizeof(V_pfr_sin6.sin6_addr)); + ke = (struct pfr_kentry *)rn_match(&V_pfr_sin6, kt->pfrkt_ip6); +#else bcopy(a, &pfr_sin6.sin6_addr, sizeof(pfr_sin6.sin6_addr)); ke = (struct pfr_kentry *)rn_match(&pfr_sin6, kt->pfrkt_ip6); +#endif if (ke && KENTRY_RNF_ROOT(ke)) ke = NULL; break; @@ -2236,7 +2284,11 @@ pfr_update_stats(struct pfr_ktable *kt, if (ke != NULL && op_pass != PFR_OP_XPASS && (kt->pfrkt_flags & PFR_TFLAG_COUNTERS)) { if (ke->pfrke_counters == NULL) +#ifdef __FreeBSD__ + ke->pfrke_counters = pool_get(&V_pfr_kcounters_pl, +#else ke->pfrke_counters = pool_get(&pfr_kcounters_pl, +#endif PR_NOWAIT | PR_ZERO); if (ke->pfrke_counters != NULL) { ke->pfrke_counters->pfrkc_packets[dir_out][op_pass]++; @@ -2305,10 +2357,17 @@ pfr_pool_get(struct pfr_ktable *kt, int union sockaddr_union mask; int idx = -1, use_counter = 0; +#ifdef __FreeBSD__ + if (af == AF_INET) + addr = (struct pf_addr *)&V_pfr_sin.sin_addr; + else if (af == AF_INET6) + addr = (struct pf_addr *)&V_pfr_sin6.sin6_addr; +#else if (af == AF_INET) addr = (struct pf_addr *)&pfr_sin.sin_addr; else if (af == AF_INET6) addr = (struct pf_addr *)&pfr_sin6.sin6_addr; +#endif if (!(kt->pfrkt_flags & PFR_TFLAG_ACTIVE) && kt->pfrkt_root != NULL) kt = kt->pfrkt_root; if (!(kt->pfrkt_flags & PFR_TFLAG_ACTIVE)) @@ -2327,9 +2386,17 @@ _next_block: kt->pfrkt_nomatch++; return (1); } +#ifdef __FreeBSD__ + pfr_prepare_network(&V_pfr_mask, af, ke->pfrke_net); +#else pfr_prepare_network(&pfr_mask, af, ke->pfrke_net); +#endif *raddr = SUNION2PF(&ke->pfrke_sa, af); +#ifdef __FreeBSD__ + *rmask = SUNION2PF(&V_pfr_mask, af); +#else *rmask = SUNION2PF(&pfr_mask, af); +#endif if (use_counter) { /* is supplied address within block? */ @@ -2354,12 +2421,21 @@ _next_block: } for (;;) { /* we don't want to use a nested block */ +#ifdef __FreeBSD__ + if (af == AF_INET) + ke2 = (struct pfr_kentry *)rn_match(&V_pfr_sin, + kt->pfrkt_ip4); + else if (af == AF_INET6) + ke2 = (struct pfr_kentry *)rn_match(&V_pfr_sin6, + kt->pfrkt_ip6); +#else if (af == AF_INET) ke2 = (struct pfr_kentry *)rn_match(&pfr_sin, kt->pfrkt_ip4); else if (af == AF_INET6) ke2 = (struct pfr_kentry *)rn_match(&pfr_sin6, kt->pfrkt_ip6); +#endif /* no need to check KENTRY_RNF_ROOT() here */ if (ke2 == ke) { /* lookup return the same block - perfect */ @@ -2371,7 +2447,11 @@ _next_block: /* we need to increase the counter past the nested block */ pfr_prepare_network(&mask, AF_INET, ke2->pfrke_net); +#ifdef __FreeBSD__ + PF_POOLMASK(addr, addr, SUNION2PF(&mask, af), &V_pfr_ffaddr, af); +#else PF_POOLMASK(addr, addr, SUNION2PF(&mask, af), &pfr_ffaddr, af); +#endif PF_AINC(addr, af); if (!PF_MATCHA(0, *raddr, *rmask, addr, af)) { /* ok, we reached the end of our main block */ From owner-svn-src-user@FreeBSD.ORG Thu Oct 15 08:42:30 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E301E106568F; Thu, 15 Oct 2009 08:42:29 +0000 (UTC) (envelope-from eri@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D328E8FC18; Thu, 15 Oct 2009 08:42:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n9F8gTUC065349; Thu, 15 Oct 2009 08:42:29 GMT (envelope-from eri@svn.freebsd.org) Received: (from eri@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9F8gTCD065347; Thu, 15 Oct 2009 08:42:29 GMT (envelope-from eri@svn.freebsd.org) Message-Id: <200910150842.n9F8gTCD065347@svn.freebsd.org> From: Ermal Luçi Date: Thu, 15 Oct 2009 08:42:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r198116 - user/eri/pf45/head/sys/contrib/pf/net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Oct 2009 08:42:30 -0000 Author: eri Date: Thu Oct 15 08:42:29 2009 New Revision: 198116 URL: http://svn.freebsd.org/changeset/base/198116 Log: * Prepend V_ to exported variables(tcp_mssdflt, ip_defttl) from other protocols. * Wrap ip_stat statistics on macros. Modified: user/eri/pf45/head/sys/contrib/pf/net/pf.c Modified: user/eri/pf45/head/sys/contrib/pf/net/pf.c ============================================================================== --- user/eri/pf45/head/sys/contrib/pf/net/pf.c Thu Oct 15 08:32:26 2009 (r198115) +++ user/eri/pf45/head/sys/contrib/pf/net/pf.c Thu Oct 15 08:42:29 2009 (r198116) @@ -2438,14 +2438,15 @@ pf_send_tcp(const struct pf_rule *r, sa_ h->ip_v = 4; h->ip_hl = sizeof(*h) >> 2; h->ip_tos = IPTOS_LOWDELAY; - #ifdef __FreeBSD__ +#ifdef __FreeBSD__ h->ip_off = V_path_mtu_discovery ? IP_DF : 0; h->ip_len = len; - #else + h->ip_ttl = ttl ? ttl : V_ip_defttl; +#else h->ip_len = htons(len); h->ip_off = htons(ip_mtudisc ? IP_DF : 0); -#endif h->ip_ttl = ttl ? ttl : ip_defttl; +#endif h->ip_sum = 0; if (eh == NULL) { #ifdef __FreeBSD__ @@ -3101,7 +3102,11 @@ pf_get_mss(struct mbuf *m, int off, u_in int hlen; u_int8_t hdr[60]; u_int8_t *opt, optlen; +#ifdef __FreeBSD__ + u_int16_t mss = V_tcp_mssdflt; +#else u_int16_t mss = tcp_mssdflt; +#endif hlen = th_off << 2; /* hlen <= sizeof(hdr) */ if (hlen <= sizeof(struct tcphdr)) @@ -3147,10 +3152,11 @@ pf_calc_mss(struct pf_addr *addr, sa_fam struct rtentry *rt = NULL; #ifdef __FreeBSD__ int hlen = 0; + u_int16_t mss = V_tcp_mssdflt; #else int hlen; -#endif u_int16_t mss = tcp_mssdflt; +#endif switch (af) { #ifdef INET @@ -3239,10 +3245,10 @@ pf_tcp_iss(struct pf_pdesc *pd) #ifdef __FreeBSD__ if (V_pf_tcp_secret_init == 0) { - read_random(&V_pf_tcp_secret, sizeof(pf_tcp_secret)); + read_random(&V_pf_tcp_secret, sizeof(V_pf_tcp_secret)); MD5Init(&V_pf_tcp_secret_ctx); MD5Update(&V_pf_tcp_secret_ctx, V_pf_tcp_secret, - sizeof(pf_tcp_secret)); + sizeof(V_pf_tcp_secret)); V_pf_tcp_secret_init = 1; } @@ -3775,7 +3781,11 @@ pf_create_state(struct pf_rule *r, struc struct pf_state *s = NULL; struct pf_src_node *sn = NULL; struct tcphdr *th = pd->hdr.tcp; +#ifdef __FreeBSD__ + u_int16_t mss = V_tcp_mssdflt; +#else u_int16_t mss = tcp_mssdflt; +#endif u_short reason; /* check maximums */ @@ -5939,7 +5949,11 @@ pf_route(struct mbuf **m, struct pf_rule rtalloc(ro); #endif if (ro->ro_rt == 0) { +#ifdef __FreeBSD__ + KMOD_IPSTAT_INC(ips_noroute); +#else ipstat.ips_noroute++; +#endif goto bad; } @@ -6071,7 +6085,11 @@ pf_route(struct mbuf **m, struct pf_rule if ((ifp->if_capabilities & IFCAP_CSUM_IPv4) && ifp->if_bridge == NULL) { m0->m_pkthdr.csum_flags |= M_IPV4_CSUM_OUT; +#ifdef __FreeBSD__ + KMOD_IPSTAT_INC(ips_outhwcsum); +#else ipstat.ips_outhwcsum++; +#endif } else ip->ip_sum = in_cksum(m0, ip->ip_hl << 2); /* Update relevant hardware checksum stats for TCP/UDP */ @@ -6089,7 +6107,11 @@ pf_route(struct mbuf **m, struct pf_rule * Must be able to put at least 8 bytes per fragment. */ if (ip->ip_off & htons(IP_DF)) { +#ifdef __FreeBSD__ + KMOD_IPSTAT_INC(ips_cantfrag); +#else ipstat.ips_cantfrag++; +#endif if (r->rt != PF_DUPTO) { #ifdef __FreeBSD__ /* icmp_error() expects host byte ordering */ @@ -6146,7 +6168,11 @@ pf_route(struct mbuf **m, struct pf_rule } if (error == 0) +#ifdef __FreeBSD__ + KMOD_IPSTAT_INC(ips_fragmented); +#else ipstat.ips_fragmented++; +#endif done: if (r->rt != PF_DUPTO) @@ -7087,7 +7113,7 @@ pf_test6(int dir, struct ifnet *ifp, str #ifdef __FreeBSD__ PF_LOCK(); - if (!pf_status.running) + if (!V_pf_status.running) { PF_UNLOCK(); return (PF_PASS); From owner-svn-src-user@FreeBSD.ORG Thu Oct 15 08:55:43 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6DF5A106566B; Thu, 15 Oct 2009 08:55:43 +0000 (UTC) (envelope-from eri@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5E8218FC14; Thu, 15 Oct 2009 08:55:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n9F8thEd065854; Thu, 15 Oct 2009 08:55:43 GMT (envelope-from eri@svn.freebsd.org) Received: (from eri@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9F8thgO065852; Thu, 15 Oct 2009 08:55:43 GMT (envelope-from eri@svn.freebsd.org) Message-Id: <200910150855.n9F8thgO065852@svn.freebsd.org> From: Ermal Luçi Date: Thu, 15 Oct 2009 08:55:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r198117 - user/eri/pf45/head/sys/netinet X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Oct 2009 08:55:43 -0000 Author: eri Date: Thu Oct 15 08:55:43 2009 New Revision: 198117 URL: http://svn.freebsd.org/changeset/base/198117 Log: Remove missed check of divert(4) dependency on ipfw(4). Modified: user/eri/pf45/head/sys/netinet/ip_divert.c Modified: user/eri/pf45/head/sys/netinet/ip_divert.c ============================================================================== --- user/eri/pf45/head/sys/netinet/ip_divert.c Thu Oct 15 08:42:29 2009 (r198116) +++ user/eri/pf45/head/sys/netinet/ip_divert.c Thu Oct 15 08:55:43 2009 (r198117) @@ -37,9 +37,6 @@ __FBSDID("$FreeBSD$"); #ifndef INET #error "IPDIVERT requires INET." #endif -#ifndef IPFIREWALL -#error "IPDIVERT requires IPFIREWALL" -#endif #endif #include From owner-svn-src-user@FreeBSD.ORG Thu Oct 15 10:42:30 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D40FB1065694; Thu, 15 Oct 2009 10:42:30 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C44528FC1F; Thu, 15 Oct 2009 10:42:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n9FAgUOD070896; Thu, 15 Oct 2009 10:42:30 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9FAgUi5070893; Thu, 15 Oct 2009 10:42:30 GMT (envelope-from des@svn.freebsd.org) Message-Id: <200910151042.n9FAgUi5070893@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Thu, 15 Oct 2009 10:42:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r198119 - user/des/svnsup/src/distill X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Oct 2009 10:42:30 -0000 Author: des Date: Thu Oct 15 10:42:30 2009 New Revision: 198119 URL: http://svn.freebsd.org/changeset/base/198119 Log: Nothing to see except in debug mode (for now) Modified: user/des/svnsup/src/distill/log.c user/des/svnsup/src/distill/txdelta.c Modified: user/des/svnsup/src/distill/log.c ============================================================================== --- user/des/svnsup/src/distill/log.c Thu Oct 15 10:31:24 2009 (r198118) +++ user/des/svnsup/src/distill/log.c Thu Oct 15 10:42:30 2009 (r198119) @@ -52,6 +52,10 @@ log_entry_receiver(void *baton, (void)pool; (void)baton; SVNSUP_DEBUG("%s(r%lu)\n", __func__, (long)log_entry->revision); + + if (!debug) + return (SVN_NO_ERROR); + fprintf(stderr, "revision properties:\n"); #if 0 for (hash_index = apr_hash_first(pool, log_entry->revprops); Modified: user/des/svnsup/src/distill/txdelta.c ============================================================================== --- user/des/svnsup/src/distill/txdelta.c Thu Oct 15 10:31:24 2009 (r198118) +++ user/des/svnsup/src/distill/txdelta.c Thu Oct 15 10:42:30 2009 (r198119) @@ -44,6 +44,9 @@ txdelta_window_handler(svn_txdelta_windo (void)baton; SVNSUP_DEBUG("%s()\n", __func__); + if (!debug) + return (SVN_NO_ERROR); + if (window == NULL) { fprintf(stderr, "end of delta\n"); return (SVN_NO_ERROR); From owner-svn-src-user@FreeBSD.ORG Thu Oct 15 10:46:21 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E7428106566C; Thu, 15 Oct 2009 10:46:21 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D73D18FC1C; Thu, 15 Oct 2009 10:46:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n9FAkLtq071022; Thu, 15 Oct 2009 10:46:21 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9FAkLni071020; Thu, 15 Oct 2009 10:46:21 GMT (envelope-from des@svn.freebsd.org) Message-Id: <200910151046.n9FAkLni071020@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Thu, 15 Oct 2009 10:46:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r198120 - user/des/svnsup/src/distill X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Oct 2009 10:46:22 -0000 Author: des Date: Thu Oct 15 10:46:21 2009 New Revision: 198120 URL: http://svn.freebsd.org/changeset/base/198120 Log: Additional refactoring Modified: user/des/svnsup/src/distill/error.c Modified: user/des/svnsup/src/distill/error.c ============================================================================== --- user/des/svnsup/src/distill/error.c Thu Oct 15 10:42:30 2009 (r198119) +++ user/des/svnsup/src/distill/error.c Thu Oct 15 10:46:21 2009 (r198120) @@ -36,8 +36,18 @@ #include "distill.h" +static inline void +svnsup_print_where(FILE *f, svnsup_where_t *where) +{ + if (debug) { + fprintf(f, "svnsup: in %s() on line %d of %s\n", + where->func, where->line, where->file); + } +} + void -svnsup_apr_error(svnsup_where_t *where, apr_status_t status, const char *fmt, ...) +svnsup_apr_error(svnsup_where_t *where, apr_status_t status, + const char *fmt, ...) { char errbuf[1024]; va_list ap; @@ -48,14 +58,13 @@ svnsup_apr_error(svnsup_where_t *where, va_end(ap); apr_strerror(status, errbuf, sizeof(errbuf)); fprintf(stderr, "\nsvnsup: %s\n", errbuf); - if (debug) - fprintf(stderr, "svnsup: in %s() on line %d of %s\n", - where->func, where->line, where->file); + svnsup_print_where(stderr, where); exit(1); } void -svnsup_svn_error(svnsup_where_t *where, svn_error_t *error, const char *fmt, ...) +svnsup_svn_error(svnsup_where_t *where, svn_error_t *error, + const char *fmt, ...) { va_list ap; @@ -65,14 +74,13 @@ svnsup_svn_error(svnsup_where_t *where, va_end(ap); fprintf(stderr, "\n"); svn_handle_error2(error, stderr, FALSE, "svnsup: "); - if (debug) - fprintf(stderr, "svnsup: in %s() on line %d of %s\n", - where->func, where->line, where->file); + svnsup_print_where(stderr, where); exit(1); } void -svnsup_assert(svnsup_where_t *where, const char *cond, const char *fmt, ...) +svnsup_assert(svnsup_where_t *where, const char *cond, + const char *fmt, ...) { va_list ap; @@ -82,8 +90,6 @@ svnsup_assert(svnsup_where_t *where, con va_start(ap, fmt); vfprintf(stderr, fmt, ap); va_end(ap); - if (debug) - fprintf(stderr, "svnsup: in %s() on line %d of %s\n", - where->func, where->line, where->file); + svnsup_print_where(stderr, where); exit(1); } From owner-svn-src-user@FreeBSD.ORG Thu Oct 15 10:48:19 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B0DC01065676; Thu, 15 Oct 2009 10:48:19 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9556E8FC12; Thu, 15 Oct 2009 10:48:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n9FAmJ8i071102; Thu, 15 Oct 2009 10:48:19 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9FAmJGM071098; Thu, 15 Oct 2009 10:48:19 GMT (envelope-from des@svn.freebsd.org) Message-Id: <200910151048.n9FAmJGM071098@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Thu, 15 Oct 2009 10:48:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r198121 - user/des/svnsup/src/libsvnsup X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Oct 2009 10:48:19 -0000 Author: des Date: Thu Oct 15 10:48:19 2009 New Revision: 198121 URL: http://svn.freebsd.org/changeset/base/198121 Log: Common code for creating and reading svnsup deltas. Added: user/des/svnsup/src/libsvnsup/ (props changed) user/des/svnsup/src/libsvnsup/Makefile.am (contents, props changed) user/des/svnsup/src/libsvnsup/svnsup.h (contents, props changed) user/des/svnsup/src/libsvnsup/svnsup_delta.c (contents, props changed) Added: user/des/svnsup/src/libsvnsup/Makefile.am ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/des/svnsup/src/libsvnsup/Makefile.am Thu Oct 15 10:48:19 2009 (r198121) @@ -0,0 +1,9 @@ +# $Id$ + +lib_LIBRARIES = libsvnsup.a + +libsvnsup_a_SOURCES = \ + svnsup_delta.c + +noinst_HEADERS = \ + svnsup.h Added: user/des/svnsup/src/libsvnsup/svnsup.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/des/svnsup/src/libsvnsup/svnsup.h Thu Oct 15 10:48:19 2009 (r198121) @@ -0,0 +1,47 @@ +/*- + * Copyright (c) 2009 Dag-Erling Coïdan Smørgrav + * 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 + * in this position and unchanged. + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + * + * $Id$ + */ + +#ifndef SVNSUP_H_INCLUDED +#define SVNSUP_H_INCLUDED + +typedef enum svnsup_err { + SVNSUP_ERR_NONE, + SVNSUP_ERR_MEMORY, + SVNSUP_ERR_UNKNOWN, + SVNSUP_ERR_MAX, +} svnsup_err_t; + +typedef struct svnsup_delta *svnsup_delta_t; + +int svnsup_delta_create(svnsup_delta_t *); +int svnsup_delta_close(svnsup_delta_t); + +int svnsup_delta_comment(svnsup_delta_t, const char *, ...); + +#endif Added: user/des/svnsup/src/libsvnsup/svnsup_delta.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/des/svnsup/src/libsvnsup/svnsup_delta.c Thu Oct 15 10:48:19 2009 (r198121) @@ -0,0 +1,87 @@ +/*- + * Copyright (c) 2009 Dag-Erling Coïdan Smørgrav + * 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 + * in this position and unchanged. + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + * + * $Id$ + */ + +#include +#include +#include +#include + +#include "svnsup.h" + +struct svnsup_delta { + FILE *f; + int started:1; +}; + +int +svnsup_delta_create(svnsup_delta_t *sdp) +{ + svnsup_delta_t sd; + + if ((sd = calloc(1, sizeof *sd)) == NULL) + return (SVNSUP_ERR_MEMORY); + sd->f = stdout; + *sdp = sd; + return (SVNSUP_ERR_NONE); +} + +int +svnsup_delta_close(svnsup_delta_t sd) +{ + + free(sd); + return (SVNSUP_ERR_NONE); +} + +int +svnsup_delta_comment(svnsup_delta_t sd, const char *fmt, ...) +{ + va_list ap; + char *commentbuf, *p; + int len; + + va_start(ap, fmt); + len = vasprintf(&commentbuf, fmt, ap); + va_end(ap); + if (commentbuf == NULL) + return (SVNSUP_ERR_MEMORY); + p = commentbuf; + while (*p != '\0') { + fputs("# ", sd->f); + while (*p != '\0' && *p != '\n') { + putc(isprint(*p) ? *p : ' ', sd->f); + ++p; + } + putc('\n', sd->f); + if (*p == '\n') + ++p; + } + free(commentbuf); + return (SVNSUP_ERR_NONE); +} From owner-svn-src-user@FreeBSD.ORG Thu Oct 15 10:48:45 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 811CF106566B; Thu, 15 Oct 2009 10:48:45 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 70F4F8FC0C; Thu, 15 Oct 2009 10:48:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n9FAmjqM071147; Thu, 15 Oct 2009 10:48:45 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9FAmjdw071142; Thu, 15 Oct 2009 10:48:45 GMT (envelope-from des@svn.freebsd.org) Message-Id: <200910151048.n9FAmjdw071142@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Thu, 15 Oct 2009 10:48:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r198122 - in user/des/svnsup: . src src/apply src/distill X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Oct 2009 10:48:45 -0000 Author: des Date: Thu Oct 15 10:48:45 2009 New Revision: 198122 URL: http://svn.freebsd.org/changeset/base/198122 Log: Connect libsvnsup to the build. Modified: user/des/svnsup/configure.ac user/des/svnsup/src/Makefile.am user/des/svnsup/src/apply/Makefile.am user/des/svnsup/src/distill/Makefile.am Modified: user/des/svnsup/configure.ac ============================================================================== --- user/des/svnsup/configure.ac Thu Oct 15 10:48:19 2009 (r198121) +++ user/des/svnsup/configure.ac Thu Oct 15 10:48:45 2009 (r198122) @@ -15,6 +15,7 @@ AC_PROG_CPP AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_MAKE_SET +AC_PROG_RANLIB AC_ARG_ENABLE(distill, AS_HELP_STRING([--enable-distill], @@ -124,6 +125,7 @@ AS_IF([test x"$enable_distill" = x"yes"] AC_CONFIG_FILES([ Makefile src/Makefile + src/libsvnsup/Makefile src/distill/Makefile src/apply/Makefile ]) Modified: user/des/svnsup/src/Makefile.am ============================================================================== --- user/des/svnsup/src/Makefile.am Thu Oct 15 10:48:19 2009 (r198121) +++ user/des/svnsup/src/Makefile.am Thu Oct 15 10:48:45 2009 (r198122) @@ -8,4 +8,4 @@ if ENABLE_APPLY APPLY_SUBDIR = apply endif -SUBDIRS = ${DISTILL_SUBDIR} ${APPLY_SUBDIR} +SUBDIRS = libsvnsup ${DISTILL_SUBDIR} ${APPLY_SUBDIR} Modified: user/des/svnsup/src/apply/Makefile.am ============================================================================== --- user/des/svnsup/src/apply/Makefile.am Thu Oct 15 10:48:19 2009 (r198121) +++ user/des/svnsup/src/apply/Makefile.am Thu Oct 15 10:48:45 2009 (r198122) @@ -5,4 +5,8 @@ bin_PROGRAMS = svnsup-apply svnsup_apply_SOURCES = \ main.c -svnsup_apply_LDADD = +svnsup_apply_CPPFLAGS = \ + -I$(top_builddir)/src/libsvnsup + +svnsup_apply_LDADD = \ + $(top_builddir)/src/libsvnsup/libsvnsup.a Modified: user/des/svnsup/src/distill/Makefile.am ============================================================================== --- user/des/svnsup/src/distill/Makefile.am Thu Oct 15 10:48:19 2009 (r198121) +++ user/des/svnsup/src/distill/Makefile.am Thu Oct 15 10:48:45 2009 (r198122) @@ -15,9 +15,11 @@ svnsup_distill_SOURCES = \ txdelta.c svnsup_distill_CPPFLAGS = \ + -I$(top_builddir)/src/libsvnsup \ ${APR_1_CFLAGS} svnsup_distill_LDADD = \ + $(top_builddir)/src/libsvnsup/libsvnsup.a \ ${APR_1_LDADD} \ ${SVN_DELTA_1_LIBS} \ ${SVN_CLIENT_1_LIBS} \ From owner-svn-src-user@FreeBSD.ORG Thu Oct 15 10:49:24 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 63F3B106566B; Thu, 15 Oct 2009 10:49:24 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 509508FC0A; Thu, 15 Oct 2009 10:49:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n9FAnOuE071199; Thu, 15 Oct 2009 10:49:24 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9FAnOQd071196; Thu, 15 Oct 2009 10:49:24 GMT (envelope-from des@svn.freebsd.org) Message-Id: <200910151049.n9FAnOQd071196@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Thu, 15 Oct 2009 10:49:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r198123 - user/des/svnsup/src/distill X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Oct 2009 10:49:24 -0000 Author: des Date: Thu Oct 15 10:49:24 2009 New Revision: 198123 URL: http://svn.freebsd.org/changeset/base/198123 Log: Handle libsvnsup errors (poorly) Modified: user/des/svnsup/src/distill/distill.h user/des/svnsup/src/distill/error.c Modified: user/des/svnsup/src/distill/distill.h ============================================================================== --- user/des/svnsup/src/distill/distill.h Thu Oct 15 10:48:45 2009 (r198122) +++ user/des/svnsup/src/distill/distill.h Thu Oct 15 10:49:24 2009 (r198123) @@ -42,6 +42,8 @@ #include #include +#include "svnsup.h" + extern int debug; extern int verbose; @@ -71,6 +73,15 @@ void svnsup_svn_error(svnsup_where_t *, (error), __VA_ARGS__); \ } while (0) +/* svnsup errors */ +void svnsup_svnsup_error(svnsup_where_t *, svnsup_err_t, const char *, ...); +#define SVNSUP_SVNSUP_ERROR(error, ...) \ + do { \ + if ((error) != SVNSUP_ERR_NONE) \ + svnsup_svnsup_error(SVNSUP_WHERE, \ + (error), __VA_ARGS__); \ + } while (0) + /* assertions */ void svnsup_assert(svnsup_where_t *, const char *, const char *, ...); #define SVNSUP_ASSERT(cond, ...) \ Modified: user/des/svnsup/src/distill/error.c ============================================================================== --- user/des/svnsup/src/distill/error.c Thu Oct 15 10:48:45 2009 (r198122) +++ user/des/svnsup/src/distill/error.c Thu Oct 15 10:49:24 2009 (r198123) @@ -79,6 +79,22 @@ svnsup_svn_error(svnsup_where_t *where, } void +svnsup_svnsup_error(svnsup_where_t *where, svnsup_err_t error, + const char *fmt, ...) +{ + va_list ap; + + fprintf(stderr, "svnsup: "); + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end(ap); + fprintf(stderr, "\n"); + fprintf(stderr, "svnsup: error code %d\n", error); /* XXX */ + svnsup_print_where(stderr, where); + exit(1); +} + +void svnsup_assert(svnsup_where_t *where, const char *cond, const char *fmt, ...) { From owner-svn-src-user@FreeBSD.ORG Thu Oct 15 11:12:54 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 08BF51065672; Thu, 15 Oct 2009 11:12:54 +0000 (UTC) (envelope-from eri@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EBC568FC1D; Thu, 15 Oct 2009 11:12:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n9FBCraH071786; Thu, 15 Oct 2009 11:12:53 GMT (envelope-from eri@svn.freebsd.org) Received: (from eri@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9FBCrwv071781; Thu, 15 Oct 2009 11:12:53 GMT (envelope-from eri@svn.freebsd.org) Message-Id: <200910151112.n9FBCrwv071781@svn.freebsd.org> From: Ermal Luçi Date: Thu, 15 Oct 2009 11:12:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r198124 - user/eri/pf45/head/sys/contrib/pf/net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Oct 2009 11:12:54 -0000 Author: eri Date: Thu Oct 15 11:12:53 2009 New Revision: 198124 URL: http://svn.freebsd.org/changeset/base/198124 Log: More V_ foo. NOTE: With this commit a GENERIC VIMAGE kernel builds. Modified: user/eri/pf45/head/sys/contrib/pf/net/pf.c user/eri/pf45/head/sys/contrib/pf/net/pf_if.c user/eri/pf45/head/sys/contrib/pf/net/pf_ioctl.c user/eri/pf45/head/sys/contrib/pf/net/pf_ruleset.c Modified: user/eri/pf45/head/sys/contrib/pf/net/pf.c ============================================================================== --- user/eri/pf45/head/sys/contrib/pf/net/pf.c Thu Oct 15 10:49:24 2009 (r198123) +++ user/eri/pf45/head/sys/contrib/pf/net/pf.c Thu Oct 15 11:12:53 2009 (r198124) @@ -3204,7 +3204,11 @@ pf_calc_mss(struct pf_addr *addr, sa_fam if (rt && rt->rt_ifp) { mss = rt->rt_ifp->if_mtu - hlen - sizeof(struct tcphdr); +#ifdef __FreeBSD__ + mss = max(V_tcp_mssdflt, mss); +#else mss = max(tcp_mssdflt, mss); +#endif RTFREE(rt); } mss = min(mss, offer); Modified: user/eri/pf45/head/sys/contrib/pf/net/pf_if.c ============================================================================== --- user/eri/pf45/head/sys/contrib/pf/net/pf_if.c Thu Oct 15 10:49:24 2009 (r198123) +++ user/eri/pf45/head/sys/contrib/pf/net/pf_if.c Thu Oct 15 11:12:53 2009 (r198124) @@ -149,7 +149,7 @@ pfi_initialize(void) #endif #ifdef __FreeBSD__ V_pfi_buffer_max = 64; - V_pfi_buffer = malloc(V_pfi_buffer_max * sizeof(*pfi_buffer), + V_pfi_buffer = malloc(V_pfi_buffer_max * sizeof(*V_pfi_buffer), PFI_MTYPE, M_WAITOK); if ((V_pfi_all = pfi_kif_get(IFG_ALL)) == NULL) @@ -745,7 +745,7 @@ pfi_address_add(struct sockaddr *sa, int #endif return; } - p = malloc(new_max * sizeof(*pfi_buffer), PFI_MTYPE, + p = malloc(new_max * sizeof(*V_pfi_buffer), PFI_MTYPE, #ifdef __FreeBSD__ M_NOWAIT); #else @@ -761,7 +761,7 @@ pfi_address_add(struct sockaddr *sa, int return; } #ifdef __FreeBSD__ - memcpy(V_pfi_buffer, p, V_pfi_buffer_cnt * sizeof(*pfi_buffer)); + memcpy(V_pfi_buffer, p, V_pfi_buffer_cnt * sizeof(*V_pfi_buffer)); /* no need to zero buffer */ free(V_pfi_buffer, PFI_MTYPE); V_pfi_buffer = p; Modified: user/eri/pf45/head/sys/contrib/pf/net/pf_ioctl.c ============================================================================== --- user/eri/pf45/head/sys/contrib/pf/net/pf_ioctl.c Thu Oct 15 10:49:24 2009 (r198123) +++ user/eri/pf45/head/sys/contrib/pf/net/pf_ioctl.c Thu Oct 15 11:12:53 2009 (r198124) @@ -39,6 +39,7 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_global.h" #include "opt_inet.h" #include "opt_inet6.h" #include "opt_bpf.h" @@ -178,21 +179,30 @@ void pf_addr_copyout(struct pf_addr_w #ifdef __FreeBSD__ VNET_DEFINE(struct pf_rule, pf_default_rule); VNET_DEFINE(struct sx, pf_consistency_lock); +#ifndef VIMAGE SX_SYSINIT(pf_consistency_lock, &V_pf_consistency_lock, "pf_statetbl_lock"); +#endif #ifdef ALTQ -static VNET_DEFINE(int, pf_altq_running); -#define pf_altq_running VNET(pf_altq_running) +static VNET_DEFINE(int, pf_altq_running); +#define V_pf_altq_running VNET(pf_altq_running) #endif TAILQ_HEAD(pf_tags, pf_tagname); +#ifdef VIMAGE +#define V_pf_tags VNET(pf_tags) +VNET_DEFINE(struct pf_tags, pf_tags); +#define V_pf_qids VNET(pf_qids) +VNET_DEFINE(struct pf_tags, pf_qids); +#else #define V_pf_tags VNET(pf_tags) VNET_DEFINE(struct pf_tags, pf_tags) = TAILQ_HEAD_INITIALIZER(V_pf_tags); +#define V_pf_qids VNET(pf_qids) VNET_DEFINE(struct pf_tags, pf_qids) = - TAILQ_HEAD_INITIALIZER(pf_qids); -#define pf_qids VNET(pf_qids) + TAILQ_HEAD_INITIALIZER(V_pf_qids); +#endif #else /* !__FreeBSD__ */ struct pf_rule pf_default_rule; @@ -223,7 +233,7 @@ void pf_rtlabel_copyout(struct pf_add #endif #ifdef __FreeBSD__ -static VNET_DEFINE(struct cdev, *pf_dev); +static struct cdev *pf_dev; /* * XXX - These are new and need to be checked when moveing to a new version @@ -283,7 +293,7 @@ pflog_packet_t *pflog_packet_ptr = NUL VNET_DEFINE(int, debug_pfugidhack); SYSCTL_VNET_INT(_debug, OID_AUTO, pfugidhack, CTLFLAG_RW, - &V_debug_pfugidhack, 0, + &VNET_NAME(debug_pfugidhack), 0, "Enable/disable pf user/group rules mpsafe hack"); void @@ -419,7 +429,7 @@ pfattach(void) pf_normalize_init(); - bzero(&V_pf_status, sizeof(pf_status)); + bzero(&V_pf_status, sizeof(V_pf_status)); V_pf_status.debug = PF_DEBUG_URGENT; V_pf_pfil_hooked = 0; @@ -833,19 +843,31 @@ pf_rtlabel_copyout(struct pf_addr_wrap * u_int32_t pf_qname2qid(char *qname) { +#ifdef __FreeBSD__ + return ((u_int32_t)tagname2tag(&V_pf_qids, qname)); +#else return ((u_int32_t)tagname2tag(&pf_qids, qname)); +#endif } void pf_qid2qname(u_int32_t qid, char *p) { +#ifdef __FreeBSD__ + tag2tagname(&V_pf_qids, (u_int16_t)qid, p); +#else tag2tagname(&pf_qids, (u_int16_t)qid, p); +#endif } void pf_qid_unref(u_int32_t qid) { +#ifdef __FreeBSD__ + tag_unref(&V_pf_qids, (u_int16_t)qid); +#else tag_unref(&pf_qids, (u_int16_t)qid); +#endif } int @@ -962,7 +984,11 @@ pf_commit_altq(u_int32_t ticket) #endif /* attach the discipline */ error = altq_pfattach(altq); +#ifdef __FreeBSD__ + if (error == 0 && V_pf_altq_running) +#else if (error == 0 && pf_altq_running) +#endif error = pf_enable_altq(altq); if (error != 0) { splx(s); @@ -983,7 +1009,11 @@ pf_commit_altq(u_int32_t ticket) if (altq->qname[0] == 0) { #endif /* detach and destroy the discipline */ +#ifdef __FreeBSD__ + if (V_pf_altq_running) +#else if (pf_altq_running) +#endif error = pf_disable_altq(altq); err = altq_pfdetach(altq); if (err != 0 && error == 0) @@ -2611,7 +2641,11 @@ pfioctl(dev_t dev, u_long cmd, caddr_t a } } if (error == 0) +#ifdef __FreeBSD__ + V_pf_altq_running = 1; +#else pf_altq_running = 1; +#endif DPFPRINTF(PF_DEBUG_MISC, ("altq: started\n")); break; } @@ -2634,7 +2668,11 @@ pfioctl(dev_t dev, u_long cmd, caddr_t a } } if (error == 0) +#ifdef __FreeBSD__ + V_pf_altq_running = 0; +#else pf_altq_running = 0; +#endif DPFPRINTF(PF_DEBUG_MISC, ("altq: stopped\n")); break; } @@ -3098,7 +3136,11 @@ pfioctl(dev_t dev, u_long cmd, caddr_t a pr->nr = 0; if (ruleset->anchor == NULL) { /* XXX kludge for pf_main_ruleset */ +#ifdef __FreeBSD__ + RB_FOREACH(anchor, pf_anchor_global, &V_pf_anchors) +#else RB_FOREACH(anchor, pf_anchor_global, &pf_anchors) +#endif if (anchor->parent == NULL) pr->nr++; } else { @@ -3123,7 +3165,11 @@ pfioctl(dev_t dev, u_long cmd, caddr_t a pr->name[0] = 0; if (ruleset->anchor == NULL) { /* XXX kludge for pf_main_ruleset */ +#ifdef __FreeBSD__ + RB_FOREACH(anchor, pf_anchor_global, &V_pf_anchors) +#else RB_FOREACH(anchor, pf_anchor_global, &pf_anchors) +#endif if (anchor->parent == NULL && nr++ == pr->nr) { strlcpy(pr->name, anchor->name, sizeof(pr->name)); @@ -4261,6 +4307,9 @@ vnet_pf_init(const void *unused) V_debug_pfugidhack = 0; + TAILQ_INIT(&V_pf_tags); + TAILQ_INIT(&V_pf_qids); + return (0); } @@ -4293,6 +4342,9 @@ static int pf_load(void) { init_zone_var(); +#ifdef VIMAGE + sx_init(&V_pf_consistency_lock, "pf_statetbl_lock"); +#endif init_pf_mutex(); pf_dev = make_dev(&pf_cdevsw, 0, 0, 0, 0600, PF_NAME); if (pfattach() < 0) { @@ -4335,6 +4387,9 @@ pf_unload(void) PF_UNLOCK(); destroy_dev(pf_dev); destroy_pf_mutex(); +#ifdef VIMAGE + sx_destroy(&V_pf_consistency_lock); +#endif return error; } Modified: user/eri/pf45/head/sys/contrib/pf/net/pf_ruleset.c ============================================================================== --- user/eri/pf45/head/sys/contrib/pf/net/pf_ruleset.c Thu Oct 15 10:49:24 2009 (r198123) +++ user/eri/pf45/head/sys/contrib/pf/net/pf_ruleset.c Thu Oct 15 11:12:53 2009 (r198124) @@ -171,7 +171,11 @@ pf_find_anchor(const char *path) if (key == NULL) return (NULL); strlcpy(key->path, path, sizeof(key->path)); +#ifdef __FreeBSD__ + found = RB_FIND(pf_anchor_global, &V_pf_anchors, key); +#else found = RB_FIND(pf_anchor_global, &pf_anchors, key); +#endif rs_free(key); return (found); } @@ -252,7 +256,11 @@ pf_find_or_create_ruleset(const char *pa strlcat(anchor->path, "/", sizeof(anchor->path)); } strlcat(anchor->path, anchor->name, sizeof(anchor->path)); +#ifdef __FreeBSD__ + if ((dup = RB_INSERT(pf_anchor_global, &V_pf_anchors, anchor)) != +#else if ((dup = RB_INSERT(pf_anchor_global, &pf_anchors, anchor)) != +#endif NULL) { printf("pf_find_or_create_ruleset: RB_INSERT1 " "'%s' '%s' collides with '%s' '%s'\n", @@ -269,7 +277,11 @@ pf_find_or_create_ruleset(const char *pa "RB_INSERT2 '%s' '%s' collides with " "'%s' '%s'\n", anchor->path, anchor->name, dup->path, dup->name); +#ifdef __FreeBSD__ + RB_REMOVE(pf_anchor_global, &V_pf_anchors, +#else RB_REMOVE(pf_anchor_global, &pf_anchors, +#endif anchor); rs_free(anchor); rs_free(p); @@ -305,7 +317,11 @@ pf_remove_if_empty_ruleset(struct pf_rul !TAILQ_EMPTY(ruleset->rules[i].inactive.ptr) || ruleset->rules[i].inactive.open) return; +#ifdef __FreeBSD__ + RB_REMOVE(pf_anchor_global, &V_pf_anchors, ruleset->anchor); +#else RB_REMOVE(pf_anchor_global, &pf_anchors, ruleset->anchor); +#endif if ((parent = ruleset->anchor->parent) != NULL) RB_REMOVE(pf_anchor_node, &parent->children, ruleset->anchor); From owner-svn-src-user@FreeBSD.ORG Thu Oct 15 15:55:35 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DC97A1065672; Thu, 15 Oct 2009 15:55:35 +0000 (UTC) (envelope-from eri@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CBFCA8FC17; Thu, 15 Oct 2009 15:55:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n9FFtZnL077894; Thu, 15 Oct 2009 15:55:35 GMT (envelope-from eri@svn.freebsd.org) Received: (from eri@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9FFtZqn077891; Thu, 15 Oct 2009 15:55:35 GMT (envelope-from eri@svn.freebsd.org) Message-Id: <200910151555.n9FFtZqn077891@svn.freebsd.org> From: Ermal Luçi Date: Thu, 15 Oct 2009 15:55:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r198137 - user/eri/pf45/head/sys/contrib/pf/net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Oct 2009 15:55:35 -0000 Author: eri Date: Thu Oct 15 15:55:35 2009 New Revision: 198137 URL: http://svn.freebsd.org/changeset/base/198137 Log: Some more V_ foo. Modified: user/eri/pf45/head/sys/contrib/pf/net/if_pfsync.c user/eri/pf45/head/sys/contrib/pf/net/pf_ioctl.c Modified: user/eri/pf45/head/sys/contrib/pf/net/if_pfsync.c ============================================================================== --- user/eri/pf45/head/sys/contrib/pf/net/if_pfsync.c Thu Oct 15 15:30:41 2009 (r198136) +++ user/eri/pf45/head/sys/contrib/pf/net/if_pfsync.c Thu Oct 15 15:55:35 2009 (r198137) @@ -711,7 +711,11 @@ pfsync_state_import(struct pfsync_state r = pf_main_ruleset.rules[ PF_RULESET_FILTER].active.ptr_array[ntohl(sp->rule)]; else +#ifdef __FreeBSD__ + r = &V_pf_default_rule; +#else r = &pf_default_rule; +#endif if ((r->max_states && r->states_cur >= r->max_states)) goto cleanup; Modified: user/eri/pf45/head/sys/contrib/pf/net/pf_ioctl.c ============================================================================== --- user/eri/pf45/head/sys/contrib/pf/net/pf_ioctl.c Thu Oct 15 15:30:41 2009 (r198136) +++ user/eri/pf45/head/sys/contrib/pf/net/pf_ioctl.c Thu Oct 15 15:55:35 2009 (r198137) @@ -273,9 +273,9 @@ static VNET_DEFINE(struct cdevsw, pf_cde #define pf_cdevsw VNET(pf_cdevsw) static volatile VNET_DEFINE(int, pf_pfil_hooked); -#define V_pf_pfil_hooked VNET(pf_pfil_hooked) -VNET_DEFINE(int, pf_end_threads); -struct mtx pf_task_mtx; +#define V_pf_pfil_hooked VNET(pf_pfil_hooked) +VNET_DEFINE(int, pf_end_threads); +VNET_DEFINE(struct mtx, pf_task_mtx); /* pfsync */ pfsync_state_import_t *pfsync_state_import_ptr = NULL; @@ -4378,7 +4378,7 @@ pf_unload(void) V_pf_end_threads = 1; while (V_pf_end_threads < 2) { wakeup_one(pf_purge_thread); - msleep(pf_purge_thread, &pf_task_mtx, 0, "pftmo", hz); + msleep(pf_purge_thread, &V_pf_task_mtx, 0, "pftmo", hz); } pfi_cleanup(); pf_osfp_flush(); From owner-svn-src-user@FreeBSD.ORG Thu Oct 15 17:40:07 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6A71B106568D; Thu, 15 Oct 2009 17:40:07 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4142B8FC23; Thu, 15 Oct 2009 17:40:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n9FHe7JF080342; Thu, 15 Oct 2009 17:40:07 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9FHe7K1080340; Thu, 15 Oct 2009 17:40:07 GMT (envelope-from des@svn.freebsd.org) Message-Id: <200910151740.n9FHe7K1080340@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Thu, 15 Oct 2009 17:40:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r198146 - user/des/svnsup X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Oct 2009 17:40:07 -0000 Author: des Date: Thu Oct 15 17:40:06 2009 New Revision: 198146 URL: http://svn.freebsd.org/changeset/base/198146 Log: Pretty it up a little, and add AC_USE_SYSTEM_EXTENSIONS, which is required for things like vasprintf() on GNU systems. Modified: user/des/svnsup/configure.ac Modified: user/des/svnsup/configure.ac ============================================================================== --- user/des/svnsup/configure.ac Thu Oct 15 17:35:34 2009 (r198145) +++ user/des/svnsup/configure.ac Thu Oct 15 17:40:06 2009 (r198146) @@ -5,10 +5,11 @@ AC_PREREQ([2.59]) AC_INIT([svnsup], [1.0], [des@des.no]) AC_CONFIG_SRCDIR([src/distill/distill.c]) AM_CONFIG_HEADER([config.h]) +AM_INIT_AUTOMAKE AC_LANG(C) +AC_USE_SYSTEM_EXTENSIONS AC_C_CONST -AM_INIT_AUTOMAKE AC_PROG_CC AC_PROG_CPP @@ -17,6 +18,7 @@ AC_PROG_LN_S AC_PROG_MAKE_SET AC_PROG_RANLIB +# Build svnsup-distill AC_ARG_ENABLE(distill, AS_HELP_STRING([--enable-distill], [build svnsup-distill (default is YES)]), @@ -24,6 +26,7 @@ AC_ARG_ENABLE(distill, ) AM_CONDITIONAL([ENABLE_DISTILL], [test x"$enable_distill" = xyes]) +# Build svnsup-apply AC_ARG_ENABLE(apply, AS_HELP_STRING([--enable-apply], [build svnsup-apply (default is YES)]), @@ -31,15 +34,17 @@ AC_ARG_ENABLE(apply, ) AM_CONDITIONAL([ENABLE_APPLY], [test x"$enable_apply" = xyes]) +# Enable debugging symbols AC_ARG_ENABLE(debugging, AS_HELP_STRING([--enable-debugging], - [enable debugging (default is NO)]), + [enable debugging symbols (default is NO)]), [ CFLAGS="${CFLAGS} -O0 -g" CPPFLAGS="${CPPFLAGS} -DDEBUG" ] ) +# Compile with -Wall AC_ARG_ENABLE(wall, AS_HELP_STRING([--enable-wall], [gcc only: compile with -Wall (default is NO)]), @@ -50,6 +55,7 @@ AC_ARG_ENABLE(wall, ]) ) +# Compile with -Wextra AC_ARG_ENABLE(wextra, AS_HELP_STRING([--enable-wextra], [gcc only: compile with -Wextra (default is NO)]), @@ -60,6 +66,7 @@ AC_ARG_ENABLE(wextra, ]) ) +# Compile with -Werror AC_ARG_ENABLE(werror, AS_HELP_STRING([--enable-werror], [gcc only: compile with -Werror (default is NO)]), From owner-svn-src-user@FreeBSD.ORG Thu Oct 15 17:40:45 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 740841065676; Thu, 15 Oct 2009 17:40:45 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4AF2C8FC39; Thu, 15 Oct 2009 17:40:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n9FHejGl080386; Thu, 15 Oct 2009 17:40:45 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9FHejjL080384; Thu, 15 Oct 2009 17:40:45 GMT (envelope-from des@svn.freebsd.org) Message-Id: <200910151740.n9FHejjL080384@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Thu, 15 Oct 2009 17:40:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r198147 - user/des/svnsup/src/libsvnsup X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Oct 2009 17:40:45 -0000 Author: des Date: Thu Oct 15 17:40:45 2009 New Revision: 198147 URL: http://svn.freebsd.org/changeset/base/198147 Log: Missing #include "config.h" Modified: user/des/svnsup/src/libsvnsup/svnsup_delta.c Modified: user/des/svnsup/src/libsvnsup/svnsup_delta.c ============================================================================== --- user/des/svnsup/src/libsvnsup/svnsup_delta.c Thu Oct 15 17:40:06 2009 (r198146) +++ user/des/svnsup/src/libsvnsup/svnsup_delta.c Thu Oct 15 17:40:45 2009 (r198147) @@ -27,6 +27,10 @@ * $Id$ */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include #include From owner-svn-src-user@FreeBSD.ORG Thu Oct 15 23:30:57 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4ADEF1065676; Thu, 15 Oct 2009 23:30:57 +0000 (UTC) (envelope-from eri@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3A7F08FC0C; Thu, 15 Oct 2009 23:30:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n9FNUv8B087661; Thu, 15 Oct 2009 23:30:57 GMT (envelope-from eri@svn.freebsd.org) Received: (from eri@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9FNUviR087658; Thu, 15 Oct 2009 23:30:57 GMT (envelope-from eri@svn.freebsd.org) Message-Id: <200910152330.n9FNUviR087658@svn.freebsd.org> From: Ermal Luçi Date: Thu, 15 Oct 2009 23:30:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r198163 - user/eri/pf45/head/sys/contrib/pf/net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Oct 2009 23:30:57 -0000 Author: eri Date: Thu Oct 15 23:30:56 2009 New Revision: 198163 URL: http://svn.freebsd.org/changeset/base/198163 Log: Make visible to userland the ioctl definitions so ifconfig can compile. Modified: user/eri/pf45/head/sys/contrib/pf/net/if_pflow.h user/eri/pf45/head/sys/contrib/pf/net/if_pfsync.h Modified: user/eri/pf45/head/sys/contrib/pf/net/if_pflow.h ============================================================================== --- user/eri/pf45/head/sys/contrib/pf/net/if_pflow.h Thu Oct 15 23:20:23 2009 (r198162) +++ user/eri/pf45/head/sys/contrib/pf/net/if_pflow.h Thu Oct 15 23:30:56 2009 (r198163) @@ -123,12 +123,12 @@ struct pflowreq { #define PFLOW_MASK_DSTPRT 0x04 }; -#ifdef _KERNEL #ifdef __FreeBSD__ #define SIOCSETPFLOW _IOW('i', 249, struct ifreq) #define SIOCGETPFLOW _IOWR('i', 250, struct ifreq) #endif +#ifdef _KERNEL int export_pflow(struct pf_state *); int pflow_sysctl(int *, u_int, void *, size_t *, void *, size_t); #endif /* _KERNEL */ Modified: user/eri/pf45/head/sys/contrib/pf/net/if_pfsync.h ============================================================================== --- user/eri/pf45/head/sys/contrib/pf/net/if_pfsync.h Thu Oct 15 23:20:23 2009 (r198162) +++ user/eri/pf45/head/sys/contrib/pf/net/if_pfsync.h Thu Oct 15 23:30:56 2009 (r198163) @@ -268,13 +268,13 @@ struct pfsyncreq { int pfsyncr_authlevel; }; -#ifdef _KERNEL - #ifdef __FreeBSD__ #define SIOCSETPFSYNC _IOW('i', 247, struct ifreq) #define SIOCGETPFSYNC _IOWR('i', 248, struct ifreq) #endif +#ifdef _KERNEL + /* * this shows where a pf state is with respect to the syncing. */ From owner-svn-src-user@FreeBSD.ORG Fri Oct 16 21:42:54 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 219781065692; Fri, 16 Oct 2009 21:42:54 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1128B8FC17; Fri, 16 Oct 2009 21:42:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n9GLgrFj014244; Fri, 16 Oct 2009 21:42:53 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9GLgrN9014242; Fri, 16 Oct 2009 21:42:53 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200910162142.n9GLgrN9014242@svn.freebsd.org> From: Kip Macy Date: Fri, 16 Oct 2009 21:42:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r198176 - user/kmacy/releng_8_fcs/sys/kern X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Oct 2009 21:42:54 -0000 Author: kmacy Date: Fri Oct 16 21:42:53 2009 New Revision: 198176 URL: http://svn.freebsd.org/changeset/base/198176 Log: remove unused variable Modified: user/kmacy/releng_8_fcs/sys/kern/uipc_sockbuf.c Modified: user/kmacy/releng_8_fcs/sys/kern/uipc_sockbuf.c ============================================================================== --- user/kmacy/releng_8_fcs/sys/kern/uipc_sockbuf.c Fri Oct 16 20:52:45 2009 (r198175) +++ user/kmacy/releng_8_fcs/sys/kern/uipc_sockbuf.c Fri Oct 16 21:42:53 2009 (r198176) @@ -906,7 +906,6 @@ sbdrop_internal(struct sockbuf *sb, int void sbdrop_locked(struct sockbuf *sb, int len) { - int flags; SOCKBUF_LOCK_ASSERT(sb); From owner-svn-src-user@FreeBSD.ORG Fri Oct 16 22:34:52 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BF52D106566C; Fri, 16 Oct 2009 22:34:52 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AE1968FC0C; Fri, 16 Oct 2009 22:34:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n9GMYqOv015345; Fri, 16 Oct 2009 22:34:52 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9GMYqFo015343; Fri, 16 Oct 2009 22:34:52 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200910162234.n9GMYqFo015343@svn.freebsd.org> From: Kip Macy Date: Fri, 16 Oct 2009 22:34:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r198179 - user/kmacy/releng_8_fcs/cddl/contrib/opensolaris/lib/libzpool/common/sys X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Oct 2009 22:34:52 -0000 Author: kmacy Date: Fri Oct 16 22:34:52 2009 New Revision: 198179 URL: http://svn.freebsd.org/changeset/base/198179 Log: define KM_NODEBUG to fix the compile Modified: user/kmacy/releng_8_fcs/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h Modified: user/kmacy/releng_8_fcs/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h ============================================================================== --- user/kmacy/releng_8_fcs/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h Fri Oct 16 22:24:56 2009 (r198178) +++ user/kmacy/releng_8_fcs/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h Fri Oct 16 22:34:52 2009 (r198179) @@ -305,6 +305,8 @@ extern void cv_broadcast(kcondvar_t *cv) #define KM_PUSHPAGE KM_SLEEP #define KM_NOSLEEP UMEM_DEFAULT #define KMC_NODEBUG UMC_NODEBUG +#define KM_NODEBUG KMC_NODEBUG + #define kmem_alloc(_s, _f) umem_alloc(_s, _f) #define kmem_zalloc(_s, _f) umem_zalloc(_s, _f) #define kmem_free(_b, _s) umem_free(_b, _s) From owner-svn-src-user@FreeBSD.ORG Sat Oct 17 23:01:29 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A1BD8106566B; Sat, 17 Oct 2009 23:01:29 +0000 (UTC) (envelope-from eri@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 903078FC0A; Sat, 17 Oct 2009 23:01:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n9HN1Td0053224; Sat, 17 Oct 2009 23:01:29 GMT (envelope-from eri@svn.freebsd.org) Received: (from eri@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9HN1Tnw053214; Sat, 17 Oct 2009 23:01:29 GMT (envelope-from eri@svn.freebsd.org) Message-Id: <200910172301.n9HN1Tnw053214@svn.freebsd.org> From: Ermal Luçi Date: Sat, 17 Oct 2009 23:01:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r198192 - user/eri/pf45/head/sys/contrib/pf/net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Oct 2009 23:01:29 -0000 Author: eri Date: Sat Oct 17 23:01:29 2009 New Revision: 198192 URL: http://svn.freebsd.org/changeset/base/198192 Log: Say HELLO to pf(4) virtualized. * Set propper context where required. * Prepend V_ to some more global variables. * Initialize pf(4) during with vnet events rather than module ones. * Include opt_global.h where required to aid in building with virtualization enabled Please help test! Modified: user/eri/pf45/head/sys/contrib/pf/net/pf.c user/eri/pf45/head/sys/contrib/pf/net/pf_if.c user/eri/pf45/head/sys/contrib/pf/net/pf_ioctl.c user/eri/pf45/head/sys/contrib/pf/net/pf_lb.c user/eri/pf45/head/sys/contrib/pf/net/pf_norm.c user/eri/pf45/head/sys/contrib/pf/net/pf_osfp.c user/eri/pf45/head/sys/contrib/pf/net/pf_ruleset.c user/eri/pf45/head/sys/contrib/pf/net/pf_table.c user/eri/pf45/head/sys/contrib/pf/net/pfvar.h Modified: user/eri/pf45/head/sys/contrib/pf/net/pf.c ============================================================================== --- user/eri/pf45/head/sys/contrib/pf/net/pf.c Sat Oct 17 21:52:31 2009 (r198191) +++ user/eri/pf45/head/sys/contrib/pf/net/pf.c Sat Oct 17 23:01:29 2009 (r198192) @@ -36,6 +36,7 @@ */ #ifdef __FreeBSD__ +#include "opt_global.h" #include "opt_inet.h" #include "opt_inet6.h" @@ -1326,18 +1327,20 @@ void pf_purge_thread(void *v) { int nloops = 0, s; - #ifdef __FreeBSD__ +#ifdef __FreeBSD__ int locked; - #endif +#endif + + CURVNET_SET((struct vnet *)v); for (;;) { tsleep(pf_purge_thread, PWAIT, "pftm", 1 * hz); - #ifdef __FreeBSD__ +#ifdef __FreeBSD__ sx_slock(&V_pf_consistency_lock); PF_LOCK(); locked = 0; - + if (V_pf_end_threads) { PF_UNLOCK(); sx_sunlock(&V_pf_consistency_lock); @@ -1354,11 +1357,11 @@ pf_purge_thread(void *v) wakeup(pf_purge_thread); kproc_exit(0); } - #endif +#endif s = splsoftnet(); /* process a fraction of the state table every second */ - #ifdef __FreeBSD__ +#ifdef __FreeBSD__ if(!pf_purge_expired_states(1 + (V_pf_status.states / V_pf_default_rule.timeout[PFTM_INTERVAL]), 0)) { PF_UNLOCK(); @@ -1370,7 +1373,7 @@ pf_purge_thread(void *v) pf_purge_expired_states(1 + (V_pf_status.states / V_pf_default_rule.timeout[PFTM_INTERVAL]), 1); } - #else +#else pf_purge_expired_states(1 + (pf_status.states / pf_default_rule.timeout[PFTM_INTERVAL])); #endif @@ -1395,6 +1398,7 @@ pf_purge_thread(void *v) sx_sunlock(&V_pf_consistency_lock); #endif } + CURVNET_RESTORE(); } u_int32_t Modified: user/eri/pf45/head/sys/contrib/pf/net/pf_if.c ============================================================================== --- user/eri/pf45/head/sys/contrib/pf/net/pf_if.c Sat Oct 17 21:52:31 2009 (r198191) +++ user/eri/pf45/head/sys/contrib/pf/net/pf_if.c Sat Oct 17 23:01:29 2009 (r198192) @@ -33,6 +33,7 @@ */ #if defined(__FreeBSD__) +#include "opt_global.h" #include "opt_inet.h" #include "opt_inet6.h" @@ -120,11 +121,10 @@ int pfi_unmask(void *); #ifdef __FreeBSD__ void pfi_attach_ifnet_event(void * __unused, struct ifnet *); void pfi_detach_ifnet_event(void * __unused, struct ifnet *); -void pfi_attach_group_event(void * __unused, struct ifg_group *); -void pfi_change_group_event(void * __unused, char *); -void pfi_detach_group_event(void * __unused, struct ifg_group *); +void pfi_attach_group_event(void *, struct ifg_group *); +void pfi_change_group_event(void *, char *); +void pfi_detach_group_event(void *, struct ifg_group *); void pfi_ifaddr_event(void * __unused, struct ifnet *); - #endif RB_PROTOTYPE(pfi_ifhead, pfi_kif, pfik_tree, pfi_if_compare); @@ -177,11 +177,11 @@ pfi_initialize(void) pfi_detach_cookie = EVENTHANDLER_REGISTER(ifnet_departure_event, pfi_detach_ifnet_event, NULL, EVENTHANDLER_PRI_ANY); pfi_attach_group_cookie = EVENTHANDLER_REGISTER(group_attach_event, - pfi_attach_group_event, NULL, EVENTHANDLER_PRI_ANY); + pfi_attach_group_event, curvnet, EVENTHANDLER_PRI_ANY); pfi_change_group_cookie = EVENTHANDLER_REGISTER(group_change_event, - pfi_change_group_event, NULL, EVENTHANDLER_PRI_ANY); + pfi_change_group_event, curvnet, EVENTHANDLER_PRI_ANY); pfi_detach_group_cookie = EVENTHANDLER_REGISTER(group_detach_event, - pfi_detach_group_event, NULL, EVENTHANDLER_PRI_ANY); + pfi_detach_group_event, curvnet, EVENTHANDLER_PRI_ANY); pfi_ifaddr_event_cookie = EVENTHANDLER_REGISTER(ifaddr_event, pfi_ifaddr_event, NULL, EVENTHANDLER_PRI_ANY); #endif @@ -1040,55 +1040,67 @@ pfi_unmask(void *addr) void pfi_attach_ifnet_event(void *arg __unused, struct ifnet *ifp) { + CURVNET_SET(ifp->if_vnet); PF_LOCK(); pfi_attach_ifnet(ifp); #ifdef ALTQ pf_altq_ifnet_event(ifp, 0); #endif PF_UNLOCK(); + CURVNET_RESTORE(); } void pfi_detach_ifnet_event(void *arg __unused, struct ifnet *ifp) { + CURVNET_SET(ifp->if_vnet); PF_LOCK(); pfi_detach_ifnet(ifp); #ifdef ALTQ pf_altq_ifnet_event(ifp, 1); #endif PF_UNLOCK(); + CURVNET_RESTORE(); } void - pfi_attach_group_event(void *arg __unused, struct ifg_group *ifg) + pfi_attach_group_event(void *arg , struct ifg_group *ifg) { + CURVNET_SET((struct vnet *)arg); PF_LOCK(); pfi_attach_ifgroup(ifg); PF_UNLOCK(); + CURVNET_RESTORE(); } void - pfi_change_group_event(void *arg __unused, char *gname) + pfi_change_group_event(void *arg, char *gname) { + CURVNET_SET((struct vnet *)arg); PF_LOCK(); pfi_group_change(gname); PF_UNLOCK(); + CURVNET_RESTORE(); } void - pfi_detach_group_event(void *arg __unused, struct ifg_group *ifg) + pfi_detach_group_event(void *arg, struct ifg_group *ifg) { + CURVNET_SET((struct vnet *)arg); PF_LOCK(); pfi_detach_ifgroup(ifg); PF_UNLOCK(); + CURVNET_RESTORE(); } void pfi_ifaddr_event(void *arg __unused, struct ifnet *ifp) { + CURVNET_SET(ifp->if_vnet); PF_LOCK(); if (ifp && ifp->if_pf_kif) pfi_kifaddr_update(ifp->if_pf_kif); PF_UNLOCK(); + CURVNET_RESTORE(); } #endif /* __FreeBSD__ */ Modified: user/eri/pf45/head/sys/contrib/pf/net/pf_ioctl.c ============================================================================== --- user/eri/pf45/head/sys/contrib/pf/net/pf_ioctl.c Sat Oct 17 21:52:31 2009 (r198191) +++ user/eri/pf45/head/sys/contrib/pf/net/pf_ioctl.c Sat Oct 17 23:01:29 2009 (r198192) @@ -78,6 +78,8 @@ __FBSDID("$FreeBSD$"); #include #include #ifdef __FreeBSD__ +#include +#include #include #include #include @@ -176,13 +178,11 @@ int pf_addr_setup(struct pf_ruleset * void pf_addr_copyout(struct pf_addr_wrap *); #define TAGID_MAX 50000 + #ifdef __FreeBSD__ VNET_DEFINE(struct pf_rule, pf_default_rule); VNET_DEFINE(struct sx, pf_consistency_lock); -#ifndef VIMAGE -SX_SYSINIT(pf_consistency_lock, &V_pf_consistency_lock, - "pf_statetbl_lock"); -#endif + #ifdef ALTQ static VNET_DEFINE(int, pf_altq_running); #define V_pf_altq_running VNET(pf_altq_running) @@ -190,19 +190,10 @@ static VNET_DEFINE(int, pf_altq_running TAILQ_HEAD(pf_tags, pf_tagname); -#ifdef VIMAGE #define V_pf_tags VNET(pf_tags) VNET_DEFINE(struct pf_tags, pf_tags); #define V_pf_qids VNET(pf_qids) VNET_DEFINE(struct pf_tags, pf_qids); -#else -#define V_pf_tags VNET(pf_tags) -VNET_DEFINE(struct pf_tags, pf_tags) = - TAILQ_HEAD_INITIALIZER(V_pf_tags); -#define V_pf_qids VNET(pf_qids) -VNET_DEFINE(struct pf_tags, pf_qids) = - TAILQ_HEAD_INITIALIZER(V_pf_qids); -#endif #else /* !__FreeBSD__ */ struct pf_rule pf_default_rule; @@ -233,7 +224,8 @@ void pf_rtlabel_copyout(struct pf_add #endif #ifdef __FreeBSD__ -static struct cdev *pf_dev; +static VNET_DEFINE(struct cdev *, pf_dev); +#define V_pf_dev VNET(pf_dev) /* * XXX - These are new and need to be checked when moveing to a new version @@ -265,12 +257,11 @@ static int shutdown_pf(void static int pf_load(void); static int pf_unload(void); -static VNET_DEFINE(struct cdevsw, pf_cdevsw) = { +static struct cdevsw pf_cdevsw = { .d_ioctl = pfioctl, .d_name = PF_NAME, .d_version = D_VERSION, }; -#define pf_cdevsw VNET(pf_cdevsw) static volatile VNET_DEFINE(int, pf_pfil_hooked); #define V_pf_pfil_hooked VNET(pf_pfil_hooked) @@ -437,7 +428,7 @@ pfattach(void) /* XXX do our best to avoid a conflict */ V_pf_status.hostid = arc4random(); - if (kproc_create(pf_purge_thread, NULL, NULL, 0, 0, "pfpurge")) + if (kproc_create(pf_purge_thread, curvnet, NULL, 0, 0, "pfpurge")) return (ENXIO); m_addr_chg_pf_p = pf_pkt_addr_changed; @@ -1460,6 +1451,8 @@ pfioctl(dev_t dev, u_long cmd, caddr_t a #endif int error = 0; + CURVNET_SET(TD_TO_VNET(td)); + /* XXX keep in sync with switch() below */ #ifdef __FreeBSD__ if (securelevel_gt(td->td_ucred, 2)) @@ -3894,6 +3887,9 @@ fail: else rw_exit_read(&pf_consistency_lock); #endif + + CURVNET_RESTORE(); + return (error); } @@ -4118,7 +4114,9 @@ pf_check_in(void *arg, struct mbuf **m, HTONS(h->ip_len); HTONS(h->ip_off); } + CURVNET_SET(ifp->if_vnet); chk = pf_test(PF_IN, ifp, m, NULL, inp); + CURVNET_RESTORE(); if (chk && *m) { m_freem(*m); *m = NULL; @@ -4158,7 +4156,9 @@ pf_check_out(void *arg, struct mbuf **m, HTONS(h->ip_len); HTONS(h->ip_off); } + CURVNET_SET(ifp->if_vnet); chk = pf_test(PF_OUT, ifp, m, NULL, inp); + CURVNET_RESTORE(); if (chk && *m) { m_freem(*m); *m = NULL; @@ -4189,8 +4189,10 @@ pf_check6_in(void *arg, struct mbuf **m, * order to support scoped addresses. In order to support stateful * filtering we have change this to lo0 as it is the case in IPv4. */ + CURVNET_SET(ifp->if_vnet); chk = pf_test6(PF_IN, (*m)->m_flags & M_LOOP ? V_loif : ifp, m, NULL, inp); + CURVNET_RESTORE(); if (chk && *m) { m_freem(*m); *m = NULL; @@ -4212,7 +4214,9 @@ pf_check6_out(void *arg, struct mbuf **m in_delayed_cksum(*m); (*m)->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA; } + CURVNET_SET(ifp->if_vnet); chk = pf_test6(PF_OUT, ifp, m, NULL, inp); + CURVNET_RESTORE(); if (chk && *m) { m_freem(*m); *m = NULL; @@ -4232,7 +4236,7 @@ hook_pf(void) #endif PF_ASSERT(MA_NOTOWNED); - + if (V_pf_pfil_hooked) return (0); @@ -4310,11 +4314,15 @@ vnet_pf_init(const void *unused) TAILQ_INIT(&V_pf_tags); TAILQ_INIT(&V_pf_qids); + pf_load(); + return (0); } static int vnet_pf_uninit(const void *unused) { + pf_unload(); + return (0); } @@ -4342,16 +4350,15 @@ static int pf_load(void) { init_zone_var(); -#ifdef VIMAGE sx_init(&V_pf_consistency_lock, "pf_statetbl_lock"); -#endif init_pf_mutex(); - pf_dev = make_dev(&pf_cdevsw, 0, 0, 0, 0600, PF_NAME); + V_pf_dev = make_dev(&pf_cdevsw, 0, 0, 0, 0600, PF_NAME); if (pfattach() < 0) { - destroy_dev(pf_dev); + destroy_dev(V_pf_dev); destroy_pf_mutex(); return (ENOMEM); } + return (0); } @@ -4385,11 +4392,9 @@ pf_unload(void) pf_osfp_cleanup(); cleanup_pf_zone(); PF_UNLOCK(); - destroy_dev(pf_dev); + destroy_dev(V_pf_dev); destroy_pf_mutex(); -#ifdef VIMAGE sx_destroy(&V_pf_consistency_lock); -#endif return error; } @@ -4400,11 +4405,9 @@ pf_modevent(module_t mod, int type, void switch(type) { case MOD_LOAD: - error = pf_load(); break; case MOD_UNLOAD: - error = pf_unload(); break; default: error = EINVAL; Modified: user/eri/pf45/head/sys/contrib/pf/net/pf_lb.c ============================================================================== --- user/eri/pf45/head/sys/contrib/pf/net/pf_lb.c Sat Oct 17 21:52:31 2009 (r198191) +++ user/eri/pf45/head/sys/contrib/pf/net/pf_lb.c Sat Oct 17 23:01:29 2009 (r198192) @@ -36,6 +36,7 @@ */ #ifdef __FreeBSD__ +#include "opt_global.h" #include "opt_inet.h" #include "opt_inet6.h" Modified: user/eri/pf45/head/sys/contrib/pf/net/pf_norm.c ============================================================================== --- user/eri/pf45/head/sys/contrib/pf/net/pf_norm.c Sat Oct 17 21:52:31 2009 (r198191) +++ user/eri/pf45/head/sys/contrib/pf/net/pf_norm.c Sat Oct 17 23:01:29 2009 (r198192) @@ -26,6 +26,7 @@ */ #ifdef __FreeBSD__ +#include "opt_global.h" #include "opt_inet.h" #include "opt_inet6.h" #include "opt_pf.h" Modified: user/eri/pf45/head/sys/contrib/pf/net/pf_osfp.c ============================================================================== --- user/eri/pf45/head/sys/contrib/pf/net/pf_osfp.c Sat Oct 17 21:52:31 2009 (r198191) +++ user/eri/pf45/head/sys/contrib/pf/net/pf_osfp.c Sat Oct 17 23:01:29 2009 (r198192) @@ -17,6 +17,10 @@ * */ +#ifdef __FreeBSD__ +#include "opt_global.h" +#endif + #include #include #ifdef _KERNEL Modified: user/eri/pf45/head/sys/contrib/pf/net/pf_ruleset.c ============================================================================== --- user/eri/pf45/head/sys/contrib/pf/net/pf_ruleset.c Sat Oct 17 21:52:31 2009 (r198191) +++ user/eri/pf45/head/sys/contrib/pf/net/pf_ruleset.c Sat Oct 17 23:01:29 2009 (r198192) @@ -40,6 +40,10 @@ __FBSDID("$FreeBSD$"); #endif +#ifdef _KERNEL +#include "opt_global.h" +#endif + #include #include #ifdef _KERNEL @@ -96,6 +100,13 @@ __FBSDID("$FreeBSD$"); # endif /* PFDEBUG */ #endif /* _KERNEL */ +#if defined(__FreeBSD__) && !defined(_KERNEL) +#undef V_pf_anchors +#define V_pf_anchors pf_anchors + +#undef pf_main_ruleset +#define pf_main_ruleset pf_main_anchor.ruleset +#endif #if defined(__FreeBSD__) && defined(_KERNEL) VNET_DEFINE(struct pf_anchor_global, pf_anchors); Modified: user/eri/pf45/head/sys/contrib/pf/net/pf_table.c ============================================================================== --- user/eri/pf45/head/sys/contrib/pf/net/pf_table.c Sat Oct 17 21:52:31 2009 (r198191) +++ user/eri/pf45/head/sys/contrib/pf/net/pf_table.c Sat Oct 17 23:01:29 2009 (r198192) @@ -31,6 +31,7 @@ */ #ifdef __FreeBSD__ +#include "opt_global.h" #include "opt_inet.h" #include "opt_inet6.h" Modified: user/eri/pf45/head/sys/contrib/pf/net/pfvar.h ============================================================================== --- user/eri/pf45/head/sys/contrib/pf/net/pfvar.h Sat Oct 17 21:52:31 2009 (r198191) +++ user/eri/pf45/head/sys/contrib/pf/net/pfvar.h Sat Oct 17 23:01:29 2009 (r198192) @@ -235,8 +235,8 @@ struct pfi_dynaddr { if(var) uma_zdestroy(var) #ifdef __FreeBSD__ -VNET_DECLARE(struct mtx, pf_task_mtx); -#define V_pf_task_mtx VNET(pf_task_mtx) +VNET_DECLARE(struct mtx, pf_task_mtx); +#define V_pf_task_mtx VNET(pf_task_mtx) #define PF_ASSERT(h) mtx_assert(&V_pf_task_mtx, (h)) From owner-svn-src-user@FreeBSD.ORG Sat Oct 17 23:04:05 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 40193106566C; Sat, 17 Oct 2009 23:04:05 +0000 (UTC) (envelope-from eri@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2E58F8FC0A; Sat, 17 Oct 2009 23:04:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n9HN45iM053298; Sat, 17 Oct 2009 23:04:05 GMT (envelope-from eri@svn.freebsd.org) Received: (from eri@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9HN4580053296; Sat, 17 Oct 2009 23:04:05 GMT (envelope-from eri@svn.freebsd.org) Message-Id: <200910172304.n9HN4580053296@svn.freebsd.org> From: Ermal Luçi Date: Sat, 17 Oct 2009 23:04:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r198193 - user/eri/pf45/head/sys/modules/pf X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Oct 2009 23:04:05 -0000 Author: eri Date: Sat Oct 17 23:04:04 2009 New Revision: 198193 URL: http://svn.freebsd.org/changeset/base/198193 Log: Allow pf(4) module to be built as module with vimage options enabled. It is off by default. To enable just define VIMAGE variable. Modified: user/eri/pf45/head/sys/modules/pf/Makefile Modified: user/eri/pf45/head/sys/modules/pf/Makefile ============================================================================== --- user/eri/pf45/head/sys/modules/pf/Makefile Sat Oct 17 23:01:29 2009 (r198192) +++ user/eri/pf45/head/sys/modules/pf/Makefile Sat Oct 17 23:04:04 2009 (r198193) @@ -9,7 +9,7 @@ KMOD= pf SRCS = pf.c pf_if.c pf_lb.c pf_osfp.c pf_ioctl.c pf_norm.c pf_table.c \ pf_ruleset.c \ in4_cksum.c \ - opt_pf.h opt_inet.h opt_inet6.h opt_bpf.h + opt_pf.h opt_inet.h opt_inet6.h opt_bpf.h opt_global.h CFLAGS+= -I${.CURDIR}/../../contrib/pf @@ -33,6 +33,11 @@ opt_pf.h: echo "#define DEV_PFSYNC 1" >> ${.TARGET} echo "#define DEV_PFLOW 1" >> ${.TARGET} +.if defined(VIMAGE) +opt_global.h: + echo "#define VIMAGE 1" >> ${.TARGET} +.endif + .endif .include