...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.
+
+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