8000 Handle hex-encoded IPv4-Mapped-in-IPv6 addresses by iam-TJ · Pull Request #561 · iputils/iputils · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Handle hex-encoded IPv4-Mapped-in-IPv6 addresses #561

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

iam-TJ
Copy link
@iam-TJ iam-TJ commented Oct 19, 2024

Hexadecimal encoding such as ::ffff:7f:1 would break IPv4 handling; the hex value needs converting to dotted decimal.

I've also added tests (I think correctly!) for both.

@pevik pevik added this to the Next release (bug fixes) milestone Oct 19, 2024
@pevik pevik self-assigned this Oct 19, 2024
@aral-matrix
Copy link

stop racing me to fixes :p

There are several possible 'non-standard' forms of IPv4-mapped
addresses. Identify them by the first 'f' in the 'ffff' so multiple
leading zeros or 'f' in the hex-encoded address do not confuse.

Signed-off-by: Tj <linux@iam.tj>
@iam-TJ iam-TJ force-pushed the feature_ipv4-mapped-in-ipv6_hex-encoded branch from 0a016cd to 44d337d Compare October 22, 2024 09:19
Signed-off-by: Tj <linux@iam.tj>
@iam-TJ iam-TJ force-pushed the feature_ipv4-mapped-in-ipv6_hex-encoded branch from 44d337d to 2ee0350 Compare October 22, 2024 09:27
pevik added a commit to pevik/iputils that referenced this pull request Nov 15, 2024
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 <pvorel@suse.cz>
pevik added a commit to pevik/iputils that referenced this pull request Nov 17, 2024
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

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] 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 <pvorel@suse.cz>
pevik added a commit to pevik/iputils that referenced this pull request Nov 26, 2024
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

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] 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

Closes: iputils#567
Signed-off-by: Petr Vorel <pvorel@suse.cz>
pevik added a commit to pevik/iputils that referenced this pull request Nov 27, 2024
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

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] 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

Closes: iputils#567
Reviewed-by: Ronan Pigott <ronan@rjp.ie>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
@pevik
Copy link
Contributor
pevik commented Dec 3, 2024

Closing due reverting the original feature, see #567.

@pevik pevik closed this Dec 3, 2024
@aral-matrix
Copy link

Pity - despite not understanding many of the technical details, what I have seen in the discussion was a lot of flailing about and mostly personal reluctance to have this feature - there's not really been a conclusive argument(*) how IPv4 mapped in IPv6 (or hostnames that resolve to such an address form) should be interpreted other than as IPv4.

  • The one notable exception being network troubleshooting - and I proposed a solution how to leave existing behavior unchanged (by combining -4 and -6 options).

I still believe the feature is good and should eventually be reconsidered, possibly in a different form of implementation.

@pevik
Copy link
Contributor
pevik commented Dec 3, 2024

There was a conflict with another issue, which we agreed is more important: #252 which resulted into 8ed7ffc.

Once glibc is fixed (see https://public-inbox.org/libc-alpha/a26674d3f48af0f67b9abb3e54c1228854cc0bd5@rjp.ie/) 8ed7ffc can be reverted and that fix ping -c1 -4 ::ffff:127.0.0.1. Unfortunately -6 and default (without switch) will not work. But based on IN6_IS_ADDR_V4MAPPED() just setting hints.ai_family = AF_INET; could work. The problematic part was modifying the target, I would like to avoid it.

Anyway, feel free to create an issue so that we don't forget on it.

@aral-matrix
Copy link

Mhh - as you know, my proposed fix #562 works a bit different than this one here - I propose to do a proper interpretation of the result(s) returned by getaddrinfo - I think that does not introduce the same conflict with #252 ?

Anyway, feel free to create an issue so that we don't forget on it.

Since my according pull request is not yet closed, I would propose to keep #562 open instead of creating a new issue, if that's okay with you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0