]> git.proxmox.com Git - mirror_frr.git/commitdiff
zebra: use prefix2str for logging where possible
authorTimo Teräs <timo.teras@iki.fi>
Sat, 23 May 2015 08:08:41 +0000 (11:08 +0300)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 9 Jun 2016 13:08:05 +0000 (09:08 -0400)
This makes code more robust, consice and readable.

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

zebra/interface.c
zebra/ioctl_solaris.c
zebra/irdp_main.c
zebra/kernel_socket.c
zebra/redistribute.c
zebra/rt_netlink.c
zebra/rt_socket.c
zebra/rtadv.c
zebra/zebra_fpm.c
zebra/zebra_rib.c

index f3bd3eb46c732d4c43196b48a663607a874b87f5..cac3f2d69f18f23a79d96567a24ea83748033fe4 100644 (file)
@@ -2116,10 +2116,9 @@ if_config_write (struct vty *vty)
              {
                char buf[INET6_ADDRSTRLEN];
                p = ifc->address;
-               vty_out (vty, " ip%s address %s/%d",
+               vty_out (vty, " ip%s address %s",
                         p->family == AF_INET ? "" : "v6",
-                        inet_ntop (p->family, &p->u.prefix, buf, sizeof(buf)),
-                        p->prefixlen);
+                        prefix2str (p, buf, sizeof(buf)));
 
                if (ifc->label)
                  vty_out (vty, " label %s", ifc->label);
index 7c1e602e2d3a221053efc77cfd465f7e439498a9..19be21ded8942827ff3afe739c2b420849b08c35 100644 (file)
@@ -407,11 +407,11 @@ if_unset_flags (struct interface *ifp, uint64_t flags)
 int
 if_prefix_add_ipv6 (struct interface *ifp, struct connected *ifc)
 {
-  char addrbuf[INET_ADDRSTRLEN];
+  char addrbuf[PREFIX_STRLEN];
 
-  inet_ntop (AF_INET6, &(((struct prefix_ipv6 *) (ifc->address))->prefix),
-             addrbuf, sizeof (addrbuf));
-  zlog_warn ("Can't set %s on interface %s", addrbuf, ifp->name);
+  zlog_warn ("Can't set %s on interface %s",
+             prefix2str(ifc->address->prefix, addrbuf, sizeof(addrbuf)),
+             ifp->name);
 
   return 0;
 
@@ -420,11 +420,11 @@ if_prefix_add_ipv6 (struct interface *ifp, struct connected *ifc)
 int
 if_prefix_delete_ipv6 (struct interface *ifp, struct connected *ifc)
 {
-  char addrbuf[INET_ADDRSTRLEN];
+  char addrbuf[PREFIX_STRLEN];
 
-  inet_ntop (AF_INET6, &(((struct prefix_ipv6 *) (ifc->address))->prefix),
-             addrbuf, sizeof (addrbuf));
-  zlog_warn ("Can't delete %s on interface %s", addrbuf, ifp->name);
+  zlog_warn ("Can't delete %s on interface %s",
+             prefix2str(ifc->address->prefix, addrbuf, sizeof(addrbuf)),
+             ifp->name);
 
   return 0;
 
index 069a2df006bc1c6fe8b5df26dce02684435dba4c..c68eca42a696815e4adae5ad877526103cdd4cf2 100644 (file)
@@ -178,6 +178,7 @@ irdp_send(struct interface *ifp, struct prefix *p, struct stream *s)
 {
   struct zebra_if *zi=ifp->info;
   struct irdp_interface *irdp=&zi->irdp;
+  char buf[PREFIX_STRLEN];
   u_int32_t dst;
   u_int32_t ttl=1;
 
@@ -189,10 +190,9 @@ irdp_send(struct interface *ifp, struct prefix *p, struct stream *s)
     dst = htonl(INADDR_ALLHOSTS_GROUP);
 
   if(irdp->flags & IF_DEBUG_MESSAGES) 
-    zlog_debug("IRDP: TX Advert on %s %s/%d Holdtime=%d Preference=%d", 
+    zlog_debug("IRDP: TX Advert on %s %s Holdtime=%d Preference=%d",
              ifp->name,
-             inet_ntoa(p->u.prefix4), 
-             p->prefixlen,
+             prefix2str(p, buf, sizeof buf),
              irdp->flags & IF_SHUTDOWN? 0 : irdp->Lifetime,
              get_pref(irdp, p));
 
index 031ef170a3dd0dd5505fca21bf1496df3239e698..1744caf2e8af5917dce8657985e83b763373d2ee 100644 (file)
@@ -640,50 +640,32 @@ ifam_read_mesg (struct ifa_msghdr *ifm,
 
   if (IS_ZEBRA_DEBUG_KERNEL)
     {
-      switch (sockunion_family(addr))
+      int family = sockunion_family(addr);
+      switch (family)
         {
        case AF_INET:
-         {
-           char buf[4][INET_ADDRSTRLEN];
-           zlog_debug ("%s: ifindex %d, ifname %s, ifam_addrs 0x%x, "
-                       "ifam_flags 0x%x, addr %s/%d broad %s dst %s "
-                       "gateway %s",
-                       __func__, ifm->ifam_index,
-                       (ifnlen ? ifname : "(nil)"), ifm->ifam_addrs,
-                       ifm->ifam_flags,
-                       inet_ntop(AF_INET,&addr->sin.sin_addr,
-                                 buf[0],sizeof(buf[0])),
-                       ip_masklen(mask->sin.sin_addr),
-                       inet_ntop(AF_INET,&brd->sin.sin_addr,
-                                 buf[1],sizeof(buf[1])),
-                       inet_ntop(AF_INET,&dst.sin.sin_addr,
-                                 buf[2],sizeof(buf[2])),
-                       inet_ntop(AF_INET,&gateway.sin.sin_addr,
-                                 buf[3],sizeof(buf[3])));
-         }
-         break;
 #ifdef HAVE_IPV6
        case AF_INET6:
+#endif
          {
            char buf[4][INET6_ADDRSTRLEN];
            zlog_debug ("%s: ifindex %d, ifname %s, ifam_addrs 0x%x, "
                        "ifam_flags 0x%x, addr %s/%d broad %s dst %s "
                        "gateway %s",
-                       __func__, ifm->ifam_index, 
+                       __func__, ifm->ifam_index,
                        (ifnlen ? ifname : "(nil)"), ifm->ifam_addrs,
                        ifm->ifam_flags,
-                       inet_ntop(AF_INET6,&addr->sin6.sin6_addr,
+                       inet_ntop(family,&addr->sin.sin_addr,
                                  buf[0],sizeof(buf[0])),
-                       ip6_masklen(mask->sin6.sin6_addr),
-                       inet_ntop(AF_INET6,&brd->sin6.sin6_addr,
+                       ip_masklen(mask->sin.sin_addr),
+                       inet_ntop(family,&brd->sin.sin_addr,
                                  buf[1],sizeof(buf[1])),
-                       inet_ntop(AF_INET6,&dst.sin6.sin6_addr,
+                       inet_ntop(family,&dst.sin.sin_addr,
                                  buf[2],sizeof(buf[2])),
-                       inet_ntop(AF_INET6,&gateway.sin6.sin6_addr,
+                       inet_ntop(family,&gateway.sin.sin_addr,
                                  buf[3],sizeof(buf[3])));
          }
          break;
-#endif /* HAVE_IPV6 */
         default:
          zlog_debug ("%s: ifindex %d, ifname %s, ifam_addrs 0x%x",
                      __func__, ifm->ifam_index, 
@@ -915,7 +897,7 @@ rtm_read (struct rt_msghdr *rtm)
        */
       if (rtm->rtm_type != RTM_GET && rtm->rtm_pid == pid)
       {
-        char buf[PREFIX2STR_BUFFER], gate_buf[INET_ADDRSTRLEN];
+        char buf[PREFIX_STRLEN], gate_buf[INET_ADDRSTRLEN];
         int ret;
         if (! IS_ZEBRA_DEBUG_RIB)
           return;
@@ -931,18 +913,18 @@ rtm_read (struct rt_msghdr *rtm)
             switch (ret)
             {
               case ZEBRA_RIB_NOTFOUND:
-                zlog_debug ("%s: %s %s/%d: desync: RR isn't yet in RIB, while already in FIB",
-                  __func__, lookup (rtm_type_str, rtm->rtm_type), buf, p.prefixlen);
+                zlog_debug ("%s: %s %s: desync: RR isn't yet in RIB, while already in FIB",
+                  __func__, lookup (rtm_type_str, rtm->rtm_type), buf);
                 break;
               case ZEBRA_RIB_FOUND_CONNECTED:
               case ZEBRA_RIB_FOUND_NOGATE:
                 inet_ntop (AF_INET, &gate.sin.sin_addr, gate_buf, INET_ADDRSTRLEN);
-                zlog_debug ("%s: %s %s/%d: desync: RR is in RIB, but gate differs (ours is %s)",
-                  __func__, lookup (rtm_type_str, rtm->rtm_type), buf, p.prefixlen, gate_buf);
+                zlog_debug ("%s: %s %s: desync: RR is in RIB, but gate differs (ours is %s)",
+                  __func__, lookup (rtm_type_str, rtm->rtm_type), buf, gate_buf);
                 break;
               case ZEBRA_RIB_FOUND_EXACT: /* RIB RR == FIB RR */
-                zlog_debug ("%s: %s %s/%d: done Ok",
-                  __func__, lookup (rtm_type_str, rtm->rtm_type), buf, p.prefixlen);
+                zlog_debug ("%s: %s %s: done Ok",
+                  __func__, lookup (rtm_type_str, rtm->rtm_type), buf);
                 rib_lookup_and_dump (&p);
                 return;
                 break;
@@ -954,27 +936,27 @@ rtm_read (struct rt_msghdr *rtm)
             switch (ret)
             {
               case ZEBRA_RIB_FOUND_EXACT:
-                zlog_debug ("%s: %s %s/%d: desync: RR is still in RIB, while already not in FIB",
-                  __func__, lookup (rtm_type_str, rtm->rtm_type), buf, p.prefixlen);
+                zlog_debug ("%s: %s %s: desync: RR is still in RIB, while already not in FIB",
+                  __func__, lookup (rtm_type_str, rtm->rtm_type), buf);
                 rib_lookup_and_dump (&p);
                 break;
               case ZEBRA_RIB_FOUND_CONNECTED:
               case ZEBRA_RIB_FOUND_NOGATE:
-                zlog_debug ("%s: %s %s/%d: desync: RR is still in RIB, plus gate differs",
-                  __func__, lookup (rtm_type_str, rtm->rtm_type), buf, p.prefixlen);
+                zlog_debug ("%s: %s %s: desync: RR is still in RIB, plus gate differs",
+                  __func__, lookup (rtm_type_str, rtm->rtm_type), buf);
                 rib_lookup_and_dump (&p);
                 break;
               case ZEBRA_RIB_NOTFOUND: /* RIB RR == FIB RR */
-                zlog_debug ("%s: %s %s/%d: done Ok",
-                  __func__, lookup (rtm_type_str, rtm->rtm_type), buf, p.prefixlen);
+                zlog_debug ("%s: %s %s: done Ok",
+                  __func__, lookup (rtm_type_str, rtm->rtm_type), buf);
                 rib_lookup_and_dump (&p);
                 return;
                 break;
             }
             break;
           default:
-            zlog_debug ("%s: %s/%d: warning: loopback RTM of type %s received",
-              __func__, buf, p.prefixlen, lookup (rtm_type_str, rtm->rtm_type));
+            zlog_debug ("%s: %s: warning: loopback RTM of type %s received",
+              __func__, buf, lookup (rtm_type_str, rtm->rtm_type));
         }
         return;
       }
index a383fdde7c535c5faaff9bd8ffd76e22bf95c6da..1867362778dd9471f0e317ef81a439ca3fb8ce82 100644 (file)
@@ -446,12 +446,12 @@ zebra_interface_address_add_update (struct interface *ifp,
 
   if (IS_ZEBRA_DEBUG_EVENT)
     {
-      char buf[INET6_ADDRSTRLEN];
+      char buf[PREFIX_STRLEN];
 
       p = ifc->address;
-      zlog_debug ("MESSAGE: ZEBRA_INTERFACE_ADDRESS_ADD %s/%d on %s",
-                 inet_ntop (p->family, &p->u.prefix, buf, INET6_ADDRSTRLEN),
-                 p->prefixlen, ifc->ifp->name);
+      zlog_debug ("MESSAGE: ZEBRA_INTERFACE_ADDRESS_ADD %s on %s",
+                 prefix2str (p, buf, sizeof(buf)),
+                 ifc->ifp->name);
     }
 
   if (!CHECK_FLAG(ifc->conf, ZEBRA_IFC_REAL))
@@ -478,12 +478,12 @@ zebra_interface_address_delete_update (struct interface *ifp,
 
   if (IS_ZEBRA_DEBUG_EVENT)
     {
-      char buf[INET6_ADDRSTRLEN];
+      char buf[PREFIX_STRLEN];
 
       p = ifc->address;
-      zlog_debug ("MESSAGE: ZEBRA_INTERFACE_ADDRESS_DELETE %s/%d on %s",
-                 inet_ntop (p->family, &p->u.prefix, buf, INET6_ADDRSTRLEN),
-                p->prefixlen, ifc->ifp->name);
+      zlog_debug ("MESSAGE: ZEBRA_INTERFACE_ADDRESS_DELETE %s on %s",
+                 prefix2str (p, buf, sizeof(buf)),
+                 ifc->ifp->name);
     }
 
   router_id_del_address(ifc);
index bc2b08dd72cf30c3386e179a1435a0d5db454204..251b55c0c6d49011d639d1839f67b678ce88f2e9 100644 (file)
@@ -1144,7 +1144,7 @@ netlink_route_change (struct sockaddr_nl *snl, struct nlmsghdr *h,
 
       if (IS_ZEBRA_DEBUG_KERNEL)
         {
-          char buf[PREFIX2STR_BUFFER];
+          char buf[PREFIX_STRLEN];
           zlog_debug ("%s %s vrf %u",
                       h->nlmsg_type == RTM_NEWROUTE ? "RTM_NEWROUTE" : "RTM_DELROUTE",
                       prefix2str (&p, buf, sizeof(buf)), vrf_id);
@@ -1223,7 +1223,6 @@ netlink_route_change (struct sockaddr_nl *snl, struct nlmsghdr *h,
   if (rtm->rtm_family == AF_INET6)
     {
       struct prefix_ipv6 p;
-      char buf[PREFIX2STR_BUFFER];
 
       p.family = AF_INET6;
       memcpy (&p.prefix, dest, 16);
@@ -1231,6 +1230,7 @@ netlink_route_change (struct sockaddr_nl *snl, struct nlmsghdr *h,
 
       if (IS_ZEBRA_DEBUG_KERNEL)
         {
+         char buf[PREFIX_STRLEN];
           zlog_debug ("%s %s vrf %u",
                       h->nlmsg_type == RTM_NEWROUTE ? "RTM_NEWROUTE" : "RTM_DELROUTE",
                       prefix2str (&p, buf, sizeof(buf)), vrf_id);
@@ -1946,16 +1946,12 @@ _netlink_route_debug(
 {
   if (IS_ZEBRA_DEBUG_KERNEL)
     {
-      zlog_debug ("netlink_route_multipath() (%s): %s %s/%d vrf %u type %s",
-         routedesc,
-         lookup (nlmsg_str, cmd),
-#ifdef HAVE_IPV6
-         (family == AF_INET) ? inet_ntoa (p->u.prefix4) :
-         inet6_ntoa (p->u.prefix6),
-#else
-         inet_ntoa (p->u.prefix4),
-#endif /* HAVE_IPV6 */
-         p->prefixlen, zvrf->vrf_id, nexthop_type_to_str (nexthop->type));
+      char buf[PREFIX_STRLEN];
+      zlog_debug ("netlink_route_multipath() (%s): %s %s vrf %u type %s",
+                 routedesc,
+                 lookup (nlmsg_str, cmd),
+                 prefix2str (p, buf, sizeof(buf)),
+                 zvrf->vrf_id, nexthop_type_to_str (nexthop->type));
     }
 }
 
index 23e219be97b54ec403db926d87aeafc176f76e23..abeb87a42729dcff4abd59e37f257f357ab39d02 100644 (file)
@@ -79,10 +79,10 @@ kernel_rtm_ipv4 (int cmd, struct prefix *p, struct rib *rib, int family)
   unsigned int ifindex = 0;
   int gate = 0;
   int error;
-  char prefix_buf[INET_ADDRSTRLEN];
+  char prefix_buf[PREFIX_STRLEN];
 
   if (IS_ZEBRA_DEBUG_RIB)
-    inet_ntop (AF_INET, &p->u.prefix, prefix_buf, INET_ADDRSTRLEN);
+    prefix2str (p, prefix_buf, sizeof(prefix_buf));
   memset (&sin_dest, 0, sizeof (struct sockaddr_in));
   sin_dest.sin_family = AF_INET;
 #ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
@@ -159,8 +159,8 @@ kernel_rtm_ipv4 (int cmd, struct prefix *p, struct rib *rib, int family)
            {
              if (!gate)
              {
-               zlog_debug ("%s: %s/%d: attention! gate not found for rib %p",
-                 __func__, prefix_buf, p->prefixlen, rib);
+               zlog_debug ("%s: %s: attention! gate not found for rib %p",
+                 __func__, prefix_buf, rib);
                rib_dump (p, rib);
              }
              else
@@ -173,8 +173,8 @@ kernel_rtm_ipv4 (int cmd, struct prefix *p, struct rib *rib, int family)
              case ZEBRA_ERR_NOERROR:
                nexthop_num++;
                if (IS_ZEBRA_DEBUG_RIB)
-                 zlog_debug ("%s: %s/%d: successfully did NH %s",
-                   __func__, prefix_buf, p->prefixlen, gate_buf);
+                 zlog_debug ("%s: %s: successfully did NH %s",
+                   __func__, prefix_buf, gate_buf);
                if (cmd == RTM_ADD)
                  SET_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB);
                break;
@@ -196,11 +196,9 @@ kernel_rtm_ipv4 (int cmd, struct prefix *p, struct rib *rib, int family)
              case ZEBRA_ERR_RTNOEXIST:
              case ZEBRA_ERR_RTUNREACH:
              default:
-               /* This point is reachable regardless of debugging mode. */
-               if (!IS_ZEBRA_DEBUG_RIB)
-                 inet_ntop (AF_INET, &p->u.prefix, prefix_buf, INET_ADDRSTRLEN);
-               zlog_err ("%s: %s/%d: rtm_write() unexpectedly returned %d for command %s",
-                 __func__, prefix_buf, p->prefixlen, error, lookup (rtm_type_str, cmd));
+               zlog_err ("%s: %s: rtm_write() unexpectedly returned %d for command %s",
+                 __func__, prefix2str(p, prefix_buf, sizeof(prefix_buf)),
+                 error, lookup (rtm_type_str, cmd));
                break;
            }
          } /* if (cmd and flags make sense) */
index 89087a9eca56633ede45a9e0d704109cb3875fe2..909b8cd646a252bcd0987ef23126997517e50466 100644 (file)
@@ -1895,7 +1895,7 @@ rtadv_config_write (struct vty *vty, struct interface *ifp)
   struct zebra_if *zif;
   struct listnode *node;
   struct rtadv_prefix *rprefix;
-  u_char buf[INET6_ADDRSTRLEN];
+  char buf[PREFIX_STRLEN];
   int interval;
 
   zif = ifp->info;
@@ -1954,10 +1954,8 @@ rtadv_config_write (struct vty *vty, struct interface *ifp)
 
   for (ALL_LIST_ELEMENTS_RO (zif->rtadv.AdvPrefixList, node, rprefix))
     {
-      vty_out (vty, " ipv6 nd prefix %s/%d",
-              inet_ntop (AF_INET6, &rprefix->prefix.prefix,
-                         (char *) buf, INET6_ADDRSTRLEN),
-              rprefix->prefix.prefixlen);
+      vty_out (vty, " ipv6 nd prefix %s",
+               prefix2str (&rprefix->prefix, buf, sizeof(buf)));
       if ((rprefix->AdvValidLifetime != RTADV_VALID_LIFETIME) || 
          (rprefix->AdvPreferredLifetime != RTADV_PREFERRED_LIFETIME))
        {
index 3771e53e849f3ec9bff30ae60dd7e9d9490d7528..220fddaf67983c99b33e1496e92cb07a0870f3a9 100644 (file)
@@ -1304,7 +1304,7 @@ void
 zfpm_trigger_update (struct route_node *rn, const char *reason)
 {
   rib_dest_t *dest;
-  char buf[INET6_ADDRSTRLEN];
+  char buf[PREFIX_STRLEN];
 
   /*
    * Ignore if the connection is down. We will update the FPM about
@@ -1332,9 +1332,8 @@ zfpm_trigger_update (struct route_node *rn, const char *reason)
 
   if (reason)
     {
-      zfpm_debug ("%s/%d triggering update to FPM - Reason: %s",
-                 inet_ntop (rn->p.family, &rn->p.u.prefix, buf, sizeof (buf)),
-                 rn->p.prefixlen, reason);
+      zfpm_debug ("%s triggering update to FPM - Reason: %s",
+                 prefix2str (&rn->p, buf, sizeof(buf)), reason);
     }
 
   SET_FLAG (dest->flags, RIB_DEST_UPDATE_FPM);
index 656f5bb7521e6f6a9dd0915999cf8a1e5beb795e..d70f528f5a41e95ae0d86d37d55f2d7883961109 100644 (file)
@@ -87,7 +87,7 @@ static void __attribute__((format (printf, 5, 6)))
 _rnode_zlog(const char *_func, vrf_id_t vrf_id, struct route_node *rn, int priority,
            const char *msgfmt, ...)
 {
-  char buf[INET6_ADDRSTRLEN + 4], *bptr;
+  char buf[PREFIX_STRLEN + 8];
   char msgbuf[512];
   va_list ap;
 
@@ -99,10 +99,9 @@ _rnode_zlog(const char *_func, vrf_id_t vrf_id, struct route_node *rn, int prior
     {
       rib_table_info_t *info = rn->table->info;
 
-      inet_ntop (rn->p.family, &rn->p.u.prefix, buf, INET6_ADDRSTRLEN);
-      bptr = buf + strlen(buf);
-      snprintf(bptr, buf + sizeof(buf) - bptr, "/%d%s", rn->p.prefixlen,
-               info->safi == SAFI_MULTICAST ? " (MRIB)" : "");
+      prefix2str(&rn->p, buf, sizeof(buf));
+      if (info->safi == SAFI_MULTICAST)
+        strcat(buf, " (MRIB)");
     }
   else
     {
@@ -2529,7 +2528,7 @@ void _rib_dump (const char * func,
                union prefix46constptr pp, const struct rib * rib)
 {
   const struct prefix *p = pp.p;
-  char straddr[PREFIX2STR_BUFFER];
+  char straddr[PREFIX_STRLEN];
   struct nexthop *nexthop, *tnexthop;
   int recursing;
 
@@ -2599,14 +2598,14 @@ void rib_lookup_and_dump (struct prefix_ipv4 * p, vrf_id_t vrf_id)
     return;
   }
 
-  inet_ntop (AF_INET, &p->prefix.s_addr, prefix_buf, INET_ADDRSTRLEN);
   /* Scan the RIB table for exactly matching RIB entry. */
   rn = route_node_lookup (table, (struct prefix *) p);
 
   /* No route for this prefix. */
   if (! rn)
   {
-    zlog_debug ("%s: lookup failed for %s/%d", __func__, prefix_buf, p->prefixlen);
+    zlog_debug ("%s: lookup failed for %s", __func__,
+                prefix2str((struct prefix*) p, prefix_buf, sizeof(prefix_buf)));
     return;
   }
 
@@ -2669,10 +2668,9 @@ void rib_lookup_and_pushup (struct prefix_ipv4 * p, vrf_id_t vrf_id)
       changed = 1;
       if (IS_ZEBRA_DEBUG_RIB)
       {
-        char buf[INET_ADDRSTRLEN];
-        inet_ntop (rn->p.family, &p->prefix, buf, INET_ADDRSTRLEN);
-        zlog_debug ("%u:%s/%d: freeing way for connected prefix",
-                    rib->vrf_id, buf, p->prefixlen);
+        char buf[PREFIX_STRLEN];
+        zlog_debug ("%u:%s: freeing way for connected prefix",
+                    rib->vrf_id, prefix2str(&rn->p, buf, sizeof(buf)));
         rib_dump (&rn->p, rib);
       }
       rib_uninstall (rn, rib);
@@ -2774,7 +2772,7 @@ rib_delete_ipv4 (int type, u_short instance, int flags, struct prefix_ipv4 *p,
   struct rib *same = NULL;
   struct nexthop *nexthop, *tnexthop;
   int recursing;
-  char buf1[PREFIX2STR_BUFFER];
+  char buf1[PREFIX_STRLEN];
   char buf2[INET6_ADDRSTRLEN];
 
   /* Lookup table.  */
@@ -2790,9 +2788,8 @@ rib_delete_ipv4 (int type, u_short instance, int flags, struct prefix_ipv4 *p,
   if (! rn)
     {
       if (IS_ZEBRA_DEBUG_RIB)
-        zlog_debug ("%u:%s/%d: doesn't exist in rib",
-                    vrf_id, inet_ntop (p->family, &p->prefix, buf1, INET6_ADDRSTRLEN),
-                    p->prefixlen);
+        zlog_debug ("%u:%s: doesn't exist in rib",
+                    vrf_id, prefix2str (p, buf1, sizeof(buf1)));
       return ZEBRA_ERR_RTNOEXIST;
     }
 
@@ -2878,15 +2875,15 @@ rib_delete_ipv4 (int type, u_short instance, int flags, struct prefix_ipv4 *p,
              if (gate)
                zlog_debug ("%u:%s: via %s ifindex %d type %d "
                           "doesn't exist in rib",
-                          vrf_id, prefix2str (p, buf1, sizeof(buf1)),
-                          inet_ntop (AF_INET, gate, buf2, INET_ADDRSTRLEN),
-                          ifindex,
-                          type);
+                           vrf_id, prefix2str (p, buf1, sizeof(buf1)),
+                           inet_ntop (AF_INET, gate, buf2, INET_ADDRSTRLEN),
+                           ifindex,
+                           type);
              else
                zlog_debug ("%u:%s: ifindex %d type %d doesn't exist in rib",
-                          vrf_id, prefix2str (p, buf1, sizeof(buf1)),
-                          ifindex,
-                          type);
+                           vrf_id, prefix2str (p, buf1, sizeof(buf1)),
+                           ifindex,
+                           type);
            }
          route_unlock_node (rn);
          return ZEBRA_ERR_RTNOEXIST;
@@ -3570,7 +3567,7 @@ rib_delete_ipv6 (int type, u_short instance, int flags, struct prefix_ipv6 *p,
   struct rib *same = NULL;
   struct nexthop *nexthop, *tnexthop;
   int recursing;
-  char buf1[PREFIX2STR_BUFFER];
+  char buf1[PREFIX_STRLEN];
   char buf2[INET6_ADDRSTRLEN];
 
   /* Apply mask. */
@@ -3586,9 +3583,8 @@ rib_delete_ipv6 (int type, u_short instance, int flags, struct prefix_ipv6 *p,
   if (! rn)
     {
       if (IS_ZEBRA_DEBUG_RIB)
-        zlog_debug ("%u:%s/%d: doesn't exist in rib",
-                    vrf_id, inet_ntop (p->family, &p->prefix, buf1, INET6_ADDRSTRLEN),
-                    p->prefixlen);
+        zlog_debug ("%u:%s: doesn't exist in rib",
+                    vrf_id, prefix2str (p, buf1, sizeof(buf1)));
       return ZEBRA_ERR_RTNOEXIST;
     }
 
@@ -3672,16 +3668,16 @@ rib_delete_ipv6 (int type, u_short instance, int flags, struct prefix_ipv6 *p,
            {
              if (gate)
                zlog_debug ("%s: vrf %u via %s ifindex %d type %d "
-                          "doesn't exist in rib",
-                          prefix2str (p, buf1, sizeof(buf1)), vrf_id,
-                          inet_ntop (AF_INET6, gate, buf2, INET6_ADDRSTRLEN),
-                          ifindex,
-                          type);
+                           "doesn't exist in rib",
+                           prefix2str (p, buf1, sizeof(buf1)), vrf_id,
+                           inet_ntop (AF_INET6, gate, buf2, INET6_ADDRSTRLEN),
+                           ifindex,
+                           type);
              else
                zlog_debug ("%s: vrf %u ifindex %d type %d doesn't exist in rib",
-                          prefix2str (p, buf1, sizeof(buf1)), vrf_id,
-                          ifindex,
-                          type);
+                           prefix2str (p, buf1, sizeof(buf1)), vrf_id,
+                           ifindex,
+                           type);
            }
          route_unlock_node (rn);
          return ZEBRA_ERR_RTNOEXIST;