diff --git a/libi2pd/RouterInfo.cpp b/libi2pd/RouterInfo.cpp index 4af32f57..eca42e72 100644 --- a/libi2pd/RouterInfo.cpp +++ b/libi2pd/RouterInfo.cpp @@ -307,13 +307,16 @@ namespace data } else if (key == "v") { - if (value == "2") + if (value.size () == 1 && value[0] >= '2' && value[0] <= '5') // only 2,3,4,5 allowed + { + address->v = value[0] - '0'; isV2 = true; - else + } + else { LogPrint (eLogWarning, "RouterInfo: Unexpected value ", value, " for v"); address->transportStyle = eTransportUnknown; // invalid address - } + } } else if (key[0] == 'i') { @@ -1437,7 +1440,7 @@ namespace data WriteString ("s", properties); properties << '='; WriteString (address.s.ToBase64 (), properties); properties << ';'; WriteString ("v", properties); properties << '='; - WriteString ("2", properties); properties << ';'; + WriteString (std::to_string(address.v), properties); properties << ';'; } uint16_t size = htobe16 (properties.str ().size ()); diff --git a/libi2pd/RouterInfo.h b/libi2pd/RouterInfo.h index cb3ae499..f4687054 100644 --- a/libi2pd/RouterInfo.h +++ b/libi2pd/RouterInfo.h @@ -151,6 +151,7 @@ namespace data TransportStyle transportStyle; boost::asio::ip::address host; Tag<32> s, i; // keys, i is first 16 bytes for NTCP2 and 32 bytes intro key for SSU + int v = 2; // version int port; uint64_t date; uint8_t caps;