aboutgitcodebugslistschat
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2025-03-28 14:34:14 +1100
committerStefano Brivio <sbrivio@redhat.com>2025-03-28 13:25:51 +0100
commit025a3c2686b06be3fd09e29b2e3408d2c4ad6239 (patch)
tree4fb5ab957cb610ec7c1b662d960ae8b87815a8cd
parent42a854a52b6fa2bbd70cbc0c7657c8a49a9c3d2d (diff)
downloadpasst-025a3c2686b06be3fd09e29b2e3408d2c4ad6239.tar
passt-025a3c2686b06be3fd09e29b2e3408d2c4ad6239.tar.gz
passt-025a3c2686b06be3fd09e29b2e3408d2c4ad6239.tar.bz2
passt-025a3c2686b06be3fd09e29b2e3408d2c4ad6239.tar.lz
passt-025a3c2686b06be3fd09e29b2e3408d2c4ad6239.tar.xz
passt-025a3c2686b06be3fd09e29b2e3408d2c4ad6239.tar.zst
passt-025a3c2686b06be3fd09e29b2e3408d2c4ad6239.zip
udp: Don't attempt to forward ICMP socket errors to other sockets
Recently we added support for detecting ICMP triggered errors on UDP sockets and forwarding them to the tap interface. However, in udp_sock_recverr() where this is handled we don't know for certain that the tap interface is the other side of the UDP flow. It could be a spliced connection with another socket on the other side. To forward errors in that case, we'd need to force the other side's socket to trigger issue an ICMP error. I'm not sure if there's a way to do that; probably not for an arbitrary ICMP but it might be possible for certain error conditions. Nonetheless what we do now - synthesise an ICMP on the tap interface - is certainly wrong. It's probably harmless; for a spliced connection it will have loopback addresses meaning we can expect the guest to discard it. But, correct this for now, by not attempting to propagate errors when the other side of the flow is a socket. Fixes: 55431f0077b6 ("udp: create and send ICMPv4 to local peer when applicable") Fixes: 68b04182e07d ("udp: create and send ICMPv6 to local peer when applicable") Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Acked-by: Jon Maloy <jmaloy@redhat.com> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
-rw-r--r--udp.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/udp.c b/udp.c
index 0c223b4..e410f55 100644
--- a/udp.c
+++ b/udp.c
@@ -560,7 +560,10 @@ static int udp_sock_recverr(const struct ctx *c, union epoll_ref ref)
const struct flowside *toside = flowside_at_sidx(sidx);
size_t dlen = rc;
- if (hdr->cmsg_level == IPPROTO_IP) {
+ if (pif_is_socket(pif_at_sidx(sidx))) {
+ /* XXX Is there any way to propagate ICMPs from socket
+ * to socket? */
+ } else if (hdr->cmsg_level == IPPROTO_IP) {
dlen = MIN(dlen, ICMP4_MAX_DLEN);
udp_send_conn_fail_icmp4(c, &eh->ee, toside,
eh->saddr.sa4.sin_addr,