From a2fc2fa6114ee94dd1c71bb8b73f78ef42b5aa0e Mon Sep 17 00:00:00 2001 From: Petr Vorel Date: Fri, 15 Nov 2024 17:05:04 +0100 Subject: [PATCH] Revert "ping: support IPv4-Mapped-in-IPv6 target addresses" This reverts commit 8ed7ffc999e2a541e06ee48faf26a323dfe487c2. This is an incomplete implementation. While there are two attempts (PR#562 [1] PR#562 [2] and PR#563 [3]) to fix it, it's probably not a good idea to support IPv4-Mapped-in-IPv6 target addresses. There were concerns [4] about supporting this when discussion on BusyBox mailing list about patch bringing this functionality to BusyBox ping implementation: * ping is a low-level diagnostic tool, maybe it's not good to assume things like this, because IPv4-mapped IPv6 address format is not supported by raw sockets * it's not clear how -4 -6 switches should behave NOTE: next commit fixes IPv4-Mapped-in-IPv6 target addresses via -4 flag. Because also fping did not want to support it [6], let's revert the feature. [1] https://github.com/iputils/iputils/pull/561 [2] https://github.com/iputils/iputils/pull/563 [3] https://github.com/iputils/iputils/pull/562 [4] https://lists.busybox.net/pipermail/busybox/2024-October/090975.html [5] https://lists.busybox.net/pipermail/busybox/2024-October/090985.html [6] https://github.com/schweikert/fping/pull/356 Closes: https://github.com/iputils/iputils/pull/567 Signed-off-by: Petr Vorel --- ping/ping.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/ping/ping.c b/ping/ping.c index 15ca247f..22c0dba9 100644 --- a/ping/ping.c +++ b/ping/ping.c @@ -353,7 +353,6 @@ main(int argc, char **argv) .ni.subject_type = -1, }; unsigned char buf[sizeof(struct in6_addr)]; - struct in6_addr a6; /* FIXME: global_rts will be removed in future */ global_rts = &rts; @@ -621,14 +620,6 @@ main(int argc, char **argv) hints.ai_socktype = SOCK_RAW; } - if (inet_pton(AF_INET6, target, &a6) && IN6_IS_ADDR_V4MAPPED(&a6)) { - target = strrchr(target, ':') + 1; - hints.ai_family = AF_INET; - - if (rts.opt_verbose) - error(0, 0, _("IPv4-Mapped-in-IPv6 address, using IPv4 %s"), target); - } - if (hints.ai_family != AF_INET6) { create_socket(&rts, &sock4, AF_INET, hints.ai_socktype, IPPROTO_ICMP, hints.ai_family == AF_INET);