ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:91641] [Ruby trunk Feature#15628] init_inetsock_internal should fallback to IPv4 if IPv6 is unreachable
       [not found] <redmine.issue-15628.20190228115117@ruby-lang.org>
@ 2019-02-28 11:51 ` aditya.prakash132
  2019-02-28 12:11 ` [ruby-core:91642] " aditya.prakash132
  2019-03-21 16:24 ` [ruby-core:91915] " aditya.prakash132
  2 siblings, 0 replies; 3+ messages in thread
From: aditya.prakash132 @ 2019-02-28 11:51 UTC (permalink / raw)
  To: ruby-core

Issue #15628 has been reported by sonalkr132 (Aditya Prakash).

----------------------------------------
Feature #15628: init_inetsock_internal should fallback to IPv4 if IPv6 is unreachable
https://bugs.ruby-lang.org/issues/15628

* Author: sonalkr132 (Aditya Prakash)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
Hi,

This is not really bug but more of a missing feature. Let me layout steps to reproduce what I am trying to achieve:
* Add local entries for `example.com` 

```
$ echo "::1     example.com www.example.com
127.0.0.1 example.com www.example.com" | sudo tee  --append /etc/hosts
```
* Add rule to `DROP` ipv6 packets: `sudo ip6tables -P INPUT DROP`
* Start a server: `ruby -rwebrick -e 'WEBrick::HTTPServer.new(Port: 8000).start'`
* Making request using Net:HTTP with timeout (`Net::OpenTimeout`) after after 60 seconds: `ruby -rnet/http -e "Net::HTTP.get(URI('http://example.com:8000'))"`


As far as I understand, [init_inetsock_internal](https://github.com/ruby/ruby/blob/4444025d16ae1a586eee6a0ac9bdd09e33833f3c/ext/socket/ipsocket.c#L42) needs to fallback to ipv4 for Net::HTTP.get to work. IPv6 route being broke is expected and hence, [RFC8305](https://tools.ietf.org/html/rfc8305) recommends fallback to IPv4.
Support for IPv6 fallback is spotty across languages and http clients, for example, [golang supports it](https://github.com/golang/go/blob/master/src/net/dial.go#L47) but python doesn't, making request with `curl` works but `wget` hangs.



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [ruby-core:91642] [Ruby trunk Feature#15628] init_inetsock_internal should fallback to IPv4 if IPv6 is unreachable
       [not found] <redmine.issue-15628.20190228115117@ruby-lang.org>
  2019-02-28 11:51 ` [ruby-core:91641] [Ruby trunk Feature#15628] init_inetsock_internal should fallback to IPv4 if IPv6 is unreachable aditya.prakash132
@ 2019-02-28 12:11 ` aditya.prakash132
  2019-03-21 16:24 ` [ruby-core:91915] " aditya.prakash132
  2 siblings, 0 replies; 3+ messages in thread
From: aditya.prakash132 @ 2019-02-28 12:11 UTC (permalink / raw)
  To: ruby-core

Issue #15628 has been updated by sonalkr132 (Aditya Prakash).


Related: [rubygems/rubygems#2662](https://github.com/rubygems/rubygems/pull/2662)

----------------------------------------
Feature #15628: init_inetsock_internal should fallback to IPv4 if IPv6 is unreachable
https://bugs.ruby-lang.org/issues/15628#change-76906

* Author: sonalkr132 (Aditya Prakash)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
Hi,

This is not really bug but more of a missing feature. Let me layout steps to reproduce what I am trying to achieve:
* Add local entries for `example.com` 

```
$ echo "::1     example.com www.example.com
127.0.0.1 example.com www.example.com" | sudo tee  --append /etc/hosts
```
* Add rule to `DROP` ipv6 packets: `sudo ip6tables -P INPUT DROP`
* Start a server: `ruby -rwebrick -e 'WEBrick::HTTPServer.new(Port: 8000).start'`
* Making request using Net:HTTP with timeout (`Net::OpenTimeout`) after after 60 seconds: `ruby -rnet/http -e "Net::HTTP.get(URI('http://example.com:8000'))"`


As far as I understand, [init_inetsock_internal](https://github.com/ruby/ruby/blob/4444025d16ae1a586eee6a0ac9bdd09e33833f3c/ext/socket/ipsocket.c#L42) needs to fallback to ipv4 for Net::HTTP.get to work. IPv6 route being broke is expected and hence, [RFC8305](https://tools.ietf.org/html/rfc8305) recommends fallback to IPv4.
Support for IPv6 fallback is spotty across languages and http clients, for example, [golang supports it](https://github.com/golang/go/blob/master/src/net/dial.go#L47) but python doesn't, making request with `curl` works but `wget` hangs.



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [ruby-core:91915] [Ruby trunk Feature#15628] init_inetsock_internal should fallback to IPv4 if IPv6 is unreachable
       [not found] <redmine.issue-15628.20190228115117@ruby-lang.org>
  2019-02-28 11:51 ` [ruby-core:91641] [Ruby trunk Feature#15628] init_inetsock_internal should fallback to IPv4 if IPv6 is unreachable aditya.prakash132
  2019-02-28 12:11 ` [ruby-core:91642] " aditya.prakash132
@ 2019-03-21 16:24 ` aditya.prakash132
  2 siblings, 0 replies; 3+ messages in thread
From: aditya.prakash132 @ 2019-03-21 16:24 UTC (permalink / raw)
  To: ruby-core

Issue #15628 has been updated by sonalkr132 (Aditya Prakash).


> Net:HTTP with timeout (Net::OpenTimeout) after after 60 seconds

I meant "Net:HTTP will timeout (Net::OpenTimeout) after 60 seconds".

Any suggestion on fixing this would very helpful ![](https://gist.github.com/sonalkr132/debcab857485405e9a1117a62d5d1fd7/raw/caed6188620279f6a930a4058dba0def8153f5a9/download%2520(2).png). So far I have tried using `Socket.tcp(addr.ip_address, serv).close` to preemptively check if resolved addresses are reachable. It works but it is very inefficient.
Besides the brute steps explained above, in the wild, this only affects host which have an IPv6 address but their IPv6 route to our CDN is broken. Personal home networks which generally have only IPv4 connectivity seamlessly use the IPv4 address to start the connection (without the need for a fallback).

----------------------------------------
Feature #15628: init_inetsock_internal should fallback to IPv4 if IPv6 is unreachable
https://bugs.ruby-lang.org/issues/15628#change-77245

* Author: sonalkr132 (Aditya Prakash)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
Hi,

This is not really bug but more of a missing feature. Let me layout steps to reproduce what I am trying to achieve:
* Add local entries for `example.com` 

```
$ echo "::1     example.com www.example.com
127.0.0.1 example.com www.example.com" | sudo tee  --append /etc/hosts
```
* Add rule to `DROP` ipv6 packets: `sudo ip6tables -P INPUT DROP`
* Start a server: `ruby -rwebrick -e 'WEBrick::HTTPServer.new(Port: 8000).start'`
* Making request using Net:HTTP with timeout (`Net::OpenTimeout`) after after 60 seconds: `ruby -rnet/http -e "Net::HTTP.get(URI('http://example.com:8000'))"`


As far as I understand, [init_inetsock_internal](https://github.com/ruby/ruby/blob/4444025d16ae1a586eee6a0ac9bdd09e33833f3c/ext/socket/ipsocket.c#L42) needs to fallback to ipv4 for Net::HTTP.get to work. IPv6 route being broke is expected and hence, [RFC8305](https://tools.ietf.org/html/rfc8305) recommends fallback to IPv4.
Support for IPv6 fallback is spotty across languages and http clients, for example, [golang supports it](https://github.com/golang/go/blob/master/src/net/dial.go#L47) but python doesn't, making request with `curl` works but `wget` hangs.



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-03-21 16:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <redmine.issue-15628.20190228115117@ruby-lang.org>
2019-02-28 11:51 ` [ruby-core:91641] [Ruby trunk Feature#15628] init_inetsock_internal should fallback to IPv4 if IPv6 is unreachable aditya.prakash132
2019-02-28 12:11 ` [ruby-core:91642] " aditya.prakash132
2019-03-21 16:24 ` [ruby-core:91915] " aditya.prakash132

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).