Fix a bug in libteam LACP protocol implementation.
According to the LACP standard "LACP daemon must send LACP PDU
packets with updates "when the Actor’s state changes or when it is
apparent from the Partner’s LACPDUs that the Partner does not know
the Actor’s current state."
The current libteam implementation sends periodic updates only, so
in LACP rate slow mode the update will be sent within 30 seconds
which doesn't follow the LACP standard.
To fix the issue:
1. The following patch was reverted:
https://github.com/jpirko/libteam/commit/b2de61b39696c9158e725a691aee5a6f...
2. LACP actor state recalculated before the comparison what the LACP
partner thinks about the LACP actor state.
Signed-off-by: Pavel Shirshov <pavel.contrib(a)gmail.com>
---
teamd/teamd_runner_lacp.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/teamd/teamd_runner_lacp.c b/teamd/teamd_runner_lacp.c
index ec01237..11d02f1 100644
--- a/teamd/teamd_runner_lacp.c
+++ b/teamd/teamd_runner_lacp.c
@@ -996,8 +996,7 @@ static int lacp_port_set_state(struct lacp_port *lacp_port,
return err;
lacp_port_actor_update(lacp_port);
- if (lacp_port->periodic_on)
- return 0;
+
return lacpdu_send(lacp_port);
}
@@ -1110,9 +1109,10 @@ static int lacpdu_recv(struct lacp_port *lacp_port)
if (err)
return err;
+ lacp_port_actor_update(lacp_port);
+
/* Check if the other side has correct info about us */
- if (!lacp_port->periodic_on &&
- memcmp(&lacpdu.partner, &lacp_port->actor,
+ if (memcmp(&lacpdu.partner, &lacp_port->actor,
sizeof(struct lacpdu_info))) {
err = lacpdu_send(lacp_port);
if (err)
--
2.7.4