Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F108004108
D35389.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D35389.diff
View Options
Index: lib/libc/sys/getsockopt.2
===================================================================
--- lib/libc/sys/getsockopt.2
+++ lib/libc/sys/getsockopt.2
@@ -311,6 +311,9 @@
The default value for
.Dv SO_SNDLOWAT
is set to a convenient size for network efficiency, often 1024.
+This socket option is applicable only to
+.Dv SOCK_STREAM
+type sockets.
.Pp
.Dv SO_RCVLOWAT
is an option to set the minimum count for input operations.
@@ -328,6 +331,9 @@
Receive calls may still return less than the low water mark if an error
occurs, a signal is caught, or the type of data next in the receive queue
is different from that which was returned.
+This socket option is applicable only to
+.Dv SOCK_STREAM
+type sockets.
.Pp
.Dv SO_SNDTIMEO
is an option to set a timeout value for output operations.
@@ -583,9 +589,10 @@
.Fa optlen
is not in a valid part of the process address space.
.It Bq Er EINVAL
-Installing an
+Use of a socket option not applicable to this kind of socket was attempted.
+This includes, but is not limited to: attempt to install an
.Xr accept_filter 9
-on a non-listening socket was attempted.
+on a non-listening socket and attempt to set watermarks on non-stream sockets.
.It Bq Er ENOMEM
A memory allocation failed that was required to service the request.
.El
Index: sys/kern/uipc_socket.c
===================================================================
--- sys/kern/uipc_socket.c
+++ sys/kern/uipc_socket.c
@@ -3137,10 +3137,15 @@
so->so_user_cookie = val32;
break;
- case SO_SNDBUF:
- case SO_RCVBUF:
case SO_SNDLOWAT:
case SO_RCVLOWAT:
+ if (so->so_type != SOCK_STREAM) {
+ error = EINVAL;
+ goto bad;
+ }
+ /* FALLTHROUGH */
+ case SO_SNDBUF:
+ case SO_RCVBUF:
error = sooptcopyin(sopt, &optval, sizeof optval,
sizeof optval);
if (error)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Jan 21, 10:21 AM (21 h, 5 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16007793
Default Alt Text
D35389.diff (1 KB)
Attached To
Mode
D35389: sockets: limit use of watermarks to SOCK_STREAM sockets
Attached
Detach File
Event Timeline
Log In to Comment