Hi Patrick,

On 2021-May-14 23:40:04 +0200, "Patrick M. Hausen" <hau...@punkt.de> wrote:
>do you have some spare time and would you be so kind to look at our discussion
>here: https://github.com/AdguardTeam/AdGuardHome/issues/3015
>
>Andrey from the AdGuard team references this golang issue:
>https://github.com/golang/go/issues/8329
>
>Which references this FreeBSD issue:
>https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=193246

I've skimmed through all three issues.

>What I as a sysadmin can observe is that the test code Andrey gave me
>binds to *.53 on IPv4 and IPv6 although I start it with `-l 0.0.0.0` which is
>clearly an IPv4 "any" address.
>

>I am not 100% familiar with the API but as I understand you can treat
>IPv4 as IPv6 via the socket interface by using an IPv4-mapped IPv6
>address. So far so good.

Yes.

>But then of course you have an AF_INET6 socket and it seems that
>FreeBSD does not allow setting IPv4 specific options via setsockopt()
>because it's an IPv6 socket. Correct?

That's my reading of the FreeBSD issue.

>Why can you have a single socket on both address families, anyway?
>IPv4 and IPv6 are as "related" as IP and IPX - if you go dual stack,
>treat them both separately - no?

This is getting outside my expertise but my understanding is that
the idea behind using IPv4-mapped addressed is to simplify building
dual-stack applications, particularly during the early introduction
of IPv6.  The main benefit is that it made it possible to support
both IPv4 and IPv6 without needing 2 sockets - which means you
can stick to doing an accept() on a blocking socket, rather than
needing to use poll() or select() etc with a pair of non-blocking
sockets.

I'm not sure how to solve your problem, sorry.

-- 
Peter Jeremy

Attachment: signature.asc
Description: PGP signature

Reply via email to