summaryrefslogtreecommitdiffstats
path: root/nest
diff options
context:
space:
mode:
Diffstat (limited to 'nest')
-rw-r--r--nest/a-set.c11
-rw-r--r--nest/attrs.h2
-rw-r--r--nest/proto-hooks.c2
-rw-r--r--nest/protocol.h2
-rw-r--r--nest/rt-attr.c4
5 files changed, 14 insertions, 7 deletions
diff --git a/nest/a-set.c b/nest/a-set.c
index 69c090b..505c0e5 100644
--- a/nest/a-set.c
+++ b/nest/a-set.c
@@ -14,7 +14,7 @@
#include "lib/string.h"
void
-int_set_format(struct adata *set, byte *buf, unsigned int size)
+int_set_format(struct adata *set, int way, byte *buf, unsigned int size)
{
u32 *z = (u32 *) set->data;
int l = set->length / 4;
@@ -30,7 +30,14 @@ int_set_format(struct adata *set, byte *buf, unsigned int size)
strcpy(buf, "...");
return;
}
- buf += bsprintf(buf, "(%d,%d)", *z >> 16, *z & 0xffff);
+
+ if (way)
+ buf += bsprintf(buf, "(%d,%d)", *z >> 16, *z & 0xffff);
+ else
+ buf += bsprintf(buf, "%d.%d.%d.%d",
+ (*z >> 24) & 0xff, (*z >> 16) & 0xff,
+ (*z >> 8) & 0xff, *z & 0xff);
+
z++;
sp = 0;
}
diff --git a/nest/attrs.h b/nest/attrs.h
index fee2c2c..6f0bc1f 100644
--- a/nest/attrs.h
+++ b/nest/attrs.h
@@ -43,7 +43,7 @@ int as_path_match(struct adata *path, struct f_path_mask *mask);
/* a-set.c */
-void int_set_format(struct adata *set, byte *buf, unsigned int size);
+void int_set_format(struct adata *set, int way, byte *buf, unsigned int size);
struct adata *int_set_add(struct linpool *pool, struct adata *list, u32 val);
int int_set_contains(struct adata *list, u32 val);
struct adata *int_set_del(struct linpool *pool, struct adata *list, u32 val);
diff --git a/nest/proto-hooks.c b/nest/proto-hooks.c
index 4035fdd..82df5cb 100644
--- a/nest/proto-hooks.c
+++ b/nest/proto-hooks.c
@@ -146,7 +146,7 @@ void get_route_info(rte *e, byte *buf, ea_list *attrs)
* or doing the whole conversion (used in case the value requires extra
* care; return %GA_FULL).
*/
-int get_attr(eattr *a, byte *buf)
+int get_attr(eattr *a, byte *buf, int buflen)
{ DUMMY; }
/**
diff --git a/nest/protocol.h b/nest/protocol.h
index 64ea466..d681ae6 100644
--- a/nest/protocol.h
+++ b/nest/protocol.h
@@ -48,7 +48,7 @@ struct protocol {
int (*shutdown)(struct proto *); /* Stop the instance */
void (*get_status)(struct proto *, byte *buf); /* Get instance status (for `show protocols' command) */
void (*get_route_info)(struct rte *, byte *buf, struct ea_list *attrs); /* Get route information (for `show route' command) */
- int (*get_attr)(struct eattr *, byte *buf); /* ASCIIfy dynamic attribute (returns GA_*) */
+ int (*get_attr)(struct eattr *, byte *buf, int buflen); /* ASCIIfy dynamic attribute (returns GA_*) */
};
void protos_build(void);
diff --git a/nest/rt-attr.c b/nest/rt-attr.c
index cbece88..e79cba1 100644
--- a/nest/rt-attr.c
+++ b/nest/rt-attr.c
@@ -386,7 +386,7 @@ ea_format(eattr *e, byte *buf)
{
buf += bsprintf(buf, "%s.", p->name);
if (p->get_attr)
- status = p->get_attr(e, buf);
+ status = p->get_attr(e, buf, end - buf);
buf += strlen(buf);
}
else if (EA_PROTO(e->id))
@@ -429,7 +429,7 @@ ea_format(eattr *e, byte *buf)
as_path_format(ad, buf, end - buf);
break;
case EAF_TYPE_INT_SET:
- int_set_format(ad, buf, end - buf);
+ int_set_format(ad, 1, buf, end - buf);
break;
case EAF_TYPE_UNDEF:
default: