Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Feb 2011 19:49:37 GMT
From:      Simon Walton <simonw@matteworld.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   kern/155040: [patch] Linux recvfrom doesn't handle proto family
Message-ID:  <201102251949.p1PJnbFs002460@red.freebsd.org>
Resent-Message-ID: <201102251950.p1PJo7AF062095@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>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:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201102251949.p1PJnbFs002460>