]> git.proxmox.com Git - mirror_frr.git/commitdiff
BGP: Rectifying the log messages.
authorNaveen Thanikachalam <nthanikachal@vmware.com>
Wed, 21 Aug 2019 03:16:20 +0000 (20:16 -0700)
committerNaveen Thanikachalam <nthanikachal@vmware.com>
Tue, 10 Sep 2019 05:59:22 +0000 (22:59 -0700)
This change addresses the following:
1) Ensures logs under DEBUG macro checks are categorized
   as zlog_debug instead of zlog_info.
2) Error logs are categorized as zlog_err instead of zlog_info.
3) Rephrasing certain logs to make them appear more intuitive.

Signed-off-by: NaveenThanikachalam <nthanikachal@vmware.com>
bgpd/bgp_attr.c
bgpd/bgp_fsm.c
bgpd/bgp_open.c
bgpd/bgpd.c

index c64d153f1b8c67fd6b238f54fb0091d747e7d45e..0440a95ffa7721619f41fde49aa525597f16baa5 100644 (file)
@@ -1647,8 +1647,8 @@ int bgp_mp_reach_parse(struct bgp_attr_parser_args *args,
 #define BGP_MP_REACH_MIN_SIZE 5
 #define LEN_LEFT       (length - (stream_get_getp(s) - start))
        if ((length > STREAM_READABLE(s)) || (length < BGP_MP_REACH_MIN_SIZE)) {
-               zlog_info("%s: %s sent invalid length, %lu", __func__,
-                         peer->host, (unsigned long)length);
+               zlog_info("%s: %s sent invalid length, %lu, of MP_REACH_NLRI",
+                         __func__, peer->host, (unsigned long)length);
                return BGP_ATTR_PARSE_ERROR_NOTIFYPLS;
        }
 
@@ -1664,7 +1664,7 @@ int bgp_mp_reach_parse(struct bgp_attr_parser_args *args,
                 */
                if (bgp_debug_update(peer, NULL, NULL, 0))
                        zlog_debug(
-                               "%s: MP_REACH received AFI %s or SAFI %s is unrecognized",
+                               "%s sent unrecognizable AFI, %s or, SAFI, %s, of MP_REACH_NLRI",
                                peer->host, iana_afi2str(pkt_afi),
                                iana_safi2str(pkt_safi));
                return BGP_ATTR_PARSE_ERROR;
@@ -1675,7 +1675,7 @@ int bgp_mp_reach_parse(struct bgp_attr_parser_args *args,
 
        if (LEN_LEFT < attr->mp_nexthop_len) {
                zlog_info(
-                       "%s: %s, MP nexthop length, %u, goes past end of attribute",
+                       "%s: %s sent next-hop length, %u, in MP_REACH_NLRI which goes past the end of attribute",
                        __func__, peer->host, attr->mp_nexthop_len);
                return BGP_ATTR_PARSE_ERROR_NOTIFYPLS;
        }
@@ -1684,7 +1684,7 @@ int bgp_mp_reach_parse(struct bgp_attr_parser_args *args,
        switch (attr->mp_nexthop_len) {
        case 0:
                if (safi != SAFI_FLOWSPEC) {
-                       zlog_info("%s: (%s) Wrong multiprotocol next hop length: %d",
+                       zlog_info("%s: %s sent wrong next-hop length, %d, in MP_REACH_NLRI",
                                  __func__, peer->host, attr->mp_nexthop_len);
                        return BGP_ATTR_PARSE_ERROR_NOTIFYPLS;
                }
@@ -1716,7 +1716,7 @@ int bgp_mp_reach_parse(struct bgp_attr_parser_args *args,
                stream_get(&attr->mp_nexthop_global, s, IPV6_MAX_BYTELEN);
                if (IN6_IS_ADDR_LINKLOCAL(&attr->mp_nexthop_global)) {
                        if (!peer->nexthop.ifp) {
-                               zlog_warn("%s: Received a V6/VPNV6 Global attribute but address is a V6 LL and we have no peer interface information, withdrawing",
+                               zlog_warn("%s sent a v6 global attribute but address is a V6 LL and there's no peer interface information. Hence, withdrawing",
                                          peer->host);
                                return BGP_ATTR_PARSE_WITHDRAW;
                        }
@@ -1733,7 +1733,7 @@ int bgp_mp_reach_parse(struct bgp_attr_parser_args *args,
                stream_get(&attr->mp_nexthop_global, s, IPV6_MAX_BYTELEN);
                if (IN6_IS_ADDR_LINKLOCAL(&attr->mp_nexthop_global)) {
                        if (!peer->nexthop.ifp) {
-                               zlog_warn("%s: Received V6/VPNV6 Global and LL attribute but global address is a V6 LL and we have no peer interface information, withdrawing",
+                               zlog_warn("%s sent a v6 global and LL attribute but global address is a V6 LL and there's no peer interface information. Hence, withdrawing",
                                          peer->host);
                                return BGP_ATTR_PARSE_WITHDRAW;
                        }
@@ -1751,7 +1751,7 @@ int bgp_mp_reach_parse(struct bgp_attr_parser_args *args,
 
                        if (bgp_debug_update(peer, NULL, NULL, 1))
                                zlog_debug(
-                                       "%s rcvd nexthops %s, %s -- ignoring non-LL value",
+                                       "%s sent next-hops %s and %s. Ignoring non-LL value",
                                        peer->host,
                                        inet_ntop(AF_INET6,
                                                  &attr->mp_nexthop_global,
@@ -1763,21 +1763,21 @@ int bgp_mp_reach_parse(struct bgp_attr_parser_args *args,
                        attr->mp_nexthop_len = IPV6_MAX_BYTELEN;
                }
                if (!peer->nexthop.ifp) {
-                       zlog_warn("%s: Received a V6 LL nexthop and we have no peer interface information, withdrawing",
+                       zlog_warn("%s sent a v6 LL next-hop and there's no peer interface information. Hence, withdrawing",
                                  peer->host);
                        return BGP_ATTR_PARSE_WITHDRAW;
                }
                attr->nh_lla_ifindex = peer->nexthop.ifp->ifindex;
                break;
        default:
-               zlog_info("%s: (%s) Wrong multiprotocol next hop length: %d",
+               zlog_info("%s: %s sent wrong next-hop length, %d, in MP_REACH_NLRI",
                          __func__, peer->host, attr->mp_nexthop_len);
                return BGP_ATTR_PARSE_ERROR_NOTIFYPLS;
        }
 
        if (!LEN_LEFT) {
-               zlog_info("%s: (%s) Failed to read SNPA and NLRI(s)", __func__,
-                         peer->host);
+               zlog_info("%s: %s sent SNPA which couldn't be read",
+                         __func__, peer->host);
                return BGP_ATTR_PARSE_ERROR_NOTIFYPLS;
        }
 
@@ -1793,12 +1793,13 @@ int bgp_mp_reach_parse(struct bgp_attr_parser_args *args,
        /* must have nrli_len, what is left of the attribute */
        nlri_len = LEN_LEFT;
        if (nlri_len > STREAM_READABLE(s)) {
-               zlog_info("%s: (%s) Failed to read NLRI", __func__, peer->host);
+               zlog_info("%s: %s sent MP_REACH_NLRI which couldn't be read",
+                         __func__, peer->host);
                return BGP_ATTR_PARSE_ERROR_NOTIFYPLS;
        }
 
        if (!nlri_len) {
-               zlog_info("%s: (%s) No Reachability, Treating as a EOR marker",
+               zlog_info("%s: %s sent a zero-length NLRI. Hence, treating as a EOR marker",
                          __func__, peer->host);
 
                mp_update->afi = afi;
@@ -2005,8 +2006,8 @@ static int bgp_attr_encap(uint8_t type, struct peer *peer, /* IN */
                length -= 4;
 
                if (tlv_length != length) {
-                       zlog_info("%s: tlv_length(%d) != length(%d)", __func__,
-                                 tlv_length, length);
+                       zlog_info("%s: tlv_length(%d) != length(%d)",
+                                 __func__, tlv_length, length);
                }
        }
 
index 4348e6b240c68185c80a7745b58d88d1d551dbe8..28b3dc501d59b3143b68b96d42d836c22e46f503 100644 (file)
@@ -1304,7 +1304,7 @@ static int bgp_connect_check(struct thread *thread)
 
        /* If getsockopt is fail, this is fatal error. */
        if (ret < 0) {
-               zlog_info("can't get sockopt for nonblocking connect: %d(%s)",
+               zlog_err("can't get sockopt for nonblocking connect: %d(%s)",
                          errno, safe_strerror(errno));
                BGP_EVENT_ADD(peer, TCP_fatal_error);
                return -1;
index 64529f6ef384efaca43e51766c5bcc55c340767a..03264147adb6098cba7333cd41277dccaaa13a9f 100644 (file)
@@ -1031,7 +1031,7 @@ as_t peek_for_as4_capability(struct peer *peer, uint8_t length)
        as_t as4 = 0;
 
        if (BGP_DEBUG(as4, AS4))
-               zlog_info(
+               zlog_debug(
                        "%s [AS4] rcv OPEN w/ OPTION parameter len: %u,"
                        " peeking for as4",
                        peer->host, length);
@@ -1075,7 +1075,7 @@ as_t peek_for_as4_capability(struct peer *peer, uint8_t length)
 
                                if (hdr.code == CAPABILITY_CODE_AS4) {
                                        if (BGP_DEBUG(as4, AS4))
-                                               zlog_info(
+                                               zlog_debug(
                                                        "[AS4] found AS4 capability, about to parse");
                                        as4 = bgp_capability_as4(peer, &hdr);
 
index b5f267cc3862221124651cfd7351a0212ff13ab7..dc49af4764dde9b149a08886e8f193205a8f2b3b 100644 (file)
@@ -2047,7 +2047,7 @@ int peer_activate(struct peer *peer, afi_t afi, safi_t safi)
            && !bgp->allocate_mpls_labels[afi][SAFI_UNICAST]) {
 
                if (BGP_DEBUG(zebra, ZEBRA))
-                       zlog_info(
+                       zlog_debug(
                                "peer(s) are now active for labeled-unicast, allocate MPLS labels");
 
                bgp->allocate_mpls_labels[afi][SAFI_UNICAST] = 1;
@@ -2150,7 +2150,7 @@ int peer_deactivate(struct peer *peer, afi_t afi, safi_t safi)
            && !bgp_afi_safi_peer_exists(bgp, afi, safi)) {
 
                if (BGP_DEBUG(zebra, ZEBRA))
-                       zlog_info(
+                       zlog_debug(
                                "peer(s) are no longer active for labeled-unicast, deallocate MPLS labels");
 
                bgp->allocate_mpls_labels[afi][SAFI_UNICAST] = 0;