aboutsummaryrefslogtreecommitdiff
path: root/src/init.cpp
diff options
context:
space:
mode:
authorMartin Zumsande <mzumsande@gmail.com>2022-09-01 18:25:25 -0400
committerMartin Zumsande <mzumsande@gmail.com>2022-09-19 11:06:43 -0400
commita8a9ed67cc447d204304ccfd844c45fd76486c6a (patch)
tree6bbf20a836f8449c612e416491d72e79f86259f7 /src/init.cpp
parent55e1deb745531a0749f668ed7265770c70a58563 (diff)
init: Abort if i2p/cjdns are chosen via -onlynet but unreachable
...because -i2psam or -cjdnsreachable are not provided. This mimics existing behavior for -onlynet=onion and non-specified proxy.
Diffstat (limited to 'src/init.cpp')
-rw-r--r--src/init.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/init.cpp b/src/init.cpp
index 20cb483a3a..606adb09a1 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -1284,6 +1284,11 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
}
if (!args.IsArgSet("-cjdnsreachable")) {
+ if (args.IsArgSet("-onlynet") && IsReachable(NET_CJDNS)) {
+ return InitError(
+ _("Outbound connections restricted to CJDNS (-onlynet=cjdns) but "
+ "-cjdnsreachable is not provided"));
+ }
SetReachable(NET_CJDNS, false);
}
// Now IsReachable(NET_CJDNS) is true if:
@@ -1756,6 +1761,11 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
}
SetProxy(NET_I2P, Proxy{addr});
} else {
+ if (args.IsArgSet("-onlynet") && IsReachable(NET_I2P)) {
+ return InitError(
+ _("Outbound connections restricted to i2p (-onlynet=i2p) but "
+ "-i2psam is not provided"));
+ }
SetReachable(NET_I2P, false);
}