Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src - {npf_mk_rproc, npf_nat_save}: fix the fetching of {rproc-pt...
details: https://anonhg.NetBSD.org/src/rev/dfb09fda6954
branches: trunk
changeset: 781028:dfb09fda6954
user: rmind <rmind%NetBSD.org@localhost>
date: Wed Aug 15 18:44:56 2012 +0000
description:
- {npf_mk_rproc,npf_nat_save}: fix the fetching of {rproc-ptr,id_ptr}.
- npf_rproc_setlog: initialise variables to 0, as keys may not exist.
Bugs found by mlelstv@ while testing on Amiga.
diffstat:
lib/libnpf/npf.c | 8 ++++----
sys/net/npf/npf_ctl.c | 13 ++++++++-----
sys/net/npf/npf_nat.c | 10 +++++-----
3 files changed, 17 insertions(+), 14 deletions(-)
diffs (116 lines):
diff -r ddf0f27a0fc3 -r dfb09fda6954 lib/libnpf/npf.c
--- a/lib/libnpf/npf.c Wed Aug 15 17:56:58 2012 +0000
+++ b/lib/libnpf/npf.c Wed Aug 15 18:44:56 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: npf.c,v 1.11 2012/08/12 03:35:14 rmind Exp $ */
+/* $NetBSD: npf.c,v 1.12 2012/08/15 18:44:56 rmind Exp $ */
/*-
* Copyright (c) 2010-2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: npf.c,v 1.11 2012/08/12 03:35:14 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf.c,v 1.12 2012/08/15 18:44:56 rmind Exp $");
#include <sys/types.h>
#include <netinet/in_systm.h>
@@ -456,7 +456,7 @@
u_int maxmss)
{
prop_dictionary_t rpdict = rp->nrp_dict;
- uint32_t fl;
+ uint32_t fl = 0;
prop_dictionary_set_bool(rpdict, "randomize-id", rnd);
prop_dictionary_set_bool(rpdict, "no-df", no_df);
@@ -472,7 +472,7 @@
_npf_rproc_setlog(nl_rproc_t *rp, u_int if_idx)
{
prop_dictionary_t rpdict = rp->nrp_dict;
- uint32_t fl;
+ uint32_t fl = 0;
prop_dictionary_set_uint32(rpdict, "log-interface", if_idx);
diff -r ddf0f27a0fc3 -r dfb09fda6954 sys/net/npf/npf_ctl.c
--- a/sys/net/npf/npf_ctl.c Wed Aug 15 17:56:58 2012 +0000
+++ b/sys/net/npf/npf_ctl.c Wed Aug 15 18:44:56 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: npf_ctl.c,v 1.16 2012/07/15 00:23:00 rmind Exp $ */
+/* $NetBSD: npf_ctl.c,v 1.17 2012/08/15 18:44:56 rmind Exp $ */
/*-
* Copyright (c) 2009-2012 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: npf_ctl.c,v 1.16 2012/07/15 00:23:00 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_ctl.c,v 1.17 2012/08/15 18:44:56 rmind Exp $");
#include <sys/param.h>
#include <sys/conf.h>
@@ -164,6 +164,7 @@
prop_object_iterator_t it;
prop_dictionary_t rpdict;
npf_rproc_t *rp;
+ uint64_t rpval;
it = prop_array_iterator(rprocs);
while ((rpdict = prop_object_iterator_next(it)) != NULL) {
@@ -178,10 +179,12 @@
return NULL;
}
CTASSERT(sizeof(uintptr_t) <= sizeof(uint64_t));
- if (!prop_dictionary_get_uint64(rpdict, "rproc-ptr", (uint64_t *)&rp)) {
+ if (!prop_dictionary_get_uint64(rpdict, "rproc-ptr", &rpval)) {
rp = npf_rproc_create(rpdict);
- prop_dictionary_set_uint64(rpdict, "rproc-ptr",
- (uint64_t)(uintptr_t)rp);
+ rpval = (uint64_t)(uintptr_t)rp;
+ prop_dictionary_set_uint64(rpdict, "rproc-ptr", rpval);
+ } else {
+ rp = (npf_rproc_t *)(uintptr_t)rpval;
}
return rp;
}
diff -r ddf0f27a0fc3 -r dfb09fda6954 sys/net/npf/npf_nat.c
--- a/sys/net/npf/npf_nat.c Wed Aug 15 17:56:58 2012 +0000
+++ b/sys/net/npf/npf_nat.c Wed Aug 15 18:44:56 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: npf_nat.c,v 1.16 2012/08/12 03:35:14 rmind Exp $ */
+/* $NetBSD: npf_nat.c,v 1.17 2012/08/15 18:44:56 rmind Exp $ */
/*-
* Copyright (c) 2010-2012 The NetBSD Foundation, Inc.
@@ -76,7 +76,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: npf_nat.c,v 1.16 2012/08/12 03:35:14 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_nat.c,v 1.17 2012/08/15 18:44:56 rmind Exp $");
#include <sys/param.h>
#include <sys/types.h>
@@ -751,7 +751,7 @@
prop_object_iterator_t it;
prop_dictionary_t npdict;
prop_data_t nd, npd;
- uintptr_t itnp;
+ uint64_t itnp;
/* Set NAT entry data. */
nd = prop_data_create_data(nt, sizeof(npf_nat_t));
@@ -762,8 +762,8 @@
it = prop_array_iterator(natlist);
while ((npdict = prop_object_iterator_next(it)) != NULL) {
CTASSERT(sizeof(uintptr_t) <= sizeof(uint64_t));
- prop_dictionary_get_uint64(npdict, "id-ptr", (uint64_t *)&itnp);
- if (itnp == (uintptr_t)np) {
+ prop_dictionary_get_uint64(npdict, "id-ptr", &itnp);
+ if ((uintptr_t)itnp == (uintptr_t)np) {
break;
}
}
Home |
Main Index |
Thread Index |
Old Index