jpirko / libteam

team netdevice library
GNU Lesser General Public License v2.1
230 stars 57 forks source link

teamd: lacp: update port state according to partner's sync bit #41

Closed mengkoonlim closed 5 years ago

mengkoonlim commented 5 years ago

1) According to 6.4.12 of IEEE 802.1AX-2008, Figure 6-18, if the partner's sync bit is not set, the lacp port state should be set to EXPIRED.

Function lacpdu_recv() makes the state of the lacp port to PORT_STATE_CURRENT when the teamd receives any valid lacp packet. Fix it by checking the parter's sync bit.

2) According to 6.4.15 of IEEE 802.1AX-2008, Figure 6-22, the state that the port is selected moves MUX state from DETACHED to ATTACHED.

But ATTACHED sate does not mean that the port can send and receive user frames. COLLECTING_DISTRIBUTION state is the sate that the port can send and receive user frames. To move MUX state from ATTACHED to COLLECTING_DISTRIBUTION, the partner state should be sync as well as the port selected.

In function lacp_port_actor_update(), only INFO_STATE_SYNCHRONIZATION should be set to the actor.state when the port is selected. INFO_STATE_COLLECTING and INFO_STATE_DISTRIBUTING should be set to false with ATTACHED mode and set to true when INFO_STATE_SYNCHRONIZATION of partner.state is set.

In function lacp_port_shouldbe{enabled, disabled}(), we also need to check the INFO_STATE_SYNCHRONIZATION bit of partner.state.

Reported-by: Cisco Systems Signed-off-by: Hangbin Liu liuhangbin@gmail.com