From 63d97a836870bf106488efccee29d9f0ed606389 Mon Sep 17 00:00:00 2001 From: John Fastabend Date: Wed, 27 Jul 2011 15:08:10 -0700 Subject: [PATCH 18/29] lldapd: 802.1Qaz, add output buffer response to set pfc All other 802.1Qaz set commands report set values except pfc enabled. Signed-off-by: John Fastabend Signed-off-by: Petr Sabata --- lldp_8021qaz_cmds.c | 20 +++++++++++++++++++- 1 files changed, 19 insertions(+), 1 deletions(-) diff --git a/lldp_8021qaz_cmds.c b/lldp_8021qaz_cmds.c index 4dd8042..04556c2 100644 --- a/lldp_8021qaz_cmds.c +++ b/lldp_8021qaz_cmds.c @@ -780,7 +780,8 @@ static int _set_arg_enabled(struct cmd *cmd, char *args, char *priority, *parse; char arg_path[256]; long mask = 0; - int err = cmd_success; + bool first; + int i, err = cmd_success; if (cmd->cmd != cmd_settlv) return cmd_invalid; @@ -823,6 +824,23 @@ static int _set_arg_enabled(struct cmd *cmd, char *args, return cmd_success; } + first = true; + strncat(obuf, "prio = ", obuf_len - strlen(obuf) - 1); + for (i = 0; i < 8; i++) { + if (mask & (1 << i)) { + char val[3]; + + if (first) { + snprintf(val, sizeof(val), "%i", i); + first = false; + } else { + snprintf(val, sizeof(val), ",%i", i); + } + strncat(obuf, val, obuf_len - strlen(obuf) - 1); + } + } + strncat(obuf, "\n", obuf_len - strlen(obuf) - 1); + /* Set configuration */ snprintf(arg_path, sizeof(arg_path), "%s%08x.%s", TLVID_PREFIX, cmd->tlvid, args); -- 1.7.6