kern/155040: [patch] Linux recvfrom doesn't handle proto family

Simon Walton simonw at matteworld.com
Fri Feb 25 19:50:08 UTC 2011


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


More information about the freebsd-bugs mailing list