+lldpd (0.5.5)
+ * Fixes:
+ + Key/value output was incorrect when a dot was present in
+ interface names. This is fixed but it is preferable to use XML
+ output since the parsing is more difficult in this case.
+
lldpd (0.5.4)
* Features:
+ Get OS information from /etc/os-release if available. Patch from
#include "writer.h"
#include "lldpd.h"
+#define SEP '.'
+
struct kv_writer_private {
FILE * fh;
char * prefix;
if ((newprefix = malloc(s+1)) == NULL)
fatal(NULL);
if (strlen(p->prefix) > 0)
- snprintf(newprefix, s+1, "%s.%s", p->prefix, tag);
+ snprintf(newprefix, s+1, "%s\1%s", p->prefix, tag);
else
snprintf(newprefix, s+1, "%s", tag);
free(p->prefix);
kv_data(struct writer *w, const char *data)
{
struct kv_writer_private *p = w->priv;
- fprintf(p->fh, "%s=%s\n", p->prefix, data);
+ char *key = strdup(p->prefix);
+ char *dot;
+ if (!key) fatal(NULL);
+ while ((dot = strchr(key, '\1')) != NULL) *dot=SEP;
+ fprintf(p->fh, "%s=%s\n", key, data);
+ free(key);
}
void
struct kv_writer_private *p = w->priv;
char *dot;
- if ((dot = strrchr(p->prefix, '.')) == NULL)
+ if ((dot = strrchr(p->prefix, '\1')) == NULL)
p->prefix[0] = '\0';
else
*dot = '\0';