Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/npf/npftest npftest: fix previous harder - pass and...
details: https://anonhg.NetBSD.org/src/rev/d2ba08dd6bd6
branches: trunk
changeset: 326587:d2ba08dd6bd6
user: rmind <rmind%NetBSD.org@localhost>
date: Wed Feb 05 03:49:48 2014 +0000
description:
npftest: fix previous harder - pass and use libc's random(3).
diffstat:
usr.sbin/npf/npftest/libnpftest/npf_nat_test.c | 4 ++--
usr.sbin/npf/npftest/libnpftest/npf_test.h | 2 +-
usr.sbin/npf/npftest/libnpftest/npf_test_subr.c | 8 +++++---
usr.sbin/npf/npftest/npftest.c | 4 ++--
usr.sbin/npf/npftest/npftest.h | 2 +-
5 files changed, 11 insertions(+), 9 deletions(-)
diffs (91 lines):
diff -r 65becd1b29c6 -r d2ba08dd6bd6 usr.sbin/npf/npftest/libnpftest/npf_nat_test.c
--- a/usr.sbin/npf/npftest/libnpftest/npf_nat_test.c Wed Feb 05 03:30:13 2014 +0000
+++ b/usr.sbin/npf/npftest/libnpftest/npf_nat_test.c Wed Feb 05 03:49:48 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: npf_nat_test.c,v 1.5 2014/02/05 03:30:13 rmind Exp $ */
+/* $NetBSD: npf_nat_test.c,v 1.6 2014/02/05 03:49:48 rmind Exp $ */
/*
* NPF NAT test.
@@ -16,7 +16,7 @@
#define NPF_BINAT (NPF_NATIN | NPF_NATOUT)
-#define RANDOM_PORT 45600
+#define RANDOM_PORT 53472
static const struct test_case {
const char * src;
diff -r 65becd1b29c6 -r d2ba08dd6bd6 usr.sbin/npf/npftest/libnpftest/npf_test.h
--- a/usr.sbin/npf/npftest/libnpftest/npf_test.h Wed Feb 05 03:30:13 2014 +0000
+++ b/usr.sbin/npf/npftest/libnpftest/npf_test.h Wed Feb 05 03:49:48 2014 +0000
@@ -39,7 +39,7 @@
#define REMOTE_IP1 "192.0.2.3"
#define REMOTE_IP2 "192.0.2.4"
-void npf_test_init(void);
+void npf_test_init(long (*)(void));
int npf_test_load(const void *);
ifnet_t * npf_test_addif(const char *, bool, bool);
ifnet_t * npf_test_getif(const char *);
diff -r 65becd1b29c6 -r d2ba08dd6bd6 usr.sbin/npf/npftest/libnpftest/npf_test_subr.c
--- a/usr.sbin/npf/npftest/libnpftest/npf_test_subr.c Wed Feb 05 03:30:13 2014 +0000
+++ b/usr.sbin/npf/npftest/libnpftest/npf_test_subr.c Wed Feb 05 03:49:48 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: npf_test_subr.c,v 1.7 2014/02/05 03:30:13 rmind Exp $ */
+/* $NetBSD: npf_test_subr.c,v 1.8 2014/02/05 03:49:48 rmind Exp $ */
/*
* NPF initialisation and handler routines.
@@ -20,11 +20,13 @@
static bool cstream_retval;
static void npf_state_sample(npf_state_t *, bool);
+static long (*npf_random_func)(void) = NULL;
void
-npf_test_init(void)
+npf_test_init(long (*rndfunc)(void))
{
npf_state_setsampler(npf_state_sample);
+ npf_random_func = rndfunc;
}
int
@@ -122,5 +124,5 @@
uint32_t
_arc4random(void)
{
- return random();
+ return (uint32_t)(npf_random_func ? npf_random_func() : random());
}
diff -r 65becd1b29c6 -r d2ba08dd6bd6 usr.sbin/npf/npftest/npftest.c
--- a/usr.sbin/npf/npftest/npftest.c Wed Feb 05 03:30:13 2014 +0000
+++ b/usr.sbin/npf/npftest/npftest.c Wed Feb 05 03:49:48 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: npftest.c,v 1.14 2014/02/05 03:30:13 rmind Exp $ */
+/* $NetBSD: npftest.c,v 1.15 2014/02/05 03:49:48 rmind Exp $ */
/*
* NPF testing framework.
@@ -207,7 +207,7 @@
rump_init();
rump_schedule();
- rumpns_npf_test_init();
+ rumpns_npf_test_init(random);
if (config) {
load_npf_config(config);
diff -r 65becd1b29c6 -r d2ba08dd6bd6 usr.sbin/npf/npftest/npftest.h
--- a/usr.sbin/npf/npftest/npftest.h Wed Feb 05 03:30:13 2014 +0000
+++ b/usr.sbin/npf/npftest/npftest.h Wed Feb 05 03:49:48 2014 +0000
@@ -12,7 +12,7 @@
#include <net/if.h>
-void rumpns_npf_test_init(void);
+void rumpns_npf_test_init(long (*)(void));
int rumpns_npf_test_load(const void *);
ifnet_t * rumpns_npf_test_addif(const char *, bool, bool);
ifnet_t * rumpns_npf_test_getif(const char *);
Home |
Main Index |
Thread Index |
Old Index