0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-12-22 09:41:54 +00:00

Add format for BGP_AGGREGATOR attribute

This commit is contained in:
Ondrej Zajicek 2009-02-21 17:47:56 +01:00
parent 25cb9f1d01
commit cd17c651a6
2 changed files with 23 additions and 2 deletions

View File

@ -83,7 +83,7 @@ pm_format(struct f_path_mask *p, byte *buf, unsigned int size)
} }
if (p->any) if (p->any)
buf += bsprintf(buf, "? "); buf += bsprintf(buf, "* ");
else else
buf += bsprintf(buf, "%u ", p->val); buf += bsprintf(buf, "%u ", p->val);

View File

@ -111,6 +111,27 @@ bgp_check_aggregator(struct bgp_proto *p, byte *a UNUSED, int len)
return (len == exp_len) ? 0 : 5; return (len == exp_len) ? 0 : 5;
} }
static void
bgp_format_aggregator(eattr *a, byte *buf, int buflen UNUSED)
{
struct adata *ad = a->u.ptr;
byte *data = ad->data;
u32 as;
if (bgp_as4_support)
{
as = get_u32(data);
data += 4;
}
else
{
as = get_u16(data);
data += 2;
}
bsprintf(buf, "%d.%d.%d.%d AS%d", data[0], data[1], data[2], data[3], as);
}
static int static int
bgp_check_cluster_list(struct bgp_proto *p UNUSED, byte *a UNUSED, int len) bgp_check_cluster_list(struct bgp_proto *p UNUSED, byte *a UNUSED, int len)
{ {
@ -159,7 +180,7 @@ static struct attr_desc bgp_attr_table[] = {
{ "atomic_aggr", 0, BAF_TRANSITIVE, EAF_TYPE_OPAQUE, 1, /* BA_ATOMIC_AGGR */ { "atomic_aggr", 0, BAF_TRANSITIVE, EAF_TYPE_OPAQUE, 1, /* BA_ATOMIC_AGGR */
NULL, NULL }, NULL, NULL },
{ "aggregator", -1, BAF_OPTIONAL | BAF_TRANSITIVE, EAF_TYPE_OPAQUE, 1, /* BA_AGGREGATOR */ { "aggregator", -1, BAF_OPTIONAL | BAF_TRANSITIVE, EAF_TYPE_OPAQUE, 1, /* BA_AGGREGATOR */
bgp_check_aggregator, NULL }, bgp_check_aggregator, bgp_format_aggregator },
{ "community", -1, BAF_OPTIONAL | BAF_TRANSITIVE, EAF_TYPE_INT_SET, 1, /* BA_COMMUNITY */ { "community", -1, BAF_OPTIONAL | BAF_TRANSITIVE, EAF_TYPE_INT_SET, 1, /* BA_COMMUNITY */
NULL, NULL }, NULL, NULL },
{ "originator_id", 4, BAF_OPTIONAL, EAF_TYPE_ROUTER_ID, 0, /* BA_ORIGINATOR_ID */ { "originator_id", 4, BAF_OPTIONAL, EAF_TYPE_ROUTER_ID, 0, /* BA_ORIGINATOR_ID */