Skip to content

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

@reyk

Description

@reyk

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions