diff options
-rw-r--r-- | node/Network.cpp | 4 | ||||
-rw-r--r-- | node/NetworkConfig.hpp | 6 |
2 files changed, 7 insertions, 3 deletions
diff --git a/node/Network.cpp b/node/Network.cpp index f2c14db3..e7b99661 100644 --- a/node/Network.cpp +++ b/node/Network.cpp @@ -186,8 +186,8 @@ int Network::setConfiguration(const void *confBytes,unsigned int confLen,bool sa NetworkConfig newConfig; if (reinterpret_cast<const uint8_t *>(confBytes)[0] == ZT_NETWORKCONFIG_V2_MARKER_BYTE) { - // TODO: deserialize new binary format netconf - return 0; + Buffer<8194> tmp(confBytes,confLen); + newConfig.deserialize(tmp,0); } else { #ifdef ZT_SUPPORT_OLD_STYLE_NETCONF newConfig.fromDictionary(reinterpret_cast<const char *>(confBytes),confLen); // throws if invalid diff --git a/node/NetworkConfig.hpp b/node/NetworkConfig.hpp index 6e91cb9d..73f1e3f2 100644 --- a/node/NetworkConfig.hpp +++ b/node/NetworkConfig.hpp @@ -529,6 +529,8 @@ public: } } + _com.serialize(b); + b.append((uint16_t)0); // extended bytes, currently 0 since unused } @@ -540,7 +542,7 @@ public: unsigned int p = startAt; if (b[p++] != ZT_NETWORKCONFIG_V2_MARKER_BYTE) - throw std::invalid_argument("use fromDictionary() for old style netconf deserialization"); + throw std::invalid_argument("unrecognized format"); if (b.template at<uint16_t>(p) != 0) throw std::invalid_argument("unrecognized version"); p += 2; @@ -660,6 +662,8 @@ public: p += rlen; } + p += _com.deserialize(b,p); + p += b.template at<uint16_t>(p) + 2; return (p - startAt); |