diff --git a/src/init.cpp b/src/init.cpp index c034826d6..cb37a7827 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1134,6 +1134,16 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler) LogPrintf("%s: parameter interaction: -externalip set -> setting -discover=0\n", __func__); } + //TODO: define a constant for the default of each of these that the CLI + //help also uses + if (GetBoolArg("-disableipv6", false)) { + SetReachable(NET_IPV6, false); + } + + if (GetBoolArg("-disableipv4", false)) { + SetReachable(NET_IPV4, false); + } + // Read asmap file by default for HUSH3 and all Hush Arrakis Chains if (GetArg("-asmap",1)) { fs::path asmap_path = fs::path(GetArg("-asmap", "")); @@ -1647,8 +1657,13 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler) std::set nets; BOOST_FOREACH(const std::string& snet, mapMultiArgs["-onlynet"]) { enum Network net = ParseNetwork(snet); - if (net == NET_UNROUTABLE) + if (net == NET_UNROUTABLE) { return InitError(strprintf(_("Unknown network specified in -onlynet: '%s'"), snet)); + } else if (net == NET_IPV4 && GetBoolArg("-disableipv4", false)) { + return InitError(strprintf(_("-onlynet=ipv4 is incompatible with -disableipv4 !"), snet)); + } else if (net == NET_IPV6 && GetBoolArg("-disableipv6", false)) { + return InitError(strprintf(_("-onlynet=ipv6 is incompatible with -disableipv6 !"), snet)); + } nets.insert(net); } for (int n = 0; n < NET_MAX; n++) {