From: "hsbt (Hiroshi SHIBATA) via ruby-core" <ruby-core@ml.ruby-lang.org>
To: ruby-core@ml.ruby-lang.org
Cc: "hsbt (Hiroshi SHIBATA)" <noreply@ruby-lang.org>
Subject: [ruby-core:117411] [Ruby master Feature#15628] init_inetsock_internal should fallback to IPv4 if IPv6 is unreachable
Date: Wed, 03 Apr 2024 02:35:22 +0000 (UTC) [thread overview]
Message-ID: <redmine.journal-107588.20240403023522.20217@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-15628.20190228115117.20217@ruby-lang.org
Issue #15628 has been updated by hsbt (Hiroshi SHIBATA).
Status changed from Assigned to Closed
Closing in favor of https://bugs.ruby-lang.org/issues/20108
----------------------------------------
Feature #15628: init_inetsock_internal should fallback to IPv4 if IPv6 is unreachable
https://bugs.ruby-lang.org/issues/15628#change-107588
* Author: sonalkr132 (Aditya Prakash)
* Status: Closed
* Assignee: Glass_saga (Masaki Matsushita)
----------------------------------------
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/
______________________________________________
ruby-core mailing list -- ruby-core@ml.ruby-lang.org
To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/
prev parent reply other threads:[~2024-04-03 2:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <redmine.issue-15628.20190228115117.20217@ruby-lang.org>
2020-09-02 20:33 ` [ruby-core:99851] [Ruby master Feature#15628] init_inetsock_internal should fallback to IPv4 if IPv6 is unreachable deivid.rodriguez
2020-09-25 5:42 ` [ruby-core:100123] " glass.saga
2024-04-03 2:35 ` hsbt (Hiroshi SHIBATA) via ruby-core [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.ruby-lang.org/en/community/mailing-lists/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=redmine.journal-107588.20240403023522.20217@ruby-lang.org \
--to=ruby-core@ruby-lang.org \
--cc=noreply@ruby-lang.org \
--cc=ruby-core@ml.ruby-lang.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).