NetBSD Problem Report #33676

From www@NetBSD.org  Fri Jun  9 14:27:19 2006
Return-Path: <www@NetBSD.org>
Received: by narn.NetBSD.org (Postfix, from userid 31301)
	id B892163B863; Fri,  9 Jun 2006 14:27:19 +0000 (UTC)
Message-Id: <20060609142719.B892163B863@narn.NetBSD.org>
Date: Fri,  9 Jun 2006 14:27:19 +0000 (UTC)
From: uwe@NetBSD.org
Reply-To: uwe@NetBSD.org
To: gnats-bugs@NetBSD.org
Subject: socket(2) returns incorrect errno if domain is not supported
X-Send-Pr-Version: www-1.0

>Number:         33676
>Category:       kern
>Synopsis:       socket(2) returns incorrect errno if domain is not supported
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    ginsbach
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jun 09 14:30:00 +0000 2006
>Closed-Date:    Wed Jun 14 14:06:16 +0000 2006
>Last-Modified:  Wed Oct 25 08:00:07 +0000 2006
>Originator:     Valeriy E. Ushakov
>Release:        current as of 2006-06-09
>Organization:
>Environment:
>Description:
socket(2) incorrectly sets errno to EPROTONOSUPPORT
if the protocol family is not supported.

To quote http://www.fefe.de/libowfat/changes-0.23.txt

    work around freebsd 5.4 brokenness (if you don't have IPv6 in the
    kernel, socket(PF_INET6,SOCK_STREAM,0) returns EPROTONOSUPPORT
    instead of EPFNOSUPPORT, which basically says "yeah, I know IPv6,
    but TCP?  never heard of it")


SUS says <http://www.opengroup.org/onlinepubs/007908799/xns/socket.html>
that socket(2) should return EAFNOSUPPORT in that case.

There's a complication in that POSIX doesn't have
PF_* values (it uses AF_* instead).  We do have PF_*
so returning EPFNOSUPPORT would be a logical choice,
but as it's != EAFNOSUPPORT, it seems impossible to be
both posixly correct and internally consistent.

>How-To-Repeat:
Try to start in-tree postfix on a custom kernel w/out IPv6 support.
potfix is compiled with IPv6 support enabled, so it checks if IPv6
support is present in the kernel by creating a PF_INET6 socket
it expects EAFNOSUPPORT to indicate lack IPv6 support.
It gets EPROTONOSUPPORT instead and treats it as a fatal error.

>Fix:

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: kern-bug-people->rpaulo
Responsible-Changed-By: rpaulo@netbsd.org
Responsible-Changed-When: Fri, 09 Jun 2006 15:29:12 +0000
Responsible-Changed-Why:
I'll see what I can do.


From: Brian Ginsbach <ginsbach@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: PR/33676 CVS commit: src
Date: Tue, 13 Jun 2006 21:19:56 +0000 (UTC)

 Module Name:	src
 Committed By:	ginsbach
 Date:		Tue Jun 13 21:19:56 UTC 2006

 Modified Files:
 	src/lib/libc/sys: socket.2
 	src/sys/kern: uipc_socket.c

 Log Message:
 Add EAFNOSUPPORT as a possible error if the address family is not
 supported.  This adds further differentiation between which argument to
 socket(2) caused the error.  No longer are invalid domain (address family)
 errors classified as ENOPROTOSUPPORT errors.  This should make socket(2)
 conform to current POSIX and X/Open standards.  Fixes PR/33676.


 To generate a diff of this commit:
 cvs rdiff -r1.32 -r1.33 src/lib/libc/sys/socket.2
 cvs rdiff -r1.119 -r1.120 src/sys/kern/uipc_socket.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

Responsible-Changed-From-To: rpaulo->ginsbach
Responsible-Changed-By: ginsbach@netbsd.org
Responsible-Changed-When: Wed, 14 Jun 2006 14:06:16 +0000
Responsible-Changed-Why:
I committed a solution.


State-Changed-From-To: open->closed
State-Changed-By: ginsbach@netbsd.org
State-Changed-When: Wed, 14 Jun 2006 14:06:16 +0000
State-Changed-Why:
Fixed.


From: Geert Hendrickx <ghen@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: PR/33676 CVS commit: [netbsd-3] src
Date: Wed, 25 Oct 2006 07:53:19 +0000 (UTC)

 Module Name:	src
 Committed By:	ghen
 Date:		Wed Oct 25 07:53:19 UTC 2006

 Modified Files:
 	src/lib/libc/sys [netbsd-3]: socket.2
 	src/sys/kern [netbsd-3]: uipc_socket.c

 Log Message:
 Pull up following revision(s) (requested by ginsbach in ticket #1568):
 	sys/kern/uipc_socket.c: revision 1.120
 	lib/libc/sys/socket.2: revision 1.32
 	lib/libc/sys/socket.2: revision 1.33
 Sort ERRORS.  Bump date.
 Add EAFNOSUPPORT as a possible error if the address family is not
 supported.  This adds further differentiation between which argument to
 socket(2) caused the error.  No longer are invalid domain (address family)
 errors classified as ENOPROTOSUPPORT errors.  This should make socket(2)
 conform to current POSIX and X/Open standards.  Fixes PR/33676.


 To generate a diff of this commit:
 cvs rdiff -r1.31 -r1.31.2.1 src/lib/libc/sys/socket.2
 cvs rdiff -r1.108.2.1 -r1.108.2.2 src/sys/kern/uipc_socket.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: Mail Delivery Subsystem <MAILER-DAEMON@epita.fr>
To: undisclosed-recipients: ;
Cc: 
Subject: Re: PR/33676 CVS commit: [netbsd-3] src
Date: Wed, 25 Oct 2006 09:55:05 +0200 (CEST)

 	Désolé, 
         le compte de epibug est actuellement indisponible.
 	Votre e-mail a été délivré mais le destinataire risque temporairement 
         de ne  pas pouvoir y acceder.

         Sorry,
         epibug's account is currently unavailable.
         Your email has been delivered. The recipient may temporarily
         be unable to read it.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.49 2026/05/14 01:52:41 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.