iface_reconfigure_lacp(struct iface *iface)
{
struct lacp_slave_settings s;
- int priority;
+ int priority, portid;
+
+ portid = atoi(get_interface_other_config(iface->cfg, "lacp-port-id", "0"));
+ priority = atoi(get_interface_other_config(iface->cfg,
+ "lacp-port-priority", "0"));
+
+ if (portid <= 0 || portid > UINT16_MAX) {
+ portid = iface->dp_ifidx;
+ }
+
+ if (priority <= 0 || priority > UINT16_MAX) {
+ priority = UINT16_MAX;
+ }
s.name = iface->name;
- s.id = iface->dp_ifidx;
- priority = atoi(get_interface_other_config(
- iface->cfg, "lacp-port-priority", "0"));
- s.priority = (priority >= 0 && priority <= UINT16_MAX
- ? priority : UINT16_MAX);
+ s.id = portid;
+ s.priority = priority;
lacp_slave_register(iface->port->lacp, iface, &s);
}
{
static struct lacp_settings s;
struct iface *iface;
+ uint8_t sysid[ETH_ADDR_LEN];
+ const char *sysid_str;
+ const char *lacp_time;
+ long long int custom_time;
int priority;
if (!enable_lacp(port, &s.active)) {
return;
}
+ sysid_str = get_port_other_config(port->cfg, "lacp-system-id", NULL);
+ if (sysid_str && eth_addr_from_string(sysid_str, sysid)) {
+ memcpy(s.id, sysid, ETH_ADDR_LEN);
+ } else {
+ memcpy(s.id, port->bridge->ea, ETH_ADDR_LEN);
+ }
+
s.name = port->name;
- memcpy(s.id, port->bridge->ea, ETH_ADDR_LEN);
/* Prefer bondable links if unspecified. */
priority = atoi(get_port_other_config(port->cfg, "lacp-system-priority",
? priority
: UINT16_MAX - !list_is_short(&port->ifaces));
- s.fast = !strcmp(get_port_other_config(port->cfg, "lacp-time", "slow"),
- "fast");
s.strict = !strcmp(get_port_other_config(port->cfg, "lacp-strict",
"false"),
"true");
+ lacp_time = get_port_other_config(port->cfg, "lacp-time", "slow");
+ custom_time = atoi(lacp_time);
+ if (!strcmp(lacp_time, "fast")) {
+ s.lacp_time = LACP_TIME_FAST;
+ } else if (!strcmp(lacp_time, "slow")) {
+ s.lacp_time = LACP_TIME_SLOW;
+ } else if (custom_time > 0) {
+ s.lacp_time = LACP_TIME_CUSTOM;
+ s.custom_time = custom_time;
+ } else {
+ s.lacp_time = LACP_TIME_SLOW;
+ }
+
if (!port->lacp) {
port->lacp = lacp_create();
}