* [ruby-core:68331] [Ruby trunk - Bug #10911] [Open] IPAddr.new should ignore zone identifiers
[not found] <redmine.issue-10911.20150226233624@ruby-lang.org>
@ 2015-02-26 23:36 ` postmodern.mod3
2019-03-20 12:40 ` [ruby-core:91899] [Ruby trunk Bug#10911] " hsbt
` (3 subsequent siblings)
4 siblings, 0 replies; 5+ messages in thread
From: postmodern.mod3 @ 2015-02-26 23:36 UTC (permalink / raw)
To: ruby-core
Issue #10911 has been reported by Hal Brodigan.
----------------------------------------
Bug #10911: IPAddr.new should ignore zone identifiers
https://bugs.ruby-lang.org/issues/10911
* Author: Hal Brodigan
* Status: Open
* Priority: Normal
* Assignee:
* ruby -v: ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-linux]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
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.
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 5+ messages in thread
* [ruby-core:91899] [Ruby trunk Bug#10911] IPAddr.new should ignore zone identifiers
[not found] <redmine.issue-10911.20150226233624@ruby-lang.org>
2015-02-26 23:36 ` [ruby-core:68331] [Ruby trunk - Bug #10911] [Open] IPAddr.new should ignore zone identifiers postmodern.mod3
@ 2019-03-20 12:40 ` hsbt
2019-10-31 16:23 ` [ruby-core:95610] [Ruby master Feature#10911] " merch-redmine
` (2 subsequent siblings)
4 siblings, 0 replies; 5+ messages in thread
From: hsbt @ 2019-03-20 12:40 UTC (permalink / raw)
To: ruby-core
Issue #10911 has been updated by hsbt (Hiroshi SHIBATA).
Assignee set to knu (Akinori MUSHA)
Status changed from Open to Assigned
----------------------------------------
Bug #10911: IPAddr.new should ignore zone identifiers
https://bugs.ruby-lang.org/issues/10911#change-77225
* Author: postmodern (Hal Brodigan)
* Status: Assigned
* Priority: Normal
* Assignee: knu (Akinori MUSHA)
* Target version:
* ruby -v: ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-linux]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
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.
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 5+ messages in thread
* [ruby-core:95610] [Ruby master Feature#10911] IPAddr.new should ignore zone identifiers
[not found] <redmine.issue-10911.20150226233624@ruby-lang.org>
2015-02-26 23:36 ` [ruby-core:68331] [Ruby trunk - Bug #10911] [Open] IPAddr.new should ignore zone identifiers postmodern.mod3
2019-03-20 12:40 ` [ruby-core:91899] [Ruby trunk Bug#10911] " hsbt
@ 2019-10-31 16:23 ` merch-redmine
2019-10-31 18:37 ` [ruby-core:95614] " daniel
2019-10-31 19:02 ` [ruby-core:95615] " merch-redmine
4 siblings, 0 replies; 5+ messages in thread
From: merch-redmine @ 2019-10-31 16:23 UTC (permalink / raw)
To: ruby-core
Issue #10911 has been updated by jeremyevans0 (Jeremy Evans).
Backport deleted (2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN)
ruby -v deleted (ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-linux])
Tracker changed from Bug to Feature
File ipaddr-ipv6-zone-id-10911.patch added
I don't think this is a bug. The decision to not support zone identifiers seems deliberate as there are tests that using a zone identifier raises an exception:
```ruby
assert_raise(IPAddr::InvalidAddressError) { IPAddr.new("fe80::1%fxp0") }
```
Still, I think this would be a useful feature to add. We should not ignore the zone identifier, as it a property of the address. Attached is a patch that implements support for it, so that `to_s` and `inspect` will show the zone identifier. It doesn't consider the zone identifier when determining equality, just as the mask_addr is not currently considered for that. That may be a bug (#11531), but at least it is consistent.
----------------------------------------
Feature #10911: IPAddr.new should ignore zone identifiers
https://bugs.ruby-lang.org/issues/10911#change-82399
* 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/
^ permalink raw reply [flat|nested] 5+ messages in thread
* [ruby-core:95614] [Ruby master Feature#10911] IPAddr.new should ignore zone identifiers
[not found] <redmine.issue-10911.20150226233624@ruby-lang.org>
` (2 preceding siblings ...)
2019-10-31 16:23 ` [ruby-core:95610] [Ruby master Feature#10911] " merch-redmine
@ 2019-10-31 18:37 ` daniel
2019-10-31 19:02 ` [ruby-core:95615] " merch-redmine
4 siblings, 0 replies; 5+ messages in thread
From: daniel @ 2019-10-31 18:37 UTC (permalink / raw)
To: ruby-core
Issue #10911 has been updated by Dan0042 (Daniel DeLorme).
Looks like this testcase was in the original IPAddr commit from 2002:
```
commit 9ec0a96ad4235f2054976eab6c04efbe62b3c703
Author: knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>
Date: Mon Dec 23 17:07:49 2002 +0000
* MANIFEST, lib/README, lib/ipaddr.rb: Add ipaddr.rb from rough.
```
Maybe @knu remembers why?
But I think this could break the contract in other places that accept a IPv6 address but not a zone identifier. ex:
```ruby
Socket.getaddrinfo("fe80::1%fxp0", nil) #=> SocketError (getaddrinfo: Name or service not known)
Socket.getaddrinfo("fe80::1", nil) #=> [["AF_INET6", 0, "fe80::1", "fe80::1", 10, 1, 6], ["AF_INET6", 0, "fe80::1", "fe80::1", 10, 2, 17], ["AF_INET6", 0, "fe80::1", "fe80::1", 10, 3, 0]]
TCPSocket.new("fe80::1%fxp0", 42) #=> SocketError (getaddrinfo: Name or service not known)
TCPSocket.new("fe80::1", 42) #=> Errno::EINVAL (Invalid argument - connect(2) for "fe80::1" port 42)
```
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
```
----------------------------------------
Feature #10911: IPAddr.new should ignore zone identifiers
https://bugs.ruby-lang.org/issues/10911#change-82405
* 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/
^ permalink raw reply [flat|nested] 5+ messages in thread
* [ruby-core:95615] [Ruby master Feature#10911] IPAddr.new should ignore zone identifiers
[not found] <redmine.issue-10911.20150226233624@ruby-lang.org>
` (3 preceding siblings ...)
2019-10-31 18:37 ` [ruby-core:95614] " daniel
@ 2019-10-31 19:02 ` merch-redmine
4 siblings, 0 replies; 5+ messages in thread
From: merch-redmine @ 2019-10-31 19:02 UTC (permalink / raw)
To: ruby-core
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/
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-10-31 19:02 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <redmine.issue-10911.20150226233624@ruby-lang.org>
2015-02-26 23:36 ` [ruby-core:68331] [Ruby trunk - Bug #10911] [Open] IPAddr.new should ignore zone identifiers postmodern.mod3
2019-03-20 12:40 ` [ruby-core:91899] [Ruby trunk Bug#10911] " hsbt
2019-10-31 16:23 ` [ruby-core:95610] [Ruby master Feature#10911] " merch-redmine
2019-10-31 18:37 ` [ruby-core:95614] " daniel
2019-10-31 19:02 ` [ruby-core:95615] " merch-redmine
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).