NetworkConfig.hpp 18 KB

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