From: merch-redmine@... Date: 2019-10-31T19:02:46+00:00 Subject: [ruby-core:95615] [Ruby master Feature#10911] IPAddr.new should ignore zone identifiers Issue #10911 has been updated by jeremyevans0 (Jeremy Evans). Dan0042 (Daniel DeLorme) wrote: > So "fe80::1%fxp0" is not even recognized as an IP address. This could result in unpleasantness in cases like this: > > ```ruby > str = "fe80::1%fxp0" > ip = IPAddr.new(str) rescue nil #validate IP address > TCPSocket.new(ip.to_s, 42) if ip #and connect > ``` Good point. We would probably want to fix socket to support this before adding support to ipaddr. I think it is reasonable for socket to support it, as tools dealing with IPv6 should handle zone identifiers. I tried ping6 and traceroute6: ``` $ ping6 fe80::1%lo0 PING fe80::1%lo0 (fe80::1%lo0): 56 data bytes 64 bytes from fe80::1%lo0: icmp_seq=0 hlim=64 time=0.630 ms $ traceroute6 fe80::1 traceroute6 to fe80::1%lo (fe80::1%lo0), 64 hops max, 60 byte packets 1 fe80::1%lo0 (fe80::1%lo0) 0.162 ms 0.098 ms 0.091 ms ``` Ignoring the zone identifier is not valid: ``` $ ping6 fe80::1 PING fe80::1 (fe80::1): 56 data bytes ping6: sendmsg: Network is unreachable $ traceroute6 fe80::1 traceroute6 to fe80::1 (fe80::1), 64 hops max, 60 byte packets traceroute6: sendto: Network is unreachable ``` ---------------------------------------- Feature #10911: IPAddr.new should ignore zone identifiers https://bugs.ruby-lang.org/issues/10911#change-82406 * Author: postmodern (Hal Brodigan) * Status: Assigned * Priority: Normal * Assignee: knu (Akinori MUSHA) * Target version: ---------------------------------------- Link local IPv6 addresses may have a zone identifier suffix: fe80::1%lo0 IPAddr.new currently does not ignore the zone identifier and raises IPAddr::InvalidAddressError. ---Files-------------------------------- ipaddr-ipv6-zone-id-10911.patch (5.17 KB) -- https://bugs.ruby-lang.org/ Unsubscribe: