On Tue, Feb 25, 2025 at 03:39:39PM +1100, duluxoz via Postfix-users wrote:

> After much toing-and-froing I finally tracked down the issue, and I'm happy
> to say it *wasn't* postfix causing the problem at all, but haproxy. In
> particular it was a (health) `check` statement on the offending port in the
> haproxy config. Removing that statement and the error messages disappeared.
> 
> Problem solved (or at least side-stepped)

Well, it leaves us in a not entirely satisfactory situation,
because it is still unclear what the haproxy health check
sent to Postfix, and whether it should, or should not, have
been accepted.

Nor it is clear what inet_protocols your Postfix is configured with, or
what your getaddrinfo(3) supports.

If you are able to compile and run the program in:

    auxiliary/name-addr-test/getaddrinfo.c

with arguments as below and report the output, that'd be helpful:

    $ make getaddrinfo
    cc     getaddrinfo.c   -o getaddrinfo

    $ ./getaddrinfo 192.0.2.1
    Hostname:       192.0.2.1
    Addresses:      192.0.2.1

    $ ./getaddrinfo 2001:db8::beef
    Hostname:       2001:db8::beef
    Addresses:      2001:db8::beef

I can reproduce something similar to what you report by changing the
code to take an optional port argument, and passing a *negative* value.

    $ ./getaddrinfo 2001:db8::beef -43
    host 2001:db8::beef not found: Servname not supported for ai_socktype

Large positive values are accepted (presumbaly just use the low 16
bits).

-- 
    Viktor.

--- getaddrinfo.c
+++ getaddrinfo.c
@@ -34,6 +34,4 @@ int     main(int argc, char **argv)
 
-#define NO_SERVICE ((char *) 0)
-
-    if (argc != 2) {
-       fprintf(stderr, "usage: %s hostname\n", argv[0]);
+    if (argc < 2 || argc > 3) {
+       fprintf(stderr, "usage: %s hostname [port]\n", argv[0]);
        exit(1);
@@ -42,5 +40,5 @@ int     main(int argc, char **argv)
     hints.ai_family = PF_UNSPEC;
-    hints.ai_flags = AI_CANONNAME;
+    hints.ai_flags = AI_CANONNAME | AI_NUMERICSERV;
     hints.ai_socktype = SOCK_STREAM;
-    if ((err = getaddrinfo(argv[1], NO_SERVICE, &hints, &res0)) != 0) {
+    if ((err = getaddrinfo(argv[1], argv[2], &hints, &res0)) != 0) {
        fprintf(stderr, "host %s not found: %s\n", argv[1], gai_strerror(err));
_______________________________________________
Postfix-users mailing list -- postfix-users@postfix.org
To unsubscribe send an email to postfix-users-le...@postfix.org

Reply via email to