NetBSD Problem Report #50905
From www@NetBSD.org Mon Mar 7 10:36:46 2016
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
by mollari.NetBSD.org (Postfix) with ESMTPS id 1BCC17ABDC
for <gnats-bugs@gnats.NetBSD.org>; Mon, 7 Mar 2016 10:36:46 +0000 (UTC)
Message-Id: <20160307103645.27EE57ACBA@mollari.NetBSD.org>
Date: Mon, 7 Mar 2016 10:36:45 +0000 (UTC)
From: henning.petersen@t-online.de
Reply-To: henning.petersen@t-online.de
To: gnats-bugs@NetBSD.org
Subject: Useless comparision.
X-Send-Pr-Version: www-1.0
>Number: 50905
>Category: kern
>Synopsis: Useless comparision.
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: kern-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Mar 07 10:40:00 +0000 2016
>Closed-Date: Mon Mar 07 13:24:39 +0000 2016
>Last-Modified: Sun Mar 13 12:00:01 +0000 2016
>Originator: Henning Petersen
>Release:
>Organization:
>Environment:
>Description:
In function key_parse is useless comparision at line 7358:
if ((m->m_flags & M_PKTHDR) == 0 ||
m->m_pkthdr.len != m->m_pkthdr.len) <<<===
Patch is taken from freebsd.
>How-To-Repeat:
>Fix:
diff -u -p -r1.96 key.c
--- sys/netipsec/key.c 6 Mar 2016 04:19:51 -0000 1.96
+++ sys/netipsec/key.c 7 Mar 2016 10:25:21 -0000
@@ -7333,6 +7333,7 @@ key_parse(struct mbuf *m, struct socket
{
struct sadb_msg *msg;
struct sadb_msghdr mh;
+ u_int orglen;
int error;
int target;
@@ -7352,10 +7353,11 @@ key_parse(struct mbuf *m, struct socket
return ENOBUFS;
}
msg = mtod(m, struct sadb_msg *);
+ orglen = PFKEY_UNUNIT64(msg->sadb_msg_len);
target = KEY_SENDUP_ONE;
if ((m->m_flags & M_PKTHDR) == 0 ||
- m->m_pkthdr.len != m->m_pkthdr.len) {
+ m->m_pkthdr.len != orglen) {
ipseclog((LOG_DEBUG, "key_parse: invalid message length.\n"));
PFKEY_STATINC(PFKEY_STAT_OUT_INVLEN);
error = EINVAL;
>Release-Note:
>Audit-Trail:
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/50905 CVS commit: src/sys/netipsec
Date: Mon, 7 Mar 2016 08:08:48 -0500
Module Name: src
Committed By: christos
Date: Mon Mar 7 13:08:48 UTC 2016
Modified Files:
src/sys/netipsec: key.c
Log Message:
PR/50905: Henning Petersen: Fix useless comparison (from FreeBSD)
To generate a diff of this commit:
cvs rdiff -u -r1.96 -r1.97 src/sys/netipsec/key.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: open->closed
State-Changed-By: wiz@NetBSD.org
State-Changed-When: Mon, 07 Mar 2016 13:24:39 +0000
State-Changed-Why:
Fixed by christos, thanks.
From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/50905 CVS commit: [netbsd-7] src/sys/netipsec
Date: Sun, 13 Mar 2016 11:59:23 +0000
Module Name: src
Committed By: martin
Date: Sun Mar 13 11:59:23 UTC 2016
Modified Files:
src/sys/netipsec [netbsd-7]: key.c key_debug.h
Log Message:
Pull up following revision(s) (requested by christos in ticket #1136):
sys/netipsec/key.c: revision 1.92-1.97
sys/netipsec/key_debug.h: revision 1.7
Add more debugging, no functional change.
Gather more information from mbuf.
Fix port matching; we need to ignore ports when they are 0 not only in
the second saidx but the first one too. Fixes NAT-T issue with NetBSD
being the host behind NAT.
Kill stray &
Simplify the port comparison code further.
PR/50905: Henning Petersen: Fix useless comparison (from FreeBSD)
To generate a diff of this commit:
cvs rdiff -u -r1.91 -r1.91.2.1 src/sys/netipsec/key.c
cvs rdiff -u -r1.6 -r1.6.30.1 src/sys/netipsec/key_debug.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.