diff --git a/llarp/ev_epoll.hpp b/llarp/ev_epoll.hpp index fe262efe3..e0c1ad5c7 100644 --- a/llarp/ev_epoll.hpp +++ b/llarp/ev_epoll.hpp @@ -391,6 +391,8 @@ struct llarp_epoll_loop : public llarp_ev_loop llarp::ev_io* ev = static_cast< llarp::ev_io* >(events[idx].data.ptr); if(ev) { + llarp::LogDebug(idx, " of ", result, + " events=", std::to_string(events[idx].events)); if(events[idx].events & EPOLLERR) { ev->error(); diff --git a/llarp/router.cpp b/llarp/router.cpp index 6e99f5a37..3532ccc07 100644 --- a/llarp/router.cpp +++ b/llarp/router.cpp @@ -1430,6 +1430,20 @@ namespace llarp } else if(StrEq(section, "router")) { + if(StrEq(key, "netid")) + { + if(strlen(val) <= self->_rc.netID.size()) + { + llarp::LogWarn("!!!! you have manually set netid to be '", val, + "' which does not equal '", LLARP_NET_ID, + "' you will run as a different network, good luck and " + "don't forget: something something MUH traffic shape " + "correlation !!!!"); + llarp::NetID::DefaultValue = (const byte_t *)strdup(val); + } + else + llarp::LogError("invalid netid '", val, "', is too long"); + } if(StrEq(key, "nickname")) { self->_rc.SetNick(val); diff --git a/llarp/router_contact.cpp b/llarp/router_contact.cpp index d262d0d7c..a2d3d2cfe 100644 --- a/llarp/router_contact.cpp +++ b/llarp/router_contact.cpp @@ -12,6 +12,8 @@ namespace llarp { + const byte_t *NetID::DefaultValue = (const byte_t *)LLARP_NET_ID; + bool RouterContact::IgnoreBogons = false; #ifdef TESTNET @@ -21,7 +23,7 @@ namespace llarp /// 1 day for real network llarp_time_t RouterContact::Lifetime = 24 * 60 * 60 * 1000; #endif - NetID::NetID() : AlignedBuffer< 8 >((const byte_t *)LLARP_NET_ID) + NetID::NetID() : AlignedBuffer< 8 >(DefaultValue) { } @@ -74,9 +76,8 @@ namespace llarp /* write netid */ if(!bencode_write_bytestring(buf, "i", 1)) return false; - if(!bencode_write_bytestring(buf, netID.data(), netID.size())) + if(!netID.BEncode(buf)) return false; - /* write signing pubkey */ if(!bencode_write_bytestring(buf, "k", 1)) return false; @@ -238,7 +239,7 @@ namespace llarp bool RouterContact::Verify(llarp::Crypto *crypto, llarp_time_t now) const { - if(netID.ToString() != LLARP_NET_ID) + if(netID != NetID()) return false; if(IsExpired(now)) return false; diff --git a/llarp/router_contact.hpp b/llarp/router_contact.hpp index b9d0e5eb1..186eb73d7 100644 --- a/llarp/router_contact.hpp +++ b/llarp/router_contact.hpp @@ -17,6 +17,8 @@ namespace llarp /// NetID struct NetID final : public AlignedBuffer< 8 > { + static const byte_t *DefaultValue; + NetID(); bool diff --git a/llarp/version.hpp b/llarp/version.hpp index 6b4212159..9bb415049 100644 --- a/llarp/version.hpp +++ b/llarp/version.hpp @@ -6,11 +6,11 @@ #endif #ifndef LLARP_VERSION_MIN -#define LLARP_VERSION_MIN "3" +#define LLARP_VERSION_MIN "4" #endif #ifndef LLARP_VERSION_PATCH -#define LLARP_VERSION_PATCH "1" +#define LLARP_VERSION_PATCH "0" #endif #ifndef LLARP_VERSION_NUM diff --git a/motto.txt b/motto.txt index 77b19f65b..19fa2505b 100644 --- a/motto.txt +++ b/motto.txt @@ -1 +1 @@ -kuz yolo +subscribe to pewdiepie diff --git a/test/utp_unittest.cpp b/test/utp_unittest.cpp index 77399b906..48f7c5e2b 100644 --- a/test/utp_unittest.cpp +++ b/test/utp_unittest.cpp @@ -61,7 +61,7 @@ struct UTPTest : public ::testing::Test || (__APPLE__ && __MACH__) return "lo0"; #else - return "lo" + return "lo"; #endif }