public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: Stefano Brivio <sbrivio@redhat.com>
To: David Gibson <david@gibson.dropbear.id.au>
Cc: passt-dev@passt.top
Subject: Re: [PATCH] udp: Correctly look up outbound socket with port remappings
Date: Thu, 25 Apr 2024 00:01:39 +0200	[thread overview]
Message-ID: <20240425000139.62cbe490@elisabeth> (raw)
In-Reply-To: <20240424010534.496003-1-david@gibson.dropbear.id.au>

On Wed, 24 Apr 2024 11:05:34 +1000
David Gibson <david@gibson.dropbear.id.au> wrote:

> Commit bb9bf0bb ("tcp, udp: Don't precompute port remappings in epoll
> references") changed the epoll reference for UDP sockets to include the
> bound port as seen by the socket itself, rather than the bound port it
> would be translated to on the guest side.  As a side effect, it also means
> that udp_tap_map[] is indexed by the bound port on the host side, rather
> than on the guest side.  This is consistent and a good idea, however we
> forgot to account for it when finding the correct outgoing socket for
> packets originating in the guest.  This means that if forwarding UDP
> inbound with a port number change, reply packets would be misdirected.
> 
> Fix this by applying the reverse mapping before looking up the socket in
> udp_tap_handler().  While we're at it, use 'port' directly instead of
> 'uref.port' in udp_sock_init().  Those now always have the same value -
> failing to realise that is the same error as above.
> 
> Link: https://bugs.passt.top/show_bug.cgi?id=87
> Fixes: bb9bf0bb ("tcp, udp: Don't precompute port remappings in epoll
>                   references")
> 
> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>

Applied.

-- 
Stefano


      reply	other threads:[~2024-04-24 22:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-24  1:05 [PATCH] udp: Correctly look up outbound socket with port remappings David Gibson
2024-04-24 22:01 ` Stefano Brivio [this message]

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=20240425000139.62cbe490@elisabeth \
    --to=sbrivio@redhat.com \
    --cc=david@gibson.dropbear.id.au \
    --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).