summaryrefslogtreecommitdiff
path: root/bgpd/bgp_attr.c
diff options
context:
space:
mode:
Diffstat (limited to 'bgpd/bgp_attr.c')
-rw-r--r--bgpd/bgp_attr.c47
1 files changed, 33 insertions, 14 deletions
diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c
index ce22e8404d..dc8cc81042 100644
--- a/bgpd/bgp_attr.c
+++ b/bgpd/bgp_attr.c
@@ -1753,14 +1753,22 @@ static int bgp_attr_aggregator(struct bgp_attr_parser_args *args)
attr->aggregator_as = aggregator_as;
attr->aggregator_addr.s_addr = stream_get_ipv4(peer->curr);
- /* Set atomic aggregate flag. */
- attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_AGGREGATOR);
-
/* Codification of AS 0 Processing */
- if (aggregator_as == BGP_AS_ZERO)
+ if (aggregator_as == BGP_AS_ZERO) {
flog_err(EC_BGP_ATTR_LEN,
- "AGGREGATOR AS number is 0 for aspath: %s",
- aspath_print(attr->aspath));
+ "%s: AGGREGATOR AS number is 0 for aspath: %s",
+ peer->host, aspath_print(attr->aspath));
+
+ if (bgp_debug_update(peer, NULL, NULL, 1)) {
+ char attr_str[BUFSIZ] = {0};
+
+ bgp_dump_attr(attr, attr_str, sizeof(attr_str));
+
+ zlog_debug("%s: attributes: %s", __func__, attr_str);
+ }
+ } else {
+ attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_AGGREGATOR);
+ }
return BGP_ATTR_PARSE_PROCEED;
}
@@ -1784,16 +1792,26 @@ bgp_attr_as4_aggregator(struct bgp_attr_parser_args *args,
}
aggregator_as = stream_getl(peer->curr);
+
*as4_aggregator_as = aggregator_as;
as4_aggregator_addr->s_addr = stream_get_ipv4(peer->curr);
- attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_AS4_AGGREGATOR);
-
/* Codification of AS 0 Processing */
- if (aggregator_as == BGP_AS_ZERO)
+ if (aggregator_as == BGP_AS_ZERO) {
flog_err(EC_BGP_ATTR_LEN,
- "AS4_AGGREGATOR AS number is 0 for aspath: %s",
- aspath_print(attr->aspath));
+ "%s: AS4_AGGREGATOR AS number is 0 for aspath: %s",
+ peer->host, aspath_print(attr->aspath));
+
+ if (bgp_debug_update(peer, NULL, NULL, 1)) {
+ char attr_str[BUFSIZ] = {0};
+
+ bgp_dump_attr(attr, attr_str, sizeof(attr_str));
+
+ zlog_debug("%s: attributes: %s", __func__, attr_str);
+ }
+ } else {
+ attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_AS4_AGGREGATOR);
+ }
return BGP_ATTR_PARSE_PROCEED;
}
@@ -3395,7 +3413,8 @@ void bgp_attr_extcom_tunnel_type(struct attr *attr,
bgp_encap_types *tunnel_type)
{
struct ecommunity *ecom;
- int i;
+ uint32_t i;
+
if (!attr)
return;
@@ -3900,7 +3919,7 @@ bgp_size_t bgp_packet_attribute(struct bgp *bgp, struct peer *peer,
/* Is ASN representable in 2-bytes? Or must AS_TRANS be
* used? */
- if (attr->aggregator_as > 65535) {
+ if (attr->aggregator_as > UINT16_MAX) {
stream_putw(s, BGP_AS_TRANS);
/* we have to send AS4_AGGREGATOR, too.
@@ -4021,7 +4040,7 @@ bgp_size_t bgp_packet_attribute(struct bgp *bgp, struct peer *peer,
uint8_t *pnt;
int tbit;
int ecom_tr_size = 0;
- int i;
+ uint32_t i;
for (i = 0; i < attr->ecommunity->size; i++) {
pnt = attr->ecommunity->val + (i * 8);