From nobody@FreeBSD.org  Wed Oct  6 17:07:33 2004
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 7814416A4D0
	for <freebsd-gnats-submit@FreeBSD.org>; Wed,  6 Oct 2004 17:07:33 +0000 (GMT)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 6BF0E43D2F
	for <freebsd-gnats-submit@FreeBSD.org>; Wed,  6 Oct 2004 17:07:33 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.12.11/8.12.11) with ESMTP id i96H7XHH076687
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 6 Oct 2004 17:07:33 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.12.11/8.12.11/Submit) id i96H7Xja076686;
	Wed, 6 Oct 2004 17:07:33 GMT
	(envelope-from nobody)
Message-Id: <200410061707.i96H7Xja076686@www.freebsd.org>
Date: Wed, 6 Oct 2004 17:07:33 GMT
From: Richard Andrades <richard.andrades@utstar.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: missing break after case AF_INET6 in key_sockaddrcmp
X-Send-Pr-Version: www-2.3

>Number:         72393
>Category:       kern
>Synopsis:       [patch] missing break after case AF_INET6 in key_sockaddrcmp
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    suz
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Oct 06 17:10:23 GMT 2004
>Closed-Date:    Thu Jan 13 22:35:21 GMT 2005
>Last-Modified:  Thu Jan 13 22:35:21 GMT 2005
>Originator:     Richard Andrades
>Release:        4.9-RELEASE
>Organization:
UTStarcom, Inc.
>Environment:
FreeBSD mobomom.nj.us.utstar.com 4.9-RELEASE FreeBSD 4.9-RELEASE #0: Mon Dec  8 19:07:51 EST 2003     root@x7.nj.us.utstar.com:/usr/src/sys/compile/GENERIC_ROCKETPORT  i386
>Description:
The function key_sockaddrcmp(). has the following problem. If the 
function is called with the parameter port = 0, meaning that the 
port number should not be used in the address comparison, at the
end of the successful comparison of the test of the address structure, 
the test control will fall through to the default case which can
fail due to a difference in the port number.

>How-To-Repeat:
Fund it while debugging the code for an unrelated problem. It can
probably be reproduced by installing a policy that is intended to
cover all ports and sending packets with different port numbers.
>Fix:
FILE: src/sys/netkey/key.c
static int
key_sockaddrcmp(sa1, sa2, port)
	struct sockaddr *sa1;
	struct sockaddr *sa2;
	int port;
{
..
..

	case AF_INET6:
..
..
		if (port &&
		    satosin6(sa1)->sin6_port != satosin6(sa2)->sin6_port) {
			return 1;
		}
                break; /**** BUGFIX Add this missing break */
	default:
		if (bcmp(sa1, sa2, sa1->sa_len) != 0)
			return 1;
		break;
	}


Although I found this with version 4.9, I checked the codebase
and the problem is still present in the latest version.

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->suz 
Responsible-Changed-By: rwatson 
Responsible-Changed-When: Mon Jan 3 12:23:43 GMT 2005 
Responsible-Changed-Why:  
Change owner to suz who has most recently been maintaining the netkey 
code. 


http://www.freebsd.org/cgi/query-pr.cgi?pr=72393 
State-Changed-From-To: open->patched 
State-Changed-By: suz 
State-Changed-When: Mon Jan 10 13:07:00 GMT 2005 
State-Changed-Why:  
applied the suggested patch.


http://www.freebsd.org/cgi/query-pr.cgi?pr=72393 
State-Changed-From-To: patched->closed 
State-Changed-By: suz 
State-Changed-When: Thu Jan 13 22:32:46 GMT 2005 
State-Changed-Why:  
MFC to RELENG_4 and 5 

http://www.freebsd.org/cgi/query-pr.cgi?pr=72393 
>Unformatted:
