aboutgitcodebugslistschat
path: root/test
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2024-04-24 11:05:34 +1000
committerStefano Brivio <sbrivio@redhat.com>2024-04-25 00:00:34 +0200
commit0804fdbc28418883f479fde1beb24c620087fe17 (patch)
tree9bbe0c64c5ab59fb66958fff7175ea54afcb169b /test
parent95601237ef82c28413d686ea20b68edd43c5fe1b (diff)
downloadpasst-0804fdbc28418883f479fde1beb24c620087fe17.tar
passt-0804fdbc28418883f479fde1beb24c620087fe17.tar.gz
passt-0804fdbc28418883f479fde1beb24c620087fe17.tar.bz2
passt-0804fdbc28418883f479fde1beb24c620087fe17.tar.lz
passt-0804fdbc28418883f479fde1beb24c620087fe17.tar.xz
passt-0804fdbc28418883f479fde1beb24c620087fe17.tar.zst
passt-0804fdbc28418883f479fde1beb24c620087fe17.zip
udp: Correctly look up outbound socket with port remappings
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. Reported-by: Laurent Jacquot <jk@lutty.net> Link: https://bugs.passt.top/show_bug.cgi?id=87 Fixes: bb9bf0bb8f57 ("tcp, udp: Don't precompute port remappings in epoll references") Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'test')
0 files changed, 0 insertions, 0 deletions