"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Christian Weisgerber <naddy@mips.inka.de>
Subject:
gotwebd: EAI_NODATA portability
To:
gameoftrees@openbsd.org
Date:
Fri, 15 Jul 2022 23:52:53 +0200

Download raw body.

Thread
gotwebd needs something like this (in -portable?) to compile on
FreeBSD:

------------------->
--- gotwebd/parse.y.orig	2022-07-15 15:12:25 UTC
+++ gotwebd/parse.y
@@ -1110,7 +1110,11 @@ host_dns(const char *s, struct addresslist *al, int ma
 	hints.ai_socktype = SOCK_DGRAM; /* DUMMY */
 	hints.ai_flags = AI_ADDRCONFIG;
 	error = getaddrinfo(s, NULL, &hints, &res0);
-	if (error == EAI_AGAIN || error == EAI_NODATA || error == EAI_NONAME)
+	if (error == EAI_AGAIN ||
+#ifdef EAI_NODATA
+            error == EAI_NODATA ||
+#endif
+            error == EAI_NONAME)
 		return (0);
 	if (error) {
 		log_warnx("%s: could not parse \"%s\": %s", __func__, s,
<-------------------

Or should we strategically place...

#ifndef EAI_NODATA
#define EAI_NODATA EAI_NONAME
#endif

... somewhere?

The underlying reason is that EAI_NODATA was defined in RFC 2553,
but along with some other error codes it was dropped in RFC 3493.
FreeBSD's getaddrinfo() implementation did a s/EAI_NODATA/EAI_NONAME/
in response.

-- 
Christian "naddy" Weisgerber                          naddy@mips.inka.de