From ff7a21292914fe184a92e04eebdaea2ccadd4629 Mon Sep 17 00:00:00 2001 From: John Fastabend Date: Wed, 6 Apr 2011 08:47:53 -0700 Subject: [PATCH 41/51] lldpad: DCBx should not free TLV type 0 The DCBx module is free'ing the type 0 TLV. This is not valid for two reasons. First the rchange() ops does not return TLV_OK indicating the module has consumed the TLV. And two the type 0 TLV should be handled by all modules to indicate the end of a lldpdu. Signed-off-by: John Fastabend Signed-off-by: Petr Sabata --- lldp_dcbx.c | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lldp_dcbx.c b/lldp_dcbx.c index 4227296..02c07f3 100644 --- a/lldp_dcbx.c +++ b/lldp_dcbx.c @@ -645,9 +645,11 @@ int dcbx_rchange(struct port *port, struct unpacked_tlv *tlv) (tlv->info[DCB_OUI_LEN] == dcbx_subtype2)) { port->lldpdu |= RCVD_LLDP_DCBX2_TLV; dcbx->manifest->dcbx2 = tlv; + return TLV_OK; } else if (tlv->info[DCB_OUI_LEN] == dcbx_subtype1) { port->lldpdu |= RCVD_LLDP_DCBX1_TLV; dcbx->manifest->dcbx1 = tlv; + return TLV_OK; } else { /* not a DCBX subtype we support */ return SUBTYPE_INVALID; @@ -678,12 +680,14 @@ int dcbx_rchange(struct port *port, struct unpacked_tlv *tlv) mibUpdateObjects(port); } - free_unpkd_tlv(tlv); clear_dcbx_manifest(dcbx); - dcbx->dcbdu = 0; } - return TLV_OK; + /* TLV is not handled by DCBx module return invalid to + * indicate lldpad core should continue to look for + * a module to handle this TLV + */ + return SUBTYPE_INVALID; } u8 dcbx_mibDeleteObjects(struct port *port) -- 1.7.4.4