Skip to content

Commit ff50762

Browse files
committed
Merge multipath branch into dev branch
2 parents 8eb453e + 29ebda6 commit ff50762

31 files changed

+5001
-1268
lines changed

include/ZeroTierOne.h

+165-34
Original file line numberDiff line numberDiff line change
@@ -415,33 +415,155 @@ enum ZT_ResultCode
415415
*/
416416
#define ZT_ResultCode_isFatal(x) ((((int)(x)) >= 100)&&(((int)(x)) < 1000))
417417

418+
418419
/**
419-
* The multipath algorithm in use by this node.
420+
* Multipath bonding policy
420421
*/
421-
enum ZT_MultipathMode
422+
enum ZT_MultipathBondingPolicy
422423
{
423424
/**
424-
* No active multipath.
425-
*
426-
* Traffic is merely sent over the strongest path. That being
427-
* said, this mode will automatically failover in the event that a link goes down.
425+
* Normal operation. No fault tolerance, no load balancing
428426
*/
429-
ZT_MULTIPATH_NONE = 0,
427+
ZT_BONDING_POLICY_NONE = 0,
430428

431429
/**
432-
* Traffic is randomly distributed among all active paths.
433-
*
434-
* Will cease sending traffic over links that appear to be stale.
430+
* Sends traffic out on only one path at a time. Configurable immediate
431+
* fail-over.
435432
*/
436-
ZT_MULTIPATH_RANDOM = 1,
433+
ZT_BONDING_POLICY_ACTIVE_BACKUP = 1,
437434

438435
/**
439-
* Traffic is allocated across all active paths in proportion to their strength and
440-
* reliability.
441-
*
442-
* Will cease sending traffic over links that appear to be stale.
436+
* Sends traffic out on all paths
437+
*/
438+
ZT_BONDING_POLICY_BROADCAST = 2,
439+
440+
/**
441+
* Stripes packets across all paths
442+
*/
443+
ZT_BONDING_POLICY_BALANCE_RR = 3,
444+
445+
/**
446+
* Packets destined for specific peers will always be sent over the same
447+
* path.
448+
*/
449+
ZT_BONDING_POLICY_BALANCE_XOR = 4,
450+
451+
/**
452+
* Balances flows among all paths according to path performance
453+
*/
454+
ZT_BONDING_POLICY_BALANCE_AWARE = 5
455+
};
456+
457+
/**
458+
* Multipath active re-selection policy (linkSelectMethod)
459+
*/
460+
enum ZT_MultipathLinkSelectMethod
461+
{
462+
/**
463+
* Primary link regains status as active link whenever it comes back up
464+
* (default when links are explicitly specified)
465+
*/
466+
ZT_MULTIPATH_RESELECTION_POLICY_ALWAYS = 0,
467+
468+
/**
469+
* Primary link regains status as active link when it comes back up and
470+
* (if) it is better than the currently-active link.
471+
*/
472+
ZT_MULTIPATH_RESELECTION_POLICY_BETTER = 1,
473+
474+
/**
475+
* Primary link regains status as active link only if the currently-active
476+
* link fails.
477+
*/
478+
ZT_MULTIPATH_RESELECTION_POLICY_FAILURE = 2,
479+
480+
/**
481+
* The primary link can change if a superior path is detected.
482+
* (default if user provides no fail-over guidance)
443483
*/
444-
ZT_MULTIPATH_PROPORTIONALLY_BALANCED = 2,
484+
ZT_MULTIPATH_RESELECTION_POLICY_OPTIMIZE = 3
485+
};
486+
487+
/**
488+
* Mode of multipath link interface
489+
*/
490+
enum ZT_MultipathLinkMode
491+
{
492+
ZT_MULTIPATH_SLAVE_MODE_PRIMARY = 0,
493+
ZT_MULTIPATH_SLAVE_MODE_SPARE = 1
494+
};
495+
496+
/**
497+
* Strategy for path monitoring
498+
*/
499+
enum ZT_MultipathMonitorStrategy
500+
{
501+
/**
502+
* Use bonding policy's default strategy
503+
*/
504+
ZT_MULTIPATH_SLAVE_MONITOR_STRATEGY_DEFAULT = 0,
505+
506+
/**
507+
* Does not actively send probes to judge aliveness, will rely
508+
* on conventional traffic and summary statistics.
509+
*/
510+
ZT_MULTIPATH_SLAVE_MONITOR_STRATEGY_PASSIVE = 1,
511+
512+
/**
513+
* Sends probes at a constant rate to judge aliveness.
514+
*/
515+
ZT_MULTIPATH_SLAVE_MONITOR_STRATEGY_ACTIVE = 2,
516+
517+
/**
518+
* Sends probes at varying rates which correlate to native
519+
* traffic loads to judge aliveness.
520+
*/
521+
ZT_MULTIPATH_SLAVE_MONITOR_STRATEGY_DYNAMIC = 3
522+
};
523+
524+
/**
525+
* Strategy for re-balancing protocol flows
526+
*/
527+
enum ZT_MultipathFlowRebalanceStrategy
528+
{
529+
/**
530+
* Flows will only be re-balanced among links during
531+
* assignment or failover. This minimizes the possibility
532+
* of sequence reordering and is thus the default setting.
533+
*/
534+
ZT_MULTIPATH_FLOW_REBALANCE_STRATEGY_PASSIVE = 0,
535+
536+
/**
537+
* Flows that are active may be re-assigned to a new more
538+
* suitable link if it can be done without disrupting the flow.
539+
* This setting can sometimes cause sequence re-ordering.
540+
*/
541+
ZT_MULTIPATH_FLOW_REBALANCE_STRATEGY_OPPORTUNISTIC = 0,
542+
543+
/**
544+
* Flows will be continuously re-assigned the most suitable link
545+
* in order to maximize "balance". This can often cause sequence
546+
* reordering and is thus only reccomended for protocols like UDP.
547+
*/
548+
ZT_MULTIPATH_FLOW_REBALANCE_STRATEGY_AGGRESSIVE = 2
549+
};
550+
551+
/**
552+
* Indices for the path quality weight vector
553+
*/
554+
enum ZT_MultipathQualityWeightIndex
555+
{
556+
ZT_QOS_LAT_IDX,
557+
ZT_QOS_LTM_IDX,
558+
ZT_QOS_PDV_IDX,
559+
ZT_QOS_PLR_IDX,
560+
ZT_QOS_PER_IDX,
561+
ZT_QOS_THR_IDX,
562+
ZT_QOS_THM_IDX,
563+
ZT_QOS_THV_IDX,
564+
ZT_QOS_AGE_IDX,
565+
ZT_QOS_SCP_IDX,
566+
ZT_QOS_WEIGHT_SIZE
445567
};
446568

