From dcb32bd003d89158b5b82296116690d57ca0338d Mon Sep 17 00:00:00 2001 From: John Fastabend Date: Wed, 27 Jul 2011 15:05:24 -0700 Subject: [PATCH 11/29] dcbtool: return different error codes for invalid device and IEEE dcbtool currently returns the same error code for an invalid device name and a device in IEEE mode. This results in the tool printing an output that gives an error about IEEE mode in both cases. This patch separates the two cases and additionally allows sets and gets to occur. Oper mode calls should still fail device in IEEE mode errors. This is more inline with the current lldptool behavior and supports users configuring CEE mode before switching DCBX mode. Signed-off-by: John Fastabend Signed-off-by: Petr Sabata --- lldp_dcbx_cmds.c | 11 +++++------ 1 files changed, 5 insertions(+), 6 deletions(-) diff --git a/lldp_dcbx_cmds.c b/lldp_dcbx_cmds.c index bbfbcf6..7799557 100644 --- a/lldp_dcbx_cmds.c +++ b/lldp_dcbx_cmds.c @@ -533,15 +533,14 @@ int dcbx_clif_cmd(void *data, if (!port) return dcb_device_not_found; - /* DCBTOOL is not applicable in IEEE-DCBX modes */ dcbx = dcbx_data(port->ifname); - if (!dcbx || dcbx->active == 0) - return cmd_not_applicable; - - /* check that DCB features is supported and in DCB state */ - if (feature != FEATURE_DCB && check_port_dcb_mode(port_id) == false) + if (!dcbx) return dcb_device_not_found; + /* OPER and PEER cmd not applicable while in IEEE-DCBX modes */ + if (dcbx->active == 0 && (cmd == CMD_GET_PEER || cmd == CMD_GET_OPER)) + return cmd_not_applicable; + switch(feature) { case FEATURE_DCB: if (cmd == CMD_SET_CONFIG) -- 1.7.6