teamd: lacp: send LACPDU when port state transitions from DEFAULT to CURRENT
diff mbox series

Message ID 20181107150917.80542-1-mengkoon@live.com
State New
Headers show
Series
  • teamd: lacp: send LACPDU when port state transitions from DEFAULT to CURRENT
Related show

Commit Message

Meng Koon Lim Nov. 7, 2018, 3:09 p.m. UTC
Currently, when local port state become DEFAULTED, its Partner_State
field is set to 0x00

Bit 1 in Actor_State and Partner_State field is for LACP_Timeout. When
set, it means LACP fast is used.

If teamd_runner_lacp receives an LACPDU with Actor_State field bit 1
set, it transitions local port to CURRENT, and transmits LACPDU

If teamd_runner_lacp receives an LACPDU without Actor_State field bit 1
set, it transitions local port to CURRENT, but does not transmit LACPDU

The second scenario results in teamd starting data transmission when
partner port remains in either Defaulted or Expired state, causing
packets to be dropped by partner

Fix this by setting Partner_State field to 0x02 on the local port
when local port state transitions to DEFAULTED

Signed-off-by: Meng Koon Lim <mengkoon@live.com>
---
 teamd/teamd_runner_lacp.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Jiri Pirko Nov. 7, 2018, 3:22 p.m. UTC | #1
Wed, Nov 07, 2018 at 04:09:17PM CET, mengkoon@live.com wrote:
>Currently, when local port state become DEFAULTED, its Partner_State
>field is set to 0x00
>
>Bit 1 in Actor_State and Partner_State field is for LACP_Timeout. When
>set, it means LACP fast is used.
>
>If teamd_runner_lacp receives an LACPDU with Actor_State field bit 1
>set, it transitions local port to CURRENT, and transmits LACPDU
>
>If teamd_runner_lacp receives an LACPDU without Actor_State field bit 1
>set, it transitions local port to CURRENT, but does not transmit LACPDU
>
>The second scenario results in teamd starting data transmission when
>partner port remains in either Defaulted or Expired state, causing
>packets to be dropped by partner
>
>Fix this by setting Partner_State field to 0x02 on the local port
>when local port state transitions to DEFAULTED
>
>Signed-off-by: Meng Koon Lim <mengkoon@live.com>

applied, thanks.

Patch
diff mbox series

diff --git a/teamd/teamd_runner_lacp.c b/teamd/teamd_runner_lacp.c
index 7b8f0a7..555aa06 100644
--- a/teamd/teamd_runner_lacp.c
+++ b/teamd/teamd_runner_lacp.c
@@ -965,7 +965,12 @@  static int lacp_port_set_state(struct lacp_port *lacp_port,
 	case PORT_STATE_DEFAULTED:
 		teamd_loop_callback_disable(lacp_port->ctx,
 					    LACP_TIMEOUT_CB_NAME, lacp_port);
-		/* fall through */
+		memset(&lacp_port->partner, 0, sizeof(lacp_port->partner));
+		lacp_port->partner.state |= INFO_STATE_LACP_TIMEOUT;
+		err = lacp_port_partner_update(lacp_port);
+		if (err)
+			return err;
+		break;
 	case PORT_STATE_DISABLED:
 		memset(&lacp_port->partner, 0, sizeof(lacp_port->partner));
 		err = lacp_port_partner_update(lacp_port);