[lldp-devel] [PATCH] lldpad: stop dcbx from overwriting adminstatus

John Fastabend john.fastabend at gmail.com
Mon Nov 25 23:37:32 UTC 2013


The DCBX protocol would by default attempt to set the interfaces
adminstatus to rxtx if the hardware was DCB capable. This is a
good default for devices but if an admin disables TX we should
not continue to reset it via DCBX.

This fixes the checks in the DCBX modules to only do the auto
enable when the adminstatus has not been set by the user.

Signed-off-by: John Fastabend <john.r.fastabend at intel.com>
---
 lldp_dcbx.c |   16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/lldp_dcbx.c b/lldp_dcbx.c
index 53a5e01..7b1c3d4 100644
--- a/lldp_dcbx.c
+++ b/lldp_dcbx.c
@@ -484,7 +484,7 @@ void dcbx_unregister(struct lldp_module *mod)
 
 void dcbx_ifup(char *ifname, struct lldp_agent *agent)
 {
-	int ifindex;
+	int ifindex, ret;
 	struct port *port;
 	struct dcbx_tlvs *tlvs;
 	struct dcbd_user_data *dud;
@@ -531,14 +531,12 @@ void dcbx_ifup(char *ifname, struct lldp_agent *agent)
 	if (dcb_support.dcbx && !(dcb_support.dcbx & DCB_CAP_DCBX_HOST))
 		return;
 
-	/* if no adminStatus setting or wrong setting for adminStatus,
-	 * then set adminStatus to enabledRxTx.
-	 */
-	if (get_config_setting(ifname, agent->type, ARG_ADMINSTATUS,
-			       &adminstatus, CONFIG_TYPE_INT) ||
-				adminstatus == enabledTxOnly ||
-				adminstatus == enabledRxOnly) {
-
+	/* if no adminStatus setting default to enabled for DCBX */
+	ret = get_config_setting(ifname, agent->type,
+				 ARG_ADMINSTATUS,
+				 &adminstatus,
+				 CONFIG_TYPE_INT);
+	if (ret != cmd_success) {
 		/* set enableTx to true if it is not already set */
 		snprintf(arg_path, sizeof(arg_path), "%s%08x.%s", TLVID_PREFIX,
 			(OUI_CEE_DCBX << 8) | 1, ARG_TLVTXENABLE);



More information about the lldp-devel mailing list