diff options
author | Ondrej Zajicek <santiago@crfreenet.org> | 2009-02-21 17:47:56 +0100 |
---|---|---|
committer | Ondrej Zajicek <santiago@crfreenet.org> | 2009-02-21 17:47:56 +0100 |
commit | cd17c651a60c30837b683f8ca6e07139dc57d882 (patch) | |
tree | 4b720d0a7454a777ef9cbe06aa2732ad2b0678b3 /proto/bgp/attrs.c | |
parent | 25cb9f1d0165df5e86956021cc3e6ee87730ef3b (diff) |
Add format for BGP_AGGREGATOR attribute
Diffstat (limited to 'proto/bgp/attrs.c')
-rw-r--r-- | proto/bgp/attrs.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/proto/bgp/attrs.c b/proto/bgp/attrs.c index d3716eab..d8a6aad4 100644 --- a/proto/bgp/attrs.c +++ b/proto/bgp/attrs.c @@ -111,6 +111,27 @@ bgp_check_aggregator(struct bgp_proto *p, byte *a UNUSED, int len) 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 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 */ NULL, NULL }, { "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 */ NULL, NULL }, { "originator_id", 4, BAF_OPTIONAL, EAF_TYPE_ROUTER_ID, 0, /* BA_ORIGINATOR_ID */ |