Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

very minor bug with "warning: OS rejected socket bufsize" #287

Closed
mwtzzz-zz opened this issue Jun 27, 2017 · 4 comments
Closed

very minor bug with "warning: OS rejected socket bufsize" #287

mwtzzz-zz opened this issue Jun 27, 2017 · 4 comments

Comments

@mwtzzz-zz
Copy link

mwtzzz-zz commented Jun 27, 2017

This bug is so minor, I really don't want to waste your time, but I figure I should mention it.
It does not affect performance or functionality in any way.

This line in relay.c:
if (sockbufsize != (unsigned int)val)
should be changed to:
if (sockbufsize != 2 * (unsigned int)val)
as per socket(7):

              kernel doubles this value (to allow space for bookkeeping
              overhead) when it is set using setsockopt(2), and this doubled
              value is returned by getsockopt(2). 

and you might want to include the sockbufsize number in the warning message so that the user will be aware of which value was assigned.

@grobian
Copy link
Owner

grobian commented Jun 28, 2017

I think I should change it to sockbufsize > (unsigned int)val, because the OS might align values or anything, the doubling may be Linux (kernel) specific

@grobian
Copy link
Owner

grobian commented Jun 28, 2017

actually < to trigger an warning only when the set size is smaller than what was requested

grobian added a commit that referenced this issue Jun 28, 2017
For issue #287, only emit warning about OS rejecting socket bufsize when
the value is actually lower than requested.  On Linux it seems the
kernel doubles the value (so it will never match), on other kernels it
seems not to, but might align or something.  So with this in place on
Linux the kernel might still set it to a lower value (because it
doubles), but solving that needs kernel-specific checks which I want to
defer for now.
@grobian
Copy link
Owner

grobian commented Jun 28, 2017

I pushed a fix, thanks.

@grobian grobian closed this as completed Jun 28, 2017
@mwtzzz-zz
Copy link
Author

Awesome, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants