From: Omar Polo Subject: Re: remove host, host_v4 and host_v6; rename host_dns -> host To: Klemens Nanni Cc: gameoftrees@openbsd.org Date: Mon, 29 May 2023 20:12:54 +0200 On 2023/05/29 17:24:37 +0000, Klemens Nanni wrote: > On Mon, May 29, 2023 at 06:35:02PM +0200, Omar Polo wrote: > > This is an attempt at simplifying how host() works. host() is used in > > the configuration file via get_addrs() to prepare a struct address > > after a "listen on" directive > > > > The current code first tries to resolve it as an ipv4 address via > > inet_pton(), then as an ipv6 address using getaddrinfo() with > > AI_NUMERICHOST, then as an interface name and finally as a name to > > resolve via getaddrinfo() again. > > > > Instead, scratch host(), host_v4() and host_v6() and rename host_dns() > > to host(). It preserve the lookup via interface name, and then uses > > getaddrinfo() only once wich already knows how to deal with IPv4/v6 > > literals and resolving addresses too. > > Did got copy this code from somewhere initially? > > I recall doing this kind of host*() cleanup back in 2018 for base; > afaict all got cleaned up/unified eventually, so there should be a few > programs (with their own nuances) to compare against. ah, didn't thought about tracking this code back to where it was from in base. good to know these stuff was cleaned up, will look (tomorrow) at some daemons in base and do some diffing. thanks! :)