sender source IP address on UDP socket bound to INADDR_ANY in golang

Patrick M. Hausen hausen at punkt.de
Tue May 11 11:40:54 UTC 2021


Hi!

> Am 11.05.2021 um 12:38 schrieb Peter Jeremy <peter at rulingia.com>:
> 
> On 2021-May-08 19:05:56 +0200, "Patrick M. Hausen" <hausen at punkt.de> wrote:
>> I am facing a problem that is perfectly explained by the semantics
>> of the socket interface for UDP, if one assumes that the application
>> in question binds to INADDR_ANY and does not specifically set the
>> sender address when sending datagrams.
> ...
>> Their code in question is here:
>> https://github.com/AdguardTeam/dnsproxy/blob/1163404e605c3dfbeab360fc3540fc290f61a321/proxyutil/udp_unix.go#L47
> 
> So, they say that they retrieve "the net interface IP the packet was
> sent to (dst addr) from the socket's OOB data" and I agree that's what
> the referenced code does.  I hadn't heard of that behaviour before and
> went digging...

Thank you. I received some code with internal debugging added from the
AdGuard core team and will try that today or tomorrow. If I read the quote
from the documentation correctly, on possible explanation would be them
calling recvmsg() but forgetting to setsockopt()?

Kind regards,
Patrick
--
punkt.de GmbH
Patrick M. Hausen
.infrastructure

Kaiserallee 13a
76133 Karlsruhe

Tel. +49 721 9109500

https://infrastructure.punkt.de
info at punkt.de

AG Mannheim 108285
Geschäftsführer: Jürgen Egeling, Daniel Lienert, Fabian Stein

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: Message signed with OpenPGP
URL: <http://lists.freebsd.org/pipermail/freebsd-net/attachments/20210511/97e31ebb/attachment.sig>


More information about the freebsd-net mailing list