Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
From: jeremie.galarneau@efficios.com (Jérémie Galarneau)
Subject: [lttng-dev] [PATCH lttng-tools v2] Fix: Use SOL_SOCKET level for SO_KEEPALIVE on all platform
Date: Tue, 27 Feb 2018 11:14:42 -0500	[thread overview]
Message-ID: <20180227161440.GB1647@gmail.com> (raw)
In-Reply-To: <1519250394-7100-1-git-send-email-jonathan.rajotte-julien@efficios.com>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1979 bytes --]

Merged in master, stable-2.10, and stable-2.9.

Thanks!
Jérémie

On Wed, Feb 21, 2018 at 04:59:54PM -0500, Jonathan Rajotte wrote:
> On Linux, COMPAT_SOCKET_LEVEL was set to SOL_TCP instead
> of SOL_SOCKET, this resulted in execution of:
>     setsockopt(..., SOL_TCP, TCP_DEFER_ACCEPT, ...)
> 
> Instead of:
>     setsockopt(..., SOL_SOCKET, SO_KEEPALIVE, ...)
> 
> Hence, TCP keep alive was not enabled.
> 
> COMPAT_SOCKET_LEVEL is not needed. All platforms supported use the
> SOL_SOCKET level for SO_KEEPALIVE.
> 
> Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien at efficios.com>
> ---
>  src/bin/lttng-relayd/tcp_keep_alive.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/src/bin/lttng-relayd/tcp_keep_alive.c b/src/bin/lttng-relayd/tcp_keep_alive.c
> index 4a2cd9f..469bec3 100644
> --- a/src/bin/lttng-relayd/tcp_keep_alive.c
> +++ b/src/bin/lttng-relayd/tcp_keep_alive.c
> @@ -36,7 +36,6 @@
>  /* Per-platform definitions of TCP socket options. */
>  #if defined (__linux__)
>  
> -#define COMPAT_SOCKET_LEVEL SOL_TCP
>  #define COMPAT_TCP_LEVEL SOL_TCP
>  #define COMPAT_TCP_ABORT_THRESHOLD 0 /* Does not exist on linux. */
>  #define COMPAT_TCP_KEEPIDLE TCP_KEEPIDLE
> @@ -45,7 +44,6 @@
>  
>  #elif defined (__sun__) /* ! defined (__linux__) */
>  
> -#define COMPAT_SOCKET_LEVEL SOL_SOCKET
>  #define COMPAT_TCP_LEVEL IPPROTO_TCP
>  
>  #ifdef TCP_KEEPALIVE_THRESHOLD
> @@ -65,7 +63,6 @@
>  
>  #else /* ! defined (__linux__) && ! defined (__sun__) */
>  
> -#define COMPAT_SOCKET_LEVEL 0
>  #define COMPAT_TCP_LEVEL 0
>  #define COMPAT_TCP_ABORT_THRESHOLD 0
>  #define COMPAT_TCP_KEEPIDLE 0
> @@ -547,7 +544,7 @@ int socket_apply_keep_alive_config(int socket_fd)
>  		goto end;
>  	}
>  
> -	ret = setsockopt(socket_fd, COMPAT_SOCKET_LEVEL, SO_KEEPALIVE, &val,
> +	ret = setsockopt(socket_fd, SOL_SOCKET, SO_KEEPALIVE, &val,
>  			sizeof(val));
>  	if (ret < 0) {
>  		PERROR("setsockopt so_keepalive");
> -- 
> 2.7.4
> 


           reply	other threads:[~2018-02-27 16:14 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <1519250394-7100-1-git-send-email-jonathan.rajotte-julien@efficios.com>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180227161440.GB1647@gmail.com \
    --to=jeremie.galarneau@efficios.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox