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

OpenBSD does not support TCP_KEEPALIVE or a timeout with SO_KEEPALIVE #82

Open
reyk opened this issue Mar 27, 2019 · 3 comments
Open

OpenBSD does not support TCP_KEEPALIVE or a timeout with SO_KEEPALIVE #82

reyk opened this issue Mar 27, 2019 · 3 comments

Comments

@reyk
Copy link

reyk commented Mar 27, 2019

Hi,

using net2 on OpenBSD, I've stumbled over this:

 24878 arca-broker CALL  setsockopt(23,SOL_SOCKET,SO_KEEPALIVE,0x1f005a366034,4)
 24878 arca-broker RET   setsockopt 0
 24878 arca-broker CALL  setsockopt(23,6<unknown>,8,0x1f005a366034,4)
 24878 arca-broker RET   setsockopt -1 errno 1 Operation not permitted
 24878 arca-broker CALL  close(23)

The first setsockopt() call is enabling SO_KEEPALIVE, which is OK and supported, the second setsockopt() call is trying to set the timeout with IPPROTO_TCP (6) and TCP_KEEPALIVE (mapped to SO_KEEPALIVE == 8).

Using SO_KEEPALIVE/TCP_KEEPALIVE on a IPPROTO_TCP level is not supported on OpenBSD. OpenBSD only supports global sysctl settings for setting the keepalive intervals:

net.inet.tcp.keepinittime=150
net.inet.tcp.keepidle=14400
net.inet.tcp.keepintvl=150
net.inet.tcp.always_keepalive=0

This mapping is invalid on OpenBSD...:
https://github.com/rust-lang-nursery/net2-rs/blob/a3d51b36da8dfbc62e0df2219662537e110aeb59/src/ext.rs#L661

...as it is used here:
https://github.com/rust-lang-nursery/net2-rs/blob/master/src/ext.rs#L735-L736

...and here:
https://github.com/rust-lang-nursery/net2-rs/blob/master/src/ext.rs#L748-L749

@matm
Copy link

matm commented Dec 1, 2019

Thanks @reyk for this explanation.

On another topic, the echo web framework I try to use on my OpenBSD box is also concerned, I now understand why.

Looks like this is a recurring issue that can be found here and there on the web, like in aerogo/aero#10.

@reyk
Copy link
Author

reyk commented Dec 3, 2019

I think I've sent a proper bug report but never got any response 😿

I guess we have to come up with a pull request instead.

@jhatala
Copy link

jhatala commented Mar 9, 2020

@reyk, I stumbled upon the same problem as you had, and I was delighted to find that you had documented it in this ticket. According to my testing the patch in #99 fixes the problem.

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

Successfully merging a pull request may close this issue.

3 participants