From nobody@FreeBSD.org  Tue Jan 12 10:41:56 2010
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C2A35106566B
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 12 Jan 2010 10:41:56 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id B16948FC15
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 12 Jan 2010 10:41:56 +0000 (UTC)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.3/8.14.3) with ESMTP id o0CAftc5026607
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 12 Jan 2010 10:41:55 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.3/8.14.3/Submit) id o0CAftxb026606;
	Tue, 12 Jan 2010 10:41:55 GMT
	(envelope-from nobody)
Message-Id: <201001121041.o0CAftxb026606@www.freebsd.org>
Date: Tue, 12 Jan 2010 10:41:55 GMT
From: Matthijs Kooiman <matthijs@stdin.nl>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Wrong use of constant PF_UNSPEC in libipsec/pfkey.c, should be SADB_SATYPE_UNSPEC
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         142741
>Category:       kern
>Synopsis:       [libipsec] [ipsec] Wrong use of constant PF_UNSPEC in libipsec/pfkey.c, should be SADB_SATYPE_UNSPEC
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bz
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jan 12 10:50:00 UTC 2010
>Closed-Date:    Wed Feb 15 09:33:30 UTC 2012
>Last-Modified:  Wed Feb 15 09:40:10 UTC 2012
>Originator:     Matthijs Kooiman
>Release:        HEAD
>Organization:
I.C.T.S.V. Inter-Actief
>Environment:
>Description:
While debugging a problem with IPSEC on my 6.4 box, I noticed that libipsec uses the wrong constant, as per subject. This occurs in lib/libipsec/pfkey.c:665 in pfkey_send_register in both my 6.4 version as in the HEAD version (http://www.freebsd.org/cgi/cvsweb.cgi/src/lib/libipsec/pfkey.c?annotate=1.9.10.1.2.1):

    if (satype == PF_UNSPEC) {

Line 1389 and this snippet from sbin/setkey/setkey.c show that it should indeed be SADB_SATYPE_UNSPEC

    if (pfkey_send_register(so, SADB_SATYPE_UNSPEC) < 0)
        return -1;                                                         

Since these constants both have the value 0, this wrong constant has never caused any problems, but for clarity and to prevent possible future bugs, it's probably best to change it?

>How-To-Repeat:

>Fix:


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->bz 
Responsible-Changed-By: bz 
Responsible-Changed-When: Tue Jan 12 20:27:57 UTC 2010 
Responsible-Changed-Why:  
Take. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=142741 
State-Changed-From-To: open->patched 
State-Changed-By: bz 
State-Changed-When: Sat Feb 11 11:12:45 UTC 2012 
State-Changed-Why:  
Committed to HEAD, will MFC soon. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=142741 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/142741: commit references a PR
Date: Sat, 11 Feb 2012 11:11:53 +0000 (UTC)

 Author: bz
 Date: Sat Feb 11 11:11:43 2012
 New Revision: 231515
 URL: http://svn.freebsd.org/changeset/base/231515
 
 Log:
   Use the correct constant (with same value) for comparying the SA type.
   
   PR:		kern/142741
   Submitted by:	Matthijs Kooiman (matthijs stdin.nl)
   MFC after:	3 days
 
 Modified:
   head/lib/libipsec/pfkey.c
 
 Modified: head/lib/libipsec/pfkey.c
 ==============================================================================
 --- head/lib/libipsec/pfkey.c	Sat Feb 11 11:11:13 2012	(r231514)
 +++ head/lib/libipsec/pfkey.c	Sat Feb 11 11:11:43 2012	(r231515)
 @@ -662,7 +662,7 @@ pfkey_send_register(so, satype)
  {
  	int len, algno;
  
 -	if (satype == PF_UNSPEC) {
 +	if (satype == SADB_SATYPE_UNSPEC) {
  		for (algno = 0;
  		     algno < sizeof(supported_map)/sizeof(supported_map[0]);
  		     algno++) {
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: patched->closed 
State-Changed-By: bz 
State-Changed-When: Wed Feb 15 09:33:02 UTC 2012 
State-Changed-Why:  
Thanks a lot for reporting the problem and the correct change! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=142741 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/142741: commit references a PR
Date: Wed, 15 Feb 2012 09:32:34 +0000 (UTC)

 Author: bz
 Date: Wed Feb 15 09:32:20 2012
 New Revision: 231746
 URL: http://svn.freebsd.org/changeset/base/231746
 
 Log:
   MFC r231515:
   
    Use the correct constant (with same value) for comparying the SA type.
   
   PR:		kern/142741
   Submitted by:	Matthijs Kooiman (matthijs stdin.nl)
 
 Modified:
   stable/9/lib/libipsec/pfkey.c
 Directory Properties:
   stable/9/lib/libipsec/   (props changed)
 
 Modified: stable/9/lib/libipsec/pfkey.c
 ==============================================================================
 --- stable/9/lib/libipsec/pfkey.c	Wed Feb 15 07:30:23 2012	(r231745)
 +++ stable/9/lib/libipsec/pfkey.c	Wed Feb 15 09:32:20 2012	(r231746)
 @@ -662,7 +662,7 @@ pfkey_send_register(so, satype)
  {
  	int len, algno;
  
 -	if (satype == PF_UNSPEC) {
 +	if (satype == SADB_SATYPE_UNSPEC) {
  		for (algno = 0;
  		     algno < sizeof(supported_map)/sizeof(supported_map[0]);
  		     algno++) {
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/142741: commit references a PR
Date: Wed, 15 Feb 2012 09:32:49 +0000 (UTC)

 Author: bz
 Date: Wed Feb 15 09:32:40 2012
 New Revision: 231747
 URL: http://svn.freebsd.org/changeset/base/231747
 
 Log:
   MFC r231515:
   
    Use the correct constant (with same value) for comparying the SA type.
   
   PR:		kern/142741
   Submitted by:	Matthijs Kooiman (matthijs stdin.nl)
 
 Modified:
   stable/8/lib/libipsec/pfkey.c
 Directory Properties:
   stable/8/lib/libipsec/   (props changed)
 
 Modified: stable/8/lib/libipsec/pfkey.c
 ==============================================================================
 --- stable/8/lib/libipsec/pfkey.c	Wed Feb 15 09:32:20 2012	(r231746)
 +++ stable/8/lib/libipsec/pfkey.c	Wed Feb 15 09:32:40 2012	(r231747)
 @@ -662,7 +662,7 @@ pfkey_send_register(so, satype)
  {
  	int len, algno;
  
 -	if (satype == PF_UNSPEC) {
 +	if (satype == SADB_SATYPE_UNSPEC) {
  		for (algno = 0;
  		     algno < sizeof(supported_map)/sizeof(supported_map[0]);
  		     algno++) {
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/142741: commit references a PR
Date: Wed, 15 Feb 2012 09:33:15 +0000 (UTC)

 Author: bz
 Date: Wed Feb 15 09:32:51 2012
 New Revision: 231748
 URL: http://svn.freebsd.org/changeset/base/231748
 
 Log:
   MFC r231515:
   
    Use the correct constant (with same value) for comparying the SA type.
   
   PR:		kern/142741
   Submitted by:	Matthijs Kooiman (matthijs stdin.nl)
 
 Modified:
   stable/7/lib/libipsec/pfkey.c
 Directory Properties:
   stable/7/lib/libipsec/   (props changed)
 
 Modified: stable/7/lib/libipsec/pfkey.c
 ==============================================================================
 --- stable/7/lib/libipsec/pfkey.c	Wed Feb 15 09:32:40 2012	(r231747)
 +++ stable/7/lib/libipsec/pfkey.c	Wed Feb 15 09:32:51 2012	(r231748)
 @@ -662,7 +662,7 @@ pfkey_send_register(so, satype)
  {
  	int len, algno;
  
 -	if (satype == PF_UNSPEC) {
 +	if (satype == SADB_SATYPE_UNSPEC) {
  		for (algno = 0;
  		     algno < sizeof(supported_map)/sizeof(supported_map[0]);
  		     algno++) {
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
>Unformatted:
