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 the failure of NAT test --...



details:   https://anonhg.NetBSD.org/src/rev/6631c55c2d0e
branches:  trunk
changeset: 793326:6631c55c2d0e
user:      rmind <rmind%NetBSD.org@localhost>
date:      Wed Feb 05 03:30:13 2014 +0000

description:
npftest: fix the failure of NAT test -- adjust for RUMP's conversion to
the in-kernel CPRNG (hi pooka!).

diffstat:

 usr.sbin/npf/npftest/libnpftest/npf_nat_test.c  |  12 +++++++-----
 usr.sbin/npf/npftest/libnpftest/npf_test_subr.c |  12 +++++++++++-
 usr.sbin/npf/npftest/npftest.c                  |  11 +----------
 3 files changed, 19 insertions(+), 16 deletions(-)

diffs (103 lines):

diff -r 42a1b7494db6 -r 6631c55c2d0e usr.sbin/npf/npftest/libnpftest/npf_nat_test.c
--- a/usr.sbin/npf/npftest/libnpftest/npf_nat_test.c    Wed Feb 05 01:59:58 2014 +0000
+++ b/usr.sbin/npf/npftest/libnpftest/npf_nat_test.c    Wed Feb 05 03:30:13 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: npf_nat_test.c,v 1.4 2013/09/24 02:04:21 rmind Exp $   */
+/*     $NetBSD: npf_nat_test.c,v 1.5 2014/02/05 03:30:13 rmind Exp $   */
 
 /*
  * NPF NAT test.
@@ -16,6 +16,8 @@
 
 #define        NPF_BINAT       (NPF_NATIN | NPF_NATOUT)
 
+#define        RANDOM_PORT     45600
+
 static const struct test_case {
        const char *    src;
        in_port_t       sport;
@@ -36,12 +38,12 @@
        {
                LOCAL_IP1,      15000,          REMOTE_IP1,     7000,
                NPF_NATOUT,     IFNAME_EXT,     PFIL_OUT,
-               RESULT_PASS,    PUB_IP1,        53472
+               RESULT_PASS,    PUB_IP1,        RANDOM_PORT
        },
        {
                LOCAL_IP1,      15000,          REMOTE_IP1,     7000,
                NPF_NATOUT,     IFNAME_EXT,     PFIL_OUT,
-               RESULT_PASS,    PUB_IP1,        53472
+               RESULT_PASS,    PUB_IP1,        RANDOM_PORT
        },
        {
                LOCAL_IP1,      15000,          REMOTE_IP1,     7000,
@@ -54,12 +56,12 @@
                RESULT_BLOCK,   NULL,           0
        },
        {
-               REMOTE_IP1,     7000,           PUB_IP1,        53472,
+               REMOTE_IP1,     7000,           PUB_IP1,        RANDOM_PORT,
                NPF_NATOUT,     IFNAME_INT,     PFIL_IN,
                RESULT_BLOCK,   NULL,           0
        },
        {
-               REMOTE_IP1,     7000,           PUB_IP1,        53472,
+               REMOTE_IP1,     7000,           PUB_IP1,        RANDOM_PORT,
                NPF_NATOUT,     IFNAME_EXT,     PFIL_IN,
                RESULT_PASS,    LOCAL_IP1,      15000
        },
diff -r 42a1b7494db6 -r 6631c55c2d0e usr.sbin/npf/npftest/libnpftest/npf_test_subr.c
--- a/usr.sbin/npf/npftest/libnpftest/npf_test_subr.c   Wed Feb 05 01:59:58 2014 +0000
+++ b/usr.sbin/npf/npftest/libnpftest/npf_test_subr.c   Wed Feb 05 03:30:13 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: npf_test_subr.c,v 1.6 2013/11/08 00:38:27 rmind Exp $  */
+/*     $NetBSD: npf_test_subr.c,v 1.7 2014/02/05 03:30:13 rmind Exp $  */
 
 /*
  * NPF initialisation and handler routines.
@@ -7,6 +7,7 @@
  */
 
 #include <sys/types.h>
+#include <sys/cprng.h>
 #include <net/if.h>
 #include <net/if_types.h>
 
@@ -114,3 +115,12 @@
 
        return 0;
 }
+
+/*
+ * Need to override for cprng_fast32() -- we need deterministic PRNG.
+ */
+uint32_t
+_arc4random(void)
+{
+       return random();
+}
diff -r 42a1b7494db6 -r 6631c55c2d0e usr.sbin/npf/npftest/npftest.c
--- a/usr.sbin/npf/npftest/npftest.c    Wed Feb 05 01:59:58 2014 +0000
+++ b/usr.sbin/npf/npftest/npftest.c    Wed Feb 05 03:30:13 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: npftest.c,v 1.13 2013/11/08 00:38:26 rmind Exp $       */
+/*     $NetBSD: npftest.c,v 1.14 2014/02/05 03:30:13 rmind Exp $       */
 
 /*
  * NPF testing framework.
@@ -121,15 +121,6 @@
        }
 }
 
-/*
- * Need to override for cprng_fast32(), since RUMP uses arc4random() for it.
- */
-uint32_t
-arc4random(void)
-{
-       return random();
-}
-
 int
 main(int argc, char **argv)
 {



Home | Main Index | Thread Index | Old Index