112 lines
3.0 KiB
Diff
112 lines
3.0 KiB
Diff
From 2c9ec8e6d4e7240e9a6ccc8fce7572f78752db6f Mon Sep 17 00:00:00 2001
|
|
From: Jens Osterkamp <jens@linux.vnet.ibm.com>
|
|
Date: Mon, 15 Aug 2011 18:16:42 -0700
|
|
Subject: [PATCH 26/29] bugfix to print all profiles
|
|
|
|
In an earlier patch a bug had been introduced which prevented all profiles
|
|
from being printed into the assigned buffer. Instead, only the last profile
|
|
for an interface would be printed in there and shown with lldptool.
|
|
|
|
Signed-off-by: Jens Osterkamp <jens@linux.vnet.ibm.com>
|
|
Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
|
|
Signed-off-by: Petr Sabata <contyk@redhat.com>
|
|
---
|
|
lldp_vdp_cmds.c | 25 +++++++++++++------------
|
|
1 files changed, 13 insertions(+), 12 deletions(-)
|
|
|
|
diff --git a/lldp_vdp_cmds.c b/lldp_vdp_cmds.c
|
|
index 8660f98..8cc871f 100644
|
|
--- a/lldp_vdp_cmds.c
|
|
+++ b/lldp_vdp_cmds.c
|
|
@@ -84,43 +84,44 @@ static char *check_and_update(size_t *total, size_t *length, char *s, int c)
|
|
return s + c;
|
|
}
|
|
|
|
-static void print_profile(char *s, size_t length, struct vsi_profile *p)
|
|
+static char * print_profile(char *s, size_t length, struct vsi_profile *p)
|
|
{
|
|
int c;
|
|
size_t total = 0;
|
|
+ char *r = s;
|
|
|
|
c = snprintf(s, length, "\nmode: %i (%s)\n",
|
|
p->mode, vsi_modes[p->mode]);
|
|
s = check_and_update(&total, &length, s, c);
|
|
if (!s)
|
|
- return;
|
|
+ return r;
|
|
|
|
c = snprintf(s, length, "response: %i (%s)\n", p->response,
|
|
vsi_responses[p->response]);
|
|
s = check_and_update(&total, &length, s, c);
|
|
if (!s)
|
|
- return;
|
|
+ return r;
|
|
|
|
c = snprintf(s, length, "state: %i (%s)\n",
|
|
p->state, vsi_states[p->state]);
|
|
s = check_and_update(&total, &length, s, c);
|
|
if (!s)
|
|
- return;
|
|
+ return r;
|
|
|
|
c = snprintf(s, length, "mgrid: %i\n", p->mgrid);
|
|
s = check_and_update(&total, &length, s, c);
|
|
if (!s)
|
|
- return;
|
|
+ return r;
|
|
|
|
c = snprintf(s, length, "id: %i (0x%x)\n", p->id, p->id);
|
|
s = check_and_update(&total, &length, s, c);
|
|
if (!s)
|
|
- return;
|
|
+ return r;
|
|
|
|
c = snprintf(s, length, "version: %i\n", p->version);
|
|
s = check_and_update(&total, &length, s, c);
|
|
if (!s)
|
|
- return;
|
|
+ return r;
|
|
|
|
{
|
|
char instance[INSTANCE_STRLEN + 2];
|
|
@@ -130,7 +131,7 @@ static void print_profile(char *s, size_t length, struct vsi_profile *p)
|
|
}
|
|
s = check_and_update(&total, &length, s, c);
|
|
if (!s)
|
|
- return;
|
|
+ return r;
|
|
|
|
{
|
|
char macbuf[MAC_ADDR_STRLEN + 1];
|
|
@@ -140,14 +141,14 @@ static void print_profile(char *s, size_t length, struct vsi_profile *p)
|
|
}
|
|
s = check_and_update(&total, &length, s, c);
|
|
if (!s)
|
|
- return;
|
|
+ return r;
|
|
|
|
c = snprintf(s, length, "vlan: %i\n\n", p->vlan);
|
|
s = check_and_update(&total, &length, s, c);
|
|
if (!s)
|
|
- return;
|
|
+ return r;
|
|
|
|
- return;
|
|
+ return s;
|
|
}
|
|
|
|
static int get_arg_tlvtxenable(struct cmd *cmd, char *arg, char *argvalue,
|
|
@@ -271,7 +272,7 @@ static int get_arg_mode(struct cmd *cmd, char *arg, char *argvalue,
|
|
memset(s, 0, (count+1)*VDP_BUF_SIZE);
|
|
|
|
LIST_FOREACH(np, &vd->profile_head, profile) {
|
|
- print_profile(t, (count + 1) * VDP_BUF_SIZE, np);
|
|
+ t = print_profile(t, (count + 1) * VDP_BUF_SIZE, np);
|
|
}
|
|
|
|
snprintf(obuf, obuf_len, "%02x%s%04x%s",
|
|
--
|
|
1.7.6
|
|
|