[PATCH 0/3] Throttle messages for invalid addresses, drop v4-mapped packets
The substantial change is in 3/3, while 1/3 is a minor refactor in preparation for the rest, and 2/3 introduces rate limiting of the existing prints. Stefano Brivio (3): tap: Move tap4_handler() / tap6_handler() adddress checks to own function tap: Rate limit messages about filtered guest-side addresses tap: Drop IPv6 packets with outbound v4-mapped addresses as well passt.1 | 16 +++++++++++++++ tap.c | 62 ++++++++++++++++++++++++++++++++++----------------------- 2 files changed, 53 insertions(+), 25 deletions(-) -- 2.43.0
This avoids some duplication and makes upcoming patches less ugly.
Signed-off-by: Stefano Brivio
Even though those are debug messages, very frequent messages would
make debugging harder.
Signed-off-by: Stefano Brivio
...not just ones with loopback addresses. It was a convenient way to
try out stuff, but I don't think anybody is using this (also judging
from the current KubeVirt integration), while Anders reported it as
unexpected, and David points out that even though this never became an
RFC:
https://datatracker.ietf.org/doc/html/draft-itojun-v6ops-v4mapped-harmful-02
it's actually mentioned by RFC 4038 as a draft presenting legitimate
concerns. In the context of this draft, it's not obvious whether we
are a router, or a node, but, arguably, we implement at least some
notion of "wire".
So, while we don't really have any formal requirement to drop those,
err on the side of caution and filter them out just like we do with
packets with loopback addresses. Document it as well, just in case
somebody else used that trick.
Reported-by: Anders Ingemann
On Tue, Nov 24, 2026 at 03:40:12AM +0100, Stefano Brivio wrote:
...not just ones with loopback addresses. It was a convenient way to try out stuff, but I don't think anybody is using this (also judging from the current KubeVirt integration), while Anders reported it as unexpected, and David points out that even though this never became an RFC:
https://datatracker.ietf.org/doc/html/draft-itojun-v6ops-v4mapped-harmful-02
it's actually mentioned by RFC 4038 as a draft presenting legitimate concerns. In the context of this draft, it's not obvious whether we are a router, or a node, but, arguably, we implement at least some notion of "wire".
So, while we don't really have any formal requirement to drop those, err on the side of caution and filter them out just like we do with packets with loopback addresses. Document it as well, just in case somebody else used that trick.
Reported-by: Anders Ingemann
Suggested-by: David Gibson Signed-off-by: Stefano Brivio --- passt.1 | 16 ++++++++++++++++ tap.c | 3 ++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/passt.1 b/passt.1 index 5d236bd..daceba1 100644 --- a/passt.1 +++ b/passt.1 @@ -1126,6 +1126,22 @@ appear to come from loopback in the namespace as well. The latter behaviour used to be the default, but is usually undesirable, since it can unintentionally expose namespace local services to the host.
+.SS Handling of IPv6 packets with IPv4-mapped addresses + +\fBpasst\fR and \fBpasta\fR implement some of the recommendations from the +expired draft-itojun-v6ops-v4mapped-harmful-02 Internet-Draft: + +.nf + https://datatracker.ietf.org/doc/draft-itojun-v6ops-v4mapped-harmful/02/ +.fi + +by silently discarding outbound IPv6 packets with IPv4-mapped addresses used as +source or destination. This means that IPv4 destinations can't be reached from +the guest or container via IPv6 using their IPv4-mapped representation.
Fwiw, I don't think that was _ever_ an intended use for IPv4-mapped addresses (:ffff::/96). Rather that was the purpose of (deprecated) IPv4-compatible IPv6 addresses (::/96).
+If you have any use for traffic forwarding using IPv4-mapped addresses, refer to +\fBREPORTING BUGS\fR below. + .SS Binding to low numbered ports (well-known or system ports, up to 1023)
If the port forwarding configuration requires binding to ports with numbers diff --git a/tap.c b/tap.c index eb2f147..13b31b1 100644 --- a/tap.c +++ b/tap.c @@ -684,7 +684,8 @@ static bool tap_filter_address(const struct timespec *now, sa_family_t af, return false;
if (af == AF_INET6 && - !IN6_IS_ADDR_LOOPBACK(saddr) && !IN6_IS_ADDR_LOOPBACK(daddr)) + !IN6_IS_ADDR_LOOPBACK(saddr) && !IN6_IS_ADDR_LOOPBACK(daddr) && + !IN6_IS_ADDR_V4MAPPED(saddr) && !IN6_IS_ADDR_V4MAPPED(daddr)) return false;
debug_ratelimit(now, "Invalid address on tap interface: %s -> %s", -- 2.43.0
-- David Gibson (he or they) | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you, not the other way | around. http://www.ozlabs.org/~dgibson
participants (2)
-
David Gibson
-
Stefano Brivio