Yahoo Groups archive

Milter-greylist

Index last updated: 2026-04-28 23:32 UTC

Thread

spamd check -> EAI_BADFLAGS on getaddrinfo()

spamd check -> EAI_BADFLAGS on getaddrinfo()

2009-02-14 by Enrico Scholz

Hi,

the ISC bind library does not seem to like the AI_ADDRCONFIG flag for
getaddrinfo().  E.g.

---
#include <netdb.h>
#include <stdio.h>

int main()
{
        struct addrinfo *ai;
        struct addrinfo hints = {
                .ai_socktype = SOCK_STREAM,
                .ai_flags    = AI_ADDRCONFIG
        };

        printf("rc=%d\n", getaddrinfo("localhost", "1234", &hints, &ai));
}
---

gives

$ gcc foo.c ; ./a.out 
rc=0

$ gcc foo.c -lbind -I/usr/include/bind; ./a.out 
rc=3


Used libraries are glibc-2.9-3.x86_64 and bind-libs-9.5.1-1.P1.fc10.x86_64
on Fedora 10, but issue was seen on CentOS 5 too.



Setting ai_flags to AI_ADDRCONFIG is done by milter-greylist and problem
will occur when dnsrbl checks are enabled (which cause linking against
libbind).


What would be the best solution?  Using NULL pointer instead of &hints?
Or checking result for EAI_BADFLAGS and invoking getaddrinfo() again
without AI_ADDRCONFIG?



Enrico

Re: [milter-greylist] spamd check -> EAI_BADFLAGS on getaddrinfo()

2009-02-14 by Hajimu UMEMOTO

Hi,

>>>>> On Sat, 14 Feb 2009 18:57:40 +0100
>>>>> Enrico Scholz <enrico.scholz@...-chemnitz.de> said:

enrico.scholz> What would be the best solution?  Using NULL pointer instead of &hints?
enrico.scholz> Or checking result for EAI_BADFLAGS and invoking getaddrinfo() again
enrico.scholz> without AI_ADDRCONFIG?

It seems to me that you don't need to set AI_ADDRCONFIG, here.

Sincerely,

--
Hajimu UMEMOTO @ Internet Mutual Aid Society Yokohama, Japan
ume@...  ume@{,jp.}FreeBSD.org
http://www.imasy.org/~ume/

Re: [milter-greylist] [PATCH] Re: spamd check -> EAI_BADFLAGS on getaddrinfo()

2009-02-15 by Manuel Badzong

Hi, 

On Sat, Feb 14, 2009 at 08:59:45PM +0100, Enrico Scholz wrote:
> ISC libbind provides AI_ADDRCONFIG macro, but getaddrinfo() fails with
> EAI_BADFLAGS when invoked with it.  This patch retries getaddrinfo()
> without AI_ADDRCONFIG flag in this case.

As Hajimu UMEMOTO said, no real need for AI_ADDRCONFIG here. IMO keeping
it zero should work just fine. If someone uses a IPv6 spamd host and has
only IPv4 configured, he's bound to notice.

Cheers, Manuel

Re: [milter-greylist] [PATCH] Re: spamd check -> EAI_BADFLAGS on getaddrinfo()

2009-02-21 by manu@netbsd.org

Manuel Badzong <manuel@...> wrote:

> As Hajimu UMEMOTO said, no real need for AI_ADDRCONFIG here. IMO keeping
> it zero should work just fine. If someone uses a IPv6 spamd host and has
> only IPv4 configured, he's bound to notice.

We could add something like this:
#ifndef AI_ADDRCONFIG
#define AI_ADDRCONFIG 0
#endif

Anyone can give it a try?

-- 
Emmanuel Dreyfus
http://hcpnet.free.fr/pubz
manu@...

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.