public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: Stefano Brivio <sbrivio@redhat.com>
To: Jon Maloy <jmaloy@redhat.com>
Cc: passt-dev@passt.top, lvivier@redhat.com, dgibson@redhat.com
Subject: Re: [PATCH] tcp: probe for SO_PEEK_OFF both in tcpv4 and tcp6
Date: Sun, 21 Jul 2024 11:21:18 +0200	[thread overview]
Message-ID: <20240721112118.2adcc6cf@elisabeth> (raw)
In-Reply-To: <a2d633f4-3be6-451b-a3c5-1b6cc0e6032a@redhat.com>

On Sat, 20 Jul 2024 10:46:07 -0400
Jon Maloy <jmaloy@redhat.com> wrote:

> My first approach to this was to condition the use of SO_PEEK_OFF with 
> tcpv4, e.g., basically
> a test like if (v4 && peek_offset_cap) {...} everywhere, but then I made 
> an interesting discovery.
> 
> It turns out that, unless the ´-4' option is explicitly given on the 
> command line, all sockets are
> v6, even those that are later used as v4 sockets.

Not necessarily: if IPv6 support is disabled for other reasons, such as
the fact that we didn't find any routable IPv6 address, sockets will
also be IPv4-only. See tcp_sock_init().

> So, the set_peek_off() 
> call failed even
> for supposedly v4 sockets.
> 
> I checked this by adding a printout to the tcp_listen_handler(), and 
> noticed that all returns from
> the accept4() call goes into the AF_INET6 branch, even when the client 
> (iperf3) call is using an IPv4 address.
> During traffic, the very same socket is marked as v4 in the tcp_tap_conn 
> structure, and this seems to
> have worked just fine until I added the set_peek_offset call().
> 
> I believe this is an issue that has been introduced during the last 
> months, since I didn't start
> using the ´-4' option consistently until some months ago, and then it 
> worked.

That's not actually an issue, it's intended, see commit 8e914238b6de
("tcp: Use dual stack sockets for port forwarding when possible").

Could it be that you enabled IPv6 on your setup meanwhile, and that's
why you see this now? I think I tested your changes on an isolated
IPv4-only setup, as I didn't run a kernel version with SO_PEEK_OFF
support at the time.

-- 
Stefano


  reply	other threads:[~2024-07-21  9:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-20 13:54 [PATCH] tcp: probe for SO_PEEK_OFF both in tcpv4 and tcp6 Jon Maloy
2024-07-20 14:46 ` Jon Maloy
2024-07-21  9:21   ` Stefano Brivio [this message]
2024-07-22  0:55     ` David Gibson
2024-07-21  9:20 ` Stefano Brivio

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=20240721112118.2adcc6cf@elisabeth \
    --to=sbrivio@redhat.com \
    --cc=dgibson@redhat.com \
    --cc=jmaloy@redhat.com \
    --cc=lvivier@redhat.com \
    --cc=passt-dev@passt.top \
    /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.
Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).