447569
/**
@@ -1250,44 +1372,49 @@ typedef struct
12501372
uint64_t trustedPathId;
12511373

12521374
/**
1253-
* One-way latency
1375+
* Mean latency
12541376
*/
1255-
float latency;
1377+
float latencyMean;
12561378

12571379
/**
1258-
* How much latency varies over time
1380+
* Maximum observed latency
12591381
*/
1260-
float packetDelayVariance;
1382+
float latencyMax;
12611383

12621384
/**
1263-
* How much observed throughput varies over time
1385+
* Variance of latency
12641386
*/
1265-
float throughputDisturbCoeff;
1387+
float latencyVariance;
12661388

12671389
/**
1268-
* Packet Error Ratio (PER)
1390+
* Packet loss ratio
1391+
*/
1392+
float packetLossRatio;
1393+
1394+
/**
1395+
* Packet error ratio
12691396
*/
12701397
float packetErrorRatio;
12711398

12721399
/**
1273-
* Packet Loss Ratio (PLR)
1400+
* Mean throughput
12741401
*/
1275-
float packetLossRatio;
1402+
uint64_t throughputMean;
12761403

12771404
/**
1278-
* Stability of the path
1405+
* Maximum observed throughput
12791406
*/
1280-
float stability;
1407+
float throughputMax;
12811408

12821409
/**
1283-
* Current throughput (moving average)
1410+
* Throughput variance
12841411
*/
1285-
uint64_t throughput;
1412+
float throughputVariance;
12861413

12871414
/**
1288-
* Maximum observed throughput for this path
1415+
* Address scope
12891416
*/
1290-
uint64_t maxThroughput;
1417+
uint8_t scope;
12911418

12921419
/**
12931420
* Percentage of traffic allocated to this path
@@ -1297,7 +1424,9 @@ typedef struct
12971424
/**
12981425
* Name of physical interface (for monitoring)
12991426
*/
1300-
char *ifname;
1427+
char ifname[32];
1428+
1429+
uint64_t localSocket;
13011430

13021431
/**
13031432
* Is path expired?
@@ -1351,9 +1480,11 @@ typedef struct
13511480
unsigned int pathCount;
13521481

13531482
/**
1354-
* Whether this peer was ever reachable via an aggregate link
1483+
* Whether multiple paths to this peer are bonded
13551484
*/
1356-
bool hadAggregateLink;
1485+
bool isBonded;
1486+
1487+
int bondingPolicy;
13571488

13581489
/**
13591490
* Known network paths to peer

make-mac.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ mac-agent: FORCE
9999

100100
one: $(CORE_OBJS) $(ONE_OBJS) one.o mac-agent
101101
$(CXX) $(CXXFLAGS) -o zerotier-one $(CORE_OBJS) $(ONE_OBJS) one.o $(LIBS)
102-
$(STRIP) zerotier-one
102+
# $(STRIP) zerotier-one
103103
ln -sf zerotier-one zerotier-idtool
104104
ln -sf zerotier-one zerotier-cli
105105
$(CODESIGN) -f -s $(CODESIGN_APP_CERT) zerotier-one

0 commit comments

Comments
 (0)