]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: Dump BGP attrs to check what's the actual prefix with aggr_as 0
authorDonatas Abraitis <donatas.abraitis@gmail.com>
Sat, 6 Feb 2021 11:57:42 +0000 (13:57 +0200)
committerDonatas Abraitis <donatas.abraitis@gmail.com>
Sat, 6 Feb 2021 12:01:13 +0000 (14:01 +0200)
Just for more debug information regarding malformed aggregator_as.

```
bgpd[5589]: [EC 33554434] 192.168.10.25: AGGREGATOR AS number is 0 for aspath: 65030
bgpd[5589]: bgp_attr_aggregator: attributes: nexthop 192.168.10.25, origin i, path 65030
```

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
bgpd/bgp_attr.c

index 3e63ed483a9d68a52d0e6cb03e5bff4ecf4a96bb..dc8cc81042736194a3fbc13e7da85455a287be52 100644 (file)
@@ -1754,12 +1754,21 @@ static int bgp_attr_aggregator(struct bgp_attr_parser_args *args)
        attr->aggregator_addr.s_addr = stream_get_ipv4(peer->curr);
 
        /* Codification of AS 0 Processing */
-       if (aggregator_as == BGP_AS_ZERO)
+       if (aggregator_as == BGP_AS_ZERO) {
                flog_err(EC_BGP_ATTR_LEN,
                         "%s: AGGREGATOR AS number is 0 for aspath: %s",
                         peer->host, aspath_print(attr->aspath));
-       else
+
+               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;
 }
@@ -1788,12 +1797,21 @@ bgp_attr_as4_aggregator(struct bgp_attr_parser_args *args,
        as4_aggregator_addr->s_addr = stream_get_ipv4(peer->curr);
 
        /* Codification of AS 0 Processing */
-       if (aggregator_as == BGP_AS_ZERO)
+       if (aggregator_as == BGP_AS_ZERO) {
                flog_err(EC_BGP_ATTR_LEN,
                         "%s: AS4_AGGREGATOR AS number is 0 for aspath: %s",
                         peer->host, aspath_print(attr->aspath));
-       else
+
+               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;
 }