]> git.puffer.fish Git - mirror/frr.git/commitdiff
zebra: replace inet_ntoa
authorMark Stapp <mjs@voltanet.io>
Wed, 21 Oct 2020 17:57:06 +0000 (13:57 -0400)
committerMark Stapp <mjs@voltanet.io>
Thu, 22 Oct 2020 17:37:25 +0000 (13:37 -0400)
Stop using inet_ntoa - use %pI4 or inet_ntop instead

Signed-off-by: Mark Stapp <mjs@voltanet.io>
17 files changed:
zebra/connected.c
zebra/interface.c
zebra/irdp_packet.c
zebra/rt_netlink.c
zebra/zebra_dplane.c
zebra/zebra_evpn.c
zebra/zebra_evpn_mac.c
zebra/zebra_evpn_mh.c
zebra/zebra_evpn_neigh.c
zebra/zebra_fpm.c
zebra/zebra_fpm_dt.c
zebra/zebra_fpm_netlink.c
zebra/zebra_mpls.c
zebra/zebra_mroute.c
zebra/zebra_rnh.c
zebra/zebra_vty.c
zebra/zebra_vxlan.c

index cd42b5b250599797757e38d02120aa2753294455..6a1efc3e65d4cc168262fe7a60eb2271c27a7d59 100644 (file)
@@ -308,8 +308,8 @@ void connected_add_ipv4(struct interface *ifp, int flags, struct in_addr *addr,
                        if (IPV4_ADDR_SAME(addr, dest))
                                flog_warn(
                                        EC_ZEBRA_IFACE_SAME_LOCAL_AS_PEER,
-                                       "warning: interface %s has same local and peer address %s, routing protocols may malfunction",
-                                       ifp->name, inet_ntoa(*addr));
+                                       "warning: interface %s has same local and peer address %pI4, routing protocols may malfunction",
+                                       ifp->name, addr);
                } else {
                        zlog_debug(
                                "warning: %s called for interface %s with peer flag set, but no peer address supplied",
@@ -322,8 +322,8 @@ void connected_add_ipv4(struct interface *ifp, int flags, struct in_addr *addr,
        if (!dest && (prefixlen == IPV4_MAX_PREFIXLEN)
                && if_is_pointopoint(ifp))
                zlog_debug(
-                       "warning: PtP interface %s with addr %s/%d needs a peer address",
-                       ifp->name, inet_ntoa(*addr), prefixlen);
+                       "warning: PtP interface %s with addr %pI4/%d needs a peer address",
+                       ifp->name, addr, prefixlen);
 
        /* Label of this address. */
        if (label)
index 0652d3a2ba9d58bc42ee822d6276f6a3c52f8ca2..3b7d6f243210a4c7c5748c6d49a76de0f9e57a05 100644 (file)
@@ -1494,14 +1494,14 @@ static void if_dump_vty(struct vty *vty, struct interface *ifp)
                vxlan_info = &zebra_if->l2info.vxl;
                vty_out(vty, "  VxLAN Id %u", vxlan_info->vni);
                if (vxlan_info->vtep_ip.s_addr != INADDR_ANY)
-                       vty_out(vty, " VTEP IP: %s",
-                               inet_ntoa(vxlan_info->vtep_ip));
+                       vty_out(vty, " VTEP IP: %pI4",
+                               &vxlan_info->vtep_ip);
                if (vxlan_info->access_vlan)
                        vty_out(vty, " Access VLAN Id %u\n",
                                vxlan_info->access_vlan);
                if (vxlan_info->mcast_grp.s_addr != INADDR_ANY)
-                       vty_out(vty, "  Mcast Group %s",
-                                       inet_ntoa(vxlan_info->mcast_grp));
+                       vty_out(vty, "  Mcast Group %pI4",
+                                       &vxlan_info->mcast_grp);
                if (vxlan_info->ifindex_link &&
                    (vxlan_info->link_nsid != NS_UNKNOWN)) {
                                struct interface *ifp;
@@ -1607,8 +1607,8 @@ static void if_dump_vty(struct vty *vty, struct interface *ifp)
                        vty_out(vty, "    Utilized Bandwidth %g (Byte/s)\n",
                                iflp->use_bw);
                if (IS_PARAM_SET(iflp, LP_RMT_AS))
-                       vty_out(vty, "    Neighbor ASBR IP: %s AS: %u \n",
-                               inet_ntoa(iflp->rmt_ip), iflp->rmt_as);
+                       vty_out(vty, "    Neighbor ASBR IP: %pI4 AS: %u \n",
+                               &iflp->rmt_ip, iflp->rmt_as);
        }
 
        hook_call(zebra_if_extra_info, vty, ifp);
@@ -3496,7 +3496,7 @@ static int link_params_config_write(struct vty *vty, struct interface *ifp)
        if (IS_PARAM_SET(iflp, LP_USE_BW))
                vty_out(vty, "  use-bw %g\n", iflp->use_bw);
        if (IS_PARAM_SET(iflp, LP_RMT_AS))
-               vty_out(vty, "  neighbor %s as %u\n", inet_ntoa(iflp->rmt_ip),
+               vty_out(vty, "  neighbor %pI4 as %u\n", &iflp->rmt_ip,
                        iflp->rmt_as);
        vty_out(vty, "  exit-link-params\n");
        return 0;
index 502a2f277cbbb937a46d88db321ced3b88c843ed..56fd35a7366cb5b60766cd3efa9937234fbc34cf 100644 (file)
@@ -79,6 +79,7 @@ static void parse_irdp_packet(char *p, int len, struct interface *ifp)
        struct zebra_if *zi;
        struct irdp_interface *irdp;
        uint16_t saved_chksum;
+       char buf[PREFIX_STRLEN];
 
        zi = ifp->info;
        if (!zi)
@@ -104,8 +105,8 @@ static void parse_irdp_packet(char *p, int len, struct interface *ifp)
 
        if (iplen < ICMP_MINLEN) {
                flog_err(EC_ZEBRA_IRDP_LEN_MISMATCH,
-                        "IRDP: RX ICMP packet too short from %s\n",
-                        inet_ntoa(src));
+                        "IRDP: RX ICMP packet too short from %pI4\n",
+                        &src);
                return;
        }
 
@@ -115,8 +116,8 @@ static void parse_irdp_packet(char *p, int len, struct interface *ifp)
         len of IP-header) 14+20 */
        if (iplen > IRDP_RX_BUF - 34) {
                flog_err(EC_ZEBRA_IRDP_LEN_MISMATCH,
-                        "IRDP: RX ICMP packet too long from %s\n",
-                        inet_ntoa(src));
+                        "IRDP: RX ICMP packet too long from %pI4\n",
+                        &src);
                return;
        }
 
@@ -128,8 +129,8 @@ static void parse_irdp_packet(char *p, int len, struct interface *ifp)
        if (in_cksum(icmp, datalen) != saved_chksum) {
                flog_warn(
                        EC_ZEBRA_IRDP_BAD_CHECKSUM,
-                       "IRDP: RX ICMP packet from %s. Bad checksum, silently ignored",
-                       inet_ntoa(src));
+                       "IRDP: RX ICMP packet from %pI4 Bad checksum, silently ignored",
+                       &src);
                return;
        }
 
@@ -141,8 +142,8 @@ static void parse_irdp_packet(char *p, int len, struct interface *ifp)
        if (icmp->code != 0) {
                flog_warn(
                        EC_ZEBRA_IRDP_BAD_TYPE_CODE,
-                       "IRDP: RX packet type %d from %s. Bad ICMP type code, silently ignored",
-                       icmp->type, inet_ntoa(src));
+                       "IRDP: RX packet type %d from %pI4 Bad ICMP type code, silently ignored",
+                       icmp->type, &src);
                return;
        }
 
