Date: Sun, 5 Jun 2016 07:43:20 +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-10@freebsd.org Subject: svn commit: r301431 - stable/10/sys/compat/linux Message-ID: <201606050743.u557hKXU077731@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: dchagin Date: Sun Jun 5 07:43:20 2016 New Revision: 301431 URL: https://svnweb.freebsd.org/changeset/base/301431 Log: MFC r300431: Convert proto family in both directions. The linux and native values for local and inet are identical, but for inet6 values differ. PR: 155040 Reported by: Simon Walton Modified: stable/10/sys/compat/linux/linux_socket.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/compat/linux/linux_socket.c ============================================================================== --- stable/10/sys/compat/linux/linux_socket.c Sun Jun 5 07:40:12 2016 (r301430) +++ stable/10/sys/compat/linux/linux_socket.c Sun Jun 5 07:43:20 2016 (r301431) @@ -462,12 +462,16 @@ bsd_to_linux_sockaddr(struct sockaddr *a { struct sockaddr sa; size_t sa_len = sizeof(struct sockaddr); - int error; + int error, bdom; if ((error = copyin(arg, &sa, sa_len))) return (error); - *(u_short *)&sa = sa.sa_family; + bdom = bsd_to_linux_domain(sa.sa_family); + if (bdom == -1) + return (EAFNOSUPPORT); + + *(u_short *)&sa = bdom; return (copyout(&sa, arg, sa_len)); } @@ -476,12 +480,16 @@ linux_to_bsd_sockaddr(struct sockaddr *a { struct sockaddr sa; size_t sa_len = sizeof(struct sockaddr); - int error; + int error, bdom; if ((error = copyin(arg, &sa, sa_len))) return (error); - sa.sa_family = *(sa_family_t *)&sa; + bdom = linux_to_bsd_domain(*(sa_family_t *)&sa); + if (bdom == -1) + return (EAFNOSUPPORT); + + sa.sa_family = bdom; sa.sa_len = len; return (copyout(&sa, arg, sa_len)); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201606050743.u557hKXU077731>