]> git.proxmox.com Git - mirror_frr.git/commitdiff
ldpd: replace inet_ntoa
authorMark Stapp <mjs@voltanet.io>
Thu, 22 Oct 2020 14:46:14 +0000 (10:46 -0400)
committerMark Stapp <mjs@voltanet.io>
Thu, 22 Oct 2020 19:49:56 +0000 (15:49 -0400)
Replace all use of inet_ntoa; use pI4 or inet_ntop instead.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
14 files changed:
ldpd/address.c
ldpd/adjacency.c
ldpd/hello.c
ldpd/init.c
ldpd/interface.c
ldpd/keepalive.c
ldpd/labelmapping.c
ldpd/ldp_vty_conf.c
ldpd/ldp_vty_exec.c
ldpd/ldp_zebra.c
ldpd/logmsg.c
ldpd/neighbor.c
ldpd/notification.c
ldpd/packet.c

index 74a3f5a309953f75b0ad837b3d22c357d5810c0b..c3e27357b5b91b59a627fc7c1d2791b31cc1c846 100644 (file)
@@ -410,8 +410,8 @@ static void
 log_msg_address(int out, uint16_t msg_type, struct nbr *nbr, int af,
     union ldpd_addr *addr)
 {
-       debug_msg(out, "%s: lsr-id %s, address %s", msg_name(msg_type),
-           inet_ntoa(nbr->id), log_addr(af, addr));
+       debug_msg(out, "%s: lsr-id %pI4, address %s", msg_name(msg_type),
+           &nbr->id, log_addr(af, addr));
 }
 
 static void