@@ -152,11 +153,12 @@ static void parse_irdp_packet(char *p, int len, struct interface *ifp)
                && !(irdp->flags & IF_BROADCAST))) {
                flog_warn(
                        EC_ZEBRA_IRDP_BAD_RX_FLAGS,
-                       "IRDP: RX illegal from %s to %s while %s operates in %s; Please correct settings\n",
-                       inet_ntoa(src),
+                       "IRDP: RX illegal from %pI4 to %s while %s operates in %s; Please correct settings\n",
+                       &src,
                        ntohl(ip->ip_dst.s_addr) == INADDR_ALLRTRS_GROUP
                                ? "multicast"
-                               : inet_ntoa(ip->ip_dst),
+                               : inet_ntop(AF_INET, &ip->ip_dst,
+                                           buf, sizeof(buf)),
                        ifp->name,
                        irdp->flags & IF_BROADCAST ? "broadcast" : "multicast");
                return;
@@ -169,8 +171,8 @@ static void parse_irdp_packet(char *p, int len, struct interface *ifp)
        case ICMP_ROUTERSOLICIT:
 
                if (irdp->flags & IF_DEBUG_MESSAGES)
-                       zlog_debug("IRDP: RX Solicit on %s from %s",
-                                  ifp->name, inet_ntoa(src));
+                       zlog_debug("IRDP: RX Solicit on %s from %pI4",
+                                  ifp->name, &src);
 
                process_solicit(ifp);
                break;
@@ -178,8 +180,8 @@ static void parse_irdp_packet(char *p, int len, struct interface *ifp)
        default:
                flog_warn(
                        EC_ZEBRA_IRDP_BAD_TYPE_CODE,
-                       "IRDP: RX packet type %d from %s. Bad ICMP type code, silently ignored",
-                       icmp->type, inet_ntoa(src));
+                       "IRDP: RX packet type %d from %pI4 Bad ICMP type code, silently ignored",
+                       icmp->type, &src);
        }
 }
 
