]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: Dump attributes before returning from bgp_attr_malformed()
authorDonatas Abraitis <donatas.abraitis@gmail.com>
Thu, 13 Aug 2020 15:42:31 +0000 (18:42 +0300)
committerDonatas Abraitis <donatas.abraitis@gmail.com>
Fri, 14 Aug 2020 04:22:22 +0000 (07:22 +0300)
This would be handy for situations when a notification was sent, but it's
absolutely not clear who triggered that.

Just in case dumping all attributes under the debug mode would help finding
the _bad_ attribute.

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

index d8566fed9f78e7f3a503f607b1b2a16ff8666a35..121b170f42d4678f5f7ec90180cb7c95b1d4a0e0 100644 (file)
@@ -1148,6 +1148,7 @@ bgp_attr_malformed(struct bgp_attr_parser_args *args, uint8_t subcode,
                   bgp_size_t length)
 {
        struct peer *const peer = args->peer;
+       struct attr *const attr = args->attr;
        const uint8_t flags = args->flags;
        /* startp and length must be special-cased, as whether or not to
         * send the attribute data with the NOTIFY depends on the error,
@@ -1155,6 +1156,14 @@ bgp_attr_malformed(struct bgp_attr_parser_args *args, uint8_t subcode,
         */
        uint8_t *notify_datap = (length > 0 ? args->startp : NULL);
 
+       if (bgp_debug_update(peer, NULL, NULL, 1)) {
+               char attr_str[BUFSIZ] = {0};
+
+               bgp_dump_attr(attr, attr_str, BUFSIZ);
+
+               zlog_debug("%s: attributes: %s", __func__, attr_str);
+       }
+
        /* Only relax error handling for eBGP peers */
        if (peer->sort != BGP_PEER_EBGP) {
                bgp_notify_send_with_data(peer, BGP_NOTIFY_UPDATE_ERR, subcode,