@@ -419,7 +419,7 @@ log_msg_mac_withdrawal(int out, struct nbr *nbr, uint8_t *mac)
 {
        char buf[ETHER_ADDR_STRLEN];
 
-       debug_msg(out, "mac withdrawal: lsr-id %s, mac %s", inet_ntoa(nbr->id),
+       debug_msg(out, "mac withdrawal: lsr-id %pI4, mac %s", &nbr->id,
            (mac) ? prefix_mac2str((struct ethaddr *)mac, buf, sizeof(buf)) :
            "wildcard");
 }
index 4e09a6c4c9e16a470613daaeca3816f210ad35df..3923c169d6ae5475c88233559a40092317ad6e55 100644 (file)
@@ -84,7 +84,7 @@ adj_new(struct in_addr lsr_id, struct hello_source *source,
 {
        struct adj      *adj;
 
-       log_debug("%s: lsr-id %s, %s", __func__, inet_ntoa(lsr_id),
+       log_debug("%s: lsr-id %pI4, %s", __func__, &lsr_id,
            log_hello_src(source));
 
        if ((adj = calloc(1, sizeof(*adj))) == NULL)
@@ -114,7 +114,7 @@ adj_del(struct adj *adj, uint32_t notif_status)
 {
        struct nbr      *nbr = adj->nbr;
 
-       log_debug("%s: lsr-id %s, %s (%s)", __func__, inet_ntoa(adj->lsr_id),
+       log_debug("%s: lsr-id %pI4, %s (%s)", __func__, &adj->lsr_id,
            log_hello_src(&adj->source), af_name(adj_get_af(adj)));
 
        adj_stop_itimer(adj);
@@ -179,7 +179,7 @@ adj_itimer(struct thread *thread)
 
        adj->inactivity_timer = NULL;
 
-       log_debug("%s: lsr-id %s", __func__, inet_ntoa(adj->lsr_id));
+       log_debug("%s: lsr-id %pI4", __func__, &adj->lsr_id);
 
        if (adj->source.type == HELLO_TARGETED) {
                if (!(adj->source.target->flags & F_TNBR_CONFIGURED) &&
index caf63c13d7b959b08ba682691ff90a901106764a..327cb32434afb0578a7999babf341ba3ed7d92a9 100644 (file)
@@ -179,24 +179,24 @@ recv_hello(struct in_addr lsr_id, struct ldp_msg *msg, int af,
 
        r = tlv_decode_hello_prms(buf, len, &holdtime, &flags);
        if (r == -1) {
-               log_debug("%s: lsr-id %s: failed to decode params", __func__,
-                   inet_ntoa(lsr_id));
+               log_debug("%s: lsr-id %pI4: failed to decode params", __func__,
+                   &lsr_id);
                return;
        }
        /* safety checks */
        if (holdtime != 0 && holdtime < MIN_HOLDTIME) {
-               log_debug("%s: lsr-id %s: invalid hello holdtime (%u)",
-                   __func__, inet_ntoa(lsr_id), holdtime);
+               log_debug("%s: lsr-id %pI4: invalid hello holdtime (%u)",
+                   __func__, &lsr_id, holdtime);
                return;
        }
        if (multicast && (flags & F_HELLO_TARGETED)) {
-               log_debug("%s: lsr-id %s: multicast targeted hello", __func__,
-                   inet_ntoa(lsr_id));
+               log_debug("%s: lsr-id %pI4: multicast targeted hello", __func__,
+                   &lsr_id);
                return;
        }
        if (!multicast && !((flags & F_HELLO_TARGETED))) {
-               log_debug("%s: lsr-id %s: unicast link hello", __func__,
-                   inet_ntoa(lsr_id));
+               log_debug("%s: lsr-id %pI4: unicast link hello", __func__,
+                   &lsr_id);
                return;
        }
        buf += r;
@@ -205,13 +205,13 @@ recv_hello(struct in_addr lsr_id, struct ldp_msg *msg, int af,
        r = tlv_decode_opt_hello_prms(buf, len, &tlvs_rcvd, af, &trans_addr,
            &conf_seqnum, &trans_pref);
        if (r == -1) {
-               log_debug("%s: lsr-id %s: failed to decode optional params",
-                   __func__, inet_ntoa(lsr_id));
+               log_debug("%s: lsr-id %pI4: failed to decode optional params",
+                   __func__, &lsr_id);
                return;
        }
        if (r != len) {
-               log_debug("%s: lsr-id %s: unexpected data in message",
-                   __func__, inet_ntoa(lsr_id));
+               log_debug("%s: lsr-id %pI4: unexpected data in message",
+                   __func__, &lsr_id);
                return;
        }
        ds_tlv = (tlvs_rcvd & F_HELLO_TLV_RCVD_DS) ? 1 : 0;
@@ -220,8 +220,8 @@ recv_hello(struct in_addr lsr_id, struct ldp_msg *msg, int af,
        if (!(tlvs_rcvd & F_HELLO_TLV_RCVD_ADDR))
                trans_addr = *src;
        if (bad_addr(af, &trans_addr)) {
-               log_debug("%s: lsr-id %s: invalid transport address %s",
-                   __func__, inet_ntoa(lsr_id), log_addr(af, &trans_addr));
+               log_debug("%s: lsr-id %pI4: invalid transport address %s",
+                   __func__, &lsr_id, log_addr(af, &trans_addr));
                return;
        }
        if (af == AF_INET6 && IN6_IS_SCOPE_EMBED(&trans_addr.v6)) {
@@ -234,7 +234,7 @@ recv_hello(struct in_addr lsr_id, struct ldp_msg *msg, int af,
                 * check)".
                 */
                if (flags & F_HELLO_TARGETED) {
-                       log_debug("%s: lsr-id %s: invalid targeted hello transport address %s", __func__, inet_ntoa(lsr_id),
+                       log_debug("%s: lsr-id %pI4: invalid targeted hello transport address %s", __func__, &lsr_id,
                             log_addr(af, &trans_addr));
                        return;
                }
@@ -249,8 +249,8 @@ recv_hello(struct in_addr lsr_id, struct ldp_msg *msg, int af,
                * targeted LDP Hello packet's source or destination addresses".
                */
                if (af == AF_INET6 && IN6_IS_SCOPE_EMBED(&src->v6)) {
-                       log_debug("%s: lsr-id %s: targeted hello with link-local source address", __func__,
-                           inet_ntoa(lsr_id));
+                       log_debug("%s: lsr-id %pI4: targeted hello with link-local source address", __func__,
+                           &lsr_id);
                        return;
                }
 
@@ -290,8 +290,8 @@ recv_hello(struct in_addr lsr_id, struct ldp_msg *msg, int af,
                source.link.src_addr = *src;
        }
 
-       debug_hello_recv("%s lsr-id %s transport-address %s holdtime %u%s",
-           log_hello_src(&source), inet_ntoa(lsr_id), log_addr(af, &trans_addr),
+       debug_hello_recv("%s lsr-id %pI4 transport-address %s holdtime %u%s",
+           log_hello_src(&source), &lsr_id, log_addr(af, &trans_addr),
             holdtime, (ds_tlv) ? " (dual stack TLV present)" : "");
 
        adj = adj_find(lsr_id, &source);
@@ -316,7 +316,7 @@ recv_hello(struct in_addr lsr_id, struct ldp_msg *msg, int af,
                 * send a fatal Notification message with status code of
                 * 'Transport Connection Mismatch' and reset the session".
                 */
-               log_debug("%s: lsr-id %s: remote transport preference does not match the local preference", __func__, inet_ntoa(lsr_id));
+               log_debug("%s: lsr-id %pI4: remote transport preference does not match the local preference", __func__, &lsr_id);
                if (nbr)
                        session_shutdown(nbr, S_TRANS_MISMTCH, msg->id,
                            msg->type);
@@ -356,7 +356,7 @@ recv_hello(struct in_addr lsr_id, struct ldp_msg *msg, int af,
        if (nbr && nbr->af == af &&
            (ldp_addrcmp(af, &nbr->raddr, &trans_addr) ||
            nbr->raddr_scope != scope_id)) {
-               log_warnx("%s: lsr-id %s: hello packet advertising a different transport address", __func__, inet_ntoa(lsr_id));
+               log_warnx("%s: lsr-id %pI4: hello packet advertising a different transport address", __func__, &lsr_id);
                if (adj)
                        adj_del(adj, S_SHUTDOWN);
                return;
@@ -364,8 +364,8 @@ recv_hello(struct in_addr lsr_id, struct ldp_msg *msg, int af,
        if (nbr == NULL) {
                nbrt = nbr_find_addr(af, &trans_addr);
                if (nbrt) {
-                       log_debug("%s: transport address %s is already being used by lsr-id %s", __func__, log_addr(af,
-                           &trans_addr), inet_ntoa(nbrt->id));
+                       log_debug("%s: transport address %s is already being used by lsr-id %pI4", __func__, log_addr(af,
+                           &trans_addr), &nbrt->id);
                        if (adj)
                                adj_del(adj, S_SHUTDOWN);
                        return;
index 30b78315f9818eb5e3281c896676409b534b768d..d394fb08ead83c3f1e49ab4dd5c08e5773299c83 100644 (file)
@@ -35,7 +35,7 @@ send_init(struct nbr *nbr)
        uint16_t                 size;
        int                      err = 0;
 
-       debug_msg_send("initialization: lsr-id %s", inet_ntoa(nbr->id));
+       debug_msg_send("initialization: lsr-id %pI4", &nbr->id);
 
        size = LDP_HDR_SIZE + LDP_MSG_SIZE + SESS_PRMS_SIZE +
            CAP_TLV_DYNAMIC_SIZE + CAP_TLV_TWCARD_SIZE + CAP_TLV_UNOTIF_SIZE;
@@ -65,7 +65,7 @@ recv_init(struct nbr *nbr, char *buf, uint16_t len)
        uint16_t                max_pdu_len;
        int                     caps_rcvd = 0;
 
-       debug_msg_recv("initialization: lsr-id %s", inet_ntoa(nbr->id));
+       debug_msg_recv("initialization: lsr-id %pI4", &nbr->id);
 
        memcpy(&msg, buf, sizeof(msg));
        buf += LDP_MSG_SIZE;
@@ -146,8 +146,8 @@ recv_init(struct nbr *nbr, char *buf, uint16_t len)
 
                        nbr->flags |= F_NBR_CAP_DYNAMIC;
 
-                       log_debug("%s: lsr-id %s announced the Dynamic Capability Announcement capability", __func__,
-                           inet_ntoa(nbr->id));
+                       log_debug("%s: lsr-id %pI4 announced the Dynamic Capability Announcement capability", __func__,
+                           &nbr->id);
                        break;
                case TLV_TYPE_TWCARD_CAP:
                        if (tlv_len != CAP_TLV_TWCARD_LEN) {
@@ -165,7 +165,7 @@ recv_init(struct nbr *nbr, char *buf, uint16_t len)
 
                        nbr->flags |= F_NBR_CAP_TWCARD;
 
-                       log_debug("%s: lsr-id %s announced the Typed Wildcard FEC capability", __func__, inet_ntoa(nbr->id));
+                       log_debug("%s: lsr-id %pI4 announced the Typed Wildcard FEC capability", __func__, &nbr->id);
                        break;
                case TLV_TYPE_UNOTIF_CAP:
                        if (tlv_len != CAP_TLV_UNOTIF_LEN) {
@@ -183,8 +183,8 @@ recv_init(struct nbr *nbr, char *buf, uint16_t len)
 
                        nbr->flags |= F_NBR_CAP_UNOTIF;
 
-                       log_debug("%s: lsr-id %s announced the Unrecognized Notification capability", __func__,
-                           inet_ntoa(nbr->id));
+                       log_debug("%s: lsr-id %pI4 announced the Unrecognized Notification capability", __func__,
+                           &nbr->id);
                        break;
                default:
                        if (!(ntohs(tlv.type) & UNKNOWN_FLAG))
@@ -222,7 +222,7 @@ send_capability(struct nbr *nbr, uint16_t capability, int enable)
        uint16_t                 size;
        int                      err = 0;
 
-       log_debug("%s: lsr-id %s", __func__, inet_ntoa(nbr->id));
+       log_debug("%s: lsr-id %pI4", __func__, &nbr->id);
 
        size = LDP_HDR_SIZE + LDP_MSG_SIZE + CAP_TLV_DYNAMIC_SIZE;
        if ((buf = ibuf_open(size)) == NULL)
@@ -268,7 +268,7 @@ recv_capability(struct nbr *nbr, char *buf, uint16_t len)
        int              enable = 0;
        int              caps_rcvd = 0;
 
-       log_debug("%s: lsr-id %s", __func__, inet_ntoa(nbr->id));
+       log_debug("%s: lsr-id %pI4", __func__, &nbr->id);
 
        memcpy(&msg, buf, sizeof(msg));
        buf += LDP_MSG_SIZE;
@@ -318,7 +318,7 @@ recv_capability(struct nbr *nbr, char *buf, uint16_t len)
                        else
                                nbr->flags &= ~F_NBR_CAP_TWCARD;
 
-                       log_debug("%s: lsr-id %s %s the Typed Wildcard FEC capability", __func__, inet_ntoa(nbr->id),
+                       log_debug("%s: lsr-id %pI4 %s the Typed Wildcard FEC capability", __func__, &nbr->id,
                            (enable) ? "announced" : "withdrew");
                        break;
                case TLV_TYPE_UNOTIF_CAP:
@@ -342,8 +342,8 @@ recv_capability(struct nbr *nbr, char *buf, uint16_t len)
                        else
                                nbr->flags &= ~F_NBR_CAP_UNOTIF;
 
-                       log_debug("%s: lsr-id %s %s the Unrecognized Notification capability", __func__,
-                           inet_ntoa(nbr->id), (enable) ? "announced" :
+                       log_debug("%s: lsr-id %pI4 %s the Unrecognized Notification capability", __func__,
+                           &nbr->id, (enable) ? "announced" :
                            "withdrew");
                        break;
                case TLV_TYPE_DYNAMIC_CAP:
index bc8f26bc58a68d505d65efdd0d2252b6ed3355de..8b3dd71fd7ce8356f7f2bd6082c59512441c13c0 100644 (file)
@@ -578,15 +578,15 @@ if_join_ipv4_group(struct iface *iface, struct in_addr *addr)
 {
        struct in_addr           if_addr;
 
-       log_debug("%s: interface %s addr %s", __func__, iface->name,
-           inet_ntoa(*addr));
+       log_debug("%s: interface %s addr %pI4", __func__, iface->name,
+           addr);
 
        if_addr.s_addr = if_get_ipv4_addr(iface);
 
        if (setsockopt_ipv4_multicast(global.ipv4.ldp_disc_socket,
            IP_ADD_MEMBERSHIP, if_addr, addr->s_addr, iface->ifindex) < 0) {
-               log_warn("%s: error IP_ADD_MEMBERSHIP, interface %s address %s",
-                    __func__, iface->name, inet_ntoa(*addr));
+               log_warn("%s: error IP_ADD_MEMBERSHIP, interface %s address %pI4",
+                    __func__, iface->name, addr);
                return (-1);
        }
        return (0);
@@ -597,14 +597,14 @@ if_leave_ipv4_group(struct iface *iface, struct in_addr *addr)
 {
        struct in_addr           if_addr;
 
-       log_debug("%s: interface %s addr %s", __func__, iface->name,
-           inet_ntoa(*addr));
+       log_debug("%s: interface %s addr %pI4", __func__, iface->name,
+           addr);
 
        if_addr.s_addr = if_get_ipv4_addr(iface);
 
        if (setsockopt_ipv4_multicast(global.ipv4.ldp_disc_socket,
            IP_DROP_MEMBERSHIP, if_addr, addr->s_addr, iface->ifindex) < 0) {
-               log_warn("%s: error IP_DROP_MEMBERSHIP, interface %s address %s", __func__, iface->name, inet_ntoa(*addr));
+               log_warn("%s: error IP_DROP_MEMBERSHIP, interface %s address %pI4", __func__, iface->name, addr);
                return (-1);
        }
 
@@ -828,14 +828,14 @@ ldp_sync_fsm_adj_event(struct adj *adj, enum ldp_sync_event event)
        }
 
        debug_evt_ldp_sync("%s: event %s, "
-               "adj iface %s (%d) lsr-id %s "
-               "source address %s transport address %s",
-               __func__, ldp_sync_event_names[event],
-               adj->source.link.ia->iface->name,
-               adj->source.link.ia->iface->ifindex,
-               inet_ntoa(adj->lsr_id),
-               log_addr(adj_get_af(adj), &adj->source.link.src_addr),
-               log_addr(adj_get_af(adj), &adj->trans_addr));
+                          "adj iface %s (%d) lsr-id %pI4 "
+                          "source address %s transport address %s",
+                          __func__, ldp_sync_event_names[event],
+                          adj->source.link.ia->iface->name,
+                          adj->source.link.ia->iface->ifindex,
+                          &adj->lsr_id,
+                          log_addr(adj_get_af(adj), &adj->source.link.src_addr),
+                          log_addr(adj_get_af(adj), &adj->trans_addr));
 
        return ldp_sync_fsm(iface, event);
 }
@@ -861,9 +861,9 @@ ldp_sync_fsm_nbr_event(struct nbr *nbr, enum ldp_sync_event event)
                         */
                        continue;
 
-               debug_evt_ldp_sync("%s: event %s, iface %s, lsr-id %s",
+               debug_evt_ldp_sync("%s: event %s, iface %s, lsr-id %pI4",
                        __func__, ldp_sync_event_names[event],
-                       iface->name, inet_ntoa(nbr->id));
+                       iface->name, &nbr->id);
 
                ldp_sync_fsm(iface, event);
        }
index ba5f2233162da9637c3def43eeee0a09beb679df..b03127109f4867aa1ebd35a421f02708856b9cef 100644 (file)
@@ -37,7 +37,7 @@ send_keepalive(struct nbr *nbr)
        size -= LDP_HDR_SIZE;
        gen_msg_hdr(buf, MSG_TYPE_KEEPALIVE, size);
 
-       debug_kalive_send("keepalive: lsr-id %s", inet_ntoa(nbr->id));
+       debug_kalive_send("keepalive: lsr-id %pI4", &nbr->id);
 
        evbuf_enqueue(&nbr->tcp->wbuf, buf);
        nbr->stats.kalive_sent++;
@@ -54,7 +54,7 @@ recv_keepalive(struct nbr *nbr, char *buf, uint16_t len)
                return (-1);
        }
 
-       debug_kalive_recv("keepalive: lsr-id %s", inet_ntoa(nbr->id));
+       debug_kalive_recv("keepalive: lsr-id %pI4", &nbr->id);
 
        if (nbr->state != NBR_STA_OPER)
                nbr_fsm(nbr, NBR_EVT_KEEPALIVE_RCVD);
index a656626356abe9a9ce8a9fbf18586bc5e38d78cb..cee9d527e859a95dd27d8ab3de21638c297cdb02 100644 (file)
@@ -910,6 +910,6 @@ tlv_decode_fec_elm(struct nbr *nbr, struct ldp_msg *msg, char *buf,
 static void
 log_msg_mapping(int out, uint16_t msg_type, struct nbr *nbr, struct map *map)
 {
-       debug_msg(out, "%s: lsr-id %s, fec %s, label %s", msg_name(msg_type),
-           inet_ntoa(nbr->id), log_map(map), log_label(map->label));
+       debug_msg(out, "%s: lsr-id %pI4, fec %s, label %s", msg_name(msg_type),
+           &nbr->id, log_map(map), log_label(map->label));
 }
index c217cfc78ab50cffe3297eb76dabe795822a5565..d21e3c0409970bc1335b24690ef7586e208237d7 100644 (file)
@@ -255,7 +255,7 @@ ldp_config_write(struct vty *vty)
        vty_out (vty, "mpls ldp\n");
 
        if (ldpd_conf->rtr_id.s_addr != INADDR_ANY)
-               vty_out(vty, " router-id %s\n", inet_ntoa(ldpd_conf->rtr_id));
+               vty_out(vty, " router-id %pI4\n", &ldpd_conf->rtr_id);
 
        if (ldpd_conf->lhello_holdtime != LINK_DFLT_HOLDTIME &&
            ldpd_conf->lhello_holdtime != 0)
@@ -292,20 +292,20 @@ ldp_config_write(struct vty *vty)
 
        RB_FOREACH(nbrp, nbrp_head, &ldpd_conf->nbrp_tree) {
                if (nbrp->flags & F_NBRP_KEEPALIVE)
-                       vty_out (vty, " neighbor %s session holdtime %u\n",
-                           inet_ntoa(nbrp->lsr_id),nbrp->keepalive);
+                       vty_out (vty, " neighbor %pI4 session holdtime %u\n",
+                           &nbrp->lsr_id,nbrp->keepalive);
 
                if (nbrp->flags & F_NBRP_GTSM) {
                        if (nbrp->gtsm_enabled)
-                               vty_out (vty, " neighbor %s ttl-security hops %u\n",  inet_ntoa(nbrp->lsr_id),
+                               vty_out (vty, " neighbor %pI4 ttl-security hops %u\n",  &nbrp->lsr_id,
                                    nbrp->gtsm_hops);
                        else
-                               vty_out (vty, " neighbor %s ttl-security disable\n",inet_ntoa(nbrp->lsr_id));
+                               vty_out (vty, " neighbor %pI4 ttl-security disable\n",&nbrp->lsr_id);
                }
 
                if (nbrp->auth.method == AUTH_MD5SIG)
-                       vty_out (vty, " neighbor %s password %s\n",
-                           inet_ntoa(nbrp->lsr_id),nbrp->auth.md5key);
+                       vty_out (vty, " neighbor %pI4 password %s\n",
+                           &nbrp->lsr_id,nbrp->auth.md5key);
        }
 
        ldp_af_config_write(vty, AF_INET, ldpd_conf, &ldpd_conf->ipv4);
@@ -326,7 +326,7 @@ ldp_l2vpn_pw_config_write(struct vty *vty, struct l2vpn_pw *pw)
        vty_out (vty, " member pseudowire %s\n", pw->ifname);
 
        if (pw->lsr_id.s_addr != INADDR_ANY)
-               vty_out (vty, "  neighbor lsr-id %s\n",inet_ntoa(pw->lsr_id));
+               vty_out (vty, "  neighbor lsr-id %pI4\n",&pw->lsr_id);
                else
                        missing_lsrid = 1;
 
index 609598a7681722c5f5aaeed2850156bf15e6e04d..09b820e3f6b6ebcb4e11516dd8add815b0760a31 100644 (file)
@@ -19,6 +19,7 @@
 
 #include <zebra.h>
 #include <sys/un.h>
+#include "lib/printfrr.h"
 
 #include "ldpd.h"
 #include "ldpe.h"
@@ -237,8 +238,8 @@ show_ldp_sync_msg(struct vty *vty, struct imsg *imsg,
                }
 
                if (iface->peer_ldp_id.s_addr)
-                       vty_out (vty, "    Peer LDP Identifier: %s:0\n",
-                               inet_ntoa(iface->peer_ldp_id));
+                       vty_out (vty, "    Peer LDP Identifier: %pI4:0\n",
+                               &iface->peer_ldp_id);
 
                break;
        case IMSG_CTL_END:
@@ -256,6 +257,7 @@ show_ldp_sync_msg_json(struct imsg *imsg, struct show_params *params,
 {
        struct ctl_ldp_sync     *iface;
        json_object             *json_iface;
+       char buf[PREFIX_STRLEN];
 
        switch (imsg->hdr.type) {
        case IMSG_CTL_SHOW_LDP_SYNC:
@@ -278,7 +280,8 @@ show_ldp_sync_msg_json(struct imsg *imsg, struct show_params *params,
 
                json_object_string_add(json_iface, "peerLdpId",
                    iface->peer_ldp_id.s_addr ?
-                   inet_ntoa(iface->peer_ldp_id) : "");
+                   inet_ntop(AF_INET, &iface->peer_ldp_id, buf, sizeof(buf)) :
+                             "");
 
                json_object_object_add(json, iface->name, json_iface);
                break;
@@ -305,8 +308,7 @@ show_discovery_msg(struct vty *vty, struct imsg *imsg,
                if (params->family != AF_UNSPEC && params->family != adj->af)
                        break;
 
-               vty_out(vty, "%-4s %-15s ", af_name(adj->af),
-                   inet_ntoa(adj->id));
+               vty_out(vty, "%-4s %-15pI4 ", af_name(adj->af), &adj->id);
                switch(adj->type) {
                case HELLO_LINK:
                        vty_out(vty, "%-8s %-15s ", "Link", adj->ifname);
@@ -336,8 +338,8 @@ show_discovery_detail_adj(struct vty *vty, char *buffer, struct ctl_adj *adj)
 {
        size_t   buflen = strlen(buffer);
 
-       snprintf(buffer + buflen, LDPBUFSIZ - buflen,
-           "      LSR Id: %s:0\n", inet_ntoa(adj->id));
+       snprintfrr(buffer + buflen, LDPBUFSIZ - buflen,
+                  "      LSR Id: %pI4:0\n", &adj->id);
        buflen = strlen(buffer);
        snprintf(buffer + buflen, LDPBUFSIZ - buflen,
            "          Source address: %s\n",
@@ -419,7 +421,7 @@ show_discovery_detail_msg(struct vty *vty, struct imsg *imsg,
        case IMSG_CTL_END:
                rtr_id.s_addr = ldp_rtr_id_get(ldpd_conf);
                vty_out (vty, "Local:\n");
-               vty_out (vty, "  LSR Id: %s:0\n",inet_ntoa(rtr_id));
+               vty_out (vty, "  LSR Id: %pI4:0\n",&rtr_id);
                if (ldpd_conf->ipv4.flags & F_LDPD_AF_ENABLED)
                        vty_out (vty, "  Transport Address (IPv4): %s\n",
                            log_addr(AF_INET, &ldpd_conf->ipv4.trans_addr));
@@ -445,6 +447,7 @@ show_discovery_msg_json(struct imsg *imsg, struct show_params *params,
     json_object *json)
 {
        struct ctl_adj          *adj;
+       char                    buf[PREFIX_STRLEN];
        json_object             *json_array;
        json_object             *json_adj;
 
@@ -465,7 +468,8 @@ show_discovery_msg_json(struct imsg *imsg, struct show_params *params,
                json_object_string_add(json_adj, "addressFamily",
                    af_name(adj->af));
                json_object_string_add(json_adj, "neighborId",
-                   inet_ntoa(adj->id));
+                                      inet_ntop(AF_INET, &adj->id, buf,
+                                                sizeof(buf)));
                switch(adj->type) {
                case HELLO_LINK:
                        json_object_string_add(json_adj, "type", "link");
@@ -494,6 +498,7 @@ show_discovery_msg_json(struct imsg *imsg, struct show_params *params,
 static void
 show_discovery_detail_adj_json(json_object *json, struct ctl_adj *adj)
 {
+       char buf[PREFIX_STRLEN];
        json_object *json_adj;
        json_object *json_array;
 
@@ -504,7 +509,8 @@ show_discovery_detail_adj_json(json_object *json, struct ctl_adj *adj)
        }
 
        json_adj = json_object_new_object();
-       json_object_string_add(json_adj, "lsrId", inet_ntoa(adj->id));
+       json_object_string_add(json_adj, "lsrId", inet_ntop(AF_INET, &adj->id,
+                                                           buf, sizeof(buf)));
        json_object_string_add(json_adj, "sourceAddress", log_addr(adj->af,
            &adj->src_addr));
        json_object_string_add(json_adj, "transportAddress", log_addr(adj->af,
@@ -526,6 +532,7 @@ show_discovery_detail_msg_json(struct imsg *imsg, struct show_params *params,
        struct ctl_disc_tnbr    *tnbr;
        struct in_addr           rtr_id;
        union ldpd_addr         *trans_addr;
+       char buf[PREFIX_STRLEN];
        json_object             *json_interface;
        json_object             *json_target;
        static json_object      *json_interfaces;
@@ -535,7 +542,9 @@ show_discovery_detail_msg_json(struct imsg *imsg, struct show_params *params,
        switch (imsg->hdr.type) {
        case IMSG_CTL_SHOW_DISCOVERY:
                rtr_id.s_addr = ldp_rtr_id_get(ldpd_conf);
-               json_object_string_add(json, "lsrId", inet_ntoa(rtr_id));
+               json_object_string_add(json, "lsrId",
+                                      inet_ntop(AF_INET, &rtr_id, buf,
+                                                sizeof(buf)));
                if (ldpd_conf->ipv4.flags & F_LDPD_AF_ENABLED)
                        json_object_string_add(json, "transportAddressIPv4",
                            log_addr(AF_INET, &ldpd_conf->ipv4.trans_addr));
@@ -612,9 +621,9 @@ show_nbr_msg(struct vty *vty, struct imsg *imsg, struct show_params *params)
 
                addr = log_addr(nbr->af, &nbr->raddr);
 
-               vty_out(vty, "%-4s %-15s %-11s %-15s",
-                   af_name(nbr->af), inet_ntoa(nbr->id),
-                   nbr_state_name(nbr->nbr_state), addr);
+               vty_out(vty, "%-4s %-15pI4 %-11s %-15s",
+                       af_name(nbr->af), &nbr->id,
+                       nbr_state_name(nbr->nbr_state), addr);
                if (strlen(addr) > 15)
                        vty_out(vty, "\n%48s", " ");
                vty_out (vty, " %8s\n", log_time(nbr->uptime));
@@ -662,8 +671,8 @@ show_nbr_detail_msg(struct vty *vty, struct imsg *imsg,
 
                v4adjs_buffer[0] = '\0';
                v6adjs_buffer[0] = '\0';
-               vty_out (vty, "Peer LDP Identifier: %s:0\n",
-                         inet_ntoa(nbr->id));
+               vty_out (vty, "Peer LDP Identifier: %pI4:0\n",
+                         &nbr->id);
                vty_out (vty, "  TCP connection: %s:%u - %s:%u\n",
                    log_addr(nbr->af, &nbr->laddr), ntohs(nbr->lport),
                    log_addr(nbr->af, &nbr->raddr),ntohs(nbr->rport));
@@ -740,6 +749,7 @@ show_nbr_msg_json(struct imsg *imsg, struct show_params *params,
     json_object *json)
 {
        struct ctl_nbr          *nbr;
+       char buf[PREFIX_STRLEN];
        json_object             *json_array;
        json_object             *json_nbr;
 
@@ -757,7 +767,8 @@ show_nbr_msg_json(struct imsg *imsg, struct show_params *params,
                json_object_string_add(json_nbr, "addressFamily",
                    af_name(nbr->af));
                json_object_string_add(json_nbr, "neighborId",
-                   inet_ntoa(nbr->id));
+                                      inet_ntop(AF_INET, &nbr->id, buf,
+                                                sizeof(buf)));
                json_object_string_add(json_nbr, "state",
                    nbr_state_name(nbr->nbr_state));
                json_object_string_add(json_nbr, "transportAddress",
@@ -803,6 +814,7 @@ show_nbr_detail_msg_json(struct imsg *imsg, struct show_params *params,
        struct ctl_nbr          *nbr;
        struct ldp_stats        *stats;
        struct ctl_adj          *adj;
+       char buf[PREFIX_STRLEN];
        json_object             *json_nbr;
        json_object             *json_array;
        json_object             *json_counter;
@@ -815,9 +827,12 @@ show_nbr_detail_msg_json(struct imsg *imsg, struct show_params *params,
                nbr = imsg->data;
 
                json_nbr = json_object_new_object();
-               json_object_object_add(json, inet_ntoa(nbr->id), json_nbr);
-
-               json_object_string_add(json_nbr, "peerId", inet_ntoa(nbr->id));
+               json_object_object_add(json,
+                                      inet_ntop(AF_INET, &nbr->id, buf,
+                                                sizeof(buf)), json_nbr);
+               json_object_string_add(json_nbr, "peerId",
+                                      inet_ntop(AF_INET, &nbr->id, buf,
+                                                sizeof(buf)));
                json_object_string_add(json_nbr, "tcpLocalAddress",
                    log_addr(nbr->af, &nbr->laddr));
                json_object_int_add(json_nbr, "tcpLocalPort",
@@ -998,8 +1013,8 @@ show_nbr_capabilities_msg(struct vty *vty, struct imsg *imsg, struct show_params
                if (nbr->nbr_state != NBR_STA_OPER)
                        break;
 
-               vty_out (vty, "Peer LDP Identifier: %s:0\n",
-                         inet_ntoa(nbr->id));
+               vty_out (vty, "Peer LDP Identifier: %pI4:0\n",
+                         &nbr->id);
                show_nbr_capabilities(vty, nbr);
                vty_out (vty, "\n");
                break;
@@ -1079,6 +1094,7 @@ show_nbr_capabilities_msg_json(struct imsg *imsg, struct show_params *params,
     json_object *json)
 {
        struct ctl_nbr          *nbr;
+       char buf[PREFIX_STRLEN];
        json_object             *json_nbr;
 
        switch (imsg->hdr.type) {
@@ -1089,7 +1105,8 @@ show_nbr_capabilities_msg_json(struct imsg *imsg, struct show_params *params,
                        break;
 
                json_nbr = json_object_new_object();
-               json_object_object_add(json, inet_ntoa(nbr->id), json_nbr);
+               json_object_object_add(json, inet_ntop(AF_INET, &nbr->id, buf,
+                                                      sizeof(buf)), json_nbr);
                show_nbr_capabilities_json(nbr, json_nbr);
                break;
        case IMSG_CTL_END:
@@ -1128,9 +1145,10 @@ show_lib_msg(struct vty *vty, struct imsg *imsg, struct show_params *params)
                vty_out(vty, "%-4s %-20s", af_name(rt->af), dstnet);
                if (strlen(dstnet) > 20)
                        vty_out(vty, "\n%25s", " ");
-               vty_out (vty, " %-15s %-11s %-13s %6s\n", inet_ntoa(rt->nexthop),
-                   log_label(rt->local_label), log_label(rt->remote_label),
-                   rt->in_use ? "yes" : "no");
+               vty_out (vty, " %-15pI4 %-11s %-13s %6s\n",
+                        &rt->nexthop, log_label(rt->local_label),
+                        log_label(rt->remote_label),
+                        rt->in_use ? "yes" : "no");
                break;
        case IMSG_CTL_END:
                vty_out (vty, "\n");
@@ -1168,17 +1186,17 @@ show_lib_detail_msg(struct vty *vty, struct imsg *imsg, struct show_params *para
 
                upstream = 1;
                buflen = strlen(sent_buffer);
-               snprintf(sent_buffer + buflen, LDPBUFSIZ - buflen,
-                   "%12s%s:0\n", "", inet_ntoa(rt->nexthop));
+               snprintfrr(sent_buffer + buflen, LDPBUFSIZ - buflen,
+                          "%12s%pI4:0\n", "", &rt->nexthop);
                break;
        case IMSG_CTL_SHOW_LIB_RCVD:
                rt = imsg->data;
                downstream = 1;
                buflen = strlen(rcvd_buffer);
-               snprintf(rcvd_buffer + buflen, LDPBUFSIZ - buflen,
-                   "%12s%s:0, label %s%s\n", "", inet_ntoa(rt->nexthop),
-                   log_label(rt->remote_label),
-                   rt->in_use ? " (in use)" : "");
+               snprintfrr(rcvd_buffer + buflen, LDPBUFSIZ - buflen,
+                          "%12s%pI4:0, label %s%s\n", "", &rt->nexthop,
+                          log_label(rt->remote_label),
+                          rt->in_use ? " (in use)" : "");
                break;
        case IMSG_CTL_SHOW_LIB_END:
                rt = imsg->data;
@@ -1217,6 +1235,7 @@ show_lib_msg_json(struct imsg *imsg, struct show_params *params,
        json_object     *json_array;
        json_object     *json_lib_entry;
        char             dstnet[BUFSIZ];
+       char buf[PREFIX_STRLEN];
 
        switch (imsg->hdr.type) {
        case IMSG_CTL_SHOW_LIB_BEGIN:
@@ -1240,11 +1259,12 @@ show_lib_msg_json(struct imsg *imsg, struct show_params *params,
                    log_addr(rt->af, &rt->prefix), rt->prefixlen);
                json_object_string_add(json_lib_entry, "prefix", dstnet);
                json_object_string_add(json_lib_entry, "neighborId",
-                   inet_ntoa(rt->nexthop));
+                                      inet_ntop(AF_INET, &rt->nexthop, buf,
+                                                sizeof(buf)));
                json_object_string_add(json_lib_entry, "localLabel",
-                   log_label(rt->local_label));
+                                      log_label(rt->local_label));
                json_object_string_add(json_lib_entry, "remoteLabel",
-                   log_label(rt->remote_label));
+                                      log_label(rt->remote_label));
                json_object_int_add(json_lib_entry, "inUse", rt->in_use);
 
                json_object_array_add(json_array, json_lib_entry);
@@ -1264,6 +1284,7 @@ show_lib_detail_msg_json(struct imsg *imsg, struct show_params *params,
 {
        struct ctl_rt           *rt = NULL;
        char                     dstnet[BUFSIZ];
+       char buf[PREFIX_STRLEN];
        static json_object      *json_lib_entry;
        static json_object      *json_adv_labels;
        json_object             *json_adv_label;
@@ -1296,7 +1317,8 @@ show_lib_detail_msg_json(struct imsg *imsg, struct show_params *params,
 
                json_adv_label = json_object_new_object();
                json_object_string_add(json_adv_label, "neighborId",
-                   inet_ntoa(rt->nexthop));
+                                      inet_ntop(AF_INET, &rt->nexthop, buf,
+                                                sizeof(buf)));
                json_object_array_add(json_adv_labels, json_adv_label);
                break;
        case IMSG_CTL_SHOW_LIB_RCVD:
@@ -1304,9 +1326,10 @@ show_lib_detail_msg_json(struct imsg *imsg, struct show_params *params,
 
                json_remote_label = json_object_new_object();
                json_object_string_add(json_remote_label, "neighborId",
-                   inet_ntoa(rt->nexthop));
+                                      inet_ntop(AF_INET, &rt->nexthop,
+                                                buf, sizeof(buf)));
                json_object_string_add(json_remote_label, "label",
-                   log_label(rt->remote_label));
+                                      log_label(rt->remote_label));
                json_object_int_add(json_remote_label, "inUse", rt->in_use);
                json_object_array_add(json_remote_labels, json_remote_label);
                break;
@@ -1329,8 +1352,8 @@ show_l2vpn_binding_msg(struct vty *vty, struct imsg *imsg,
        case IMSG_CTL_SHOW_L2VPN_BINDING:
                pw = imsg->data;
 
-               vty_out (vty, "  Destination Address: %s, VC ID: %u\n",
-                   inet_ntoa(pw->lsr_id), pw->pwid);
+               vty_out (vty, "  Destination Address: %pI4, VC ID: %u\n",
+                   &pw->lsr_id, pw->pwid);
 
                /* local binding */
                if (pw->local_label != NO_LABEL) {
@@ -1371,6 +1394,7 @@ show_l2vpn_binding_msg_json(struct imsg *imsg, struct show_params *params,
        struct ctl_pw   *pw;
        json_object     *json_pw;
        char             key_name[64];
+       char buf[PREFIX_STRLEN];
 
        switch (imsg->hdr.type) {
        case IMSG_CTL_SHOW_L2VPN_BINDING:
@@ -1378,7 +1402,8 @@ show_l2vpn_binding_msg_json(struct imsg *imsg, struct show_params *params,
 
                json_pw = json_object_new_object();
                json_object_string_add(json_pw, "destination",
-                   inet_ntoa(pw->lsr_id));
+                                      inet_ntop(AF_INET, &pw->lsr_id, buf,
+                                                sizeof(buf)));
                json_object_int_add(json_pw, "vcId", pw->pwid);
 
                /* local binding */
@@ -1415,8 +1440,8 @@ show_l2vpn_binding_msg_json(struct imsg *imsg, struct show_params *params,
                        json_object_string_add(json_pw, "remoteLabel",
                            "unassigned");
 
-               snprintf(key_name, sizeof(key_name), "%s: %u",
-                        inet_ntoa(pw->lsr_id), pw->pwid);
+               snprintfrr(key_name, sizeof(key_name), "%pI4: %u",
+                          &pw->lsr_id, pw->pwid);
                json_object_object_add(json, key_name, json_pw);
                break;
        case IMSG_CTL_END:
@@ -1437,9 +1462,9 @@ show_l2vpn_pw_msg(struct vty *vty, struct imsg *imsg, struct show_params *params
        case IMSG_CTL_SHOW_L2VPN_PW:
                pw = imsg->data;
 
-               vty_out (vty, "%-9s %-15s %-10u %-16s %-10s\n", pw->ifname,
-                   inet_ntoa(pw->lsr_id), pw->pwid, pw->l2vpn_name,
-                   (pw->status == PW_FORWARDING ? "UP" : "DOWN"));
+               vty_out (vty, "%-9s %-15pI4 %-10u %-16s %-10s\n", pw->ifname,
+                        &pw->lsr_id, pw->pwid, pw->l2vpn_name,
+                        (pw->status == PW_FORWARDING ? "UP" : "DOWN"));
                break;
        case IMSG_CTL_END:
                vty_out (vty, "\n");
@@ -1456,6 +1481,7 @@ show_l2vpn_pw_msg_json(struct imsg *imsg, struct show_params *params,
     json_object *json)
 {
        struct ctl_pw   *pw;
+       char buf[PREFIX_STRLEN];
        json_object     *json_pw;
 
        switch (imsg->hdr.type) {
@@ -1463,7 +1489,9 @@ show_l2vpn_pw_msg_json(struct imsg *imsg, struct show_params *params,
                pw = imsg->data;
 
                json_pw = json_object_new_object();
-               json_object_string_add(json_pw, "peerId", inet_ntoa(pw->lsr_id));
+               json_object_string_add(json_pw, "peerId",
+                                      inet_ntop(AF_INET, &pw->lsr_id,
+                                                buf, sizeof(buf)));
                json_object_int_add(json_pw, "vcId", pw->pwid);
                json_object_string_add(json_pw, "VpnName", pw->l2vpn_name);
                if (pw->status == PW_FORWARDING)
index 16e9adc9d97da49c4009c7e9edaaf9356c641cf9..3852d8d23b3072d52c0147908f584281d07599f5 100644 (file)
@@ -359,7 +359,7 @@ ldp_router_id_update(ZAPI_CALLBACK_ARGS)
        if (bad_addr_v4(router_id.u.prefix4))
                return (0);
 
-       debug_zebra_in("router-id update %s", inet_ntoa(router_id.u.prefix4));
+       debug_zebra_in("router-id update %pI4", &router_id.u.prefix4);
 
        global.rtr_id.s_addr = router_id.u.prefix4.s_addr;
        main_imsg_compose_ldpe(IMSG_RTRID_UPDATE, 0, &global.rtr_id,
index 6427d0e13b106073267b3a7fc688b281831fb02b..ff9294f9d24d305031f20712ebfb48711385222a 100644 (file)
@@ -17,6 +17,7 @@
  */
 
 #include <zebra.h>
+#include "lib/printfrr.h"
 
 #include "mpls.h"
 
@@ -254,10 +255,10 @@ log_fec(const struct fec *fec)
                        return ("???");
                break;
        case FEC_TYPE_PWID:
-               if (snprintf(buf, sizeof(buf),
-                   "pwid %u (%s) - %s",
-                   fec->u.pwid.pwid, pw_type_name(fec->u.pwid.type),
-                   inet_ntoa(fec->u.pwid.lsr_id)) == -1)
+               if (snprintfrr(buf, sizeof(buf),
+                              "pwid %u (%s) - %pI4",
+                              fec->u.pwid.pwid, pw_type_name(fec->u.pwid.type),
+                              &fec->u.pwid.lsr_id) == -1)
                        return ("???");
                break;
        default:
index 236d3eaa58a317867e2e84ae8caee5a431acd04a..423410f29098285b8b84af5915c8d4dd848dd6fc 100644 (file)
@@ -143,7 +143,7 @@ nbr_fsm(struct nbr *nbr, enum nbr_event event)
 
        if (nbr_fsm_tbl[i].state == -1) {
                /* event outside of the defined fsm, ignore it. */
-               log_warnx("%s: lsr-id %s, event %s not expected in state %s", __func__, inet_ntoa(nbr->id),
+               log_warnx("%s: lsr-id %pI4, event %s not expected in state %s", __func__, &nbr->id,
                    nbr_event_names[event], nbr_state_name(old_state));
                return (0);
        }
@@ -152,10 +152,10 @@ nbr_fsm(struct nbr *nbr, enum nbr_event event)
                nbr->state = new_state;
 
        if (old_state != nbr->state) {
-               log_debug("%s: event %s resulted in action %s and changing state for lsr-id %s from %s to %s",
+               log_debug("%s: event %s resulted in action %s and changing state for lsr-id %pI4 from %s to %s",
                    __func__, nbr_event_names[event],
                    nbr_action_names[nbr_fsm_tbl[i].action],
-                   inet_ntoa(nbr->id), nbr_state_name(old_state),
+                   &nbr->id, nbr_state_name(old_state),
                    nbr_state_name(nbr->state));
 
                if (nbr->state == NBR_STA_OPER) {
@@ -223,8 +223,8 @@ nbr_new(struct in_addr id, int af, int ds_tlv, union ldpd_addr *addr,
        struct adj              *adj;
        struct pending_conn     *pconn;
 
-       log_debug("%s: lsr-id %s transport-address %s", __func__,
-           inet_ntoa(id), log_addr(af, addr));
+       log_debug("%s: lsr-id %pI4 transport-address %s", __func__,
+           &id, log_addr(af, addr));
 
        if ((nbr = calloc(1, sizeof(*nbr))) == NULL)
                fatal(__func__);
@@ -289,7 +289,7 @@ nbr_del(struct nbr *nbr)
 {
        struct adj              *adj;
 
-       log_debug("%s: lsr-id %s", __func__, inet_ntoa(nbr->id));
+       log_debug("%s: lsr-id %pI4", __func__, &nbr->id);
 
        nbr_fsm(nbr, NBR_EVT_CLOSE_SESSION);
 #ifdef __OpenBSD__
@@ -436,7 +436,7 @@ nbr_ktimeout(struct thread *thread)
 
        nbr->keepalive_timeout = NULL;
 
-       log_debug("%s: lsr-id %s", __func__, inet_ntoa(nbr->id));
+       log_debug("%s: lsr-id %pI4", __func__, &nbr->id);
 
        session_shutdown(nbr, S_KEEPALIVE_TMR, 0, 0);
 
@@ -465,7 +465,7 @@ nbr_itimeout(struct thread *thread)
 {
        struct nbr      *nbr = THREAD_ARG(thread);
 
-       log_debug("%s: lsr-id %s", __func__, inet_ntoa(nbr->id));
+       log_debug("%s: lsr-id %pI4", __func__, &nbr->id);
 
        nbr_fsm(nbr, NBR_EVT_CLOSE_SESSION);
 
@@ -498,7 +498,7 @@ nbr_idtimer(struct thread *thread)
 
        nbr->initdelay_timer = NULL;
 
-       log_debug("%s: lsr-id %s", __func__, inet_ntoa(nbr->id));
+       log_debug("%s: lsr-id %pI4", __func__, &nbr->id);
 
        nbr_establish_connection(nbr);
 
@@ -619,12 +619,12 @@ nbr_establish_connection(struct nbr *nbr)
 
        if (nbr->af == AF_INET) {
                if (sock_set_ipv4_tos(nbr->fd, IPTOS_PREC_INTERNETCONTROL) == -1)
-                       log_warn("%s: lsr-id %s, sock_set_ipv4_tos error",
-                               __func__, inet_ntoa(nbr->id));
+                       log_warn("%s: lsr-id %pI4, sock_set_ipv4_tos error",
+                               __func__, &nbr->id);
        } else if (nbr->af == AF_INET6) {
                if (sock_set_ipv6_dscp(nbr->fd, IPTOS_PREC_INTERNETCONTROL) == -1)
-                       log_warn("%s: lsr-id %s, sock_set_ipv6_dscp error",
-                               __func__, inet_ntoa(nbr->id));
+                       log_warn("%s: lsr-id %pI4, sock_set_ipv6_dscp error",
+                               __func__, &nbr->id);
        }
 
        addr2sa(nbr->af, &nbr->laddr, 0, &local_su);
@@ -746,8 +746,8 @@ nbr_gtsm_check(int fd, struct nbr *nbr, struct nbr_params *nbrp)
        }
 
        if (nbr_gtsm_setup(fd, nbr->af, nbrp) == -1) {
-               log_warnx("%s: error enabling GTSM for lsr-id %s", __func__,
-                   inet_ntoa(nbr->id));
+               log_warnx("%s: error enabling GTSM for lsr-id %pI4", __func__,
+                   &nbr->id);
                return (-1);
        }
 
index 93be9d3cb03996c59dc04d3d35f19ee6fb524876..f84e0f893b8787c3ea5c3de02402a399f4124e30 100644 (file)
@@ -309,13 +309,13 @@ void
 log_msg_notification(int out, struct nbr *nbr, struct notify_msg *nm)
 {
        if (nm->status_code & STATUS_FATAL) {
-               debug_msg(out, "notification: lsr-id %s, status %s (fatal error)", inet_ntoa(nbr->id),
+               debug_msg(out, "notification: lsr-id %pI4, status %s (fatal error)", &nbr->id,
                    status_code_name(nm->status_code));
                return;
        }
 
-       debug_msg(out, "notification: lsr-id %s, status %s",
-           inet_ntoa(nbr->id), status_code_name(nm->status_code));
+       debug_msg(out, "notification: lsr-id %pI4, status %s",
+           &nbr->id, status_code_name(nm->status_code));
        if (nm->flags & F_NOTIF_FEC)
                debug_msg(out, "notification:   fec %s", log_map(&nm->fec));
        if (nm->flags & F_NOTIF_PW_STATUS)
index 3f73f8cd8850d0c4fc358de24b5c5cc41bfc5b91..06ada5957ee8a5e2ac0e48993d2739ffce2d3b3e 100644 (file)
@@ -366,7 +366,7 @@ session_accept(struct thread *thread)
                return (0);
        }
        if (nbr->state != NBR_STA_PRESENT) {
-               log_debug("%s: lsr-id %s: rejecting additional transport connection", __func__, inet_ntoa(nbr->id));
+               log_debug("%s: lsr-id %pI4: rejecting additional transport connection", __func__, &nbr->id);
                close(newfd);
                return (0);
        }
@@ -558,8 +558,8 @@ session_read(struct thread *thread)
                                    type);
                                break;
                        default:
-                               log_debug("%s: unknown LDP message from nbr %s",
-                                   __func__, inet_ntoa(nbr->id));
+                               log_debug("%s: unknown LDP message from nbr %pI4",
+                                   __func__, &nbr->id);
                                if (!(ntohs(msg->type) & UNKNOWN_FLAG))
                                        send_notification(nbr->tcp,
                                            S_UNKNOWN_MSG, msg->id, msg->type);
@@ -680,8 +680,8 @@ session_shutdown(struct nbr *nbr, uint32_t status, uint32_t msg_id,
 void
 session_close(struct nbr *nbr)
 {
-       log_debug("%s: closing session with lsr-id %s", __func__,
-           inet_ntoa(nbr->id));
+       log_debug("%s: closing session with lsr-id %pI4", __func__,
+           &nbr->id);
 
        ldp_sync_fsm_nbr_event(nbr, LDP_SYNC_EVT_SESSION_CLOSE);