Skip to content

Commit

Permalink
disable v2-only blanket on tor/i2p/cjdns
Browse files Browse the repository at this point in the history
  • Loading branch information
stratospher committed Aug 14, 2024
1 parent 0f13242 commit a602e9f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1377,6 +1377,8 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
"-cjdnsreachable is not provided"));
}
g_reachable_nets.Remove(NET_CJDNS);
} else {
g_v2_only = false;

This comment has been minimized.

Copy link
@mzumsande

mzumsande Aug 16, 2024

I meant to write a comment about this yesterday but can't find it anymore. Either I'm confused and there is a duplicate somewhere, or I forgot to press "send"...
Anyway, it might be better to either shut down with an init-error in these cases (so the user doesn't get surprised by clearnet v1 connection, this enables g_v2_only globally) or implement it such that we only allow v1 connections for CJDNS / Tor / I2P but still disallow them for clearnet.

This comment has been minimized.

Copy link
@stratospher

stratospher Aug 28, 2024

Author Owner

oh good catch! i've done the second approach to allow v1 CJDNS / Tor / I2P but disallow v1 IPV4/IPV6.

}
// Now g_reachable_nets.Contains(NET_CJDNS) is true if:
// 1. -cjdnsreachable is given and
Expand Down Expand Up @@ -1452,6 +1454,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)

if (onion_proxy.IsValid()) {
SetProxy(NET_ONION, onion_proxy);
g_v2_only = false;
} else {
// If -listenonion is set, then we will (try to) connect to the Tor control port
// later from the torcontrol thread and may retrieve the onion proxy from there.
Expand Down Expand Up @@ -1948,6 +1951,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
return InitError(strprintf(_("Invalid -i2psam address or hostname: '%s'"), i2psam_arg));
}
SetProxy(NET_I2P, Proxy{addr.value()});
g_v2_only = false;
} else {
if (args.IsArgSet("-onlynet") && g_reachable_nets.Contains(NET_I2P)) {
return InitError(
Expand Down

0 comments on commit a602e9f

Please sign in to comment.