Module Name:    src
Committed By:   christos
Date:           Sun Jul 17 23:59:55 UTC 2011

Modified Files:
        src/sys/compat/linux/common: linux_socket.c

Log Message:
fail early on socket domain+type combinations we don't support


To generate a diff of this commit:
cvs rdiff -u -r1.109 -r1.110 src/sys/compat/linux/common/linux_socket.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/linux/common/linux_socket.c
diff -u src/sys/compat/linux/common/linux_socket.c:1.109 src/sys/compat/linux/common/linux_socket.c:1.110
--- src/sys/compat/linux/common/linux_socket.c:1.109	Thu Jun 30 16:09:39 2011
+++ src/sys/compat/linux/common/linux_socket.c	Sun Jul 17 19:59:54 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_socket.c,v 1.109 2011/06/30 20:09:39 wiz Exp $	*/
+/*	$NetBSD: linux_socket.c,v 1.110 2011/07/17 23:59:54 christos Exp $	*/
 
 /*-
  * Copyright (c) 1995, 1998, 2008 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_socket.c,v 1.109 2011/06/30 20:09:39 wiz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_socket.c,v 1.110 2011/07/17 23:59:54 christos Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -309,6 +309,13 @@
 	SCARG(&bsa, domain) = linux_to_bsd_domain(SCARG(uap, domain));
 	if (SCARG(&bsa, domain) == -1)
 		return EINVAL;
+	/*
+	 * Apparently linux uses this to talk to ISDN sockets. If we fail
+	 * now programs seems to handle it, but if we don't we are going
+	 * to fail when we bind and programs don't handle this well.
+	 */
+	if (SCARG(&bsa, domain) == AF_ROUTE && SCARG(&bsa, type) == SOCK_RAW)
+		return ENOTSUP;
 	flags = SCARG(uap, type) & ~LINUX_SOCK_TYPE_MASK;
 	if (flags & ~(LINUX_SOCK_CLOEXEC | LINUX_SOCK_NONBLOCK))
 		return EINVAL;

Reply via email to