aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHangbin Liu <liuhangbin@gmail.com>2020-05-26 18:59:33 +0800
committerJiri Pirko <jiri@mellanox.com>2020-06-11 14:23:52 +0200
commit5dc1566f446660b5cf4050b81a1ecffbd9d718dc (patch)
tree32e204c85ab5b909a488d2525516a167a4990592
parentbbffa4223299c18e9886e423f80909b560713e5e (diff)
downloadlibteam-5dc1566f446660b5cf4050b81a1ecffbd9d718dc.tar.gz
teamd/lacp: silence ignore none LACP frames
According to 802.3, Annex 43B, section 4, aside from LACP, the Slow Protocol linktype is also to be used by other protocols, like 0x02 for LAMP, 0x03 for OAM. So let's only check LACP frames. For none LACP protocols, just silence ignore. Signed-off-by: Hangbin Liu <liuhangbin@gmail.com> Signed-off-by: Jiri Pirko <jiri@mellanox.com>
-rw-r--r--teamd/teamd_runner_lacp.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/teamd/teamd_runner_lacp.c b/teamd/teamd_runner_lacp.c
index 11d02f1..9437f05 100644
--- a/teamd/teamd_runner_lacp.c
+++ b/teamd/teamd_runner_lacp.c
@@ -97,16 +97,26 @@ static void lacpdu_init(struct lacpdu *lacpdu)
static bool lacpdu_check(struct lacpdu *lacpdu)
{
/*
+ * According to Annex 43B, section 4, aside from LACP, the Slow
+ * Protocol linktype is also to be used by other protocols, like
+ * 0x02 for LAMP, 0x03 for OAM. So for none LACP protocols, just
+ * silence ignore.
+ */
+ if (lacpdu->subtype != 0x01)
+ return false;
+
+ /*
* According to 43.4.12 version_number, tlv_type and reserved fields
* should not be checked.
*/
- if (lacpdu->subtype != 0x01 ||
- lacpdu->actor_info_len != 0x14 ||
+ if (lacpdu->actor_info_len != 0x14 ||
lacpdu->partner_info_len != 0x14 ||
lacpdu->collector_info_len != 0x10 ||
- lacpdu->terminator_info_len != 0x00)
+ lacpdu->terminator_info_len != 0x00) {
+ teamd_log_warn("malformed LACP PDU came.");
return false;
+ }
return true;
}
@@ -1088,10 +1098,8 @@ static int lacpdu_recv(struct lacp_port *lacp_port)
if (!teamd_port_present(lacp_port->ctx, lacp_port->tdport))
return 0;
- if (!lacpdu_check(&lacpdu)) {
- teamd_log_warn("malformed LACP PDU came.");
+ if (!lacpdu_check(&lacpdu))
return 0;
- }
/* Check if we have correct info about the other side */
if (memcmp(&lacpdu.actor, &lacp_port->partner,