Merge pull request #2491 from zerotier/fix/standardize-linkSelectMethod-naming

fix: standardize bond link selection method JSON field naming
This commit is contained in:
Joseph Henry 2025-07-29 10:29:30 -07:00 committed by GitHub
commit a8ead37312
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2612,7 +2612,17 @@ class OneServiceImpl : public OneService {
} }
_node->bondController()->addCustomLink(customPolicyStr, new Link(linkNameStr, ipvPref, mtu, capacity, enabled, linkMode, failoverToStr)); _node->bondController()->addCustomLink(customPolicyStr, new Link(linkNameStr, ipvPref, mtu, capacity, enabled, linkMode, failoverToStr));
} }
std::string linkSelectMethodStr(OSUtils::jsonString(customPolicy["activeReselect"], "always")); // Check for new field name first, fall back to legacy field name for backward compatibility
std::string linkSelectMethodStr;
if (customPolicy.contains("linkSelectMethod")) {
linkSelectMethodStr = OSUtils::jsonString(customPolicy["linkSelectMethod"], "always");
} else {
linkSelectMethodStr = OSUtils::jsonString(customPolicy["activeReselect"], "always");
if (customPolicy.contains("activeReselect")) {
fprintf(stderr, "warning: 'activeReselect' is deprecated, please use 'linkSelectMethod' instead in policy '%s'\n", customPolicyStr.c_str());
}
}
if (linkSelectMethodStr == "always") { if (linkSelectMethodStr == "always") {
newTemplateBond->setLinkSelectMethod(ZT_BOND_RESELECTION_POLICY_ALWAYS); newTemplateBond->setLinkSelectMethod(ZT_BOND_RESELECTION_POLICY_ALWAYS);
} }