Subject: Re: No IPv6 in the kernel vs socket(2) errno vs postfix
To: Valeriy E. Ushakov <uwe@ptc.spbu.ru>
From: Brian Ginsbach <ginsbach@NetBSD.org>
List: tech-net
Date: 06/09/2006 15:53:17
On Fri, Jun 09, 2006 at 06:33:26PM +0400, Valeriy E. Ushakov wrote:
> On Fri, Jun 09, 2006 at 18:09:46 +0400, Valeriy E. Ushakov wrote:
>
> > Anyway, my reading of the
> > http://www.opengroup.org/onlinepubs/007908799/xns/socket.html is that
> > unsupported arguments should be reported as:
> >
> > domain - EAFNOSUPPORT (EPFNOSUPPORT)
> > type - EPROTOTYPE
> > protocol - EPROTONOSUPPORT
>
> Filed as kern/33676
>
I think the following should work (at least this is how I fixed it
in another BSD based stack for POSIX conformance).
--
Brian
Index: kern/uipc_socket.c
===================================================================
RCS file: /cvsroot/src/sys/kern/uipc_socket.c,v
retrieving revision 1.119
diff -c -r1.119 uipc_socket.c
*** kern/uipc_socket.c 25 May 2006 14:27:28 -0000 1.119
--- kern/uipc_socket.c 9 Jun 2006 15:43:29 -0000
***************
*** 478,484 ****
prp = pffindproto(dom, proto, type);
else
prp = pffindtype(dom, type);
! if (prp == 0 || prp->pr_usrreq == 0)
return (EPROTONOSUPPORT);
if (prp->pr_type != type)
return (EPROTOTYPE);
--- 478,493 ----
prp = pffindproto(dom, proto, type);
else
prp = pffindtype(dom, type);
! if (prp == 0) {
! /* no support for domain */
! if (pffinddomain(dom) == 0)
! return (EAFNOSUPPORT);
! /* no support for socket type */
! if (proto == 0 && type != 0)
! return (EPROTOTYPE);
! return (EPROTONOSUPPORT);
! }
! if (prp->pr_usrreq == 0)
return (EPROTONOSUPPORT);
if (prp->pr_type != type)
return (EPROTOTYPE);