summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xconfigure11
-rw-r--r--docs/inspircd.conf.example13
-rw-r--r--include/configreader.h3
-rw-r--r--make/configure.pm1
-rw-r--r--src/configreader.cpp20
-rw-r--r--src/listensocket.cpp2
-rw-r--r--src/modules/m_spanningtree/capab.cpp5
-rw-r--r--src/socket.cpp51
-rw-r--r--win/configure.cpp2
9 files changed, 49 insertions, 59 deletions
diff --git a/configure b/configure
index 3f684df8a..ddb8d7376 100755
--- a/configure
+++ b/configure
@@ -220,11 +220,6 @@ if (defined $opt_noports)
{
$config{USE_PORTS} = "n";
}
-$config{IPV6} = "y"; # IPv6 support
-if (defined $opt_noipv6)
-{
- $config{IPV6} = "n";
-}
$config{_SOMAXCONN} = SOMAXCONN; # Max connections in accept queue
$config{OSNAME} = $^O; # Operating System Name
$config{IS_DARWIN} = "NO"; # Is OSX?
@@ -634,9 +629,6 @@ should NOT be used. You should probably specify a newer compiler.\n\n";
}
}
- yesno('IPV6',"Would you like to build InspIRCd with IPv6 support?\nYou can still use IPv4 addresses in your port bindings.\n\nEnable IPv6?");
- print "\n";
-
$config{USE_FREEBSD_BASE_SSL} = "n";
$config{USE_FREEBSD_PORTS_SSL} = "n";
if ($config{HAS_OPENSSL_PORT} ne "")
@@ -953,9 +945,6 @@ print FILEHANDLE "#define MAXBUF " . ($config{MAXBUF}+2) . "\n";
if ($config{HAS_STDINT} eq "true") {
print FILEHANDLE "#define HAS_STDINT\n";
}
- if ($config{IPV6} =~ /y/i) {
- print FILEHANDLE "#define IPV6\n";
- }
if ($config{HAS_EVENTFD} eq 'true') {
print FILEHANDLE "#define HAS_EVENTFD\n";
}
diff --git a/docs/inspircd.conf.example b/docs/inspircd.conf.example
index a292905c8..09cd14779 100644
--- a/docs/inspircd.conf.example
+++ b/docs/inspircd.conf.example
@@ -555,10 +555,15 @@
# in channel will be sent a NOTICE about it.
announcets="yes"
- # allowmismatched: Setting this option to yes will allow servers to link even
- # if they don't have the same VF_OPTCOMMON modules loaded. Setting this to
- # yes may introduce some desyncs and weirdness.
- allowmismatched="no"
+ # allowmismatched: Setting this option to yes will allow servers to link even
+ # if they don't have the same VF_OPTCOMMON modules loaded. Setting this to
+ # yes may introduce some desyncs and weirdness.
+ allowmismatched="no"
+
+ # defaultbind: Sets the default for <bind> tags without an address. Choices are
+ # ipv4 or ipv6; if not specified, IPv6 will be used if your system has support,
+ # falling back to IPv4 otherwise.
+ defaultbind="auto"
# hostintopic: If enabled, channels will show the host of the topicsetter
# in the topic. If set to no, it will only show the nick of the topicsetter.
diff --git a/include/configreader.h b/include/configreader.h
index c63b46779..57134390a 100644
--- a/include/configreader.h
+++ b/include/configreader.h
@@ -211,6 +211,9 @@ class CoreExport ServerConfig
/** True if this configuration is valid enough to run with */
bool valid;
+ /** Bind to IPv6 by default */
+ bool WildcardIPv6;
+
/** Used to indicate who we announce invites to on a channel */
enum InviteAnnounceState { INVITE_ANNOUNCE_NONE, INVITE_ANNOUNCE_ALL, INVITE_ANNOUNCE_OPS, INVITE_ANNOUNCE_DYNAMIC };
diff --git a/make/configure.pm b/make/configure.pm
index 245eede43..dbba7a143 100644
--- a/make/configure.pm
+++ b/make/configure.pm
@@ -213,7 +213,6 @@ sub dumphash()
print "\e[0mModule path:\e[1;32m\t\t\t$main::config{MODULE_DIR}\e[0m\n";
print "\e[0mGCC Version Found:\e[1;32m\t\t$main::config{GCCVER}.$main::config{GCCMINOR}\e[0m\n";
print "\e[0mCompiler program:\e[1;32m\t\t$main::config{CC}\e[0m\n";
- print "\e[0mIPv6 Support:\e[1;32m\t\t\t$main::config{IPV6}\e[0m\n";
print "\e[0mGnuTLS Support:\e[1;32m\t\t\t$main::config{USE_GNUTLS}\e[0m\n";
print "\e[0mOpenSSL Support:\e[1;32m\t\t$main::config{USE_OPENSSL}\e[0m\n\n";
print "\e[1;32mImportant note: The maximum length values are now configured in the\e[0m\n";
diff --git a/src/configreader.cpp b/src/configreader.cpp
index 6f576fcd7..1905b36d0 100644
--- a/src/configreader.cpp
+++ b/src/configreader.cpp
@@ -22,7 +22,7 @@ ServerConfig::ServerConfig()
{
WhoWasGroupSize = WhoWasMaxGroups = WhoWasMaxKeep = 0;
NoUserDns = OperSpyWhois = HideBans = HideSplits = UndernetMsgPrefix = false;
- CycleHosts = InvBypassModes = true;
+ WildcardIPv6 = CycleHosts = InvBypassModes = true;
dns_timeout = 5;
MaxTargets = 20;
NetBufferSize = 10240;
@@ -498,6 +498,24 @@ void ServerConfig::Fill()
if (!sid.empty() && !ServerInstance->IsSID(sid))
throw CoreException(sid + " is not a valid server ID. A server ID must be 3 characters long, with the first character a digit and the next two characters a digit or letter.");
+ std::string defbind = options->getString("defaultbind");
+ if (assign(defbind) == "ipv4")
+ {
+ WildcardIPv6 = false;
+ }
+ else if (assign(defbind) == "ipv6")
+ {
+ WildcardIPv6 = true;
+ }
+ else
+ {
+ WildcardIPv6 = true;
+ int socktest = socket(AF_INET6, SOCK_STREAM, 0);
+ if (socktest < 0)
+ WildcardIPv6 = false;
+ else
+ close(socktest);
+ }
ConfigTagList tags = ConfTags("uline");
for(ConfigIter i = tags.first; i != tags.second; ++i)
{
diff --git a/src/listensocket.cpp b/src/listensocket.cpp
index b0fce7b5b..d511d536e 100644
--- a/src/listensocket.cpp
+++ b/src/listensocket.cpp
@@ -11,8 +11,6 @@
* ---------------------------------------------------
*/
-/* $Core */
-
#include "inspircd.h"
#include "socket.h"
#include "socketengine.h"
diff --git a/src/modules/m_spanningtree/capab.cpp b/src/modules/m_spanningtree/capab.cpp
index 1e2fe710a..cb3611d33 100644
--- a/src/modules/m_spanningtree/capab.cpp
+++ b/src/modules/m_spanningtree/capab.cpp
@@ -124,10 +124,6 @@ void TreeSocket::SendCapabilities(int phase)
WriteLine("CAPAB CHANMODES :" + BuildModeList(MODETYPE_CHANNEL));
WriteLine("CAPAB USERMODES :" + BuildModeList(MODETYPE_USER));
- int ip6 = 0;
-#ifdef IPV6
- ip6 = 1;
-#endif
std::string extra;
/* Do we have sha256 available? If so, we send a challenge */
if (Utils->ChallengeResponse && (ServerInstance->Modules->Find("m_sha256.so")))
@@ -146,7 +142,6 @@ void TreeSocket::SendCapabilities(int phase)
" MAXKICK="+ConvToStr(ServerInstance->Config->Limits.MaxKick)+
" MAXGECOS="+ConvToStr(ServerInstance->Config->Limits.MaxGecos)+
" MAXAWAY="+ConvToStr(ServerInstance->Config->Limits.MaxAway)+
- " IP6NATIVE="+ConvToStr(ip6)+
" IP6SUPPORT=1"+
" PROTOCOL="+ConvToStr(ProtocolVersion)+extra+
" PREFIX="+ServerInstance->Modes->BuildPrefixes()+
diff --git a/src/socket.cpp b/src/socket.cpp
index 63b373cce..3ee996193 100644
--- a/src/socket.cpp
+++ b/src/socket.cpp
@@ -145,13 +145,16 @@ bool irc::sockets::aptosa(const std::string& addr, int port, irc::sockets::socka
memset(&sa, 0, sizeof(sa));
if (addr.empty() || addr.c_str()[0] == '*')
{
-#ifdef IPV6
- sa.in6.sin6_family = AF_INET6;
- sa.in6.sin6_port = htons(port);
-#else
- sa.in4.sin_family = AF_INET;
- sa.in4.sin_port = htons(port);
-#endif
+ if (ServerInstance->Config->WildcardIPv6)
+ {
+ sa.in6.sin6_family = AF_INET6;
+ sa.in6.sin6_port = htons(port);
+ }
+ else
+ {
+ sa.in4.sin_family = AF_INET;
+ sa.in4.sin_port = htons(port);
+ }
return true;
}
else if (inet_pton(AF_INET, addr.c_str(), &sa.in4.sin_addr) > 0)
@@ -210,35 +213,17 @@ std::string irc::sockets::sockaddrs::str() const
char buffer[MAXBUF];
if (sa.sa_family == AF_INET)
{
-#ifndef IPV6
- if (in4.sin_addr.s_addr == 0)
- {
- sprintf(buffer, "*:%u", ntohs(in4.sin_port));
- }
- else
-#endif
- {
- const uint8_t* bits = reinterpret_cast<const uint8_t*>(&in4.sin_addr);
- sprintf(buffer, "%d.%d.%d.%d:%u", bits[0], bits[1], bits[2], bits[3], ntohs(in4.sin_port));
- }
+ const uint8_t* bits = reinterpret_cast<const uint8_t*>(&in4.sin_addr);
+ sprintf(buffer, "%d.%d.%d.%d:%u", bits[0], bits[1], bits[2], bits[3], ntohs(in4.sin_port));
}
else if (sa.sa_family == AF_INET6)
{
-#ifdef IPV6
- if (!memcmp(all_zero, &in6.sin6_addr, 16))
- {
- sprintf(buffer, "*:%u", ntohs(in6.sin6_port));
- }
- else
-#endif
- {
- buffer[0] = '[';
- if (!inet_ntop(AF_INET6, &in6.sin6_addr, buffer+1, MAXBUF - 10))
- return "<unknown>"; // should never happen, buffer is large enough
- int len = strlen(buffer);
- // no need for snprintf, buffer has at least 9 chars left, max short len = 5
- sprintf(buffer + len, "]:%u", ntohs(in6.sin6_port));
- }
+ buffer[0] = '[';
+ if (!inet_ntop(AF_INET6, &in6.sin6_addr, buffer+1, MAXBUF - 10))
+ return "<unknown>"; // should never happen, buffer is large enough
+ int len = strlen(buffer);
+ // no need for snprintf, buffer has at least 9 chars left, max short len = 5
+ sprintf(buffer + len, "]:%u", ntohs(in6.sin6_port));
}
else
return "<unknown>";
diff --git a/win/configure.cpp b/win/configure.cpp
index 2cbb43da3..f2a4a92bb 100644
--- a/win/configure.cpp
+++ b/win/configure.cpp
@@ -353,8 +353,6 @@ void Run()
fprintf(f, "/* Auto generated by configure, do not modify! */\n");
fprintf(f, "#ifndef __CONFIGURATION_AUTO__\n");
fprintf(f, "#define __CONFIGURATION_AUTO__\n\n");
- if (ipv6)
- fprintf(f, "#define IPV6 1\n\n");
fprintf(f, "#define CONFIG_FILE \"%s/inspircd.conf\"\n", config_file);
fprintf(f, "#define MOD_PATH \"%s\"\n", mod_path);