changeset 10833:148e8c056d10

6859820 Several SOL_SOCKET level options no longer work on SCTP socket
author Anders Persson <Anders.Persson@Sun.COM>
date Wed, 21 Oct 2009 19:52:57 -0700
parents 1770c9c8b380
children d911b8bdf7a8
files usr/src/uts/common/fs/sockfs/sockcommon_subr.c usr/src/uts/common/inet/sockmods/socksctp.c
diffstat 2 files changed, 14 insertions(+), 35 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/uts/common/fs/sockfs/sockcommon_subr.c	Wed Oct 21 19:52:57 2009 -0700
+++ b/usr/src/uts/common/fs/sockfs/sockcommon_subr.c	Wed Oct 21 19:52:57 2009 -0700
@@ -1668,6 +1668,11 @@
 	}
 }
 
+/*
+ * This is called for all socket types to verify that the buffer size is large
+ * enough for the option, and if we can, handle the request as well. Most
+ * options will be forwarded to the protocol.
+ */
 int
 socket_getopt_common(struct sonode *so, int level, int option_name,
     void *optval, socklen_t *optlenp, int flags)
--- a/usr/src/uts/common/inet/sockmods/socksctp.c	Wed Oct 21 19:52:57 2009 -0700
+++ b/usr/src/uts/common/inet/sockmods/socksctp.c	Wed Oct 21 19:52:57 2009 -0700
@@ -1225,46 +1225,20 @@
 	void	*optbuf = &buffer;
 	int	error = 0;
 
-
 	if (level == SOL_SOCKET) {
 		switch (option_name) {
 		/* Not supported options */
 		case SO_SNDTIMEO:
 		case SO_RCVTIMEO:
 		case SO_EXCLBIND:
-			error = ENOPROTOOPT;
-			eprintsoline(so, error);
-			goto done;
-
-		case SO_TYPE:
-		case SO_ERROR:
-		case SO_DEBUG:
-		case SO_ACCEPTCONN:
-		case SO_REUSEADDR:
-		case SO_KEEPALIVE:
-		case SO_DONTROUTE:
-		case SO_BROADCAST:
-		case SO_USELOOPBACK:
-		case SO_OOBINLINE:
-		case SO_SNDBUF:
-		case SO_RCVBUF:
-		case SO_SNDLOWAT:
-		case SO_RCVLOWAT:
-		case SO_DGRAM_ERRIND:
-		case SO_PROTOTYPE:
-		case SO_DOMAIN:
-			if (maxlen < (t_uscalar_t)sizeof (int32_t)) {
-				error = EINVAL;
-				eprintsoline(so, error);
-				goto done;
-			}
-			break;
-		case SO_LINGER:
-			if (maxlen < (t_uscalar_t)sizeof (struct linger)) {
-				error = EINVAL;
-				eprintsoline(so, error);
-				goto done;
-			}
+			eprintsoline(so, ENOPROTOOPT);
+			return (ENOPROTOOPT);
+		default:
+			error = socket_getopt_common(so, level, option_name,
+			    optval, optlenp, flags);
+			if (error >= 0)
+				return (error);
+			/* Pass the request to the protocol */
 			break;
 		}
 	}
@@ -1303,7 +1277,7 @@
 	if (optbuf != &buffer) {
 		kmem_free(optbuf, maxlen);
 	}
-done:
+
 	return (error);
 }