From owner-freebsd-bugs@FreeBSD.ORG Fri Feb 25 19:50:08 2011 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3D22B1065696 for ; Fri, 25 Feb 2011 19:50:08 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 014AB8FC15 for ; Fri, 25 Feb 2011 19:50:08 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id p1PJo76m062096 for ; Fri, 25 Feb 2011 19:50:07 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p1PJo7AF062095; Fri, 25 Feb 2011 19:50:07 GMT (envelope-from gnats) Resent-Date: Fri, 25 Feb 2011 19:50:07 GMT Resent-Message-Id: <201102251950.p1PJo7AF062095@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Simon Walton Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6B7BD1065672 for ; Fri, 25 Feb 2011 19:49:38 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22]) by mx1.freebsd.org (Postfix) with ESMTP id 5BC8A8FC15 for ; Fri, 25 Feb 2011 19:49:38 +0000 (UTC) Received: from red.freebsd.org (localhost [127.0.0.1]) by red.freebsd.org (8.14.4/8.14.4) with ESMTP id p1PJnbl7002462 for ; Fri, 25 Feb 2011 19:49:37 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.4/8.14.4/Submit) id p1PJnbFs002460; Fri, 25 Feb 2011 19:49:37 GMT (envelope-from nobody) Message-Id: <201102251949.p1PJnbFs002460@red.freebsd.org> Date: Fri, 25 Feb 2011 19:49:37 GMT From: Simon Walton To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: kern/155040: [patch] Linux recvfrom doesn't handle proto family X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Feb 2011 19:50:08 -0000 >Number: 155040 >Category: kern >Synopsis: [patch] Linux recvfrom doesn't handle proto family >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Feb 25 19:50:07 UTC 2011 >Closed-Date: >Last-Modified: >Originator: Simon Walton >Release: 8.1 >Organization: Matte World Digital >Environment: FreeBSD mongo 8.1-RELEASE FreeBSD 8.1-RELEASE #3: Thu Jan 27 09:56:08 PST 2011 >Description: In the linux socket recvfrom emulation the incoming socket address family is not converted to BSD values, although the reverse conversion is done. The values for local and inet are identical so this still works, but inet6 values differ. >How-To-Repeat: >Fix: Apply patch. This also defaults unknown families to inet as apparently linux ignores bad values in this syscall. This was necessary to get a linux binary to work. Alternatively maybe just force the address family to AF_UNSPEC. Patch attached with submission follows: --- /sys/compat/linux/linux_socket.c.orig 2011-02-17 11:29:14.000000000 -0800 +++ /sys/compat/linux/linux_socket.c 2011-02-24 17:19:01.000000000 -0800 @@ -198,7 +198,7 @@ case LINUX_AF_APPLETALK: return (AF_APPLETALK); } - return (-1); + return (AF_INET); } static int @@ -393,6 +393,7 @@ sa.sa_family = *(sa_family_t *)&sa; sa.sa_len = len; + sa.sa_family = linux_to_bsd_domain (sa.sa_family); error = copyout(&sa, arg, sa_len); >Release-Note: >Audit-Trail: >Unformatted: