Date: Wed, 02 Mar 2016 18:43:09 +0000 From: bugzilla-noreply@freebsd.org To: freebsd-bugs@FreeBSD.org Subject: [Bug 206716] HPN-SSH: getsockopt(SO_SNDBUF) returns high watermark, not setsockopt(SO_SNDBUF) Message-ID: <bug-206716-8-5Xx6kuvUqH@https.bugs.freebsd.org/bugzilla/> In-Reply-To: <bug-206716-8@https.bugs.freebsd.org/bugzilla/> References: <bug-206716-8@https.bugs.freebsd.org/bugzilla/>
next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D206716 timon@timon.net.nz changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |timon@timon.net.nz --- Comment #4 from timon@timon.net.nz --- Maybe I miss something, but looks like there is no bug in FreeBSD. Yes, on FreeBSD getsockopt(..., SO_SNDBUF, ...) returns "high watermark", b= ut setsockopt(..., SO_SNDBUF, ...) attempts to resize the buffer and, on succe= ss, sets "high watermark" to the new buffer size. So getsockopt() returns the v= alue set by getsockopt(). I have written a simple test and run it on the 10.1-RELEASE and 10.2-RELEAS= E: -----8<----- #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <err.h> #include <stdio.h> int main () { int s, size; socklen_t sizelen; s =3D socket(AF_INET6, SOCK_RAW, IPPROTO_IP); sizelen =3D sizeof size; getsockopt(s, SOL_SOCKET, SO_SNDBUF, &size, &sizelen); printf("Current socket send buffer size: %i\n", size); size /=3D 2; setsockopt(s, SOL_SOCKET, SO_SNDBUF, &size, sizelen); getsockopt(s, SOL_SOCKET, SO_SNDBUF, &size, &sizelen); printf("New socket send buffer size: %i\n", size); } -----8<----- $ cc test.so_sndbuf.c $ sudo ./a.out=20 Current socket send buffer size: 9216 New socket send buffer size: 4608 --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-206716-8-5Xx6kuvUqH>