]> git.proxmox.com Git - mirror_frr.git/commitdiff
bgpd: Drop bnc_str() function
authorDonatas Abraitis <donatas@opensourcerouting.org>
Thu, 25 Aug 2022 10:53:30 +0000 (13:53 +0300)
committerDonatas Abraitis <donatas@opensourcerouting.org>
Thu, 25 Aug 2022 11:35:28 +0000 (14:35 +0300)
Reuse %pFX -> prefix2str()

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
bgpd/bgp_nexthop.c
bgpd/bgp_nexthop.h
bgpd/bgp_nht.c

index d42f2e669d50f4a2106304a4a033c8d05116e70a..971b1817c818e566267ba13682f5a27893e80667 100644 (file)
@@ -64,11 +64,6 @@ int bgp_nexthop_cache_compare(const struct bgp_nexthop_cache *a,
        return prefix_cmp(&a->prefix, &b->prefix);
 }
 
-const char *bnc_str(struct bgp_nexthop_cache *bnc, char *buf, int size)
-{
-       return prefix2str(&bnc->prefix, buf, size);
-}
-
 void bnc_nexthop_free(struct bgp_nexthop_cache *bnc)
 {
        nexthops_free(bnc->nexthop);
index 9d653ef4dc2f497b1a6795be2c18c366086ca819..efad906d0a90df2ac97e2ea83905841a34376ff5 100644 (file)
@@ -161,7 +161,6 @@ extern struct bgp_nexthop_cache *bnc_find(struct bgp_nexthop_cache_head *tree,
                                          uint32_t srte_color,
                                          ifindex_t ifindex);
 extern void bnc_nexthop_free(struct bgp_nexthop_cache *bnc);
-extern const char *bnc_str(struct bgp_nexthop_cache *bnc, char *buf, int size);
 extern void bgp_scan_init(struct bgp *bgp);
 extern void bgp_scan_finish(struct bgp *bgp);
 extern void bgp_scan_vty_init(void);
index b7964aa7a66def1c1f89b36c8e7d50249d57180a..61f1b295ca2fd558554674f7cffbd258100d763c 100644 (file)
@@ -82,13 +82,10 @@ static int bgp_isvalid_labeled_nexthop(struct bgp_nexthop_cache *bnc)
 static void bgp_unlink_nexthop_check(struct bgp_nexthop_cache *bnc)
 {
        if (LIST_EMPTY(&(bnc->paths)) && !bnc->nht_info) {
-               if (BGP_DEBUG(nht, NHT)) {
-                       char buf[PREFIX2STR_BUFFER];
-                       zlog_debug("%s: freeing bnc %s(%d)(%u)(%s)", __func__,
-                                  bnc_str(bnc, buf, PREFIX2STR_BUFFER),
-                                  bnc->ifindex, bnc->srte_color,
+               if (BGP_DEBUG(nht, NHT))
+                       zlog_debug("%s: freeing bnc %pFX(%d)(%u)(%s)", __func__,
+                                  &bnc->prefix, bnc->ifindex, bnc->srte_color,
                                   bnc->bgp->name_pretty);
-               }
                /* only unregister if this is the last nh for this prefix*/
                if (!bnc_existing_for_prefix(bnc))
                        unregister_zebra_rnh(bnc);
@@ -261,24 +258,17 @@ int bgp_find_or_add_nexthop(struct bgp *bgp_route, struct bgp *bgp_nexthop,
        if (!bnc) {
                bnc = bnc_new(tree, &p, srte_color, ifindex);
                bnc->bgp = bgp_nexthop;
-               if (BGP_DEBUG(nht, NHT)) {
-                       char buf[PREFIX2STR_BUFFER];
-
-                       zlog_debug("Allocated bnc %s(%d)(%u)(%s) peer %p",
-                                  bnc_str(bnc, buf, PREFIX2STR_BUFFER),
-                                  bnc->ifindex, bnc->srte_color,
+               if (BGP_DEBUG(nht, NHT))
+                       zlog_debug("Allocated bnc %pFX(%d)(%u)(%s) peer %p",
+                                  &bnc->prefix, bnc->ifindex, bnc->srte_color,
                                   bnc->bgp->name_pretty, peer);
-               }
        } else {
-               if (BGP_DEBUG(nht, NHT)) {
-                       char buf[PREFIX2STR_BUFFER];
-
+               if (BGP_DEBUG(nht, NHT))
                        zlog_debug(
-                               "Found existing bnc %s(%d)(%s) flags 0x%x ifindex %d #paths %d peer %p",
-                               bnc_str(bnc, buf, PREFIX2STR_BUFFER),
-                               bnc->ifindex, bnc->bgp->name_pretty, bnc->flags,
-                               bnc->ifindex, bnc->path_count, bnc->nht_info);
-               }
+                               "Found existing bnc %pFX(%d)(%s) flags 0x%x ifindex %d #paths %d peer %p",
+                               &bnc->prefix, bnc->ifindex,
+                               bnc->bgp->name_pretty, bnc->flags, bnc->ifindex,
+                               bnc->path_count, bnc->nht_info);
        }
 
        if (pi && is_route_parent_evpn(pi))
@@ -1019,14 +1009,12 @@ void evaluate_paths(struct bgp_nexthop_cache *bnc)
        const struct prefix *p;
 
        if (BGP_DEBUG(nht, NHT)) {
-               char buf[PREFIX2STR_BUFFER];
                char bnc_buf[BNC_FLAG_DUMP_SIZE];
                char chg_buf[BNC_FLAG_DUMP_SIZE];
 
-               bnc_str(bnc, buf, PREFIX2STR_BUFFER);
                zlog_debug(
-                       "NH update for %s(%d)(%u)(%s) - flags %s chgflags %s- evaluate paths",
-                       buf, bnc->ifindex, bnc->srte_color,
+                       "NH update for %pFX(%d)(%u)(%s) - flags %s chgflags %s- evaluate paths",
+                       &bnc->prefix, bnc->ifindex, bnc->srte_color,
                        bnc->bgp->name_pretty,
                        bgp_nexthop_dump_bnc_flags(bnc, bnc_buf,
                                                   sizeof(bnc_buf)),