[rbldnsd] Disabling ipv6-specific tests

Jeff Dairiki dairiki at dairiki.org
Tue Jul 30 04:19:14 MSK 2013


On Mon, Jul 29, 2013 at 07:04:56PM -0400, Michael Orlitzky wrote:
> On 07/29/2013 04:48 PM, Jeff Dairiki wrote:
> > 
> > 
> > It is the "localhost" which is the default value for the `daemon_addr`
> > argument of Rbldnsd.__init__() in rbldnsd.py which may need some attention.
> > I am not sure that I'm totally convinced of this either, however.
> > 
> 
> Right, that's where I had to change it. On my machine (with
> kernel/python ipv6 support), 'localhost' was causing.. problems.
> 
> In fact, it looks like most of the other tests that I thought were
> failing for lack of ipv6 can be fixed by changing the default
> daemon_addr to '127.0.0.1'. If I comment out 'test_refuse_ipv6' and
> 'test_pass_ipv6' as you suggested, I get 28 tests passed without ipv6
> support in rbldnsd:
> 
>   $ ./configure --disable-ipv6 && make && make check
>   ...
>   =============================================================
>   Running btrie.test
>   ......................
>   OK
>   =============================================================
>   Running tests.py
>   ............................
>   ----------------------------------------------------------------------
>   Ran 28 tests in 6.641s
> 
>   OK

Great!
 
 
> If I *also* disable python ipv6 support, we get one more failing test:
> 
> 
>   ERROR: test_exclusion (test_ip6trie.TestIp6TrieDataset)
>   ----------------------------------------------------------------------
>   Traceback (most recent call last):
>     File "/home/mjo/src/rbldnsd/test_ip6trie.py", line 31, in
>     test_exclusion
>       self.assertEqual(dnsd.query(rfc3152("dead::beef")), None)
>     File "/home/mjo/src/rbldnsd/test_ip6trie.py", line 22, in rfc3152
>       bytes = unpack("16B", inet_pton(AF_INET6, ip6addr))
>   error: can't use AF_INET6, IPv6 is disabled

Urgh.  I guess the choices are:

 - Re-implement enough of inet_pton() to get by.  Let me sleep on it
   to see if I can come up with a clean/simple way to do that.

 - Replace the calls to rfc3152() by hand-coded constants.  (Ugly and hard
   to read, but there are only two calls to rfc3152.)  E.g. replace

     rfc3152("dead::beef")

   with

     "f.e.e.b.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.d.a.e.d.example.com"

  (assuming that I got the right number of zeros in there...)


> So, most of the trouble can be fixed (at most three tests decorated) if
> we can figure out why 'localhost' causes problems. I'm not sure what's
> happening, but here's the underlying weirdness. The 'localhost' works
> fine when ipv6 is enabled in rbldnsd:
> 
>   $ ./configure && make
>   ...
>   $ ./rbldnsd -n -b localhost/5300 \
>       rbl.example1.com:ip4set:/var/db/rbldnsd/example2
>   rbldnsd: listening on ::1/5300
>   rbldnsd: listening on 127.0.0.1/5300
>   rbldnsd: file /var/db/rbldnsd/example2(23): invalid address
>   rbldnsd: ip4set:/var/db/rbldnsd/example2: 20130701 224432: e32/24
>   /16/8=2/0/2/0
>   rbldnsd: zones reloaded, time 0.0e/0.0u sec, mem arena=288 free=130
>   mmap=0 Kb
>   rbldnsd: rbldnsd version 0.997a (23 Jul 2013) started (2 socket(s), 1
>   zone(s))
> 
> If we disable ipv6 in rbldnsd, however,
> 
>   $ ./configure --disable-ipv6 && make
>   ...
>   $ ./rbldnsd -n -b localhost/5300 \
>       rbl.example1.com:ip4set:/var/db/rbldnsd/example2
>   rbldnsd: listening on 127.0.0.1/5300
>   rbldnsd: unable to bind to 127.0.0.1/5300: Address already in use
> 
> Pretty weird, but it gets weirder. Even though it looks like '127.0.0.1'
> was used above, if I replace 'localhost' with '127.0.0.1', it works:
> 
>   $ ./rbldnsd -n -b 127.0.0.1/5300 \
>       rbl.example1.com:ip4set:/var/db/rbldnsd/example2
>   rbldnsd: listening on 127.0.0.1/5300
>   rbldnsd: file /var/db/rbldnsd/example2(23): invalid address
>   rbldnsd: ip4set:/var/db/rbldnsd/example2: 20130701 224432: e32/24
>   /16/8=2/0/2/0
>   rbldnsd: zones reloaded, time 0.0e/0.0u sec, mem arena=293 free=132
>   mmap=0 Kb
>   rbldnsd: rbldnsd version 0.997a (23 Jul 2013) started (1 socket(s), 1
>   zone(s))
> 
> 
> So there's something funny going on.

Wierd, indeed.  I would say that this is a bug in rbldnsd which should
be fixed — 'rbldnsd -b localhost/5300' should work.

Maybe initsockets() in rbldnsd.c needs to be fixed to ignore duplicate
IP addresses in the list returned by gethostbyname()?

Not sure what's going on, but I suspect maybe there is a double entry
in /etc/hosts for localhost or something.  Maybe a listing for 127.0.0.1
and ::ffff:127.0.0.1, or something like that?

What does 'host localhost' produce on this system?

How about (quick-and-dirty way to see what the gethostbyname() libc
function returns):

  python -c "import socket; print socket.gethostbyname_ex('localhost')"


Jeff


More information about the rbldnsd mailing list