Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix DNS module not working with --disable-ipv6 #208

Merged
merged 4 commits into from Aug 8, 2016

Conversation

vanosg
Copy link
Member

@vanosg vanosg commented Apr 16, 2016

Found by: raclure
Patch by: Geo, thommey
Fixes: #93 #207

One-line summary:
setsockname should return AF_UNSPEC when allowres is 0, which the DNS module uses to do non-blocking DNS lookups.

Test cases demonstrating functionality (if applicable):

Fixed not-resolving hostnames with --disable-ipv6:

[19:59:42] Trying server [sinisalo.freenode.net]:6667
[19:59:42] DNS Resolver: Lookup successful: sinisalo.freenode.net
[19:59:42] DNS resolved sinisalo.freenode.net to 91.217.189.42

Additionally, instead of treating an IPv6 as a hostname, it now skips resolution and returns an error

[19:38:04] Trying server [2001:778:627f::1:0:49]:6667
[19:38:04] ERROR: Attempted to use IPv6 address, but IPv6 is not enabled on this eggdrop
[19:38:04] Warning: Can't create new socket: Address family not supported by protocol!
[19:38:04] ERROR: Attempted to use IPv6 address, but IPv6 is not enabled on this eggdrop
[19:38:04] Failed connect to 2001:778:627f::1:0:49 (Bad file descriptor)

If the OS doesn't have IPv6 capabilities, the presence of inet_pton() is not reliable,
so we simply check for 2 or more :s in the provided IP/hostname.
@vanosg
Copy link
Member Author

vanosg commented Jul 16, 2016

The first approach was, in @thommey 's (summarized) words was "all wrong". Also, we discovered inet_pton() is not reliably present on a non-IPv6 OS, so we shouldn't use it when --disable-ipv6 is used. Thus, we have this approach when --disable-ipv6 is used:

Jumping servers......
[20:55:43] Trying server [2a00:1a28:1100:11::42]:6667
[20:55:43] ERROR: This looks like an IPv6 address, but this Eggdrop was not compiled with IPv6 support.
[20:55:43] Failed connect to 2a00:1a28:1100:11::42 (Operation now in progress)

and the other use cases:

[20:56:44] Trying server [irc.freenode.net]:6667
[20:56:44] Connected to irc.freenode.net
[20:56:44] -NOTICE- *** Looking up your hostname...
[21:14:27] Trying server [193.219.128.49]:6667
[21:14:27] Connected to 193.219.128.49
[21:14:27] -NOTICE- *** Looking up your hostname...

@thommey thommey merged commit 9679f7b into eggheads:develop Aug 8, 2016
@vanosg vanosg deleted the DNSdisableIPv6 branch September 11, 2016 02:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Disabled IPv6 support breaks the DNS module
2 participants