Date: Fri, 14 May 2021 23:40:04 +0200 From: "Patrick M. Hausen" <hausen@punkt.de> To: Peter Jeremy <peter@rulingia.com> Cc: freebsd-net@freebsd.org Subject: Re: sender source IP address on UDP socket bound to INADDR_ANY in golang Message-ID: <D72535AB-1CC4-4091-8446-356DE83812A9@punkt.de> In-Reply-To: <YJvEsc9MED9rOFBV@server.rulingia.com> References: <2B26D5AB-0F77-4E36-AD9A-D7D6CE5F173C@punkt.de> <YJpenW9tB7LzlyS9@server.rulingia.com> <846FFF4A-0D81-4F04-8358-1B14F996C0A2@punkt.de> <YJvEsc9MED9rOFBV@server.rulingia.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--Apple-Mail=_ED5C81E3-9046-4C6D-AC53-243E87DB2815 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Hi Peter and everyone else following, > Am 12.05.2021 um 14:06 schrieb Peter Jeremy via freebsd-net = <freebsd-net@freebsd.org>: > As I see it, the possibilities boil down to: > 1) The Go code isn't enabling IPPROTO_IP.IP_RECVDSTADDR on the socket. > 2) There's a FreeBSD kernel bug that mean setting IP_RECVDSTADDR > isn't being correctly reflected into the recvmsg control message. > 3) The control message isn't being correctly plumbed through from > recvmsg(2) to the Go RecvMsg() return. >=20 > Note that a lot of the relevant Go library code is BSD- or FreeBSD- > specific so it's also possible that there is a bug in the Go library > code. 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=3D193246 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. 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? 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? Any light you can shed on this issue greatly appreciated. Thanks, Patrick -- punkt.de GmbH Patrick M. Hausen .infrastructure Kaiserallee 13a 76133 Karlsruhe Tel. +49 721 9109500 https://infrastructure.punkt.de info@punkt.de AG Mannheim 108285 Gesch=C3=A4ftsf=C3=BChrer: J=C3=BCrgen Egeling, Daniel Lienert, Fabian = Stein --Apple-Mail=_ED5C81E3-9046-4C6D-AC53-243E87DB2815 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEgzqrjO/mj9CSsTg2kG8u4u3aiVwFAmCe7jQACgkQkG8u4u3a iVw7wAf9G9KpbOyycqkc3VGIgguyqNRn6CMAAkSCi/Ec/DAkkfIldTJw7ynS5SB5 6Sa9iUzdkD9OBA0q6GuZDyobGhLSUkoXaII8pRbSO3+EiXa7lTyo05YSLxqZF5c4 aSnlzzy0s/XMLljm5TPAVJq7VgZvNNo1kNonhvvJCIYevuwSTnr3cKqcad5xHsny 8eGK0CZVLvHQWgC6H5bf/Lyi05bgQVwv7FXbB/XanYBtKv5z5BDDwh/mfQrs7yJI 8mZa7MHO6D/E4XzEvCuKpnw+6pKOWchjYSTBJgHBhvDG3+ggtql2PeY2QfETijcs bPI3jU+jE+QT0tjmoqC5cOYnbs6xSQ== =AneT -----END PGP SIGNATURE----- --Apple-Mail=_ED5C81E3-9046-4C6D-AC53-243E87DB2815--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?D72535AB-1CC4-4091-8446-356DE83812A9>