diff mbox series

teamd_runner_lacp.c : send LACPDU when port state transitions from DEFAULT to CURRENT

Message ID 20181107130915.74516-1-mengkoon@live.com (mailing list archive)
State New
Headers show
Series teamd_runner_lacp.c : send LACPDU when port state transitions from DEFAULT to CURRENT | expand

Commit Message

Meng Koon Lim Nov. 7, 2018, 1: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

This is fixed 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, 1:53 p.m. UTC | #1
Subject: [patch libteam] teamd_runner_lacp.c : send LACPDU when port state transitions from  DEFAULT to CURRENT
                                            ^ space here and double space here ------------^^

Please change to:
Subject: [patch libteam] teamd: lacp: send LACPDU when port state transitions from DEFAULT to CURRENT


Wed, Nov 07, 2018 at 02:09:15PM 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
>
>This is fixed by setting Partner_State field to 0x02 on the local port
>when local port state transitions to DEFAULTED

Please change this sensence to:
Fix this by setting Partner_State field to 0x02 on the local port
when local port state transitions to DEFAULTED.


Thanks
diff mbox series

Patch

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);