PowerToys icon indicating copy to clipboard operation
PowerToys copied to clipboard

[Host File Editor] Marking IPv4 and IPv6 entry as duplicate

Open KalleDK opened this issue 2 years ago • 6 comments

Microsoft PowerToys version

0.67.0

Installation method

PowerToys auto-update

Running as admin

None

Area(s) with issue?

Hosts File Editor

Steps to reproduce

Have any entries twice due to one is IPv4 and the other is IPv6

::1 localhost 127.0.0.1 localhost

✔️ Expected Behavior

That they are not marked as duplicate, because one is IPv4 and the other is IPv6

❌ Actual Behavior

They are marked as duplicate entry

Other Software

No response

KalleDK avatar Feb 02 '23 09:02 KalleDK

ping @davidegiacometti

htcfreek avatar Feb 02 '23 17:02 htcfreek

Hi @KalleDK Good catch! I am not really sure how these entries should be treated. Maybe we should just add an exception for localhost.

In my machine localhost is always resolved as ::1 even if I enable only the IPv4 entry. Still resolving ::1 if I create an entry 8.8.8.8 localhost. 🤔

Any thoughts @htcfreek ?

davidegiacometti avatar Feb 02 '23 19:02 davidegiacometti

i think a host can have an ipv4 and an ipv6 ip. so it's valid to have both for the same host.

  • Same host and same IP: Wrong.
  • Same host but IPv4 and IPv6: Valid.
  • Different Hosts and same IP: Wrong.

htcfreek avatar Feb 02 '23 20:02 htcfreek

You can force 4 and 6 resolution with ping :)

I agree with @htcfreek though I would make an exception for 127.0.0.1 and ::1 some programs adds entries for loopback, also developers use that some times to redirect to yourself.

C:\Users\km>ping -4 localhost

Pinging [127.0.0.1] with 32 bytes of data:
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128

Ping statistics for 127.0.0.1:
    Packets: Sent = 1, Received = 1, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 0ms, Average = 0ms
Control-C
^C
C:\Users\km>ping -6 localhost

Pinging  [::1] with 32 bytes of data:
Reply from ::1: time<1ms

Ping statistics for ::1:
    Packets: Sent = 1, Received = 1, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 0ms, Average = 0ms
Control-C
^C

KalleDK avatar Feb 02 '23 20:02 KalleDK

How did i miss these flags? 😱

Thank you for the feedback! So the work here is:

  • Exception for loopback 127.0.0.1 and ::1
  • Entry with same host but IPv4 and IPv6 is valid

davidegiacometti avatar Feb 02 '23 20:02 davidegiacometti

How did i miss these flags? 😱

Thank you for the feedback! So the work here is:

  • Exception for loopback 127.0.0.1 and ::1
  • Entry with same host but IPv4 and IPv6 is valid

That is what I would suggest :)

KalleDK avatar Feb 02 '23 20:02 KalleDK

This was implemented in release 0.68. Thank you for the bug report!

Aaron-Junker avatar Mar 19 '23 13:03 Aaron-Junker