Date: Tue, 2 Jun 2009 04:44:38 +0000 (UTC) From: Dmitry Chagin <dchagin@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org Subject: svn commit: r193295 - in stable/7/sys: . compat/linux contrib/pf dev/ath/ath_hal dev/cxgb Message-ID: <200906020444.n524icjH002690@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: dchagin Date: Tue Jun 2 04:44:38 2009 New Revision: 193295 URL: http://svn.freebsd.org/changeset/base/193295 Log: MFC r191742,r191871: Linux socketpair() call expects explicit specified protocol for AF_LOCAL domain unlike FreeBSD which expects 0 in this case. Return EAFNOSUPPORT in case when the incorrect domain argument is specified. Return EPROTONOSUPPORT instead of passing values that are not 0 to the BSD layer. Approved by: kib (mentor) Modified: stable/7/sys/ (props changed) stable/7/sys/compat/linux/linux_socket.c stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) Modified: stable/7/sys/compat/linux/linux_socket.c ============================================================================== --- stable/7/sys/compat/linux/linux_socket.c Tue Jun 2 04:35:44 2009 (r193294) +++ stable/7/sys/compat/linux/linux_socket.c Tue Jun 2 04:44:38 2009 (r193295) @@ -812,11 +812,21 @@ linux_socketpair(struct thread *td, stru } */ bsd_args; bsd_args.domain = linux_to_bsd_domain(args->domain); - if (bsd_args.domain == -1) - return (EINVAL); + if (bsd_args.domain != PF_LOCAL) + return (EAFNOSUPPORT); bsd_args.type = args->type; - bsd_args.protocol = args->protocol; + if (args->protocol != 0 && args->protocol != PF_UNIX) + + /* + * Use of PF_UNIX as protocol argument is not right, + * but Linux does it. + * Do not map PF_UNIX as its Linux value is identical + * to FreeBSD one. + */ + return (EPROTONOSUPPORT); + else + bsd_args.protocol = 0; bsd_args.rsv = (int *)PTRIN(args->rsv); return (socketpair(td, &bsd_args)); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200906020444.n524icjH002690>