NetworkConfig.hpp 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692
  1. /*
  2. * Copyright (c)2019 ZeroTier, Inc.
  3. *
  4. * Use of this software is governed by the Business Source License included
  5. * in the LICENSE.TXT file in the project's root directory.
  6. *
  7. * Change Date: 2026-01-01
  8. *
  9. * On the date above, in accordance with the Business Source License, use
  10. * of this software will be governed by version 2.0 of the Apache License.
  11. */
  12. /****/
  13. #ifndef ZT_NETWORKCONFIG_HPP
  14. #define ZT_NETWORKCONFIG_HPP
  15. #include "../include/ZeroTierOne.h"
  16. #include "Address.hpp"
  17. #include "Capability.hpp"
  18. #include "CertificateOfMembership.hpp"
  19. #include "CertificateOfOwnership.hpp"
  20. #include "Dictionary.hpp"
  21. #include "Hashtable.hpp"
  22. #include "InetAddress.hpp"
  23. #include "Tag.hpp"
  24. #include "Trace.hpp"
  25. #include <stdint.h>
  26. #include <stdlib.h>
  27. #include <string.h>
  28. #include <vector>
  29. /**
  30. * Default time delta for COMs, tags, and capabilities
  31. */
  32. #define ZT_NETWORKCONFIG_DEFAULT_CREDENTIAL_TIME_DFL_MAX_DELTA ((int64_t)(1000 * 60 * 30))
  33. /**
  34. * Maximum time delta for COMs, tags, and capabilities
  35. */
  36. #define ZT_NETWORKCONFIG_DEFAULT_CREDENTIAL_TIME_MAX_MAX_DELTA ((int64_t)(1000 * 60 * 60 * 2))
  37. /**
  38. * Minimum credential TTL and maxDelta for COM timestamps
  39. */
  40. #define ZT_NETWORKCONFIG_DEFAULT_CREDENTIAL_TIME_MIN_MAX_DELTA ((int64_t)(1000 * 60 * 5))
  41. /**
  42. * Flag: enable broadcast
  43. */
  44. #define ZT_NETWORKCONFIG_FLAG_ENABLE_BROADCAST 0x0000000000000002ULL
  45. /**
  46. * Flag: enable IPv6 NDP emulation for certain V6 address patterns
  47. */
  48. #define ZT_NETWORKCONFIG_FLAG_ENABLE_IPV6_NDP_EMULATION 0x0000000000000004ULL
  49. /**
  50. * Flag: result of unrecognized MATCH entries in a rules table: match if set, no-match if clear
  51. */
  52. #define ZT_NETWORKCONFIG_FLAG_RULES_RESULT_OF_UNSUPPORTED_MATCH 0x0000000000000008ULL
  53. /**
  54. * Flag: disable frame compression
  55. */
  56. #define ZT_NETWORKCONFIG_FLAG_DISABLE_COMPRESSION 0x0000000000000010ULL
  57. /**
  58. * Device can bridge to other Ethernet networks and gets unknown recipient multicasts
  59. */
  60. #define ZT_NETWORKCONFIG_SPECIALIST_TYPE_ACTIVE_BRIDGE 0x0000020000000000ULL
  61. /**
  62. * Designated multicast replicators replicate multicast in place of sender-side replication
  63. *
  64. * This is currently not really used.
  65. */
  66. #define ZT_NETWORKCONFIG_SPECIALIST_TYPE_MULTICAST_REPLICATOR 0x0000080000000000ULL
  67. /**
  68. * Designated per-network relays
  69. */
  70. #define ZT_NETWORKCONFIG_SPECIALIST_TYPE_NETWORK_RELAY 0x0000100000000000ULL
  71. namespace ZeroTier {
  72. // Dictionary capacity needed for max size network config
  73. #define ZT_NETWORKCONFIG_DICT_CAPACITY \
  74. (4096 + (sizeof(ZT_VirtualNetworkConfig)) + (sizeof(ZT_VirtualNetworkRule) * ZT_MAX_NETWORK_RULES) + (sizeof(Capability) * ZT_MAX_NETWORK_CAPABILITIES) + (sizeof(Tag) * ZT_MAX_NETWORK_TAGS) \
  75. + (sizeof(CertificateOfOwnership) * ZT_MAX_CERTIFICATES_OF_OWNERSHIP))
  76. // Dictionary capacity needed for max size network meta-data
  77. #define ZT_NETWORKCONFIG_METADATA_DICT_CAPACITY 1024
  78. // Network config version
  79. #define ZT_NETWORKCONFIG_VERSION 7
  80. // Fields for meta-data sent with network config requests
  81. // Network config version
  82. #define ZT_NETWORKCONFIG_REQUEST_METADATA_KEY_VERSION "v"
  83. // Network config version
  84. #define ZT_NETWORKCONFIG_REQUEST_METADATA_KEY_OS_ARCH "o"
  85. // Protocol version (see Packet.hpp)
  86. #define ZT_NETWORKCONFIG_REQUEST_METADATA_KEY_PROTOCOL_VERSION "pv"
  87. // Software vendor
  88. #define ZT_NETWORKCONFIG_REQUEST_METADATA_KEY_NODE_VENDOR "vend"
  89. // Software major version
  90. #define ZT_NETWORKCONFIG_REQUEST_METADATA_KEY_NODE_MAJOR_VERSION "majv"
  91. // Software minor version
  92. #define ZT_NETWORKCONFIG_REQUEST_METADATA_KEY_NODE_MINOR_VERSION "minv"
  93. // Software revision
  94. #define ZT_NETWORKCONFIG_REQUEST_METADATA_KEY_NODE_REVISION "revv"
  95. // Rules engine revision
  96. #define ZT_NETWORKCONFIG_REQUEST_METADATA_KEY_RULES_ENGINE_REV "revr"
  97. // Maximum number of rules per network this node can accept
  98. #define ZT_NETWORKCONFIG_REQUEST_METADATA_KEY_MAX_NETWORK_RULES "mr"
  99. // Maximum number of capabilities this node can accept
  100. #define ZT_NETWORKCONFIG_REQUEST_METADATA_KEY_MAX_NETWORK_CAPABILITIES "mc"
  101. // Maximum number of rules per capability this node can accept
  102. #define ZT_NETWORKCONFIG_REQUEST_METADATA_KEY_MAX_CAPABILITY_RULES "mcr"
  103. // Maximum number of tags this node can accept
  104. #define ZT_NETWORKCONFIG_REQUEST_METADATA_KEY_MAX_NETWORK_TAGS "mt"
  105. // Network join authorization token (if any)
  106. #define ZT_NETWORKCONFIG_REQUEST_METADATA_KEY_AUTH "a"
  107. // Network configuration meta-data flags
  108. #define ZT_NETWORKCONFIG_REQUEST_METADATA_KEY_FLAGS "f"
  109. // These dictionary keys are short so they don't take up much room.
  110. // By convention we use upper case for binary blobs, but it doesn't really matter.
  111. // network config version
  112. #define ZT_NETWORKCONFIG_DICT_KEY_VERSION "v"
  113. // network ID
  114. #define ZT_NETWORKCONFIG_DICT_KEY_NETWORK_ID "nwid"
  115. // integer(hex)
  116. #define ZT_NETWORKCONFIG_DICT_KEY_TIMESTAMP "ts"
  117. // integer(hex)
  118. #define ZT_NETWORKCONFIG_DICT_KEY_REVISION "r"
  119. // address of member
  120. #define ZT_NETWORKCONFIG_DICT_KEY_ISSUED_TO "id"
  121. // remote trace target
  122. #define ZT_NETWORKCONFIG_DICT_KEY_REMOTE_TRACE_TARGET "tt"
  123. // remote trace level
  124. #define ZT_NETWORKCONFIG_DICT_KEY_REMOTE_TRACE_LEVEL "tl"
  125. // flags(hex)
  126. #define ZT_NETWORKCONFIG_DICT_KEY_FLAGS "f"
  127. // integer(hex)
  128. #define ZT_NETWORKCONFIG_DICT_KEY_MULTICAST_LIMIT "ml"
  129. // network type (hex)
  130. #define ZT_NETWORKCONFIG_DICT_KEY_TYPE "t"
  131. // text
  132. #define ZT_NETWORKCONFIG_DICT_KEY_NAME "n"
  133. // network MTU
  134. #define ZT_NETWORKCONFIG_DICT_KEY_MTU "mtu"
  135. // credential time max delta in ms
  136. #define ZT_NETWORKCONFIG_DICT_KEY_CREDENTIAL_TIME_MAX_DELTA "ctmd"
  137. // binary serialized certificate of membership
  138. #define ZT_NETWORKCONFIG_DICT_KEY_COM "C"
  139. // specialists (binary array of uint64_t)
  140. #define ZT_NETWORKCONFIG_DICT_KEY_SPECIALISTS "S"
  141. // routes (binary blob)
  142. #define ZT_NETWORKCONFIG_DICT_KEY_ROUTES "RT"
  143. // static IPs (binary blob)
  144. #define ZT_NETWORKCONFIG_DICT_KEY_STATIC_IPS "I"
  145. // rules (binary blob)
  146. #define ZT_NETWORKCONFIG_DICT_KEY_RULES "R"
  147. // capabilities (binary blobs)
  148. #define ZT_NETWORKCONFIG_DICT_KEY_CAPABILITIES "CAP"
  149. // tags (binary blobs)
  150. #define ZT_NETWORKCONFIG_DICT_KEY_TAGS "TAG"
  151. // tags (binary blobs)
  152. #define ZT_NETWORKCONFIG_DICT_KEY_CERTIFICATES_OF_OWNERSHIP "COO"
  153. // dns (binary blobs)
  154. #define ZT_NETWORKCONFIG_DICT_KEY_DNS "DNS"
  155. // sso enabled
  156. #define ZT_NETWORKCONFIG_DICT_KEY_SSO_ENABLED "ssoe"
  157. // so version
  158. #define ZT_NETWORKCONFIG_DICT_KEY_SSO_VERSION "ssov"
  159. // authentication URL
  160. #define ZT_NETWORKCONFIG_DICT_KEY_AUTHENTICATION_URL "aurl"
  161. // authentication expiry
  162. #define ZT_NETWORKCONFIG_DICT_KEY_AUTHENTICATION_EXPIRY_TIME "aexpt"
  163. // oidc issuer URL
  164. #define ZT_NETWORKCONFIG_DICT_KEY_ISSUER_URL "iurl"
  165. // central endpoint
  166. #define ZT_NETWORKCONFIG_DICT_KEY_CENTRAL_ENDPOINT_URL "ssoce"
  167. // nonce
  168. #define ZT_NETWORKCONFIG_DICT_KEY_NONCE "sson"
  169. // state
  170. #define ZT_NETWORKCONFIG_DICT_KEY_STATE "ssos"
  171. // client ID
  172. #define ZT_NETWORKCONFIG_DICT_KEY_CLIENT_ID "ssocid"
  173. // SSO Provider
  174. #define ZT_NETWORKCONFIG_DICT_KEY_SSO_PROVIDER "ssop"
  175. // AuthInfo fields -- used by ncSendError for sso
  176. // AuthInfo Version
  177. #define ZT_AUTHINFO_DICT_KEY_VERSION "aV"
  178. // authentication URL
  179. #define ZT_AUTHINFO_DICT_KEY_AUTHENTICATION_URL "aU"
  180. // issuer URL
  181. #define ZT_AUTHINFO_DICT_KEY_ISSUER_URL "iU"
  182. // Central endpoint URL
  183. #define ZT_AUTHINFO_DICT_KEY_CENTRAL_ENDPOINT_URL "aCU"
  184. // Nonce
  185. #define ZT_AUTHINFO_DICT_KEY_NONCE "aN"
  186. // State
  187. #define ZT_AUTHINFO_DICT_KEY_STATE "aS"
  188. // Client ID
  189. #define ZT_AUTHINFO_DICT_KEY_CLIENT_ID "aCID"
  190. // SSO Provider
  191. #define ZT_AUTHINFO_DICT_KEY_SSO_PROVIDER "aSSOp"
  192. // Legacy fields -- these are obsoleted but are included when older clients query
  193. // boolean (now a flag)
  194. #define ZT_NETWORKCONFIG_DICT_KEY_ENABLE_BROADCAST_OLD "eb"
  195. // IP/bits[,IP/bits,...]
  196. // Note that IPs that end in all zeroes are routes with no assignment in them.
  197. #define ZT_NETWORKCONFIG_DICT_KEY_IPV4_STATIC_OLD "v4s"
  198. // IP/bits[,IP/bits,...]
  199. // Note that IPs that end in all zeroes are routes with no assignment in them.
  200. #define ZT_NETWORKCONFIG_DICT_KEY_IPV6_STATIC_OLD "v6s"
  201. // 0/1
  202. #define ZT_NETWORKCONFIG_DICT_KEY_PRIVATE_OLD "p"
  203. // integer(hex)[,integer(hex),...]
  204. #define ZT_NETWORKCONFIG_DICT_KEY_ALLOWED_ETHERNET_TYPES_OLD "et"
  205. // string-serialized CertificateOfMembership
  206. #define ZT_NETWORKCONFIG_DICT_KEY_CERTIFICATE_OF_MEMBERSHIP_OLD "com"
  207. // node[,node,...]
  208. #define ZT_NETWORKCONFIG_DICT_KEY_ACTIVE_BRIDGES_OLD "ab"
  209. // node;IP/port[,node;IP/port]
  210. #define ZT_NETWORKCONFIG_DICT_KEY_RELAYS_OLD "rl"
  211. // End legacy fields
  212. /**
  213. * Network configuration received from network controller nodes
  214. *
  215. * This is a memcpy()'able structure and is safe (in a crash sense) to modify
  216. * without locks.
  217. */
  218. class NetworkConfig {
  219. public:
  220. NetworkConfig();
  221. /**
  222. * Write this network config to a dictionary for transport
  223. *
  224. * @param d Dictionary
  225. * @param includeLegacy If true, include legacy fields for old node versions
  226. * @return True if dictionary was successfully created, false if e.g. overflow
  227. */
  228. bool toDictionary(Dictionary<ZT_NETWORKCONFIG_DICT_CAPACITY>& d, bool includeLegacy) const;
  229. /**
  230. * Read this network config from a dictionary
  231. *
  232. * @param d Dictionary (non-const since it might be modified during parse, should not be used after call)
  233. * @return True if dictionary was valid and network config successfully initialized
  234. */
  235. bool fromDictionary(const Dictionary<ZT_NETWORKCONFIG_DICT_CAPACITY>& d);
  236. /**
  237. * @return True if broadcast (ff:ff:ff:ff:ff:ff) address should work on this network
  238. */
  239. inline bool enableBroadcast() const
  240. {
  241. return ((this->flags & ZT_NETWORKCONFIG_FLAG_ENABLE_BROADCAST) != 0);
  242. }
  243. /**
  244. * @return True if IPv6 NDP emulation should be allowed for certain "magic" IPv6 address patterns
  245. */
  246. inline bool ndpEmulation() const
  247. {
  248. return ((this->flags & ZT_NETWORKCONFIG_FLAG_ENABLE_IPV6_NDP_EMULATION) != 0);
  249. }
  250. /**
  251. * @return True if frames should not be compressed
  252. */
  253. inline bool disableCompression() const
  254. {
  255. #ifndef ZT_DISABLE_COMPRESSION
  256. return ((this->flags & ZT_NETWORKCONFIG_FLAG_DISABLE_COMPRESSION) != 0);
  257. #else
  258. /* Compression is disabled for libzt builds since it causes non-obvious chaotic
  259. interference with lwIP's TCP congestion algorithm. Compression is also disabled
  260. for some NAS builds due to the usage of low-performance processors in certain
  261. older and budget models. */
  262. return false;
  263. #endif
  264. }
  265. /**
  266. * @return Network type is public (no access control)
  267. */
  268. inline bool isPublic() const
  269. {
  270. return (this->type == ZT_NETWORK_TYPE_PUBLIC);
  271. }
  272. /**
  273. * @return Network type is private (certificate access control)
  274. */
  275. inline bool isPrivate() const
  276. {
  277. return (this->type == ZT_NETWORK_TYPE_PRIVATE);
  278. }
  279. /**
  280. * @return ZeroTier addresses of devices on this network designated as active bridges
  281. */
  282. inline std::vector<Address> activeBridges() const
  283. {
  284. std::vector<Address> r;
  285. for (unsigned int i = 0; i < specialistCount; ++i) {
  286. if ((specialists[i] & ZT_NETWORKCONFIG_SPECIALIST_TYPE_ACTIVE_BRIDGE) != 0) {
  287. r.push_back(Address(specialists[i]));
  288. }
  289. }
  290. return r;
  291. }
  292. inline unsigned int activeBridges(Address ab[ZT_MAX_NETWORK_SPECIALISTS]) const
  293. {
  294. unsigned int c = 0;
  295. for (unsigned int i = 0; i < specialistCount; ++i) {
  296. if ((specialists[i] & ZT_NETWORKCONFIG_SPECIALIST_TYPE_ACTIVE_BRIDGE) != 0) {
  297. ab[c++] = specialists[i];
  298. }
  299. }
  300. return c;
  301. }
  302. inline bool isActiveBridge(const Address& a) const
  303. {
  304. for (unsigned int i = 0; i < specialistCount; ++i) {
  305. if (((specialists[i] & ZT_NETWORKCONFIG_SPECIALIST_TYPE_ACTIVE_BRIDGE) != 0) && (a == specialists[i])) {
  306. return true;
  307. }
  308. }
  309. return false;
  310. }
  311. inline std::vector<Address> multicastReplicators() const
  312. {
  313. std::vector<Address> r;
  314. for (unsigned int i = 0; i < specialistCount; ++i) {
  315. if ((specialists[i] & ZT_NETWORKCONFIG_SPECIALIST_TYPE_MULTICAST_REPLICATOR) != 0) {
  316. r.push_back(Address(specialists[i]));
  317. }
  318. }
  319. return r;
  320. }
  321. inline unsigned int multicastReplicators(Address mr[ZT_MAX_NETWORK_SPECIALISTS]) const
  322. {
  323. unsigned int c = 0;
  324. for (unsigned int i = 0; i < specialistCount; ++i) {
  325. if ((specialists[i] & ZT_NETWORKCONFIG_SPECIALIST_TYPE_MULTICAST_REPLICATOR) != 0) {
  326. mr[c++] = specialists[i];
  327. }
  328. }
  329. return c;
  330. }
  331. inline bool isMulticastReplicator(const Address& a) const
  332. {
  333. for (unsigned int i = 0; i < specialistCount; ++i) {
  334. if (((specialists[i] & ZT_NETWORKCONFIG_SPECIALIST_TYPE_MULTICAST_REPLICATOR) != 0) && (a == specialists[i])) {
  335. return true;
  336. }
  337. }
  338. return false;
  339. }
  340. inline std::vector<Address> alwaysContactAddresses() const
  341. {
  342. std::vector<Address> r;
  343. for (unsigned int i = 0; i < specialistCount; ++i) {
  344. if ((specialists[i] & (ZT_NETWORKCONFIG_SPECIALIST_TYPE_NETWORK_RELAY | ZT_NETWORKCONFIG_SPECIALIST_TYPE_MULTICAST_REPLICATOR)) != 0) {
  345. r.push_back(Address(specialists[i]));
  346. }
  347. }
  348. return r;
  349. }
  350. inline unsigned int alwaysContactAddresses(Address ac[ZT_MAX_NETWORK_SPECIALISTS]) const
  351. {
  352. unsigned int c = 0;
  353. for (unsigned int i = 0; i < specialistCount; ++i) {
  354. if ((specialists[i] & (ZT_NETWORKCONFIG_SPECIALIST_TYPE_NETWORK_RELAY | ZT_NETWORKCONFIG_SPECIALIST_TYPE_MULTICAST_REPLICATOR)) != 0) {
  355. ac[c++] = specialists[i];
  356. }
  357. }
  358. return c;
  359. }
  360. inline void alwaysContactAddresses(Hashtable<Address, std::vector<InetAddress> >& a) const
  361. {
  362. for (unsigned int i = 0; i < specialistCount; ++i) {
  363. if ((specialists[i] & (ZT_NETWORKCONFIG_SPECIALIST_TYPE_NETWORK_RELAY | ZT_NETWORKCONFIG_SPECIALIST_TYPE_MULTICAST_REPLICATOR)) != 0) {
  364. a[Address(specialists[i])];
  365. }
  366. }
  367. }
  368. /**
  369. * @param fromPeer Peer attempting to bridge other Ethernet peers onto network
  370. * @return True if this network allows bridging
  371. */
  372. inline bool permitsBridging(const Address& fromPeer) const
  373. {
  374. for (unsigned int i = 0; i < specialistCount; ++i) {
  375. if ((fromPeer == specialists[i]) && ((specialists[i] & ZT_NETWORKCONFIG_SPECIALIST_TYPE_ACTIVE_BRIDGE) != 0)) {
  376. return true;
  377. }
  378. }
  379. return false;
  380. }
  381. inline operator bool() const
  382. {
  383. return (networkId != 0);
  384. }
  385. inline bool operator==(const NetworkConfig& nc) const
  386. {
  387. return (memcmp(this, &nc, sizeof(NetworkConfig)) == 0);
  388. }
  389. inline bool operator!=(const NetworkConfig& nc) const
  390. {
  391. return (! (*this == nc));
  392. }
  393. /**
  394. * Add a specialist or mask flags if already present
  395. *
  396. * This masks the existing flags if the specialist is already here or adds
  397. * it otherwise.
  398. *
  399. * @param a Address of specialist
  400. * @param f Flags (OR of specialist role/type flags)
  401. * @return True if successfully masked or added
  402. */
  403. inline bool addSpecialist(const Address& a, const uint64_t f)
  404. {
  405. const uint64_t aint = a.toInt();
  406. for (unsigned int i = 0; i < specialistCount; ++i) {
  407. if ((specialists[i] & 0xffffffffffULL) == aint) {
  408. specialists[i] |= f;
  409. return true;
  410. }
  411. }
  412. if (specialistCount < ZT_MAX_NETWORK_SPECIALISTS) {
  413. specialists[specialistCount++] = f | aint;
  414. return true;
  415. }
  416. return false;
  417. }
  418. const Capability* capability(const uint32_t id) const
  419. {
  420. for (unsigned int i = 0; i < capabilityCount; ++i) {
  421. if (capabilities[i].id() == id) {
  422. return &(capabilities[i]);
  423. }
  424. }
  425. return (Capability*)0;
  426. }
  427. const Tag* tag(const uint32_t id) const
  428. {
  429. for (unsigned int i = 0; i < tagCount; ++i) {
  430. if (tags[i].id() == id) {
  431. return &(tags[i]);
  432. }
  433. }
  434. return (Tag*)0;
  435. }
  436. /**
  437. * Network ID that this configuration applies to
  438. */
  439. uint64_t networkId;
  440. /**
  441. * Controller-side time of config generation/issue
  442. */
  443. int64_t timestamp;
  444. /**
  445. * Max difference between timestamp and tag/capability timestamp
  446. */
  447. int64_t credentialTimeMaxDelta;
  448. /**
  449. * Controller-side revision counter for this configuration
  450. */
  451. uint64_t revision;
  452. /**
  453. * Address of device to which this config is issued
  454. */
  455. Address issuedTo;
  456. /**
  457. * If non-NULL, remote traces related to this network are sent here
  458. */
  459. Address remoteTraceTarget;
  460. /**
  461. * Flags (64-bit)
  462. */
  463. uint64_t flags;
  464. /**
  465. * Remote trace level
  466. */
  467. Trace::Level remoteTraceLevel;
  468. /**
  469. * Network MTU
  470. */
  471. unsigned int mtu;
  472. /**
  473. * Maximum number of recipients per multicast (not including active bridges)
  474. */
  475. unsigned int multicastLimit;
  476. /**
  477. * Number of specialists
  478. */
  479. unsigned int specialistCount;
  480. /**
  481. * Number of routes
  482. */
  483. unsigned int routeCount;
  484. /**
  485. * Number of ZT-managed static IP assignments
  486. */
  487. unsigned int staticIpCount;
  488. /**
  489. * Number of rule table entries
  490. */
  491. unsigned int ruleCount;
  492. /**
  493. * Number of capabilities
  494. */
  495. unsigned int capabilityCount;
  496. /**
  497. * Number of tags
  498. */
  499. unsigned int tagCount;
  500. /**
  501. * Number of certificates of ownership
  502. */
  503. unsigned int certificateOfOwnershipCount;
  504. /**
  505. * Specialist devices
  506. *
  507. * For each entry the least significant 40 bits are the device's ZeroTier
  508. * address and the most significant 24 bits are flags indicating its role.
  509. */
  510. uint64_t specialists[ZT_MAX_NETWORK_SPECIALISTS];
  511. /**
  512. * Statically defined "pushed" routes (including default gateways)
  513. */
  514. ZT_VirtualNetworkRoute routes[ZT_MAX_NETWORK_ROUTES];
  515. /**
  516. * Static IP assignments
  517. */
  518. InetAddress staticIps[ZT_MAX_ZT_ASSIGNED_ADDRESSES];
  519. /**
  520. * Base network rules
  521. */
  522. ZT_VirtualNetworkRule rules[ZT_MAX_NETWORK_RULES];
  523. /**
  524. * Capabilities for this node on this network, in ascending order of capability ID
  525. */
  526. Capability capabilities[ZT_MAX_NETWORK_CAPABILITIES];
  527. /**
  528. * Tags for this node on this network, in ascending order of tag ID
  529. */
  530. Tag tags[ZT_MAX_NETWORK_TAGS];
  531. /**
  532. * Certificates of ownership for this network member
  533. */
  534. CertificateOfOwnership certificatesOfOwnership[ZT_MAX_CERTIFICATES_OF_OWNERSHIP];
  535. /**
  536. * Network type (currently just public or private)
  537. */
  538. ZT_VirtualNetworkType type;
  539. /**
  540. * Network short name or empty string if not defined
  541. */
  542. char name[ZT_MAX_NETWORK_SHORT_NAME_LENGTH + 1];
  543. /**
  544. * Certificate of membership (for private networks)
  545. */
  546. CertificateOfMembership com;
  547. /**
  548. * Number of ZT-pushed DNS configurations
  549. */
  550. unsigned int dnsCount;
  551. /**
  552. * ZT pushed DNS configuration
  553. */
  554. ZT_VirtualNetworkDNS dns;
  555. /**
  556. * SSO enabled flag.
  557. */
  558. bool ssoEnabled;
  559. /**
  560. * SSO version
  561. */
  562. uint64_t ssoVersion;
  563. /**
  564. * Authentication URL if authentication is required
  565. */
  566. char authenticationURL[2048];
  567. /**
  568. * Time current authentication expires or 0 if external authentication is disabled
  569. *
  570. * Not used if authVersion >= 1
  571. */
  572. uint64_t authenticationExpiryTime;
  573. /**
  574. * OIDC issuer URL
  575. */
  576. char issuerURL[2048];
  577. /**
  578. * central base URL.
  579. */
  580. char centralAuthURL[2048];
  581. /**
  582. * sso nonce
  583. */
  584. char ssoNonce[128];
  585. /**
  586. * sso state
  587. */
  588. char ssoState[256];
  589. /**
  590. * oidc client id
  591. */
  592. char ssoClientID[256];
  593. /**
  594. * oidc provider
  595. *
  596. * because certain providers require specific scopes to be requested
  597. * and others to be not requested in order to make everything work
  598. * correctly
  599. **/
  600. char ssoProvider[64];
  601. };
  602. } // namespace ZeroTier
  603. #endif