[rbldnsd] Disabling ipv6-specific tests
Jeff Dairiki
dairiki at dairiki.org
Tue Jul 30 00:48:56 MSK 2013
Hi Michael,
Thank you for looking into this.
On Sun, Jul 28, 2013 at 04:30:55PM -0400, Michael Orlitzky wrote:
> On Gentoo, users can enable tests globally, but may have ipv6 disabled in,
>
> * The kernel
> * Python
> * rbldnsd
There are two orthogonal issues, I think, which are being confused here.
1. The ability to communicate with rbldnsd over IPv6 (and/or IP4) sockets.
I think you're right that the ability to use IPv6 for communication with
the rbldnsd may be hindered by any of the kernel, python, or rbldnsd
compilation options.
2. The ability of rbldnsd to list/query resource records about IPv6
addresses (via the ip6trie and ip6tset datasets.)
I think in the current stock version of rbldnsd this is always supported
(regardless of the setting of -DNO_IPv6 or other compile-time options.)
> Most of the tests in the new test suite rely on ipv6, but four do not.
I don't think that's right. (I haven't tested this, mind you, so I
could be wrong...) It should be possible to use (and test) the
ip6trie (and ip6tset) datasets even with ipv6 disabled in {the kernel,
python, and/or, rbldnsd} — it's just that if ipv6 is disabled, one
must communicate with the rbldnsd over ip4.
I think only two tests — 'test_refuse_ipv6' and 'test_pass_ipv6' in
test_acl.py — should require ipv6.
Some of the other tests may currently fail when ipv6 is missing. If
that is the case, the tests should be fixed so that they run
correctly. Send me the output of a test run (complete with python
stack traces) and I'll see if I can fix things to be less sensitive to
ipv6 support.
> I'd like to make it so the test suite doesn't fail on people without
> ipv6. How do you feel about this approach?
>
> 1. Define a new decorator, @requires_ipv6, that checks for ipv6 in
> those three locations. Checking python is easy with
> socket.has_ipv6.
> Checking rbldnsd is a little less easy -- the best
> way I've got so far is to check config.h if it exists.
Other ideas:
The 'rbldnsd -6' option will not exist if -DNO_IPv6 was defined
during compilation:
- the output of 'rbldnsd -h' will include a line like
"-6 - use IPv6 socket type" if and only if ipv6 is enabled
- running rbldnsd with the '-6' option will result in a
"IPv6 support isn't compiled in" message and non-zero exit status
if ipv6 is disabled
> The kernel, I'll need to play around with. If ipv6 isn't present,
> we skip the test.
Untested, but maybe something like:
import socket
from socket import AF_INET6, SOCK_DGRAM, IPPROTO_UDP
sock = socket.socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP)
try:
sock.connect(("::1", 1))
kernel_supports_ipv6 = True
except socket.error:
kernel_supports_ipv6 = False
>
> 2. Apply the decorator to any tests requiring ipv6. Example:
>
> @requires_ipv6
> def test_parents_internal_data(self):
> prefixes = [
> ...
The decorator is a fine plan, I think, as long as it can be
implemented cleanly for python <= 2.6 (which doesn't have
unittest.skipIf) (Though, if there really are only two tests which
require ipv6, it may be overkill.)
> 3. Use '127.0.0.1' instead of 'localhost' in test_ip4trie.py, in case
> the host has ipv6 but rbldnsd/python do not.
I either don't agree (or don't understand) this point. The only place
the string "localhost" appears in test_ip4trie.py is as the value of a
TXT RR. (It doesn't appear as a hostname, and doesn't get resolved to
an IP address.)
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.
Make sense?
Jeff
More information about the rbldnsd
mailing list