Module Name: src Committed By: riz Date: Sun Nov 18 21:45:09 UTC 2012
Modified Files: src/sys/net/npf [netbsd-6]: npf_impl.h npf_state.c src/sys/rump/librump/rumpkern [netbsd-6]: rump.c src/sys/rump/net [netbsd-6]: Makefile.rumpnetcomp src/usr.sbin/npf/npftest [netbsd-6]: Makefile README npftest.c npftest.h src/usr.sbin/npf/npftest/libnpftest [netbsd-6]: npf_test.h npf_test_subr.c Added Files: src/sys/rump/net/lib/libnpf [netbsd-6]: Makefile component.c shlib_version Removed Files: src/sys/rump/dev/lib/libnpf [netbsd-6]: Makefile component.c shlib_version Log Message: Pull up following revision(s) (requested by rmind in ticket #678): sys/rump/librump/rumpkern/rump.c: revision 1.243 sys/rump/librump/rumpkern/rump.c: revision 1.244 sys/rump/librump/rumpkern/rump.c: revision 1.245 sys/rump/librump/rumpkern/rump.c: revision 1.246 usr.sbin/npf/npftest/npftest.c: revision 1.5 usr.sbin/npf/npftest/README: revision 1.2 usr.sbin/npf/npftest/npftest.h: revision 1.5 sys/rump/net/Makefile.rumpnetcomp: revision 1.5 sys/rump/net/lib/libnpf/shlib_version: revision 1.1 sys/net/npf/npf_impl.h: revision 1.22 sys/rump/dev/lib/libnpf/Makefile: file removal usr.sbin/npf/npftest/Makefile: revision 1.3 sys/rump/dev/lib/libnpf/component.c: file removal sys/rump/dev/lib/libnpf/shlib_version: file removal sys/net/npf/npf_state.c: revision 1.12 sys/rump/net/lib/libnpf/component.c: revision 1.1 usr.sbin/npf/npftest/libnpftest/npf_test_subr.c: revision 1.4 usr.sbin/npf/npftest/libnpftest/npf_test.h: revision 1.6 sys/rump/net/lib/libnpf/Makefile: revision 1.1 Move and rename librumpdev_npf to librumpnet_npf. Enable the build of librumpnet_npf. Add npf_state_setsampler() for _NPF_TESTING case. This also fixes the build. Call pserialize_init() during rump start-up, since librump/net/npf uses it. It helps to include the declaration of the routine being called. We also need kcpuset_init() now. Use correct routine name - kcpuset_sysinit() vs kcpuset_init() To generate a diff of this commit: cvs rdiff -u -r1.10.2.7 -r1.10.2.8 src/sys/net/npf/npf_impl.h cvs rdiff -u -r1.6.4.5 -r1.6.4.6 src/sys/net/npf/npf_state.c cvs rdiff -u -r1.1.18.2 -r0 src/sys/rump/dev/lib/libnpf/Makefile cvs rdiff -u -r1.1 -r0 src/sys/rump/dev/lib/libnpf/component.c \ src/sys/rump/dev/lib/libnpf/shlib_version cvs rdiff -u -r1.240 -r1.240.2.1 src/sys/rump/librump/rumpkern/rump.c cvs rdiff -u -r1.4 -r1.4.16.1 src/sys/rump/net/Makefile.rumpnetcomp cvs rdiff -u -r0 -r1.2.4.2 src/sys/rump/net/lib/libnpf/Makefile cvs rdiff -u -r0 -r1.1.6.2 src/sys/rump/net/lib/libnpf/component.c \ src/sys/rump/net/lib/libnpf/shlib_version cvs rdiff -u -r1.2.2.2 -r1.2.2.3 src/usr.sbin/npf/npftest/Makefile cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/usr.sbin/npf/npftest/README cvs rdiff -u -r1.3.2.3 -r1.3.2.4 src/usr.sbin/npf/npftest/npftest.c \ src/usr.sbin/npf/npftest/npftest.h cvs rdiff -u -r1.3.2.4 -r1.3.2.5 \ src/usr.sbin/npf/npftest/libnpftest/npf_test.h cvs rdiff -u -r1.1.2.4 -r1.1.2.5 \ src/usr.sbin/npf/npftest/libnpftest/npf_test_subr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/net/npf/npf_impl.h diff -u src/sys/net/npf/npf_impl.h:1.10.2.7 src/sys/net/npf/npf_impl.h:1.10.2.8 --- src/sys/net/npf/npf_impl.h:1.10.2.7 Mon Aug 13 17:49:52 2012 +++ src/sys/net/npf/npf_impl.h Sun Nov 18 21:45:08 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: npf_impl.h,v 1.10.2.7 2012/08/13 17:49:52 riz Exp $ */ +/* $NetBSD: npf_impl.h,v 1.10.2.8 2012/11/18 21:45:08 riz Exp $ */ /*- * Copyright (c) 2009-2012 The NetBSD Foundation, Inc. @@ -122,13 +122,6 @@ typedef struct { npf_tcpstate_t nst_tcpst[2]; } npf_state_t; -#if defined(_NPF_TESTING) -void npf_state_sample(npf_state_t *, bool); -#define NPF_STATE_SAMPLE(n, r) npf_state_sample(n, r) -#else -#define NPF_STATE_SAMPLE(n, r) -#endif - /* * INTERFACES. */ @@ -332,5 +325,6 @@ void npf_rulenc_dump(const npf_rule_t * void npf_sessions_dump(void); void npf_state_dump(const npf_state_t *); void npf_nat_dump(const npf_nat_t *); +void npf_state_setsampler(void (*)(npf_state_t *, bool)); #endif /* _NPF_IMPL_H_ */ Index: src/sys/net/npf/npf_state.c diff -u src/sys/net/npf/npf_state.c:1.6.4.5 src/sys/net/npf/npf_state.c:1.6.4.6 --- src/sys/net/npf/npf_state.c:1.6.4.5 Mon Aug 13 17:49:52 2012 +++ src/sys/net/npf/npf_state.c Sun Nov 18 21:45:08 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: npf_state.c,v 1.6.4.5 2012/08/13 17:49:52 riz Exp $ */ +/* $NetBSD: npf_state.c,v 1.6.4.6 2012/11/18 21:45:08 riz Exp $ */ /*- * Copyright (c) 2010-2012 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: npf_state.c,v 1.6.4.5 2012/08/13 17:49:52 riz Exp $"); +__KERNEL_RCSID(0, "$NetBSD: npf_state.c,v 1.6.4.6 2012/11/18 21:45:08 riz Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -75,6 +75,16 @@ static u_int npf_generic_timeout[] __rea }; /* + * State sampler for debugging. + */ +#if defined(_NPF_TESTING) +static void (*npf_state_sample)(npf_state_t *, bool) = NULL; +#define NPF_STATE_SAMPLE(n, r) if (npf_state_sample) (*npf_state_sample)(n, r); +#else +#define NPF_STATE_SAMPLE(n, r) +#endif + +/* * npf_state_init: initialise the state structure. * * Should normally be called on a first packet, which also determines the @@ -195,3 +205,11 @@ npf_state_dump(const npf_state_t *nst) ); #endif } + +#if defined(_NPF_TESTING) +void +npf_state_setsampler(void (*func)(npf_state_t *, bool)) +{ + npf_state_sample = func; +} +#endif Index: src/sys/rump/librump/rumpkern/rump.c diff -u src/sys/rump/librump/rumpkern/rump.c:1.240 src/sys/rump/librump/rumpkern/rump.c:1.240.2.1 --- src/sys/rump/librump/rumpkern/rump.c:1.240 Sat Feb 4 10:02:25 2012 +++ src/sys/rump/librump/rumpkern/rump.c Sun Nov 18 21:45:08 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: rump.c,v 1.240 2012/02/04 10:02:25 njoly Exp $ */ +/* $NetBSD: rump.c,v 1.240.2.1 2012/11/18 21:45:08 riz Exp $ */ /* * Copyright (c) 2007-2011 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.240 2012/02/04 10:02:25 njoly Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.240.2.1 2012/11/18 21:45:08 riz Exp $"); #include <sys/systm.h> #define ELFSIZE ARCH_ELFSIZE @@ -44,6 +44,7 @@ __KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.2 #include <sys/filedesc.h> #include <sys/iostat.h> #include <sys/kauth.h> +#include <sys/kcpuset.h> #include <sys/kernel.h> #include <sys/kmem.h> #include <sys/kprintf.h> @@ -56,6 +57,7 @@ __KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.2 #include <sys/percpu.h> #include <sys/pipe.h> #include <sys/pool.h> +#include <sys/pserialize.h> #include <sys/queue.h> #include <sys/reboot.h> #include <sys/resourcevar.h> @@ -296,6 +298,7 @@ rump__init(int rump_version) uvm_init(); evcnt_init(); + kcpuset_sysinit(); once_init(); kernconfig_lock_init(); prop_kern_init(); @@ -309,6 +312,7 @@ rump__init(int rump_version) callout_startup(); kprintf_init(); + pserialize_init(); loginit(); kauth_init(); Index: src/sys/rump/net/Makefile.rumpnetcomp diff -u src/sys/rump/net/Makefile.rumpnetcomp:1.4 src/sys/rump/net/Makefile.rumpnetcomp:1.4.16.1 --- src/sys/rump/net/Makefile.rumpnetcomp:1.4 Wed Dec 8 20:20:16 2010 +++ src/sys/rump/net/Makefile.rumpnetcomp Sun Nov 18 21:45:08 2012 @@ -1,7 +1,7 @@ -# $NetBSD: Makefile.rumpnetcomp,v 1.4 2010/12/08 20:20:16 pooka Exp $ +# $NetBSD: Makefile.rumpnetcomp,v 1.4.16.1 2012/11/18 21:45:08 riz Exp $ # -RUMPNETCOMP= agr bridge net net80211 netbt netinet local shmif virtif +RUMPNETCOMP= agr bridge net net80211 netbt netinet npf local shmif virtif RUMPNETSOCKIN= sockin Index: src/usr.sbin/npf/npftest/Makefile diff -u src/usr.sbin/npf/npftest/Makefile:1.2.2.2 src/usr.sbin/npf/npftest/Makefile:1.2.2.3 --- src/usr.sbin/npf/npftest/Makefile:1.2.2.2 Tue Jun 26 00:07:17 2012 +++ src/usr.sbin/npf/npftest/Makefile Sun Nov 18 21:45:08 2012 @@ -12,7 +12,7 @@ LIBNPFTEST!= cd ${.CURDIR}/libnpftest && DPADD+= ${LIBNPFTEST}/libnpftest.a LDADD+= -L${LIBNPFTEST} -lnpftest -LDADD+= -lrump -lrumpvfs -lrumpnet -lrumpnet_net -lrumpdev_npf +LDADD+= -lrump -lrumpvfs -lrumpnet -lrumpnet_net -lrumpnet_npf LDADD+= -lpcap -lprop -lpthread Index: src/usr.sbin/npf/npftest/README diff -u src/usr.sbin/npf/npftest/README:1.1.2.2 src/usr.sbin/npf/npftest/README:1.1.2.3 --- src/usr.sbin/npf/npftest/README:1.1.2.2 Mon Aug 13 17:49:52 2012 +++ src/usr.sbin/npf/npftest/README Sun Nov 18 21:45:08 2012 @@ -1,4 +1,4 @@ -$NetBSD: README,v 1.1.2.2 2012/08/13 17:49:52 riz Exp $ +$NetBSD: README,v 1.1.2.3 2012/11/18 21:45:08 riz Exp $ npftest - a tool for regression testing and debugging NPF. It uses RUMP framework to run NPF kernel module in the userspace. @@ -23,7 +23,7 @@ Update RUMP libraries once the kernel si cd src/sys/net/npf sudo make includes -cd src/sys/rump/dev/lib/libnpf +cd src/sys/rump/net/lib/libnpf make distclean MKDEBUG=yes MKDEBUGLIB=yes DBG=-g make -j8 sudo MKDEBUG=yes MKDEBUGLIB=yes DBG=-g make install Index: src/usr.sbin/npf/npftest/npftest.c diff -u src/usr.sbin/npf/npftest/npftest.c:1.3.2.3 src/usr.sbin/npf/npftest/npftest.c:1.3.2.4 --- src/usr.sbin/npf/npftest/npftest.c:1.3.2.3 Mon Aug 13 17:49:52 2012 +++ src/usr.sbin/npf/npftest/npftest.c Sun Nov 18 21:45:08 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: npftest.c,v 1.3.2.3 2012/08/13 17:49:52 riz Exp $ */ +/* $NetBSD: npftest.c,v 1.3.2.4 2012/11/18 21:45:08 riz Exp $ */ /* * NPF testing framework. @@ -178,6 +178,8 @@ main(int argc, char **argv) rump_init(); rump_schedule(); + rumpns_npf_test_init(); + if (config) { load_npf_config(config); } Index: src/usr.sbin/npf/npftest/npftest.h diff -u src/usr.sbin/npf/npftest/npftest.h:1.3.2.3 src/usr.sbin/npf/npftest/npftest.h:1.3.2.4 --- src/usr.sbin/npf/npftest/npftest.h:1.3.2.3 Mon Aug 13 17:49:52 2012 +++ src/usr.sbin/npf/npftest/npftest.h Sun Nov 18 21:45:08 2012 @@ -10,6 +10,7 @@ #include <stdint.h> #include <stdbool.h> +void rumpns_npf_test_init(void); int rumpns_npf_test_load(const void *); unsigned rumpns_npf_test_addif(const char *, unsigned, bool); unsigned rumpns_npf_test_getif(const char *); Index: src/usr.sbin/npf/npftest/libnpftest/npf_test.h diff -u src/usr.sbin/npf/npftest/libnpftest/npf_test.h:1.3.2.4 src/usr.sbin/npf/npftest/libnpftest/npf_test.h:1.3.2.5 --- src/usr.sbin/npf/npftest/libnpftest/npf_test.h:1.3.2.4 Mon Aug 13 17:49:53 2012 +++ src/usr.sbin/npf/npftest/libnpftest/npf_test.h Sun Nov 18 21:45:09 2012 @@ -24,6 +24,7 @@ #include <net/if_ether.h> #include <net/ethertypes.h> +void npf_test_init(void); int npf_test_load(const void *); unsigned npf_test_addif(const char *, unsigned, bool); unsigned npf_test_getif(const char *); Index: src/usr.sbin/npf/npftest/libnpftest/npf_test_subr.c diff -u src/usr.sbin/npf/npftest/libnpftest/npf_test_subr.c:1.1.2.4 src/usr.sbin/npf/npftest/libnpftest/npf_test_subr.c:1.1.2.5 --- src/usr.sbin/npf/npftest/libnpftest/npf_test_subr.c:1.1.2.4 Mon Aug 13 17:49:53 2012 +++ src/usr.sbin/npf/npftest/libnpftest/npf_test_subr.c Sun Nov 18 21:45:09 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: npf_test_subr.c,v 1.1.2.4 2012/08/13 17:49:53 riz Exp $ */ +/* $NetBSD: npf_test_subr.c,v 1.1.2.5 2012/11/18 21:45:09 riz Exp $ */ /* * NPF initialisation and handler routines. @@ -18,6 +18,14 @@ static npf_state_t cstream_state; static void * cstream_ptr; static bool cstream_retval; +static void npf_state_sample(npf_state_t *, bool); + +void +npf_test_init(void) +{ + npf_state_setsampler(npf_state_sample); +} + int npf_test_load(const void *xml) { @@ -54,7 +62,7 @@ npf_test_getif(const char *ifname) /* * State sampler - this routine is called from inside of NPF state engine. */ -void +static void npf_state_sample(npf_state_t *nst, bool retval) { /* Pointer will serve as an ID. */ Added files: Index: src/sys/rump/net/lib/libnpf/Makefile diff -u /dev/null src/sys/rump/net/lib/libnpf/Makefile:1.2.4.2 --- /dev/null Sun Nov 18 21:45:09 2012 +++ src/sys/rump/net/lib/libnpf/Makefile Sun Nov 18 21:45:08 2012 @@ -0,0 +1,24 @@ +# $NetBSD: Makefile,v 1.2.4.2 2012/11/18 21:45:08 riz Exp $ +# +# Public Domain. +# + +.PATH: ${.CURDIR}/../../../../net/npf + +LIB= rumpnet_npf + +SRCS= npf.c npf_alg.c npf_ctl.c npf_handler.c +SRCS+= npf_inet.c npf_instr.c npf_log.c npf_mbuf.c npf_nat.c +SRCS+= npf_processor.c npf_ruleset.c npf_rproc.c npf_sendpkt.c +SRCS+= npf_session.c npf_state.c npf_state_tcp.c +SRCS+= npf_tableset.c npf_tableset_ptree.c + +SRCS+= component.c + +WARNS= 4 + +CPPFLAGS+= -D_NPF_TESTING +CPPFLAGS+= -I${.CURDIR}/../../../librump/rumpvfs + +.include <bsd.lib.mk> +.include <bsd.klinks.mk> Index: src/sys/rump/net/lib/libnpf/component.c diff -u /dev/null src/sys/rump/net/lib/libnpf/component.c:1.1.6.2 --- /dev/null Sun Nov 18 21:45:09 2012 +++ src/sys/rump/net/lib/libnpf/component.c Sun Nov 18 21:45:08 2012 @@ -0,0 +1,34 @@ +/* $NetBSD: component.c,v 1.1.6.2 2012/11/18 21:45:08 riz Exp $ */ + +/* + * Public Domain. + */ + +#include <sys/cdefs.h> +__KERNEL_RCSID(0, "$NetBSD: component.c,v 1.1.6.2 2012/11/18 21:45:08 riz Exp $"); + +#include <sys/param.h> +#include <sys/conf.h> +#include <sys/device.h> +#include <sys/stat.h> + +#include "rump_private.h" +#include "rump_vfs_private.h" + +extern const struct cdevsw npf_cdevsw; + +RUMP_COMPONENT(RUMP_COMPONENT_DEV) +{ + devmajor_t bmajor = NODEVMAJOR, cmajor = NODEVMAJOR; + int error; + + error = devsw_attach("npf", NULL, &bmajor, &npf_cdevsw, &cmajor); + if (error) { + panic("npf attach failed: %d", error); + } + + error = rump_vfs_makeonedevnode(S_IFCHR, "/dev/npf", cmajor, 0); + if (error) { + panic("npf device node creation failed: %d", error); + } +} Index: src/sys/rump/net/lib/libnpf/shlib_version diff -u /dev/null src/sys/rump/net/lib/libnpf/shlib_version:1.1.6.2 --- /dev/null Sun Nov 18 21:45:09 2012 +++ src/sys/rump/net/lib/libnpf/shlib_version Sun Nov 18 21:45:08 2012 @@ -0,0 +1,4 @@ +# $NetBSD: shlib_version,v 1.1.6.2 2012/11/18 21:45:08 riz Exp $ +# +major=0 +minor=0