summaryrefslogtreecommitdiff
path: root/src/configreader.cpp
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2010-02-23 18:45:26 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2010-02-23 18:45:26 +0000
commit03a1bf15b1da7643b237c22db1a478916a976ccf (patch)
tree609b6f51455bb2cf62f56295c388399821e3d998 /src/configreader.cpp
parentfbb1ebd08b6e4f3322da57884d6c90447bd21460 (diff)
Replace #define IPV6 with <config defaultbind="ipv6">, and autodetect if not specified
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@12550 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/configreader.cpp')
-rw-r--r--src/configreader.cpp20
1 files changed, 19 insertions, 1 deletions
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)
{