aboutgitcodebugslistschat
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2025-12-10 18:02:57 +1100
committerStefano Brivio <sbrivio@redhat.com>2025-12-10 08:37:29 +0100
commitd04c48032bcf724550d0b8f652fd00efcd2dfad0 (patch)
treee44aafdfe3482b5084454b6217e820bbcd84dcf6
parent696709d74b240088ffeda7f2c72b16e75879c689 (diff)
downloadpasst-d04c48032bcf724550d0b8f652fd00efcd2dfad0.tar
passt-d04c48032bcf724550d0b8f652fd00efcd2dfad0.tar.gz
passt-d04c48032bcf724550d0b8f652fd00efcd2dfad0.tar.bz2
passt-d04c48032bcf724550d0b8f652fd00efcd2dfad0.tar.lz
passt-d04c48032bcf724550d0b8f652fd00efcd2dfad0.tar.xz
passt-d04c48032bcf724550d0b8f652fd00efcd2dfad0.tar.zst
passt-d04c48032bcf724550d0b8f652fd00efcd2dfad0.zip
pif: Correctly set scope_id for guest-side link local addressesHEAD2025_12_10.d04c480master
pif_sockaddr() is supposed to generate a suitable socket address, either for the host, or for the guest, depending on the 'pif' parameter. When given a link-local address, this means it needs to generate a suitable scope_id to specify which link. It does this for the host, but not for the guest. I think this was done on the assumption that we won't ever generate guest side link local addresses when forwarding connections. That, however, is not the case, at least with the recent extensions to "local mode". Fix the problem by properly populating the scope_id field for guest addresses. Link: https://bugs.passt.top/show_bug.cgi?id=181 Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
-rw-r--r--pif.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/pif.c b/pif.c
index 3d7a90e..6ae970a 100644
--- a/pif.c
+++ b/pif.c
@@ -50,10 +50,14 @@ void pif_sockaddr(const struct ctx *c, union sockaddr_inany *sa,
sa->sa_family = AF_INET6;
sa->sa6.sin6_addr = addr->a6;
sa->sa6.sin6_port = htons(port);
- if (pif == PIF_HOST && IN6_IS_ADDR_LINKLOCAL(&addr->a6))
- sa->sa6.sin6_scope_id = c->ifi6;
- else
+ if (IN6_IS_ADDR_LINKLOCAL(&addr->a6)) {
+ if (pif == PIF_HOST)
+ sa->sa6.sin6_scope_id = c->ifi6;
+ else if (pif == PIF_SPLICE)
+ sa->sa6.sin6_scope_id = c->pasta_ifi;
+ } else {
sa->sa6.sin6_scope_id = 0;
+ }
sa->sa6.sin6_flowinfo = 0;
}
}