index d0bf77f016f48b8f6ba91ddbe197cb72b3d328e7..da0eeb364e13a5628435a6d234d897e8c28814d3 100644 (file)
@@ -903,8 +903,6 @@ static int netlink_route_change_read_multicast(struct nlmsghdr *h,
        int count;
        int oif[256];
        int oif_count = 0;
-       char sbuf[40];
-       char gbuf[40];
        char oif_list[256] = "\0";
        vrf_id_t vrf;
        int table;
@@ -966,8 +964,6 @@ static int netlink_route_change_read_multicast(struct nlmsghdr *h,
                struct interface *ifp = NULL;
                struct zebra_vrf *zvrf = NULL;
 
-               strlcpy(sbuf, inet_ntoa(m->sg.src), sizeof(sbuf));
-               strlcpy(gbuf, inet_ntoa(m->sg.grp), sizeof(gbuf));
                for (count = 0; count < oif_count; count++) {
                        ifp = if_lookup_by_index(oif[count], vrf);
                        char temp[256];
@@ -979,9 +975,10 @@ static int netlink_route_change_read_multicast(struct nlmsghdr *h,
                zvrf = zebra_vrf_lookup_by_id(vrf);
                ifp = if_lookup_by_index(iif, vrf);
                zlog_debug(
-                       "MCAST VRF: %s(%d) %s (%s,%s) IIF: %s(%d) OIF: %s jiffies: %lld",
+                       "MCAST VRF: %s(%d) %s (%pI4,%pI4) IIF: %s(%d) OIF: %s jiffies: %lld",
                        zvrf_name(zvrf), vrf, nl_msg_type_to_str(h->nlmsg_type),
-                       sbuf, gbuf, ifp ? ifp->name : "Unknown", iif, oif_list,
+                       &m->sg.src, &m->sg.grp, ifp ? ifp->name : "Unknown",
+                       iif, oif_list,
                        m->lastused);
        }
        return 0;
@@ -2890,8 +2887,8 @@ static int netlink_macfdb_change(struct nlmsghdr *h, int len, ns_id_t ns_id)
                dst_present = 1;
                memcpy(&vtep_ip.s_addr, RTA_DATA(tb[NDA_DST]),
                       IPV4_MAX_BYTELEN);
-               snprintf(dst_buf, sizeof(dst_buf), " dst %s",
-                        inet_ntoa(vtep_ip));
+               snprintfrr(dst_buf, sizeof(dst_buf), " dst %pI4",
+                          &vtep_ip);
        }
 
        if (tb[NDA_NH_ID])
@@ -3948,8 +3945,8 @@ static int netlink_fdb_nh_update(uint32_t nh_id, struct in_addr vtep_ip)
                return -1;
 
        if (IS_ZEBRA_DEBUG_KERNEL || IS_ZEBRA_DEBUG_EVPN_MH_NH) {
-               zlog_debug("Tx %s fdb-nh 0x%x %s",
-                          nl_msg_type_to_str(cmd), nh_id, inet_ntoa(vtep_ip));
+               zlog_debug("Tx %s fdb-nh 0x%x %pI4",
+                          nl_msg_type_to_str(cmd), nh_id, &vtep_ip);
        }
 
        return netlink_talk(netlink_talk_filter, &req.n, &zns->netlink_cmd, zns,
index 24e8db6f3336e679a37880304123773bf5bc0567..e93444d22eef4756d00f098047d3f16c9afa399d 100644 (file)
@@ -3209,8 +3209,8 @@ enum zebra_dplane_result dplane_vtep_add(const struct interface *ifp,
        struct ipaddr addr;
 
        if (IS_ZEBRA_DEBUG_VXLAN)
-               zlog_debug("Install %s into flood list for VNI %u intf %s(%u)",
-                          inet_ntoa(*ip), vni, ifp->name, ifp->ifindex);
+               zlog_debug("Install %pI4 into flood list for VNI %u intf %s(%u)",
+                          ip, vni, ifp->name, ifp->ifindex);
 
        SET_IPADDR_V4(&addr);
        addr.ipaddr_v4 = *ip;
@@ -3234,8 +3234,8 @@ enum zebra_dplane_result dplane_vtep_delete(const struct interface *ifp,
 
        if (IS_ZEBRA_DEBUG_VXLAN)
                zlog_debug(
-                       "Uninstall %s from flood list for VNI %u intf %s(%u)",
-                       inet_ntoa(*ip), vni, ifp->name, ifp->ifindex);
+                       "Uninstall %pI4 from flood list for VNI %u intf %s(%u)",
+                       ip, vni, ifp->name, ifp->ifindex);
 
        SET_IPADDR_V4(&addr);
        addr.ipaddr_v4 = *ip;
index e1dbd04def0a86c32406aa47a660d24b80490ff9..6722af117cbe6dfba5e052884b2fb165195f39b9 100644 (file)
@@ -109,6 +109,7 @@ void zebra_evpn_print(zebra_evpn_t *zevpn, void **ctxt)
        json_object *json = NULL;
        json_object *json_vtep_list = NULL;
        json_object *json_ip_str = NULL;
+       char buf[PREFIX_STRLEN];
 
        vty = ctxt[0];
        json = ctxt[1];
@@ -134,18 +135,20 @@ void zebra_evpn_print(zebra_evpn_t *zevpn, void **ctxt)
        if (json == NULL) {
                vty_out(vty, " VxLAN interface: %s\n", zevpn->vxlan_if->name);
                vty_out(vty, " VxLAN ifIndex: %u\n", zevpn->vxlan_if->ifindex);
-               vty_out(vty, " Local VTEP IP: %s\n",
-                       inet_ntoa(zevpn->local_vtep_ip));
-               vty_out(vty, " Mcast group: %s\n",
-                               inet_ntoa(zevpn->mcast_grp));
+               vty_out(vty, " Local VTEP IP: %pI4\n",
+                       &zevpn->local_vtep_ip);
+               vty_out(vty, " Mcast group: %pI4\n",
+                               &zevpn->mcast_grp);
        } else {
                json_object_string_add(json, "vxlanInterface",
                                       zevpn->vxlan_if->name);
                json_object_int_add(json, "ifindex", zevpn->vxlan_if->ifindex);
                json_object_string_add(json, "vtepIp",
-                                      inet_ntoa(zevpn->local_vtep_ip));
+                                      inet_ntop(AF_INET, &zevpn->local_vtep_ip,
+                                                buf, sizeof(buf)));
                json_object_string_add(json, "mcastGroup",
-                               inet_ntoa(zevpn->mcast_grp));
+                                      inet_ntop(AF_INET, &zevpn->mcast_grp,
+                                                buf, sizeof(buf)));
                json_object_string_add(json, "advertiseGatewayMacip",
                                       zevpn->advertise_gw_macip ? "Yes" : "No");
                json_object_int_add(json, "numMacs", num_macs);
@@ -165,12 +168,14 @@ void zebra_evpn_print(zebra_evpn_t *zevpn, void **ctxt)
                                        VXLAN_FLOOD_STR_DEFAULT);
 
                        if (json == NULL) {
-                               vty_out(vty, "  %s flood: %s\n",
-                                               inet_ntoa(zvtep->vtep_ip),
+                               vty_out(vty, "  %pI4 flood: %s\n",
+                                               &zvtep->vtep_ip,
                                                flood_str);
                        } else {
                                json_ip_str = json_object_new_string(
-                                               inet_ntoa(zvtep->vtep_ip));
+                                               inet_ntop(AF_INET,
+                                                         &zvtep->vtep_ip, buf,
+                                                         sizeof(buf)));
                                json_object_array_add(json_vtep_list,
                                                json_ip_str);
                        }
@@ -207,6 +212,7 @@ void zebra_evpn_print_hash(struct hash_bucket *bucket, void *ctxt[])
        json_object *json_evpn = NULL;
        json_object *json_ip_str = NULL;
        json_object *json_vtep_list = NULL;
+       char buf[PREFIX_STRLEN];
 
        vty = ctxt[0];
        json = ctxt[1];
@@ -245,7 +251,8 @@ void zebra_evpn_print_hash(struct hash_bucket *bucket, void *ctxt[])
                        json_vtep_list = json_object_new_array();
                        for (zvtep = zevpn->vteps; zvtep; zvtep = zvtep->next) {
                                json_ip_str = json_object_new_string(
-                                       inet_ntoa(zvtep->vtep_ip));
+                                       inet_ntop(AF_INET, &zvtep->vtep_ip, buf,
+                                                 sizeof(buf)));
                                json_object_array_add(json_vtep_list,
                                                      json_ip_str);
                        }
@@ -1074,8 +1081,8 @@ int zebra_evpn_send_add_to_client(zebra_evpn_t *zevpn)
        stream_putw_at(s, 0, stream_get_endp(s));
 
        if (IS_ZEBRA_DEBUG_VXLAN)
-               zlog_debug("Send EVPN_ADD %u %s tenant vrf %s to %s", zevpn->vni,
-                          inet_ntoa(zevpn->local_vtep_ip),
+               zlog_debug("Send EVPN_ADD %u %pI4 tenant vrf %s to %s", zevpn->vni,
+                          &zevpn->local_vtep_ip,
                           vrf_id_to_name(zevpn->vrf_id),
                           zebra_route_string(client->proto));
 
index 75031ddba61789c3df462a8eda1936e56e2265ab..8e9a1a4e8e44ee4323e450b2ba099e98d5c047d1 100644 (file)
@@ -417,11 +417,11 @@ static void zebra_evpn_dup_addr_detect_for_mac(struct zebra_vrf *zvrf,
 
        if (mac->dad_count >= zvrf->dad_max_moves) {
                flog_warn(EC_ZEBRA_DUP_MAC_DETECTED,
-                         "VNI %u: MAC %s detected as duplicate during %s VTEP %s",
+                         "VNI %u: MAC %s detected as duplicate during %s VTEP %pI4",
                          mac->zevpn->vni,
                          prefix_mac2str(&mac->macaddr, buf, sizeof(buf)),
                          is_local ? "local update, last" :
-                         "remote update, from", inet_ntoa(vtep_ip));
+                         "remote update, from", &vtep_ip);
 
                SET_FLAG(mac->flags, ZEBRA_MAC_DUPLICATE);
 
@@ -485,6 +485,7 @@ void zebra_evpn_print_mac(zebra_mac_t *mac, void *ctxt, json_object *json)
        struct listnode *node = NULL;
        char buf1[ETHER_ADDR_STRLEN];
        char buf2[INET6_ADDRSTRLEN];
+       char addr_buf[PREFIX_STRLEN];
        struct zebra_vrf *zvrf;
        struct timeval detect_start_time = {0, 0};
        char timebuf[MONOTIME_STRLEN];
@@ -518,7 +519,8 @@ void zebra_evpn_print_mac(zebra_mac_t *mac, void *ctxt, json_object *json)
                        json_object_string_add(json_mac, "type", "remote");
                        json_object_string_add(
                                json_mac, "remoteVtep",
-                               inet_ntoa(mac->fwd_info.r_vtep_ip));
+                               inet_ntop(AF_INET, &mac->fwd_info.r_vtep_ip,
+                                         addr_buf, sizeof(addr_buf)));
                } else if (CHECK_FLAG(mac->flags, ZEBRA_MAC_AUTO))
                        json_object_string_add(json_mac, "type", "auto");
 
@@ -617,8 +619,8 @@ void zebra_evpn_print_mac(zebra_mac_t *mac, void *ctxt, json_object *json)
                                vty_out(vty, " Remote ES: %s",
                                        mac->es->esi_str);
                        else
-                               vty_out(vty, " Remote VTEP: %s",
-                                       inet_ntoa(mac->fwd_info.r_vtep_ip));
+                               vty_out(vty, " Remote VTEP: %pI4",
+                                       &mac->fwd_info.r_vtep_ip);
                } else if (CHECK_FLAG(mac->flags, ZEBRA_MAC_AUTO)) {
                        vty_out(vty, " Auto Mac ");
                }
@@ -709,6 +711,7 @@ void zebra_evpn_print_mac_hash(struct hash_bucket *bucket, void *ctxt)
        json_object *json_mac_hdr = NULL, *json_mac = NULL;
        zebra_mac_t *mac;
        char buf1[ETHER_ADDR_STRLEN];
+       char addr_buf[PREFIX_STRLEN];
        struct mac_walk_ctx *wctx = ctxt;
        char flags_buf[6];
 
@@ -785,18 +788,22 @@ void zebra_evpn_print_mac_hash(struct hash_bucket *bucket, void *ctxt)
                                        "Intf/Remote ES/VTEP", "VLAN",
                                        "Seq #'s");
                        }
+                       if (mac->es == NULL)
+                               inet_ntop(AF_INET, &mac->fwd_info.r_vtep_ip,
+                                         addr_buf, sizeof(addr_buf));
+
                        vty_out(vty, "%-17s %-6s %-5s %-30s %-5s %u/%u\n", buf1,
                                "remote",
                                zebra_evpn_print_mac_flags(mac, flags_buf,
-                sizeof(flags_buf)),
-                               mac->es ? mac->es->esi_str
-                                       : inet_ntoa(mac->fwd_info.r_vtep_ip),
+                                                          sizeof(flags_buf)),
+                               mac->es ? mac->es->esi_str : addr_buf,
                                "", mac->loc_seq, mac->rem_seq);
                } else {
                        json_object_string_add(json_mac, "type", "remote");
                        json_object_string_add(
                                json_mac, "remoteVtep",
-                               inet_ntoa(mac->fwd_info.r_vtep_ip));
+                               inet_ntop(AF_INET, &mac->fwd_info.r_vtep_ip,
+                                         addr_buf, sizeof(addr_buf)));
                        json_object_object_add(json_mac_hdr, buf1, json_mac);
                        json_object_int_add(json_mac, "localSequence",
                                            mac->loc_seq);
