diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2022-11-30 15:13:08 +1100 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2022-12-06 07:41:40 +0100 |
commit | 27bfebb0619d0b9c706bf235d4de935f9833110c (patch) | |
tree | b18cfcacba13c404d8b3e2e72010338f54d3e0b4 /test/distro/debian | |
parent | c277c6dd7d90e6f83284ecf60b94c4693dd89322 (diff) | |
download | passt-27bfebb0619d0b9c706bf235d4de935f9833110c.tar passt-27bfebb0619d0b9c706bf235d4de935f9833110c.tar.gz passt-27bfebb0619d0b9c706bf235d4de935f9833110c.tar.bz2 passt-27bfebb0619d0b9c706bf235d4de935f9833110c.tar.lz passt-27bfebb0619d0b9c706bf235d4de935f9833110c.tar.xz passt-27bfebb0619d0b9c706bf235d4de935f9833110c.tar.zst passt-27bfebb0619d0b9c706bf235d4de935f9833110c.zip |
udp: Re-use fixed bound sockets for packet forwarding when possible
When we look up udp_splice_to_ns[v6][src].target_sock in
udp_sock_handler_splice, all we really require of the socket is that it
be bound to port src in the pasta guest namespace. Similarly for
udp_splice_to_init but bound in the init namespace.
Usually these sockets are created temporarily by udp_splice_connect() and
cleaned up by udp_timer(). However, depending on the -u and -U options its
possible we have a permanent socket bound to the relevant port created by
udp_sock_init(). If such a socket exists, we could use it instead of
creating a temporary one. In fact we *must* use it, because we'll fail
trying to bind() a temporary one to the same port.
So allow this, store permanently bound sockets into udp_splice_to_{ns,init}
in udp_sock_init(). These won't get incorrectly removed by the timer
because we don't put a corresponding entry in the udp_act[] structure
which directs the timer what to clean up.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'test/distro/debian')
0 files changed, 0 insertions, 0 deletions