Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-7]: src/sys/net/npf Pull up following revision(s) (requested by r...
details: https://anonhg.NetBSD.org/src/rev/3b6ac815a93d
branches: netbsd-7
changeset: 798734:3b6ac815a93d
user: msaitoh <msaitoh%NetBSD.org@localhost>
date: Mon Dec 22 02:10:30 2014 +0000
description:
Pull up following revision(s) (requested by rmind in ticket #347):
sys/net/npf/npf_nat.c: revision 1.38
sys/net/npf/npf_conn.h: revision 1.8
sys/net/npf/npf_conn.c: revision 1.14
NPF: set the connection flags atomically in the post-creation logic and
fix a tiny race condition window. Might fix PR/49488.
diffstat:
sys/net/npf/npf_conn.c | 8 ++++----
sys/net/npf/npf_conn.h | 4 ++--
sys/net/npf/npf_nat.c | 8 ++++----
3 files changed, 10 insertions(+), 10 deletions(-)
diffs (83 lines):
diff -r 84963437b1e6 -r 3b6ac815a93d sys/net/npf/npf_conn.c
--- a/sys/net/npf/npf_conn.c Mon Dec 22 02:06:10 2014 +0000
+++ b/sys/net/npf/npf_conn.c Mon Dec 22 02:10:30 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: npf_conn.c,v 1.10.2.2 2014/12/01 13:05:26 martin Exp $ */
+/* $NetBSD: npf_conn.c,v 1.10.2.3 2014/12/22 02:10:30 msaitoh Exp $ */
/*-
* Copyright (c) 2014 Mindaugas Rasiukevicius <rmind at netbsd org>
@@ -99,7 +99,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: npf_conn.c,v 1.10.2.2 2014/12/01 13:05:26 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_conn.c,v 1.10.2.3 2014/12/22 02:10:30 msaitoh Exp $");
#include <sys/param.h>
#include <sys/types.h>
@@ -660,7 +660,7 @@
* If rproc is set, the caller transfers its reference to us,
* which will be released on npf_conn_destroy().
*/
- con->c_flags |= CONN_PASS;
+ atomic_or_uint(&con->c_flags, CONN_PASS);
con->c_rproc = rp;
}
@@ -673,7 +673,7 @@
{
if ((con->c_flags & (CONN_ACTIVE | CONN_EXPIRE)) == 0) {
/* Activate: after this, connection is globally visible. */
- con->c_flags |= CONN_ACTIVE;
+ atomic_or_uint(&con->c_flags, CONN_ACTIVE);
}
KASSERT(con->c_refcnt > 0);
atomic_dec_uint(&con->c_refcnt);
diff -r 84963437b1e6 -r 3b6ac815a93d sys/net/npf/npf_conn.h
--- a/sys/net/npf/npf_conn.h Mon Dec 22 02:06:10 2014 +0000
+++ b/sys/net/npf/npf_conn.h Mon Dec 22 02:10:30 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: npf_conn.h,v 1.6.2.1 2014/12/01 13:05:26 martin Exp $ */
+/* $NetBSD: npf_conn.h,v 1.6.2.2 2014/12/22 02:10:30 msaitoh Exp $ */
/*-
* Copyright (c) 2009-2014 The NetBSD Foundation, Inc.
@@ -47,7 +47,7 @@
#include <sys/rbtree.h>
/*
- * See npf_conn_key() function for the description key layout.
+ * See npf_conn_conkey() function for the key layout description.
*/
#define NPF_CONN_NKEYWORDS (2 + ((sizeof(npf_addr_t) * 2) >> 2))
#define NPF_CONN_MAXKEYLEN (NPF_CONN_NKEYWORDS * sizeof(uint32_t))
diff -r 84963437b1e6 -r 3b6ac815a93d sys/net/npf/npf_nat.c
--- a/sys/net/npf/npf_nat.c Mon Dec 22 02:06:10 2014 +0000
+++ b/sys/net/npf/npf_nat.c Mon Dec 22 02:10:30 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: npf_nat.c,v 1.32.2.3 2014/12/01 13:05:26 martin Exp $ */
+/* $NetBSD: npf_nat.c,v 1.32.2.4 2014/12/22 02:10:30 msaitoh Exp $ */
/*-
* Copyright (c) 2014 Mindaugas Rasiukevicius <rmind at netbsd org>
@@ -71,7 +71,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: npf_nat.c,v 1.32.2.3 2014/12/01 13:05:26 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_nat.c,v 1.32.2.4 2014/12/22 02:10:30 msaitoh Exp $");
#include <sys/param.h>
#include <sys/types.h>
@@ -914,8 +914,8 @@
np = nt->nt_natpolicy;
memcpy(&ip, &np->n_taddr, sizeof(ip));
- printf("\tNATP(%p): type %d flags 0x%x taddr %s tport %d\n",
- np, np->n_type, np->n_flags, inet_ntoa(ip), np->n_tport);
+ printf("\tNATP(%p): type %d flags 0x%x taddr %s tport %d\n", np,
+ np->n_type, np->n_flags, inet_ntoa(ip), ntohs(np->n_tport));
memcpy(&ip, &nt->nt_oaddr, sizeof(ip));
printf("\tNAT: original address %s oport %d tport %d\n",
inet_ntoa(ip), ntohs(nt->nt_oport), ntohs(nt->nt_tport));
Home |
Main Index |
Thread Index |
Old Index