aboutgitcodebugslistschat
path: root/udp.h
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2024-01-16 16:16:11 +1100
committerStefano Brivio <sbrivio@redhat.com>2024-01-22 23:36:41 +0100
commit43713af50e8a343e0df1f219a29e3d2891a094d6 (patch)
tree24c9cf98ced1c56a7512c3298a1bc5f0f304d4ac /udp.h
parent8534cdbfd1ba716a70b4b1cac15824ba0a171c94 (diff)
downloadpasst-43713af50e8a343e0df1f219a29e3d2891a094d6.tar
passt-43713af50e8a343e0df1f219a29e3d2891a094d6.tar.gz
passt-43713af50e8a343e0df1f219a29e3d2891a094d6.tar.bz2
passt-43713af50e8a343e0df1f219a29e3d2891a094d6.tar.lz
passt-43713af50e8a343e0df1f219a29e3d2891a094d6.tar.xz
passt-43713af50e8a343e0df1f219a29e3d2891a094d6.tar.zst
passt-43713af50e8a343e0df1f219a29e3d2891a094d6.zip
icmp: Don't attempt to match host IDs to guest IDs
When forwarding pings from tap, currently we create a ping socket with a socket address whose port is set to the ID of the ping received from the guest. This causes the socket to send pings with the same ID on the host. Although this seems look a good idea for maximum transparency, it's probably unwise. First, it's fallible - the bind() could fail, and we already have fallback logic which will overwrite the packets with the expected guest id if the id we get on replies doesn't already match. We might as well do that unconditionally. But more importantly, we don't know what else on the host might be using ping sockets, so we could end up with an ID that's the same as an existing socket. You'd expect that to fail the bind() with EADDRINUSE, which would be fine: we'd fall back to rewriting the reply ids. However it appears the kernel (v6.6.3 at least), does *not* fail the bind() and instead it's "last socket wins" in terms of who gets the replies. So we could accidentally intercept ping replies for something else on the host. So, instead of using bind() to set the id, just let the kernel pick one and expect to translate the replies back. Although theoretically this makes the passt/pasta link a bit less "transparent", essentially nothing cares about specific ping IDs, much like TCP source ports, which we also don't preserve. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'udp.h')
0 files changed, 0 insertions, 0 deletions