Set netid before doing anything else

pull/685/head
Michael 5 years ago
parent 661a8b6537
commit 6418c67f75
No known key found for this signature in database
GPG Key ID: 2D51757B47E2434C

@ -769,6 +769,21 @@ namespace llarp
void
Router::fromConfig(Config *conf)
{
// Set netid before anything else
if(!conf->router.netid.empty())
{
const auto &netid = conf->router.netid;
llarp::LogWarn("!!!! you have manually set netid to be '", netid,
"' which does not equal '", Version::LLARP_NET_ID,
"' you will run as a different network, good luck "
"and don't forget: something something MUH traffic "
"shape correlation !!!!");
NetID::DefaultValue() =
NetID(reinterpret_cast< const byte_t * >(netid.c_str()));
// reset netid in our rc
_rc.netID = llarp::NetID();
}
// IWP config
m_OutboundPort = conf->iwp_links.m_OutboundPort;
@ -927,20 +942,6 @@ namespace llarp
}
// Router config
if(!conf->router.netid.empty())
{
const auto &netid = conf->router.netid;
llarp::LogWarn("!!!! you have manually set netid to be '", netid,
"' which does not equal '", Version::LLARP_NET_ID,
"' you will run as a different network, good luck "
"and don't forget: something something MUH traffic "
"shape correlation !!!!");
NetID::DefaultValue() =
NetID(reinterpret_cast< const byte_t * >(netid.c_str()));
// reset netid in our rc
_rc.netID = llarp::NetID();
}
_rc.SetNick(conf->router.nickname);
maxConnectedRouters = conf->router.maxConnectedRouters;
minConnectedRouters = conf->router.minConnectedRouters;

Loading…
Cancel
Save