On 07/16 05:05, Philip Guenther wrote:
> On Thu, Jul 16, 2015 at 4:54 PM, Jeremy Evans <[email protected]> wrote:
> > Fix socketpair(2) on Unix datagram sockets that use SOCK_CLOEXEC or
> > SOCK_NONBLOCK.
> >
> > This fixes a failure in the ruby test suite.
> >
> > OK?
>
> No, that'll have false positives on SOCK_RAW sockets. You need to
> mask things, perhaps a diff like this:
This works and is definitely more correct. OK jeremy@
Thanks,
Jeremy
>
> --- sys/socket.h 21 Jan 2015 02:23:14 -0000 1.87
> +++ sys/socket.h 17 Jul 2015 00:03:48 -0000
> @@ -68,6 +68,9 @@ typedef __sa_family_t sa_family_t; /* so
> #define SOCK_RAW 3 /* raw-protocol interface */
> #define SOCK_RDM 4 /* reliably-delivered message
> */
> #define SOCK_SEQPACKET 5 /* sequenced packet stream */
> +#ifdef _KERNEL
> +#define SOCK_TYPE_MASK 0x000F /* mask that covers the above
> */
> +#endif
>
> /*
> * Socket creation flags
> Index: kern/uipc_syscalls.c
> ===================================================================
> RCS file: /data/src/openbsd/src/sys/kern/uipc_syscalls.c,v
> retrieving revision 1.102
> diff -u -p -r1.102 uipc_syscalls.c
> --- kern/uipc_syscalls.c 21 May 2015 13:35:15 -0000 1.102
> +++ kern/uipc_syscalls.c 17 Jul 2015 00:04:02 -0000
> @@ -403,7 +403,7 @@ sys_socketpair(struct proc *p, void *v,
> }
> if ((error = soconnect2(so1, so2)) != 0)
> goto free4;
> - if (SCARG(uap, type) == SOCK_DGRAM) {
> + if ((SCARG(uap, type) & SOCK_TYPE_MASK) == SOCK_DGRAM) {
> /*
> * Datagram socket connection is asymmetric.
> */