@@ -1769,10 +1776,10 @@ int process_mac_remote_macip_add(zebra_evpn_t *zevpn, struct zebra_vrf *zvrf,
                        mac = zebra_evpn_mac_add(zevpn, macaddr);
                        if (!mac) {
                                zlog_warn(
-                                       "Failed to add MAC %s VNI %u Remote VTEP %s",
+                                       "Failed to add MAC %s VNI %u Remote VTEP %pI4",
                                        prefix_mac2str(macaddr, buf,
                                                       sizeof(buf)),
-                                       zevpn->vni, inet_ntoa(vtep_ip));
+                                       zevpn->vni, &vtep_ip);
                                return -1;
                        }
 
@@ -2028,10 +2035,10 @@ int zebra_evpn_add_update_local_mac(struct zebra_vrf *zvrf, zebra_evpn_t *zevpn,
                        if (CHECK_FLAG(mac->flags, ZEBRA_MAC_STICKY)) {
                                flog_warn(
                                        EC_ZEBRA_STICKY_MAC_ALREADY_LEARNT,
-                                       "MAC %s already learnt as remote sticky MAC behind VTEP %s VNI %u",
+                                       "MAC %s already learnt as remote sticky MAC behind VTEP %pI4 VNI %u",
                                        prefix_mac2str(macaddr, buf,
                                                       sizeof(buf)),
-                                       inet_ntoa(mac->fwd_info.r_vtep_ip),
+                                       &mac->fwd_info.r_vtep_ip,
                                        zevpn->vni);
                                return 0;
                        }
index a406884187b7d47fa21fb7976510f71d1b8d4c3b..dad019731b48da93616d9b00fb994f790846bf47 100644 (file)
@@ -919,9 +919,9 @@ static void zebra_evpn_nh_add(struct zebra_evpn_es_vtep *es_vtep)
                return;
 
        if (IS_ZEBRA_DEBUG_EVPN_MH_NH)
-               zlog_debug("es %s vtep %s nh 0x%x add",
+               zlog_debug("es %s vtep %pI4 nh 0x%x add",
                                es_vtep->es->esi_str,
-                               inet_ntoa(es_vtep->vtep_ip), es_vtep->nh_id);
+                               &es_vtep->vtep_ip, es_vtep->nh_id);
        /* install the NH */
        kernel_upd_mac_nh(es_vtep->nh_id, es_vtep->vtep_ip);
        /* add the NH to the parent NHG */
@@ -936,9 +936,9 @@ static void zebra_evpn_nh_del(struct zebra_evpn_es_vtep *es_vtep)
                return;
 
        if (IS_ZEBRA_DEBUG_EVPN_MH_NH)
-               zlog_debug("es %s vtep %s nh 0x%x del",
+               zlog_debug("es %s vtep %pI4 nh 0x%x del",
                                es_vtep->es->esi_str,
-                               inet_ntoa(es_vtep->vtep_ip), es_vtep->nh_id);
+                               &es_vtep->vtep_ip, es_vtep->nh_id);
 
        nh_id = es_vtep->nh_id;
        es_vtep->nh_id = 0;
@@ -1024,8 +1024,8 @@ static void zebra_evpn_es_vtep_add(struct zebra_evpn_es *es,
 
        if (!es_vtep) {
                if (IS_ZEBRA_DEBUG_EVPN_MH_ES)
-                       zlog_debug("es %s vtep %s add",
-                                       es->esi_str, inet_ntoa(vtep_ip));
+                       zlog_debug("es %s vtep %pI4 add",
+                                       es->esi_str, &vtep_ip);
                es_vtep = zebra_evpn_es_vtep_new(es, vtep_ip);
                /* update the L2-NHG associated with the ES */
                zebra_evpn_nh_add(es_vtep);
@@ -1041,8 +1041,8 @@ static void zebra_evpn_es_vtep_del(struct zebra_evpn_es *es,
 
        if (es_vtep) {
                if (IS_ZEBRA_DEBUG_EVPN_MH_ES)
-                       zlog_debug("es %s vtep %s del",
-                                       es->esi_str, inet_ntoa(vtep_ip));
+                       zlog_debug("es %s vtep %pI4 del",
+                                       es->esi_str, &vtep_ip);
                zebra_evpn_es_vtep_free(es_vtep);
        }
 }
@@ -1168,9 +1168,9 @@ static int zebra_evpn_es_send_add_to_client(struct zebra_evpn_es *es)
        stream_putw_at(s, 0, stream_get_endp(s));
 
        if (IS_ZEBRA_DEBUG_EVPN_MH_ES)
-               zlog_debug("send add local es %s %s to %s",
+               zlog_debug("send add local es %s %pI4 to %s",
                                es->esi_str,
-                               inet_ntoa(zmh_info->es_originator_ip),
+                               &zmh_info->es_originator_ip,
                                zebra_route_string(client->proto));
 
        client->local_es_add_cnt++;
@@ -1498,9 +1498,8 @@ static int zebra_evpn_remote_es_del(esi_t *esi, struct in_addr vtep_ip)
        struct zebra_evpn_es *es;
 
        if (IS_ZEBRA_DEBUG_EVPN_MH_ES)
-               zlog_debug("remote es %s vtep %s del",
-                               esi_to_str(esi, buf, sizeof(buf)),
-                               inet_ntoa(vtep_ip));
+               zlog_debug("remote es %s vtep %pI4 del",
+                          esi_to_str(esi, buf, sizeof(buf)), &vtep_ip);
 
        es = zebra_evpn_es_find(esi);
        if (!es) {
@@ -1525,9 +1524,9 @@ static void zebra_evpn_remote_es_flush(struct zebra_evpn_es **esp)
 
        for (ALL_LIST_ELEMENTS(es->es_vtep_list, node, nnode, es_vtep)) {
                if (IS_ZEBRA_DEBUG_EVPN_MH_ES)
-                       zlog_debug("es %s vtep %s flush",
+                       zlog_debug("es %s vtep %pI4 flush",
                                        es->esi_str,
-                                       inet_ntoa(es_vtep->vtep_ip));
+                                       &es_vtep->vtep_ip);
                zebra_evpn_es_vtep_free(es_vtep);
        }
        zebra_evpn_es_remote_info_re_eval(esp);
@@ -1539,9 +1538,8 @@ static int zebra_evpn_remote_es_add(esi_t *esi, struct in_addr vtep_ip)
        struct zebra_evpn_es *es;
 
        if (IS_ZEBRA_DEBUG_EVPN_MH_ES)
-               zlog_debug("remote es %s vtep %s add",
-                               esi_to_str(esi, buf, sizeof(buf)),
-                               inet_ntoa(vtep_ip));
+               zlog_debug("remote es %s vtep %pI4 add",
+                               esi_to_str(esi, buf, sizeof(buf)), &vtep_ip);
 
        es = zebra_evpn_es_find(esi);
        if (!es) {
@@ -1756,17 +1754,20 @@ static char *zebra_evpn_es_vtep_str(char *vtep_str, struct zebra_evpn_es *es,
 {
        struct zebra_evpn_es_vtep *zvtep;
        struct listnode *node;
+       char buf[PREFIX_STRLEN];
        bool first = true;
 
        vtep_str[0] = '\0';
        for (ALL_LIST_ELEMENTS_RO(es->es_vtep_list, node, zvtep)) {
                if (first) {
                        first = false;
-                       strlcat(vtep_str, inet_ntoa(zvtep->vtep_ip),
+                       strlcat(vtep_str, inet_ntop(AF_INET, &zvtep->vtep_ip,
+                                                   buf, sizeof(buf)),
                                vtep_str_size);
                } else {
                        strlcat(vtep_str, ",", vtep_str_size);
-                       strlcat(vtep_str, inet_ntoa(zvtep->vtep_ip),
+                       strlcat(vtep_str, inet_ntop(AF_INET, &zvtep->vtep_ip,
+                                                   buf, sizeof(buf)),
                                vtep_str_size);
                }
        }
@@ -1832,8 +1833,8 @@ static void zebra_evpn_es_show_entry_detail(struct vty *vty,
                vty_out(vty, " Nexthop group: 0x%x\n", es->nhg_id);
                vty_out(vty, " VTEPs:\n");
                for (ALL_LIST_ELEMENTS_RO(es->es_vtep_list, node, zvtep))
-                       vty_out(vty, "     %s nh: 0x%x\n",
-                                       inet_ntoa(zvtep->vtep_ip),
+                       vty_out(vty, "     %pI4 nh: 0x%x\n",
+                                       &zvtep->vtep_ip,
                                        zvtep->nh_id);
 
                vty_out(vty, "\n");
@@ -2029,8 +2030,8 @@ void zebra_evpn_es_set_base_evpn(zebra_evpn_t *zevpn)
                zmh_info->es_base_evpn->local_vtep_ip.s_addr;
 
        if (IS_ZEBRA_DEBUG_EVPN_MH_ES)
-               zlog_debug("es originator ip set to %s",
-                       inet_ntoa(zmh_info->es_base_evpn->local_vtep_ip));
+               zlog_debug("es originator ip set to %pI4",
+                       &zmh_info->es_base_evpn->local_vtep_ip);
 
        /* if originator ip changes we need to update bgp */
        for (ALL_LIST_ELEMENTS_RO(zmh_info->local_es_list, node, es)) {
index 860dc5b05429f3f127b9d94a772fef81beb28a6f..bb848255d0d08f99218a5ffccfb5faa70ec6ed7e 100644 (file)
@@ -1283,12 +1283,12 @@ zebra_evpn_dup_addr_detect_for_neigh(struct zebra_vrf *zvrf, zebra_neigh_t *nbr,
        if (nbr->dad_count >= zvrf->dad_max_moves) {
                flog_warn(
                        EC_ZEBRA_DUP_IP_DETECTED,
-                       "VNI %u: MAC %s IP %s detected as duplicate during %s VTEP %s",
+                       "VNI %u: MAC %s IP %s detected as duplicate during %s VTEP %pI4",
                        nbr->zevpn->vni,
                        prefix_mac2str(&nbr->emac, buf, sizeof(buf)),
                        ipaddr2str(&nbr->ip, buf1, sizeof(buf1)),
                        is_local ? "local update, last" : "remote update, from",
-                       inet_ntoa(vtep_ip));
+                       &vtep_ip);
 
                SET_FLAG(nbr->flags, ZEBRA_NEIGH_DUPLICATE);
 
@@ -1790,6 +1790,7 @@ void zebra_evpn_print_neigh(zebra_neigh_t *n, void *ctxt, json_object *json)
        struct vty *vty;
        char buf1[ETHER_ADDR_STRLEN];
        char buf2[INET6_ADDRSTRLEN];
+       char addr_buf[PREFIX_STRLEN];
        const char *type_str;
        const char *state_str;
        bool flags_present = false;
@@ -1867,11 +1868,13 @@ void zebra_evpn_print_neigh(zebra_neigh_t *n, void *ctxt, json_object *json)
                                        n->mac->es->esi_str);
                } else {
                        if (json)
-                               json_object_string_add(json, "remoteVtep",
-                                                      inet_ntoa(n->r_vtep_ip));
+                               json_object_string_add(
+                                       json, "remoteVtep",
+                                       inet_ntop(AF_INET, &n->r_vtep_ip,
+                                                 addr_buf, sizeof(addr_buf)));
                        else
-                               vty_out(vty, " Remote VTEP: %s\n",
-                                       inet_ntoa(n->r_vtep_ip));
+                               vty_out(vty, " Remote VTEP: %pI4\n",
+                                       &n->r_vtep_ip);
                }
        }
        if (CHECK_FLAG(n->flags, ZEBRA_NEIGH_DEF_GW)) {
@@ -1952,6 +1955,7 @@ void zebra_evpn_print_neigh_hash(struct hash_bucket *bucket, void *ctxt)
        zebra_neigh_t *n;
        char buf1[ETHER_ADDR_STRLEN];
        char buf2[INET6_ADDRSTRLEN];
+       char addr_buf[PREFIX_STRLEN];
        struct neigh_walk_ctx *wctx = ctxt;
        const char *state_str;
        char flags_buf[6];
@@ -2006,12 +2010,16 @@ void zebra_evpn_print_neigh_hash(struct hash_bucket *bucket, void *ctxt)
                        if ((wctx->flags & SHOW_REMOTE_NEIGH_FROM_VTEP)
                            && (wctx->count == 0))
                                zebra_evpn_print_neigh_hdr(vty, wctx);
+
+                       if (n->mac->es == NULL)
+                               inet_ntop(AF_INET, &n->r_vtep_ip,
+                                         addr_buf, sizeof(addr_buf));
+
                        vty_out(vty, "%*s %-6s %-5s %-8s %-17s %-30s %u/%u\n",
                                -wctx->addr_width, buf2, "remote",
                                zebra_evpn_print_neigh_flags(n, flags_buf,
                                sizeof(flags_buf)), state_str, buf1,
-                               n->mac->es ? n->mac->es->esi_str
-                                          : inet_ntoa(n->r_vtep_ip),
+                               n->mac->es ? n->mac->es->esi_str : addr_buf,
                                n->loc_seq, n->rem_seq);
                } else {
                        json_object_string_add(json_row, "type", "remote");
@@ -2021,8 +2029,10 @@ void zebra_evpn_print_neigh_hash(struct hash_bucket *bucket, void *ctxt)
                                json_object_string_add(json_row, "remoteEs",
                                                       n->mac->es->esi_str);
                        else
-                               json_object_string_add(json_row, "remoteVtep",
-                                                      inet_ntoa(n->r_vtep_ip));
+                               json_object_string_add(
+                                       json_row, "remoteVtep",
+                                       inet_ntop(AF_INET, &n->r_vtep_ip,
+                                                 addr_buf, sizeof(addr_buf)));
                        if (CHECK_FLAG(n->flags, ZEBRA_NEIGH_DEF_GW))
                                json_object_boolean_true_add(json_row,
                                                             "defaultGateway");
@@ -2133,11 +2143,11 @@ void process_neigh_remote_macip_add(zebra_evpn_t *zevpn, struct zebra_vrf *zvrf,
                                                 mac, 0);
                        if (!n) {
                                zlog_warn(
-                                       "Failed to add Neigh %s MAC %s VNI %u Remote VTEP %s",
+                                       "Failed to add Neigh %s MAC %s VNI %u Remote VTEP %pI4",
                                        ipaddr2str(ipaddr, buf1, sizeof(buf1)),
                                        prefix_mac2str(&mac->macaddr, buf,
                                                       sizeof(buf)),
-                                       zevpn->vni, inet_ntoa(vtep_ip));
+                                       zevpn->vni, &vtep_ip);
                                return;
                        }
 
index 1c3193449b7a26d120af920b766811c1eb2c8d4a..73996c526faf42515efe019736a16565e105acf1 100644 (file)
@@ -1933,7 +1933,7 @@ static int fpm_remote_srv_write(struct vty *vty)
        if ((zfpm_g->fpm_server != FPM_DEFAULT_IP
             && zfpm_g->fpm_server != INADDR_ANY)
            || (zfpm_g->fpm_port != FPM_DEFAULT_PORT && zfpm_g->fpm_port != 0))
-               vty_out(vty, "fpm connection ip %s port %d\n", inet_ntoa(in),
+               vty_out(vty, "fpm connection ip %pI4 port %d\n", &in,
                        zfpm_g->fpm_port);
 
        return 0;
index 81437e72f511ebd5d0fbc1d039f3f2e9d9d2054b..e39272203032dfd77ec3735c8e414aa2ea060990 100644 (file)
@@ -181,6 +181,7 @@ static void zfpm_dt_log_fpm_message(Fpm__Message *msg)
        char *if_name;
        size_t i;
        char buf[INET6_ADDRSTRLEN];
+       char addr_buf[PREFIX_STRLEN];
        union g_addr nh_addr;
 
        if (msg->type != FPM__MESSAGE__TYPE__ADD_ROUTE)
@@ -213,7 +214,9 @@ static void zfpm_dt_log_fpm_message(Fpm__Message *msg)
 
                zfpm_debug("Nexthop - if_index: %d (%s), gateway: %s, ",
                           if_index, if_name ? if_name : "name not specified",
-                          nexthop->address ? inet_ntoa(nh_addr.ipv4) : "None");
+                          nexthop->address ?
+                          inet_ntop(AF_INET, &nh_addr.ipv4,
+                                    addr_buf, sizeof(addr_buf)) : "None");
        }
 }
 
index 2c07413638667467e09e572bfe47619bd869eaab..44f574073cb26c2598305d97118bc47ff84529a5 100644 (file)
 #include "zebra/zebra_fpm_private.h"
 #include "zebra/zebra_vxlan_private.h"
 
-/*
- * addr_to_a
- *
- * Returns string representation of an address of the given AF.
- */
-static inline const char *addr_to_a(uint8_t af, void *addr)
-{
-       if (!addr)
-               return "<No address>";
-
-       switch (af) {
-
-       case AF_INET:
-               return inet_ntoa(*((struct in_addr *)addr));
-       case AF_INET6:
-               return inet6_ntoa(*((struct in6_addr *)addr));
-       default:
-               return "<Addr in unknown AF>";
-       }
-}
-
-/*
- * prefix_addr_to_a
- *
- * Convience wrapper that returns a human-readable string for the
- * address in a prefix.
- */
-static const char *prefix_addr_to_a(struct prefix *prefix)
-{
-       if (!prefix)
-               return "<No address>";
-
-       return addr_to_a(prefix->family, &prefix->u.prefix);
-}
-
 /*
  * af_addr_size
  *
@@ -525,18 +490,24 @@ static void zfpm_log_route_info(struct netlink_route_info *ri,
 {
        struct netlink_nh_info *nhi;
        unsigned int i;
+       char buf[PREFIX_STRLEN];
 
-       zfpm_debug("%s : %s %s/%d, Proto: %s, Metric: %u", label,
+       zfpm_debug("%s : %s %s, Proto: %s, Metric: %u", label,
                   nl_msg_type_to_str(ri->nlmsg_type),
-                  prefix_addr_to_a(ri->prefix), ri->prefix->prefixlen,
+                  prefix2str(ri->prefix, buf, sizeof(buf)),
                   nl_rtproto_to_str(ri->rtm_protocol),
                   ri->metric ? *ri->metric : 0);
 
        for (i = 0; i < ri->num_nhs; i++) {
                nhi = &ri->nhs[i];
+
+               if (ri->af == AF_INET)
+                       inet_ntop(AF_INET, &nhi->gateway, buf, sizeof(buf));
+               else
+                       inet_ntop(AF_INET6, &nhi->gateway, buf, sizeof(buf));
+
                zfpm_debug("  Intf: %u, Gateway: %s, Recursive: %s, Type: %s, Encap type: %s",
-                          nhi->if_index, addr_to_a(ri->af, nhi->gateway),
-                          nhi->recursive ? "yes" : "no",
+                          nhi->if_index, buf, nhi->recursive ? "yes" : "no",
                           nexthop_type_to_str(nhi->type),
                           fpm_nh_encap_type_to_str(nhi->encap_info.encap_type)
                           );
@@ -621,11 +592,11 @@ int zfpm_netlink_encode_mac(struct fpm_mac_info_t *mac, char *in_buf,
 
        assert(req->hdr.nlmsg_len < in_buf_len);
 
-       zfpm_debug("Tx %s family %s ifindex %u MAC %s DEST %s",
+       zfpm_debug("Tx %s family %s ifindex %u MAC %s DEST %pI4",
                   nl_msg_type_to_str(req->hdr.nlmsg_type),
                   nl_family_to_str(req->ndm.ndm_family), req->ndm.ndm_ifindex,
                   prefix_mac2str(&mac->macaddr, buf1, sizeof(buf1)),
-                  inet_ntoa(mac->r_vtep_ip));
+                  &mac->r_vtep_ip);
 
        return req->hdr.nlmsg_len;
 }
index c3982904e9d49a66ea2c41e003068a91f46c08d7..66aea8936e0fa76a92c11c9ff158819a5902e5c4 100644 (file)
@@ -1502,7 +1502,8 @@ static json_object *nhlfe_json(zebra_nhlfe_t *nhlfe)
        case NEXTHOP_TYPE_IPV4:
        case NEXTHOP_TYPE_IPV4_IFINDEX:
                json_object_string_add(json_nhlfe, "nexthop",
-                                      inet_ntoa(nexthop->gate.ipv4));
+                                      inet_ntop(AF_INET, &nexthop->gate.ipv4,
+                                                buf, sizeof(buf)));
                break;
        case NEXTHOP_TYPE_IPV6:
        case NEXTHOP_TYPE_IPV6_IFINDEX:
@@ -1560,7 +1561,7 @@ static void nhlfe_print(zebra_nhlfe_t *nhlfe, struct vty *vty,
        switch (nexthop->type) {
        case NEXTHOP_TYPE_IPV4:
        case NEXTHOP_TYPE_IPV4_IFINDEX:
-               vty_out(vty, "  via %s", inet_ntoa(nexthop->gate.ipv4));
+               vty_out(vty, "  via %pI4", &nexthop->gate.ipv4);
                if (nexthop->ifindex)
                        vty_out(vty, " dev %s",
                                ifindex2ifname(nexthop->ifindex,
index 583b666e66acc71350251ced00b0a2f405d106a8..3af805558dd8c1474c2afa18061c9f58466cc282 100644 (file)
@@ -47,8 +47,8 @@ void zebra_ipmr_route_stats(ZAPI_HANDLER_ARGS)
                char sbuf[40];
                char gbuf[40];
 
-               strlcpy(sbuf, inet_ntoa(mroute.sg.src), sizeof(sbuf));
-               strlcpy(gbuf, inet_ntoa(mroute.sg.grp), sizeof(gbuf));
+               inet_ntop(AF_INET, &mroute.sg.src, sbuf, sizeof(sbuf));
+               inet_ntop(AF_INET, &mroute.sg.grp, gbuf, sizeof(gbuf));
 
                zlog_debug("Asking for (%s,%s)[%s(%u)] mroute information",
                           sbuf, gbuf, zvrf->vrf->name, zvrf->vrf->vrf_id);
index 8178629b003041d664358d6494dedf9e4a87f1d0..521f969fcc44ac3518900196e65bc5baa407bd5f 100644 (file)
@@ -1197,7 +1197,7 @@ static void print_nh(struct nexthop *nexthop, struct vty *vty)
        switch (nexthop->type) {
        case NEXTHOP_TYPE_IPV4:
        case NEXTHOP_TYPE_IPV4_IFINDEX:
-               vty_out(vty, " via %s", inet_ntoa(nexthop->gate.ipv4));
+               vty_out(vty, " via %pI4", &nexthop->gate.ipv4);
                if (nexthop->ifindex)
                        vty_out(vty, ", %s",
                                ifindex2ifname_per_ns(zns, nexthop->ifindex));
index 762da5d0d38075b4f2ef09b8bc7e741d9fc482c8..1a6e6032b681690ceb98490c4aabd57818ee19ff 100644 (file)
@@ -304,8 +304,8 @@ static void show_nexthop_detail_helper(struct vty *vty,
        switch (nexthop->type) {
        case NEXTHOP_TYPE_IPV4:
        case NEXTHOP_TYPE_IPV4_IFINDEX:
-               vty_out(vty, " %s",
-                       inet_ntoa(nexthop->gate.ipv4));
+               vty_out(vty, " %pI4",
+                       &nexthop->gate.ipv4);
                if (nexthop->ifindex)
                        vty_out(vty, ", via %s",
                                ifindex2ifname(
@@ -508,7 +508,7 @@ static void show_route_nexthop_helper(struct vty *vty,
        switch (nexthop->type) {
        case NEXTHOP_TYPE_IPV4:
        case NEXTHOP_TYPE_IPV4_IFINDEX:
-               vty_out(vty, " via %s", inet_ntoa(nexthop->gate.ipv4));
+               vty_out(vty, " via %pI4", &nexthop->gate.ipv4);
                if (nexthop->ifindex)
                        vty_out(vty, ", %s",
                                ifindex2ifname(nexthop->ifindex,
@@ -636,7 +636,8 @@ static void show_nexthop_json_helper(json_object *json_nexthop,
        case NEXTHOP_TYPE_IPV4_IFINDEX:
                json_object_string_add(
                        json_nexthop, "ip",
-                       inet_ntoa(nexthop->gate.ipv4));
+                       inet_ntop(AF_INET, &nexthop->gate.ipv4,
+                                 buf, sizeof(buf)));
                json_object_string_add(json_nexthop, "afi",
                                       "ipv4");
 
index f8b65bea15be23a57f29aae671459dce309c99b1..cca7680953909e4464662d012ef0d115ccf7be62 100644 (file)
@@ -340,8 +340,8 @@ static void zl3vni_print_rmac(zebra_mac_t *zrmac, struct vty *vty,
        if (!json) {
                vty_out(vty, "MAC: %s\n",
                        prefix_mac2str(&zrmac->macaddr, buf1, sizeof(buf1)));
-               vty_out(vty, " Remote VTEP: %s\n",
-                       inet_ntoa(zrmac->fwd_info.r_vtep_ip));
+               vty_out(vty, " Remote VTEP: %pI4\n",
+                       &zrmac->fwd_info.r_vtep_ip);
                vty_out(vty, " Refcount: %d\n", rb_host_count(&zrmac->host_rb));
                vty_out(vty, "  Prefixes:\n");
                RB_FOREACH (hle, host_rb_tree_entry, &zrmac->host_rb)
@@ -352,7 +352,9 @@ static void zl3vni_print_rmac(zebra_mac_t *zrmac, struct vty *vty,
                        json, "routerMac",
                        prefix_mac2str(&zrmac->macaddr, buf1, sizeof(buf1)));
                json_object_string_add(json, "vtepIp",
-                                      inet_ntoa(zrmac->fwd_info.r_vtep_ip));
+                                      inet_ntop(AF_INET,
+                                                &zrmac->fwd_info.r_vtep_ip,
+                                                buf1, sizeof(buf1)));
                json_object_int_add(json, "refCount",
                                    rb_host_count(&zrmac->host_rb));
                json_object_int_add(json, "localSequence", zrmac->loc_seq);
@@ -629,7 +631,7 @@ static void zl3vni_print_rmac_hash(struct hash_bucket *bucket, void *ctx)
        struct vty *vty = NULL;
        struct json_object *json = NULL;
        struct json_object *json_rmac = NULL;
-       char buf[ETHER_ADDR_STRLEN];
+       char buf[PREFIX_STRLEN];
 
        wctx = (struct rmac_walk_ctx *)ctx;
        vty = wctx->vty;
@@ -639,15 +641,17 @@ static void zl3vni_print_rmac_hash(struct hash_bucket *bucket, void *ctx)
        zrmac = (zebra_mac_t *)bucket->data;
 
        if (!json) {
-               vty_out(vty, "%-17s %-21s\n",
+               vty_out(vty, "%-17s %-21pI4\n",
                        prefix_mac2str(&zrmac->macaddr, buf, sizeof(buf)),
-                       inet_ntoa(zrmac->fwd_info.r_vtep_ip));
+                       &zrmac->fwd_info.r_vtep_ip);
        } else {
                json_object_string_add(
                        json_rmac, "routerMac",
                        prefix_mac2str(&zrmac->macaddr, buf, sizeof(buf)));
                json_object_string_add(json_rmac, "vtepIp",
-                                      inet_ntoa(zrmac->fwd_info.r_vtep_ip));
+                                      inet_ntop(AF_INET,
+                                                &zrmac->fwd_info.r_vtep_ip,
+                                                buf, sizeof(buf)));
                json_object_object_add(
                        json, prefix_mac2str(&zrmac->macaddr, buf, sizeof(buf)),
                        json_rmac);
@@ -657,7 +661,7 @@ static void zl3vni_print_rmac_hash(struct hash_bucket *bucket, void *ctx)
 /* print a specific L3 VNI entry */
 static void zl3vni_print(zebra_l3vni_t *zl3vni, void **ctx)
 {
-       char buf[ETHER_ADDR_STRLEN];
+       char buf[PREFIX_STRLEN];
        struct vty *vty = NULL;
        json_object *json = NULL;
        zebra_evpn_t *zevpn = NULL;
@@ -671,8 +675,8 @@ static void zl3vni_print(zebra_l3vni_t *zl3vni, void **ctx)
                vty_out(vty, "VNI: %u\n", zl3vni->vni);
                vty_out(vty, "  Type: %s\n", "L3");
                vty_out(vty, "  Tenant VRF: %s\n", zl3vni_vrf_name(zl3vni));
-               vty_out(vty, "  Local Vtep Ip: %s\n",
-                       inet_ntoa(zl3vni->local_vtep_ip));
+               vty_out(vty, "  Local Vtep Ip: %pI4\n",
+                       &zl3vni->local_vtep_ip);
                vty_out(vty, "  Vxlan-Intf: %s\n",
                        zl3vni_vxlan_if_name(zl3vni));
                vty_out(vty, "  SVI-If: %s\n", zl3vni_svi_if_name(zl3vni));
@@ -693,8 +697,10 @@ static void zl3vni_print(zebra_l3vni_t *zl3vni, void **ctx)
                json_evpn_list = json_object_new_array();
                json_object_int_add(json, "vni", zl3vni->vni);
                json_object_string_add(json, "type", "L3");
-               json_object_string_add(json, "localVtepIp",
-                                      inet_ntoa(zl3vni->local_vtep_ip));
+               json_object_string_add(
+                       json, "localVtepIp",
+                       inet_ntop(AF_INET, &zl3vni->local_vtep_ip, buf,
+                                 sizeof(buf)));
                json_object_string_add(json, "vxlanIntf",
                                       zl3vni_vxlan_if_name(zl3vni));
                json_object_string_add(json, "sviIntf",
@@ -943,9 +949,9 @@ static int zevpn_build_hash_table_zns(struct ns *ns,
 
                        if (IS_ZEBRA_DEBUG_VXLAN)
                                zlog_debug(
-                                       "Create L2-VNI hash for intf %s(%u) L2-VNI %u local IP %s",
+                                       "Create L2-VNI hash for intf %s(%u) L2-VNI %u local IP %pI4",
                                        ifp->name, ifp->ifindex, vni,
-                                       inet_ntoa(vxl->vtep_ip));
+                                       &vxl->vtep_ip);
 
                        /* EVPN hash entry is expected to exist, if the BGP process is killed */
                        zevpn = zebra_evpn_lookup(vni);
@@ -1297,9 +1303,9 @@ static int zl3vni_remote_rmac_add(zebra_l3vni_t *zl3vni,
                                   &vtep_ip->ipaddr_v4)) {
                if (IS_ZEBRA_DEBUG_VXLAN)
                        zlog_debug(
-                               "L3VNI %u Remote VTEP change(%s -> %s) for RMAC %s, prefix %pFX",
+                               "L3VNI %u Remote VTEP change(%pI4 -> %s) for RMAC %s, prefix %pFX",
                                zl3vni->vni,
-                               inet_ntoa(zrmac->fwd_info.r_vtep_ip),
+                               &zrmac->fwd_info.r_vtep_ip,
                                ipaddr2str(vtep_ip, buf1, sizeof(buf1)),
                                prefix_mac2str(rmac, buf, sizeof(buf)),
                                host_prefix);
@@ -1909,11 +1915,11 @@ static int zl3vni_send_add_to_client(zebra_l3vni_t *zl3vni)
 
        if (IS_ZEBRA_DEBUG_VXLAN)
                zlog_debug(
-                       "Send L3_VNI_ADD %u VRF %s RMAC %s VRR %s local-ip %s filter %s to %s",
+                       "Send L3_VNI_ADD %u VRF %s RMAC %s VRR %s local-ip %pI4 filter %s to %s",
                        zl3vni->vni, vrf_id_to_name(zl3vni_vrf_id(zl3vni)),
                        prefix_mac2str(&svi_rmac, buf, sizeof(buf)),
                        prefix_mac2str(&vrr_rmac, buf1, sizeof(buf1)),
-                       inet_ntoa(zl3vni->local_vtep_ip),
+                       &zl3vni->local_vtep_ip,
                        CHECK_FLAG(zl3vni->filter, PREFIX_ROUTES_ONLY)
                                ? "prefix-routes-only"
                                : "none",
@@ -3762,14 +3768,13 @@ void zebra_vxlan_remote_macip_del(ZAPI_HANDLER_ARGS)
                l += res_length;
                if (IS_ZEBRA_DEBUG_VXLAN)
                        zlog_debug(
-                               "Recv MACIP DEL VNI %u MAC %s%s%s Remote VTEP %s from %s",
+                               "Recv MACIP DEL VNI %u MAC %s%s%s Remote VTEP %pI4 from %s",
                                vni,
                                prefix_mac2str(&macaddr, buf, sizeof(buf)),
                                ipa_len ? " IP " : "",
                                ipa_len ?
                                ipaddr2str(&ip, buf1, sizeof(buf1)) : "",
-                               inet_ntoa(vtep_ip),
-                               zebra_route_string(client->proto));
+                               &vtep_ip, zebra_route_string(client->proto));
 
                process_remote_macip_del(vni, &macaddr, ipa_len, &ip, vtep_ip);
        }
@@ -3824,7 +3829,7 @@ void zebra_vxlan_remote_macip_add(ZAPI_HANDLER_ARGS)
                        else
                                strlcpy(esi_buf, "-", ESI_STR_LEN);
                        zlog_debug(
-                               "Recv %sMACIP ADD VNI %u MAC %s%s%s flags 0x%x seq %u VTEP %s ESI %s from %s",
+                               "Recv %sMACIP ADD VNI %u MAC %s%s%s flags 0x%x seq %u VTEP %pI4 ESI %s from %s",
                                (flags & ZEBRA_MACIP_TYPE_SYNC_PATH) ?
                                "sync-" : "",
                                vni,
@@ -3832,7 +3837,7 @@ void zebra_vxlan_remote_macip_add(ZAPI_HANDLER_ARGS)
                                ipa_len ? " IP " : "",
                                ipa_len ?
                                ipaddr2str(&ip, buf1, sizeof(buf1)) : "",
-                               flags, seq, inet_ntoa(vtep_ip), esi_buf,
+                               flags, seq, &vtep_ip, esi_buf,
                                zebra_route_string(client->proto));
                }
 
@@ -3883,8 +3888,8 @@ int zebra_vxlan_check_readd_vtep(struct interface *ifp,
 
        if (IS_ZEBRA_DEBUG_VXLAN)
                zlog_debug(
-                       "Del MAC for remote VTEP %s intf %s(%u) VNI %u - readd",
-                       inet_ntoa(vtep_ip), ifp->name, ifp->ifindex, vni);
+                       "Del MAC for remote VTEP %pI4 intf %s(%u) VNI %u - readd",
+                       &vtep_ip, ifp->name, ifp->ifindex, vni);
 
        zebra_evpn_vtep_install(zevpn, zvtep);
        return 0;
@@ -4124,8 +4129,8 @@ void zebra_vxlan_remote_vtep_del(ZAPI_HANDLER_ARGS)
                l += 4;
 
                if (IS_ZEBRA_DEBUG_VXLAN)
-                       zlog_debug("Recv VTEP_DEL %s VNI %u from %s",
-                                  inet_ntoa(vtep_ip), vni,
+                       zlog_debug("Recv VTEP_DEL %pI4 VNI %u from %s",
+                                  &vtep_ip, vni,
                                   zebra_route_string(client->proto));
 
                /* Locate VNI hash entry - expected to exist. */
@@ -4208,8 +4213,8 @@ void zebra_vxlan_remote_vtep_add(ZAPI_HANDLER_ARGS)
                l += IPV4_MAX_BYTELEN + 4;
 
                if (IS_ZEBRA_DEBUG_VXLAN)
-                       zlog_debug("Recv VTEP_ADD %s VNI %u flood %d from %s",
-                                       inet_ntoa(vtep_ip), vni, flood_control,
+                       zlog_debug("Recv VTEP_ADD %pI4 VNI %u flood %d from %s",
+                                       &vtep_ip, vni, flood_control,
                                        zebra_route_string(client->proto));
 
                /* Locate VNI hash entry - expected to exist. */
@@ -4791,9 +4796,9 @@ int zebra_vxlan_if_update(struct interface *ifp, uint16_t chgflags)
 
                if (IS_ZEBRA_DEBUG_VXLAN)
                        zlog_debug(
-                               "Update L3-VNI %u intf %s(%u) VLAN %u local IP %s master %u chg 0x%x",
+                               "Update L3-VNI %u intf %s(%u) VLAN %u local IP %pI4 master %u chg 0x%x",
                                vni, ifp->name, ifp->ifindex, vxl->access_vlan,
-                               inet_ntoa(vxl->vtep_ip),
+                               &vxl->vtep_ip,
                                zif->brslave_info.bridge_ifindex, chgflags);
 
                /* Removed from bridge? Cleanup and return */
@@ -4855,9 +4860,9 @@ int zebra_vxlan_if_update(struct interface *ifp, uint16_t chgflags)
 
                if (IS_ZEBRA_DEBUG_VXLAN)
                        zlog_debug(
-                               "Update L2-VNI %u intf %s(%u) VLAN %u local IP %s master %u chg 0x%x",
+                               "Update L2-VNI %u intf %s(%u) VLAN %u local IP %pI4 master %u chg 0x%x",
                                vni, ifp->name, ifp->ifindex, vxl->access_vlan,
-                               inet_ntoa(vxl->vtep_ip),
+                               &vxl->vtep_ip,
                                zif->brslave_info.bridge_ifindex, chgflags);
 
                /* Removed from bridge? Cleanup and return */
@@ -4962,9 +4967,9 @@ int zebra_vxlan_if_add(struct interface *ifp)
                /* process if-add for l3-vni*/
                if (IS_ZEBRA_DEBUG_VXLAN)
                        zlog_debug(
-                               "Add L3-VNI %u intf %s(%u) VLAN %u local IP %s master %u",
+                               "Add L3-VNI %u intf %s(%u) VLAN %u local IP %pI4 master %u",
                                vni, ifp->name, ifp->ifindex, vxl->access_vlan,
-                               inet_ntoa(vxl->vtep_ip),
+                               &vxl->vtep_ip,
                                zif->brslave_info.bridge_ifindex);
 
                /* associate with vxlan_if */