Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-6]: src Pull up following revision(s) (requested by rmind in tick...
details: https://anonhg.NetBSD.org/src/rev/f3bcba771a94
branches: netbsd-6
changeset: 775578:f3bcba771a94
user: riz <riz%NetBSD.org@localhost>
date: Sat Dec 15 23:45:55 2012 +0000
description:
Pull up following revision(s) (requested by rmind in ticket #745):
distrib/sets/lists/comp/shl.mi: revision 1.241
distrib/sets/lists/modules/mi: revision 1.49
distrib/sets/lists/base/md.sparc64: revision 1.171
lib/npf/ext_rndblock/npfext_rndblock.c: revision 1.1
distrib/sets/lists/base/ad.mips64eb: revision 1.106
distrib/sets/lists/modules/md.evbppc: revision 1.29
sys/net/npf/npf_ext_rndblock.c: revision 1.1
lib/npf/Makefile: revision 1.2
sys/modules/npf_ext_rndblock/Makefile: revision 1.1
lib/npf/ext_rndblock/Makefile: revision 1.1
distrib/sets/lists/base/ad.mips64el: revision 1.106
lib/npf/ext_rndblock/shlib_version: revision 1.1
distrib/sets/lists/base/md.amd64: revision 1.182
distrib/sets/lists/base/shl.mi: revision 1.643
sys/net/npf/files.npf: revision 1.9
sys/modules/Makefile: revision 1.117
Add NPF "rndblock" extension to randomly drop packets (using a random function
with a percentage or modulo operation). This is a demo module, although it can
be used for packet loss simulation. Example of a procedure in npf.conf:
procedure "somedrop" {
# Drop 1.9% of the traffic
rndblock: percentage 1.9
}
diffstat:
distrib/sets/lists/base/ad.mips64eb | 8 +-
distrib/sets/lists/base/ad.mips64el | 8 +-
distrib/sets/lists/base/md.amd64 | 5 +-
distrib/sets/lists/base/md.sparc64 | 5 +-
distrib/sets/lists/base/shl.mi | 5 +-
distrib/sets/lists/comp/shl.mi | 3 +-
distrib/sets/lists/modules/md.evbppc | 6 +-
distrib/sets/lists/modules/mi | 4 +-
lib/npf/Makefile | 4 +-
lib/npf/ext_rndblock/Makefile | 21 +++
lib/npf/ext_rndblock/npfext_rndblock.c | 97 ++++++++++++++++++
lib/npf/ext_rndblock/shlib_version | 4 +
sys/modules/Makefile | 3 +-
sys/modules/npf_ext_rndblock/Makefile | 11 ++
sys/net/npf/files.npf | 3 +-
sys/net/npf/npf_ext_rndblock.c | 174 +++++++++++++++++++++++++++++++++
16 files changed, 349 insertions(+), 12 deletions(-)
diffs (truncated from 551 to 300 lines):
diff -r 6bd49738822d -r f3bcba771a94 distrib/sets/lists/base/ad.mips64eb
--- a/distrib/sets/lists/base/ad.mips64eb Sat Dec 15 23:31:07 2012 +0000
+++ b/distrib/sets/lists/base/ad.mips64eb Sat Dec 15 23:45:55 2012 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: ad.mips64eb,v 1.82.2.7 2012/12/15 05:40:17 riz Exp $
+# $NetBSD: ad.mips64eb,v 1.82.2.8 2012/12/15 23:45:56 riz Exp $
./libexec/ld.elf_so-64 base-compat-shlib compat,pic
./libexec/ld.elf_so-o32 base-sysutil-bin compat,pic
./usr/lib/64 base-compat-lib
@@ -285,6 +285,9 @@
./usr/lib/64/npf/ext_normalise.so base-npf-shlib compat,pic
./usr/lib/64/npf/ext_normalise.so.0 base-npf-shlib compat,pic
./usr/lib/64/npf/ext_normalise.so.0.0 base-npf-shlib compat,pic
+./usr/lib/64/npf/ext_rndblock.so base-npf-shlib compat,pic
+./usr/lib/64/npf/ext_rndblock.so.0 base-npf-shlib compat,pic
+./usr/lib/64/npf/ext_rndblock.so.0.0 base-npf-shlib compat,pic
./usr/lib/64/security base-compat-shlib
./usr/lib/64/security/pam_afslog.so.3 base-compat-shlib compat,pic,kerberos,pam
./usr/lib/64/security/pam_chroot.so.3 base-compat-shlib compat,pic,pam
@@ -590,6 +593,9 @@
./usr/lib/o32/npf/ext_normalise.so base-npf-shlib compat,pic
./usr/lib/o32/npf/ext_normalise.so.0 base-npf-shlib compat,pic
./usr/lib/o32/npf/ext_normalise.so.0.0 base-npf-shlib compat,pic
+./usr/lib/o32/npf/ext_rndblock.so base-npf-shlib compat,pic
+./usr/lib/o32/npf/ext_rndblock.so.0 base-npf-shlib compat,pic
+./usr/lib/o32/npf/ext_rndblock.so.0.0 base-npf-shlib compat,pic
./usr/lib/o32/security base-compat-shlib
./usr/lib/o32/security/pam_afslog.so.3 base-compat-shlib compat,pic,kerberos,pam
./usr/lib/o32/security/pam_chroot.so.3 base-compat-shlib compat,pic,pam
diff -r 6bd49738822d -r f3bcba771a94 distrib/sets/lists/base/ad.mips64el
--- a/distrib/sets/lists/base/ad.mips64el Sat Dec 15 23:31:07 2012 +0000
+++ b/distrib/sets/lists/base/ad.mips64el Sat Dec 15 23:45:55 2012 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: ad.mips64el,v 1.81.2.7 2012/12/15 05:40:17 riz Exp $
+# $NetBSD: ad.mips64el,v 1.81.2.8 2012/12/15 23:45:57 riz Exp $
./libexec/ld.elf_so-64 base-compat-shlib compat,pic
./libexec/ld.elf_so-o32 base-sysutil-bin compat,pic
./usr/lib/64 base-compat-lib
@@ -285,6 +285,9 @@
./usr/lib/64/npf/ext_normalise.so base-npf-shlib compat,pic
./usr/lib/64/npf/ext_normalise.so.0 base-npf-shlib compat,pic
./usr/lib/64/npf/ext_normalise.so.0.0 base-npf-shlib compat,pic
+./usr/lib/64/npf/ext_rndblock.so base-npf-shlib compat,pic
+./usr/lib/64/npf/ext_rndblock.so.0 base-npf-shlib compat,pic
+./usr/lib/64/npf/ext_rndblock.so.0.0 base-npf-shlib compat,pic
./usr/lib/64/security base-compat-shlib
./usr/lib/64/security/pam_afslog.so.3 base-compat-shlib compat,pic,kerberos,pam
./usr/lib/64/security/pam_chroot.so.3 base-compat-shlib compat,pic,pam
@@ -590,6 +593,9 @@
./usr/lib/o32/npf/ext_normalise.so base-npf-shlib compat,pic
./usr/lib/o32/npf/ext_normalise.so.0 base-npf-shlib compat,pic
./usr/lib/o32/npf/ext_normalise.so.0.0 base-npf-shlib compat,pic
+./usr/lib/o32/npf/ext_rndblock.so base-npf-shlib compat,pic
+./usr/lib/o32/npf/ext_rndblock.so.0 base-npf-shlib compat,pic
+./usr/lib/o32/npf/ext_rndblock.so.0.0 base-npf-shlib compat,pic
./usr/lib/o32/security base-compat-shlib
./usr/lib/o32/security/pam_afslog.so.3 base-compat-shlib compat,pic,kerberos,pam
./usr/lib/o32/security/pam_chroot.so.3 base-compat-shlib compat,pic,pam
diff -r 6bd49738822d -r f3bcba771a94 distrib/sets/lists/base/md.amd64
--- a/distrib/sets/lists/base/md.amd64 Sat Dec 15 23:31:07 2012 +0000
+++ b/distrib/sets/lists/base/md.amd64 Sat Dec 15 23:45:55 2012 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: md.amd64,v 1.156.2.7 2012/12/15 05:40:17 riz Exp $
+# $NetBSD: md.amd64,v 1.156.2.8 2012/12/15 23:45:57 riz Exp $
./dev/lms0 base-obsolete obsolete
./dev/mms0 base-obsolete obsolete
./libexec/ld.elf_so-i386 base-sys-shlib compat,pic
@@ -288,6 +288,9 @@
./usr/lib/i386/npf/ext_normalise.so base-npf-shlib compat,pic
./usr/lib/i386/npf/ext_normalise.so.0 base-npf-shlib compat,pic
./usr/lib/i386/npf/ext_normalise.so.0.0 base-npf-shlib compat,pic
+./usr/lib/i386/npf/ext_rndblock.so base-npf-shlib compat,pic
+./usr/lib/i386/npf/ext_rndblock.so.0 base-npf-shlib compat,pic
+./usr/lib/i386/npf/ext_rndblock.so.0.0 base-npf-shlib compat,pic
./usr/lib/i386/security base-compat-shlib compat
./usr/lib/i386/security/pam_afslog.so.3 base-compat-shlib compat,pic,kerberos,pam
./usr/lib/i386/security/pam_chroot.so.3 base-compat-shlib compat,pic,pam
diff -r 6bd49738822d -r f3bcba771a94 distrib/sets/lists/base/md.sparc64
--- a/distrib/sets/lists/base/md.sparc64 Sat Dec 15 23:31:07 2012 +0000
+++ b/distrib/sets/lists/base/md.sparc64 Sat Dec 15 23:45:55 2012 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: md.sparc64,v 1.147.2.7 2012/12/15 05:40:17 riz Exp $
+# $NetBSD: md.sparc64,v 1.147.2.8 2012/12/15 23:45:56 riz Exp $
./libexec/ld.elf_so-sparc base-sysutil-bin compat,pic
./sbin/edlabel base-sysutil-root obsolete
./usr/bin/fdformat base-util-bin
@@ -286,6 +286,9 @@
./usr/lib/sparc/npf/ext_normalise.so base-npf-shlib compat,pic
./usr/lib/sparc/npf/ext_normalise.so.0 base-npf-shlib compat,pic
./usr/lib/sparc/npf/ext_normalise.so.0.0 base-npf-shlib compat,pic
+./usr/lib/sparc/npf/ext_rndblock.so base-npf-shlib compat,pic
+./usr/lib/sparc/npf/ext_rndblock.so.0 base-npf-shlib compat,pic
+./usr/lib/sparc/npf/ext_rndblock.so.0.0 base-npf-shlib compat,pic
./usr/lib/sparc/security base-compat-shlib compat
./usr/lib/sparc/security/pam_afslog.so.3 base-compat-shlib compat,pic,kerberos
./usr/lib/sparc/security/pam_chroot.so.3 base-compat-shlib compat,pic
diff -r 6bd49738822d -r f3bcba771a94 distrib/sets/lists/base/shl.mi
--- a/distrib/sets/lists/base/shl.mi Sat Dec 15 23:31:07 2012 +0000
+++ b/distrib/sets/lists/base/shl.mi Sat Dec 15 23:45:55 2012 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: shl.mi,v 1.616.2.8 2012/12/15 05:40:18 riz Exp $
+# $NetBSD: shl.mi,v 1.616.2.9 2012/12/15 23:45:57 riz Exp $
#
# Note: Don't delete entries from here - mark them as "obsolete" instead,
# unless otherwise stated below.
@@ -722,6 +722,9 @@
./usr/lib/npf/ext_normalise.so base-npf-shlib npf
./usr/lib/npf/ext_normalise.so.0 base-npf-shlib npf
./usr/lib/npf/ext_normalise.so.0.0 base-npf-shlib npf
+./usr/lib/npf/ext_rndblock.so base-npf-shlib npf
+./usr/lib/npf/ext_rndblock.so.0 base-npf-shlib npf
+./usr/lib/npf/ext_rndblock.so.0.0 base-npf-shlib npf
./usr/lib/nss_mdns.so.0 base-obsolete obsolete
./usr/lib/nss_mdnsd.so.0 base-mdns-shlib mdns
./usr/lib/nss_multicast_dns.so.0 base-mdns-shlib mdns
diff -r 6bd49738822d -r f3bcba771a94 distrib/sets/lists/comp/shl.mi
--- a/distrib/sets/lists/comp/shl.mi Sat Dec 15 23:31:07 2012 +0000
+++ b/distrib/sets/lists/comp/shl.mi Sat Dec 15 23:45:55 2012 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: shl.mi,v 1.209.2.9 2012/11/20 22:19:23 riz Exp $
+# $NetBSD: shl.mi,v 1.209.2.10 2012/12/15 23:45:55 riz Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@@ -432,3 +432,4 @@
./usr/libdata/debug/usr/lib/libzpool.so.0.0.debug comp-zfs-debug zfs,dynamicroot,debug
./usr/libdata/debug/usr/lib/npf/libext_log.so.0.0.debug comp-sys-debug debug,npf
./usr/libdata/debug/usr/lib/npf/libext_normalise.so.0.0.debug comp-sys-debug debug,npf
+./usr/libdata/debug/usr/lib/npf/libext_rndblock.so.0.0.debug comp-sys-debug debug,npf
diff -r 6bd49738822d -r f3bcba771a94 distrib/sets/lists/modules/md.evbppc
--- a/distrib/sets/lists/modules/md.evbppc Sat Dec 15 23:31:07 2012 +0000
+++ b/distrib/sets/lists/modules/md.evbppc Sat Dec 15 23:45:55 2012 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: md.evbppc,v 1.18.2.1 2012/11/20 21:22:56 riz Exp $
+# $NetBSD: md.evbppc,v 1.18.2.2 2012/12/15 23:45:56 riz Exp $
./stand/powerpc-4xx base-kernel-modules kmod,compatmodules
./stand/powerpc-4xx/@OSRELEASE@ base-kernel-modules kmod,compatmodules
./stand/powerpc-4xx/@OSRELEASE@/modules base-kernel-modules kmod,compatmodules
@@ -108,6 +108,8 @@
./stand/powerpc-4xx/@OSRELEASE@/modules/npf_ext_log/npf_ext_log.kmod base-kernel-modules kmod
./stand/powerpc-4xx/@OSRELEASE@/modules/npf_ext_normalise base-kernel-modules kmod
./stand/powerpc-4xx/@OSRELEASE@/modules/npf_ext_normalise/npf_ext_normalise.kmod base-kernel-modules kmod
+./stand/powerpc-4xx/@OSRELEASE@/modules/npf_ext_rndblock base-kernel-modules kmod
+./stand/powerpc-4xx/@OSRELEASE@/modules/npf_ext_rndblock/npf_ext_rndblock.kmod base-kernel-modules kmod
./stand/powerpc-4xx/@OSRELEASE@/modules/ntfs base-kernel-modules kmod,compatmodules
./stand/powerpc-4xx/@OSRELEASE@/modules/ntfs/ntfs.kmod base-kernel-modules kmod,compatmodules
./stand/powerpc-4xx/@OSRELEASE@/modules/null base-kernel-modules kmod,compatmodules
@@ -285,6 +287,8 @@
./stand/powerpc-booke/@OSRELEASE@/modules/npf_ext_log/npf_ext_log.kmod base-kernel-modules kmod
./stand/powerpc-booke/@OSRELEASE@/modules/npf_ext_normalise base-kernel-modules kmod
./stand/powerpc-booke/@OSRELEASE@/modules/npf_ext_normalise/npf_ext_normalise.kmod base-kernel-modules kmod
+./stand/powerpc-booke/@OSRELEASE@/modules/npf_ext_rndblock base-kernel-modules kmod
+./stand/powerpc-booke/@OSRELEASE@/modules/npf_ext_rndblock/npf_ext_rndblock.kmod base-kernel-modules kmod
./stand/powerpc-booke/@OSRELEASE@/modules/ntfs base-kernel-modules kmod,compatmodules
./stand/powerpc-booke/@OSRELEASE@/modules/ntfs/ntfs.kmod base-kernel-modules kmod,compatmodules
./stand/powerpc-booke/@OSRELEASE@/modules/null base-kernel-modules kmod,compatmodules
diff -r 6bd49738822d -r f3bcba771a94 distrib/sets/lists/modules/mi
--- a/distrib/sets/lists/modules/mi Sat Dec 15 23:31:07 2012 +0000
+++ b/distrib/sets/lists/modules/mi Sat Dec 15 23:45:55 2012 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.39.2.1 2012/11/18 22:38:25 riz Exp $
+# $NetBSD: mi,v 1.39.2.2 2012/12/15 23:45:56 riz Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@@ -119,6 +119,8 @@
./@MODULEDIR@/npf_ext_log/npf_ext_log.kmod base-kernel-modules kmod
./@MODULEDIR@/npf_ext_normalise base-kernel-modules kmod
./@MODULEDIR@/npf_ext_normalise/npf_ext_normalise.kmod base-kernel-modules kmod
+./@MODULEDIR@/npf_ext_rndblock base-kernel-modules kmod
+./@MODULEDIR@/npf_ext_rndblock/npf_ext_rndblock.kmod base-kernel-modules kmod
./@MODULEDIR@/onewire base-kernel-modules kmod
./@MODULEDIR@/onewire/onewire.kmod base-kernel-modules kmod
./@MODULEDIR@/overlay base-kernel-modules kmod
diff -r 6bd49738822d -r f3bcba771a94 lib/npf/Makefile
--- a/lib/npf/Makefile Sat Dec 15 23:31:07 2012 +0000
+++ b/lib/npf/Makefile Sat Dec 15 23:45:55 2012 +0000
@@ -1,10 +1,10 @@
-# $NetBSD: Makefile,v 1.1.4.2 2012/11/18 22:38:32 riz Exp $
+# $NetBSD: Makefile,v 1.1.4.3 2012/12/15 23:45:58 riz Exp $
.include <bsd.own.mk>
.if ${MKPIC} != "no"
-SUBDIR= ext_log ext_normalise
+SUBDIR= ext_log ext_normalise ext_rndblock
.endif
diff -r 6bd49738822d -r f3bcba771a94 lib/npf/ext_rndblock/Makefile
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/npf/ext_rndblock/Makefile Sat Dec 15 23:45:55 2012 +0000
@@ -0,0 +1,21 @@
+# $NetBSD: Makefile,v 1.1.2.2 2012/12/15 23:45:58 riz Exp $
+
+.include <bsd.own.mk>
+
+LIBISMODULE= yes
+.if defined(MLIBDIR)
+LIBDIR= /usr/lib/${MLIBDIR}/npf
+SHLIBDIR= /usr/lib/${MLIBDIR}/npf
+SHLIBINSTALLDIR=/usr/lib/${MLIBDIR}/npf
+.else
+LIBDIR= /usr/lib/npf
+SHLIBDIR= /usr/lib/npf
+SHLIBINSTALLDIR=/usr/lib/npf
+.endif
+
+LIB= ext_rndblock
+
+SRCS= npfext_rndblock.c
+WARNS= 5
+
+.include <bsd.lib.mk>
diff -r 6bd49738822d -r f3bcba771a94 lib/npf/ext_rndblock/npfext_rndblock.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/npf/ext_rndblock/npfext_rndblock.c Sat Dec 15 23:45:55 2012 +0000
@@ -0,0 +1,97 @@
+/* $NetBSD: npfext_rndblock.c,v 1.1.2.2 2012/12/15 23:45:58 riz Exp $ */
+
+/*-
+ * Copyright (c) 2012 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+ */
+
+#include <sys/cdefs.h>
+__RCSID("$NetBSD: npfext_rndblock.c,v 1.1.2.2 2012/12/15 23:45:58 riz Exp $");
+
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+#include <errno.h>
+
+#include <npf.h>
+
+int npfext_rndblock_init(void);
+nl_ext_t * npfext_rndblock_construct(const char *);
+int npfext_rndblock_param(nl_ext_t *, const char *, const char *);
+
+int
+npfext_rndblock_init(void)
+{
+ /* Nothing to initialise. */
+ return 0;
+}
+
+nl_ext_t *
+npfext_rndblock_construct(const char *name)
+{
+ assert(strcmp(name, "rndblock") == 0);
+ return npf_ext_construct(name);
+}
+
+int
+npfext_rndblock_param(nl_ext_t *ext, const char *param, const char *val)
+{
+ enum ptype { PARAM_U32 };
+ static const struct param {
+ const char * name;
+ enum ptype type;
+ signed long min;
+ signed long max;
+ } params[] = {
+ { "mod", PARAM_U32, 1, LONG_MAX },
+ { "percentage", PARAM_U32, 1, 9999 },
+ };
+
+ if (val == NULL) {
+ return EINVAL;
+ }
+ for (unsigned i = 0; i < __arraycount(params); i++) {
+ const char *name = params[i].name;
+ long ival;
+
+ if (strcmp(name, param) != 0) {
+ continue;
+ }
+
Home |
Main Index |
Thread Index |
Old Index