svn commit: r193295 - in stable/7/sys: . compat/linux contrib/pf dev/ath/ath_hal dev/cxgb

Dmitry Chagin dchagin at FreeBSD.org
Tue Jun 2 04:44:39 UTC 2009


Author: dchagin
Date: Tue Jun  2 04:44:38 2009
New Revision: 193295
URL: http://svn.freebsd.org/changeset/base/193295

Log:
  MFC r191742,r191871:
  
  Linux socketpair() call expects explicit specified protocol for
  AF_LOCAL domain unlike FreeBSD which expects 0 in this case.
  
  Return EAFNOSUPPORT in case when the incorrect domain argument
  is specified.
  
  Return EPROTONOSUPPORT instead of passing values that are not 0
  to the BSD layer.
  
  Approved by:	kib (mentor)

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/compat/linux/linux_socket.c
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/dev/ath/ath_hal/   (props changed)
  stable/7/sys/dev/cxgb/   (props changed)

Modified: stable/7/sys/compat/linux/linux_socket.c
==============================================================================
--- stable/7/sys/compat/linux/linux_socket.c	Tue Jun  2 04:35:44 2009	(r193294)
+++ stable/7/sys/compat/linux/linux_socket.c	Tue Jun  2 04:44:38 2009	(r193295)
@@ -812,11 +812,21 @@ linux_socketpair(struct thread *td, stru
 	} */ bsd_args;
 
 	bsd_args.domain = linux_to_bsd_domain(args->domain);
-	if (bsd_args.domain == -1)
-		return (EINVAL);
+	if (bsd_args.domain != PF_LOCAL)
+		return (EAFNOSUPPORT);
 
 	bsd_args.type = args->type;
-	bsd_args.protocol = args->protocol;
+	if (args->protocol != 0 && args->protocol != PF_UNIX)
+
+		/*
+		 * Use of PF_UNIX as protocol argument is not right,
+		 * but Linux does it.
+		 * Do not map PF_UNIX as its Linux value is identical
+		 * to FreeBSD one.
+		 */
+		return (EPROTONOSUPPORT);
+	else
+		bsd_args.protocol = 0;
 	bsd_args.rsv = (int *)PTRIN(args->rsv);
 	return (socketpair(td, &bsd_args));
 }


More information about the svn-src-all mailing list