npftest: fix the failure of NAT test -- adjust for RUMP's conversion to
the in-kernel CPRNG (hi pooka!).
This commit is contained in:
parent
4b43c5a40c
commit
bb1fedd189
@ -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 @@ static const struct test_case {
|
||||
{
|
||||
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 @@ static const struct test_case {
|
||||
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
|
||||
},
|
||||
|
@ -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 @@ npf_test_statetrack(const void *data, size_t len, ifnet_t *ifp,
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Need to override for cprng_fast32() -- we need deterministic PRNG.
|
||||
*/
|
||||
uint32_t
|
||||
_arc4random(void)
|
||||
{
|
||||
return random();
|
||||
}
|
||||
|
@ -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 @@ load_npf_config(const char *config)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Need to override for cprng_fast32(), since RUMP uses arc4random() for it.
|
||||
*/
|
||||
uint32_t
|
||||
arc4random(void)
|
||||
{
|
||||
return random();
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user