]> git.puffer.fish Git - mirror/frr.git/commitdiff
lib: make prefix2str simpler to use, and use it in zclient
authorTimo Teräs <timo.teras@iki.fi>
Sat, 23 May 2015 08:08:39 +0000 (11:08 +0300)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 9 Jun 2016 12:28:38 +0000 (08:28 -0400)
Returning the buffer allows using it in the logging functions
in easier way. This also makes the API consistent with sockunion.

Add also PREFIX_STRLEN to be the generic buffer length required
for any prefix string representation.

Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
(cherry picked from commit 41eb9a4305fbcb206c900a18af7df7115d857d60)

lib/prefix.h
lib/zclient.c

index 6be20de6919e2199dc43b87eb7aec382f14149fd..39c2b620196b07646005b2211ee49adb7af5f4f0 100644 (file)
@@ -129,6 +129,9 @@ union prefix46constptr
 #define INET6_BUFSIZ 51
 #endif /* INET6_BUFSIZ */
 
+/* Maximum prefix string length (IPv6) */
+#define PREFIX_STRLEN 51
+
 /* Max bit/byte length of IPv4 address. */
 #define IPV4_MAX_BYTELEN    4
 #define IPV4_MAX_BITLEN    32
index ea663329caeee5b2c849a7634bde7f3aab97ab91..b6d3aa9fed4f625f6a896b23f33844c35c53907e 100644 (file)
@@ -1181,11 +1181,11 @@ zebra_interface_address_read (int type, struct stream *s, vrf_id_t vrf_id)
           else if (CHECK_FLAG(ifc->flags, ZEBRA_IFA_PEER))
             {
               /* carp interfaces on OpenBSD with 0.0.0.0/0 as "peer" */
-              char buf[PREFIX2STR_BUFFER];
-              prefix2str (ifc->address, buf, sizeof(buf));
+              char buf[PREFIX_STRLEN];
               zlog_warn("warning: interface %s address %s "
                    "with peer flag set, but no peer address!",
-                   ifp->name, buf);
+                   ifp->name,
+                   prefix2str (ifc->address, buf, sizeof buf));
               UNSET_FLAG(ifc->flags, ZEBRA_IFA_PEER);
             }
         }