]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: Make bgp_debug.[ch] take `const struct peer *` and return bool
authorDonald Sharp <sharpd@nvidia.com>
Thu, 5 May 2022 15:31:33 +0000 (11:31 -0400)
committerDonald Sharp <sharpd@nvidia.com>
Fri, 13 May 2022 12:40:41 +0000 (08:40 -0400)
Several functions in bgp_debug.[ch] take a const struct peer *
and also return a bool instead of an int.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
bgpd/bgp_debug.c
bgpd/bgp_debug.h

index 57f37c173f6e38012431077c7b6fc6874c530d72..cd6ba008464f5eac4509b778a1e6592dc92e6d2e 100644 (file)
@@ -2576,9 +2576,9 @@ static int bgp_debug_per_prefix(const struct prefix *p,
 /* Return true if this peer is on the per_peer_list of peers to debug
  * for BGP_DEBUG_TYPE
  */
-static int bgp_debug_per_peer(char *host, unsigned long term_bgp_debug_type,
-                             unsigned int BGP_DEBUG_TYPE,
-                             struct list *per_peer_list)
+static bool bgp_debug_per_peer(char *host, unsigned long term_bgp_debug_type,
+                              unsigned int BGP_DEBUG_TYPE,
+                              struct list *per_peer_list)
 {
        struct bgp_debug_filter *filter;
        struct listnode *node, *nnode;
@@ -2586,25 +2586,25 @@ static int bgp_debug_per_peer(char *host, unsigned long term_bgp_debug_type,
        if (term_bgp_debug_type & BGP_DEBUG_TYPE) {
                /* We are debugging all peers so return true */
                if (!per_peer_list || list_isempty(per_peer_list))
-                       return 1;
+                       return true;
 
                else {
                        if (!host)
-                               return 0;
+                               return false;
 
                        for (ALL_LIST_ELEMENTS(per_peer_list, node, nnode,
                                               filter))
                                if (strcmp(filter->host, host) == 0)
-                                       return 1;
+                                       return true;
 
-                       return 0;
+                       return false;
                }
        }
 
-       return 0;
+       return false;
 }
 
-int bgp_debug_neighbor_events(struct peer *peer)
+bool bgp_debug_neighbor_events(const struct peer *peer)
 {
        char *host = NULL;
 
@@ -2616,7 +2616,7 @@ int bgp_debug_neighbor_events(struct peer *peer)
                                  bgp_debug_neighbor_events_peers);
 }
 
-int bgp_debug_keepalive(struct peer *peer)
+bool bgp_debug_keepalive(const struct peer *peer)
 {
        char *host = NULL;
 
@@ -2628,7 +2628,7 @@ int bgp_debug_keepalive(struct peer *peer)
                                  bgp_debug_keepalive_peers);
 }
 
-bool bgp_debug_update(struct peer *peer, const struct prefix *p,
+bool bgp_debug_update(const struct peer *peer, const struct prefix *p,
                      struct update_group *updgrp, unsigned int inbound)
 {
        char *host = NULL;
index 407a74340a70b9a9b368745a51379a45a6096aed..62f5340dfd53b2f78831744c222c9c733a66538c 100644 (file)
@@ -174,9 +174,9 @@ extern void bgp_notify_print(struct peer *peer, struct bgp_notify *bgp_notify,
                             const char *direct, bool hard_reset);
 
 extern const struct message bgp_status_msg[];
-extern int bgp_debug_neighbor_events(struct peer *peer);
-extern int bgp_debug_keepalive(struct peer *peer);
-extern bool bgp_debug_update(struct peer *peer, const struct prefix *p,
+extern bool bgp_debug_neighbor_events(const struct peer *peer);
+extern bool bgp_debug_keepalive(const struct peer *peer);
+extern bool bgp_debug_update(const struct peer *peer, const struct prefix *p,
                             struct update_group *updgrp, unsigned int inbound);
 extern bool bgp_debug_bestpath(struct bgp_dest *dest);
 extern bool bgp_debug_zebra(const struct prefix *p);