From 35d921cc20eca237893492dafe661f94d4e87837 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Timo=20Ter=C3=A4s?= Date: Sat, 23 May 2015 11:08:41 +0300 Subject: [PATCH] zebra: use prefix2str for logging where possible MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This makes code more robust, consice and readable. Signed-off-by: Timo Teräs Signed-off-by: David Lamparter (cherry picked from commit be6335d682c5ee1b6930345193eda875705fbab2) --- zebra/interface.c | 5 ++-- zebra/ioctl_solaris.c | 16 +++++------ zebra/irdp_main.c | 6 ++-- zebra/kernel_socket.c | 66 ++++++++++++++++--------------------------- zebra/redistribute.c | 16 +++++------ zebra/rt_netlink.c | 20 ++++++------- zebra/rt_socket.c | 20 ++++++------- zebra/rtadv.c | 8 ++---- zebra/zebra_fpm.c | 7 ++--- zebra/zebra_rib.c | 66 ++++++++++++++++++++----------------------- 10 files changed, 99 insertions(+), 131 deletions(-) diff --git a/zebra/interface.c b/zebra/interface.c index f3bd3eb46c..cac3f2d69f 100644 --- a/zebra/interface.c +++ b/zebra/interface.c @@ -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); diff --git a/zebra/ioctl_solaris.c b/zebra/ioctl_solaris.c index 7c1e602e2d..19be21ded8 100644 --- a/zebra/ioctl_solaris.c +++ b/zebra/ioctl_solaris.c @@ -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; diff --git a/zebra/irdp_main.c b/zebra/irdp_main.c index 069a2df006..c68eca42a6 100644 --- a/zebra/irdp_main.c +++ b/zebra/irdp_main.c @@ -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)); diff --git a/zebra/kernel_socket.c b/zebra/kernel_socket.c index 031ef170a3..1744caf2e8 100644 --- a/zebra/kernel_socket.c +++ b/zebra/kernel_socket.c @@ -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; } diff --git a/zebra/redistribute.c b/zebra/redistribute.c index a383fdde7c..1867362778 100644 --- a/zebra/redistribute.c +++ b/zebra/redistribute.c @@ -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); diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c index bc2b08dd72..251b55c0c6 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c @@ -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)); } } diff --git a/zebra/rt_socket.c b/zebra/rt_socket.c index 23e219be97..abeb87a427 100644 --- a/zebra/rt_socket.c +++ b/zebra/rt_socket.c @@ -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) */ diff --git a/zebra/rtadv.c b/zebra/rtadv.c index 89087a9eca..909b8cd646 100644 --- a/zebra/rtadv.c +++ b/zebra/rtadv.c @@ -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)) { diff --git a/zebra/zebra_fpm.c b/zebra/zebra_fpm.c index 3771e53e84..220fddaf67 100644 --- a/zebra/zebra_fpm.c +++ b/zebra/zebra_fpm.c @@ -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); diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index 656f5bb752..d70f528f5a 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -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; -- 2.39.5