Skip to content

Commit

Permalink
Revert "ping: support IPv4-Mapped-in-IPv6 target addresses"
Browse files Browse the repository at this point in the history
This reverts commit 8ed7ffc.

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

Although inetutils ping at least partly supports the feature [5]:

- explicit ipv4 ping:
% ping -c1 ::ffff:127.0.0.1
PING ::ffff:127.0.0.1 (127.0.0.1): 56 data bytes
64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0,100 ms

- explicit ipv6 ping:
% ping6 -c1 ::ffff:127.0.0.1
PING ::ffff:127.0.0.1 (::ffff:127.0.0.1): 56 data bytes
./ping/ping6: sending packet: Network is unreachable

Because also fping did not want to support it [6], let's revert the
feature.

[1] iputils#561
[2] iputils#563
[3] iputils#562
[4] https://lists.busybox.net/pipermail/busybox/2024-October/090975.html
[5] https://lists.busybox.net/pipermail/busybox/2024-October/090985.html
[6] schweikert/fping#356
Signed-off-by: Petr Vorel <[email protected]>
  • Loading branch information
pevik committed Nov 15, 2024
1 parent 314b743 commit c995d64
Showing 1 changed file with 0 additions and 9 deletions.
9 changes: 0 additions & 9 deletions ping/ping.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit c995d64

Please sign in to comment.