unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: "Dr. Arne Babenhauserheide" <arne_bab@web.de>
To: Chris Vine <vine35792468@gmail.com>
Cc: guile-devel@gnu.org
Subject: Re: (web server) serving on both ipv6 and ipv4?
Date: Wed, 19 Jan 2022 22:42:16 +0100	[thread overview]
Message-ID: <87fspjiejk.fsf@web.de> (raw)
In-Reply-To: <20220119211237.c451bfb4a6f9369d926f2cde@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2643 bytes --]


Chris Vine <vine35792468@gmail.com> writes:

> On Wed, 19 Jan 2022 13:44:13 +0000
> Chris Vine <vine35792468@gmail.com> wrote:
>> On Wed, 19 Jan 2022 13:07:33 +0000
>> Chris Vine <vine35792468@gmail.com> wrote:
>> [snip]
>> > As I understand it, with linux IPv6 sockets are dual stack capable, and
>> > in earlier kernel versions this was be enabled by default.  I believe
>> > with current versions that is no longer the case, and that you have to
>> > specifically enable dual stack by turning off IPV6_V6ONLY using
>> > setsockopt before binding on the socket.
>> > 
>> > Then, if receiving a IPv4 connection from address 1.2.3.4, this would be
>> > mapped as ::::ffff:1.2.3.4.
>> > 
>> > I do not know about other OSes.  I have half a memory that some earlier
>> > versions of windows did not support dual stack sockets (XP?).
>> 
>> By the way I did use dual stack some years ago, and I cannot now
>> remember all the details, but I think I may have had to bind on
>> in6addr_any (which in dual stack would cover INADDR_ANY) or on ::1
>> (which would cover 127.0.0.1) to get dual stack to work.  I suggest you
>> play around with it to see.
>> 
>> One other correction: when I said there was a mapping to ::::ffff:
>> 1.2.3.4 I meant ::ffff:1.2.3.4.
>
> You have stimulated my interest and this is what I have found.  First,
> in C the correct call in linux to do what you want to obtain a dual
> stack socket is to set the IPV6_V6ONLY option in the IPPROTO_IPV6 level
> to 0 (off). However neither IPV6_V6ONLY nor IPPROTO_IPV6 is defined in
> guile, so you have to enter the numeric values for your OS by hand.  In
> linux this will do it in guile, but of course it is non-portable:
>
>   (setsockopt [sock] 41 26 0)
>
> However, this only actually seems to accept a connection from a IPv4
> address if the socket binds to :: (which is in6addr_any, but
> the in6addr_any symbol also appears not to be defined in guile).
> Binding to ::1 (localhost) will not enable you to connect from
> 127.0.0.1 on my computer.  Whether binding to :: and so permitting any
> interface to access the socket is OK for you depends on what your needs
> are.  If not then it looks as if you are stuck with having two sockets,
> one for IPv4 and one for IPv6.

Thank you for all your info! I seem to have working ipv4 and ipv6 access
now!

I found that IPV6_V6EONLY is off by default in my system

cat /proc/sys/net/ipv6/bindv6only

But I’m now setting it anyway, because that default might change.

Best wishes,
Arne
-- 
Unpolitisch sein
heißt politisch sein,
ohne es zu merken.
draketo.de

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 1125 bytes --]

      reply	other threads:[~2022-01-19 21:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-19  7:57 (web server) serving on both ipv6 and ipv4? Dr. Arne Babenhauserheide
2022-01-19  8:51 ` Maxime Devos
2022-01-19 18:27   ` Greg Troxel
2022-01-20  7:24     ` Dr. Arne Babenhauserheide
2022-01-20 13:38       ` Greg Troxel
2022-01-19 13:07 ` Chris Vine
2022-01-19 13:44   ` Chris Vine
2022-01-19 13:53     ` Chris Vine
2022-01-19 21:12     ` Chris Vine
2022-01-19 21:42       ` Dr. Arne Babenhauserheide [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-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87fspjiejk.fsf@web.de \
    --to=arne_bab@web.de \
    --cc=guile-devel@gnu.org \
    --cc=vine35792468@gmail.com \
    /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).