summaryrefslogtreecommitdiff
path: root/lib/plist.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2020-10-14 12:57:14 -0400
committerDonald Sharp <sharpd@nvidia.com>2020-10-17 13:39:10 -0400
commitb219dda129be5121d154685bf9d7c961113cd70b (patch)
tree4c8d13a637bc4c1664458deb2213cb46f8cc95b7 /lib/plist.c
parentc10e14e96dae32a3b52bc97ab197e58577cff709 (diff)
lib: Convert usage of strings to %pFX and %pRN
Convert over to using the %pFX and %pRN modifiers to output strings to allow us to consolidate on one standard for printing prefixes. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'lib/plist.c')
-rw-r--r--lib/plist.c32
1 files changed, 7 insertions, 25 deletions
diff --git a/lib/plist.c b/lib/plist.c
index 981e86e2ac..4588dfe1d3 100644
--- a/lib/plist.c
+++ b/lib/plist.c
@@ -901,14 +901,11 @@ static void __attribute__((unused)) prefix_list_print(struct prefix_list *plist)
printf("any %s\n", prefix_list_type_str(pentry));
else {
struct prefix *p;
- char buf[BUFSIZ];
p = &pentry->prefix;
- printf(" seq %lld %s %s/%d", (long long)pentry->seq,
- prefix_list_type_str(pentry),
- inet_ntop(p->family, p->u.val, buf, BUFSIZ),
- p->prefixlen);
+ printf(" seq %lld %s %pFX", (long long)pentry->seq,
+ prefix_list_type_str(pentry), p);
if (pentry->ge)
printf(" ge %d", pentry->ge);
if (pentry->le)
@@ -1014,12 +1011,8 @@ static void vty_show_prefix_entry(struct vty *vty, afi_t afi,
vty_out(vty, "any");
else {
struct prefix *p = &pentry->prefix;
- char buf[BUFSIZ];
- vty_out(vty, "%s/%d",
- inet_ntop(p->family, p->u.val, buf,
- BUFSIZ),
- p->prefixlen);
+ vty_out(vty, "%pFX", p);
if (pentry->ge)
vty_out(vty, " ge %d", pentry->ge);
@@ -1121,12 +1114,8 @@ static int vty_show_prefix_list_prefix(struct vty *vty, afi_t afi,
vty_out(vty, "any");
else {
struct prefix *pf = &pentry->prefix;
- char buf[BUFSIZ];
- vty_out(vty, "%s/%d",
- inet_ntop(pf->family, pf->u.val, buf,
- BUFSIZ),
- pf->prefixlen);
+ vty_out(vty, "%pFX", pf);
if (pentry->ge)
vty_out(vty, " ge %d", pentry->ge);
@@ -1491,11 +1480,8 @@ int prefix_bgp_show_prefix_list(struct vty *vty, afi_t afi, char *name,
for (pentry = plist->head; pentry; pentry = pentry->next) {
struct prefix *p = &pentry->prefix;
char buf_a[BUFSIZ];
- char buf_b[BUFSIZ];
- snprintf(buf_a, sizeof(buf_a), "%s/%d",
- inet_ntop(p->family, p->u.val, buf_b, BUFSIZ),
- p->prefixlen);
+ snprintf(buf_a, sizeof(buf_a), "%pFX", p);
json_object_int_add(json_list, "seq", pentry->seq);
json_object_string_add(json_list, "seqPrefixListType",
@@ -1526,13 +1512,9 @@ int prefix_bgp_show_prefix_list(struct vty *vty, afi_t afi, char *name,
for (pentry = plist->head; pentry; pentry = pentry->next) {
struct prefix *p = &pentry->prefix;
- char buf[BUFSIZ];
- vty_out(vty, " seq %" PRId64 " %s %s/%d",
- pentry->seq,
- prefix_list_type_str(pentry),
- inet_ntop(p->family, p->u.val, buf, BUFSIZ),
- p->prefixlen);
+ vty_out(vty, " seq %" PRId64 " %s %pFX", pentry->seq,
+ prefix_list_type_str(pentry), p);
if (pentry->ge)
vty_out(vty, " ge %d", pentry->ge);