Skip to content

Commit

Permalink
No per-socket TCP keepidle on OpenBSD
Browse files Browse the repository at this point in the history
A system-wide sysctl(2) net.inet.tcp.keepidle exists, but there is no
setsockopt(2) equivalent.
  • Loading branch information
klemensn committed Jan 27, 2024
1 parent e36ec5c commit dc23527
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions definitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
#define COMPILE_FOR_FREEBSD 1
#endif

#if defined(__OpenBSD__)
#define COMPILE_FOR_OPENBSD 1
#endif

// struct sockaddr_in6 is bigger than struct sockaddr. derp
#ifdef AF_INET6
#define SOCKADDR struct sockaddr_storage
Expand Down
2 changes: 2 additions & 0 deletions rtsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -5623,6 +5623,7 @@ void *rtsp_listen_loop(__attribute((unused)) void *arg) {
#define KEEP_ALIVE_OR_IDLE_OPTION TCP_KEEPIDLE
#endif

#ifndef COMPILE_FOR_OPENBSD
if (setsockopt(conn->fd, SOL_OPTION, KEEP_ALIVE_OR_IDLE_OPTION,
(void *)&keepAliveIdleTime, sizeof(keepAliveIdleTime))) {
debug(1, "can't set the keepidle wait time");
Expand All @@ -5636,6 +5637,7 @@ void *rtsp_listen_loop(__attribute((unused)) void *arg) {
sizeof(keepAliveInterval))) {
debug(1, "can't set the keepidle missing count interval");
};
#endif

// initialise the connection info
void *client_addr = NULL, *self_addr = NULL;
Expand Down

0 comments on commit dc23527

Please sign in to comment.