]> git.puffer.fish Git - mirror/frr.git/commitdiff
bfdd: use standard log macros 6199/head
authorRafael Zalamena <rzalamena@opensourcerouting.org>
Fri, 10 Apr 2020 14:06:22 +0000 (11:06 -0300)
committerRafael Zalamena <rzalamena@opensourcerouting.org>
Fri, 10 Apr 2020 14:06:22 +0000 (11:06 -0300)
Remove old log_* macros and standardize on FRR's logging infrastructure.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
bfdd/bfd.c
bfdd/bfd.h
bfdd/bfd_packet.c
bfdd/bfdd.c
bfdd/bfdd_vty.c
bfdd/config.c
bfdd/control.c
bfdd/event.c
bfdd/ptm_adapter.c

index e16616c3716ac89b2d96e93c3042cd1b42f2b926..e1c662941bec9554e3a4ee87e848dd121b285b31 100644 (file)
@@ -131,7 +131,7 @@ int bfd_session_enable(struct bfd_session *bs)
        if (bs->key.vrfname[0]) {
                vrf = vrf_lookup_by_name(bs->key.vrfname);
                if (vrf == NULL) {
-                       log_error(
+                       zlog_err(
                                "session-enable: specified VRF doesn't exists.");
                        return 0;
                }
@@ -143,15 +143,15 @@ int bfd_session_enable(struct bfd_session *bs)
                else
                        ifp = if_lookup_by_name_all_vrf(bs->key.ifname);
                if (ifp == NULL) {
-                       log_error(
-                                 "session-enable: specified interface doesn't exists.");
+                       zlog_err(
+                               "session-enable: specified interface doesn't exists.");
                        return 0;
                }
                if (bs->key.ifname[0] && !vrf) {
                        vrf = vrf_lookup_by_id(ifp->vrf_id);
                        if (vrf == NULL) {
-                               log_error(
-                                         "session-enable: specified VRF doesn't exists.");
+                               zlog_err(
+                                       "session-enable: specified VRF doesn't exists.");
                                return 0;
                        }
                }
@@ -169,7 +169,7 @@ int bfd_session_enable(struct bfd_session *bs)
 
        /* Sanity check: don't leak open sockets. */
        if (bs->sock != -1) {
-               log_debug("session-enable: previous socket open");
+               zlog_debug("session-enable: previous socket open");
                close(bs->sock);
                bs->sock = -1;
        }
@@ -318,9 +318,9 @@ void ptm_bfd_sess_up(struct bfd_session *bfd)
 
        if (old_state != bfd->ses_state) {
                bfd->stats.session_up++;
-               log_info("state-change: [%s] %s -> %s", bs_to_string(bfd),
-                        state_list[old_state].str,
-                        state_list[bfd->ses_state].str);
+               zlog_debug("state-change: [%s] %s -> %s", bs_to_string(bfd),
+                          state_list[old_state].str,
+                          state_list[bfd->ses_state].str);
        }
 }
 
@@ -357,10 +357,10 @@ void ptm_bfd_sess_dn(struct bfd_session *bfd, uint8_t diag)
 
        if (old_state != bfd->ses_state) {
                bfd->stats.session_down++;
-               log_info("state-change: [%s] %s -> %s reason:%s",
-                        bs_to_string(bfd), state_list[old_state].str,
-                        state_list[bfd->ses_state].str,
-                        get_diag_str(bfd->local_diag));
+               zlog_debug("state-change: [%s] %s -> %s reason:%s",
+                          bs_to_string(bfd), state_list[old_state].str,
+                          state_list[bfd->ses_state].str,
+                          get_diag_str(bfd->local_diag));
        }
 }
 
@@ -682,7 +682,7 @@ struct bfd_session *ptm_bfd_sess_new(struct bfd_peer_cfg *bpc)
        /* Get BFD session storage with its defaults. */
        bfd = bfd_session_new();
        if (bfd == NULL) {
-               log_error("session-new: allocation failed");
+               zlog_err("session-new: allocation failed");
                return NULL;
        }
 
@@ -758,7 +758,7 @@ struct bfd_session *bs_registrate(struct bfd_session *bfd)
        if (bfd->key.ifname[0] || bfd->key.vrfname[0] || bfd->sock == -1)
                bs_observer_add(bfd);
 
-       log_info("session-new: %s", bs_to_string(bfd));
+       zlog_debug("session-new: %s", bs_to_string(bfd));
 
        control_notify_config(BCM_NOTIFY_CONFIG_ADD, bfd);
 
@@ -776,13 +776,13 @@ int ptm_bfd_sess_del(struct bfd_peer_cfg *bpc)
 
        /* This pointer is being referenced, don't let it be deleted. */
        if (bs->refcount > 0) {
-               log_error("session-delete: refcount failure: %" PRIu64
-                         " references",
-                         bs->refcount);
+               zlog_err("session-delete: refcount failure: %" PRIu64
+                        " references",
+                        bs->refcount);
                return -1;
        }
 
-       log_info("session-delete: %s", bs_to_string(bs));
+       zlog_debug("session-delete: %s", bs_to_string(bs));
 
        control_notify_config(BCM_NOTIFY_CONFIG_DELETE, bs);
 
@@ -849,7 +849,8 @@ static void bs_down_handler(struct bfd_session *bs, int nstate)
                break;
 
        default:
-               log_debug("state-change: unhandled neighbor state: %d", nstate);
+               zlog_debug("state-change: unhandled neighbor state: %d",
+                          nstate);
                break;
        }
 }
@@ -876,7 +877,8 @@ static void bs_init_handler(struct bfd_session *bs, int nstate)
                break;
 
        default:
-               log_debug("state-change: unhandled neighbor state: %d", nstate);
+               zlog_debug("state-change: unhandled neighbor state: %d",
+                          nstate);
                break;
        }
 }
@@ -907,10 +909,10 @@ static void bs_neighbour_admin_down_handler(struct bfd_session *bfd,
        if (old_state != bfd->ses_state) {
                bfd->stats.session_down++;
 
-               log_info("state-change: [%s] %s -> %s reason:%s",
-                       bs_to_string(bfd), state_list[old_state].str,
-                       state_list[bfd->ses_state].str,
-                       get_diag_str(bfd->local_diag));
+               zlog_debug("state-change: [%s] %s -> %s reason:%s",
+                          bs_to_string(bfd), state_list[old_state].str,
+                          state_list[bfd->ses_state].str,
+                          get_diag_str(bfd->local_diag));
        }
 }
 
@@ -932,7 +934,8 @@ static void bs_up_handler(struct bfd_session *bs, int nstate)
                break;
 
        default:
-               log_debug("state-change: unhandled neighbor state: %d", nstate);
+               zlog_debug("state-change: unhandled neighbor state: %d",
+                          nstate);
                break;
        }
 }
@@ -954,8 +957,8 @@ void bs_state_handler(struct bfd_session *bs, int nstate)
                break;
 
        default:
-               log_debug("state-change: [%s] is in invalid state: %d",
-                         bs_to_string(bs), nstate);
+               zlog_debug("state-change: [%s] is in invalid state: %d",
+                          bs_to_string(bs), nstate);
                break;
        }
 }
@@ -1434,8 +1437,8 @@ struct bfd_session *bfd_key_lookup(struct bfd_key key)
 
                        inet_ntop(bs.key.family, &key.local, addr_buf,
                                  sizeof(addr_buf));
-                       log_debug(" peer %s found, but loc-addr %s ignored",
-                                 peer_buf, addr_buf);
+                       zlog_debug(" peer %s found, but loc-addr %s ignored",
+                                  peer_buf, addr_buf);
                        return bsp;
                }
        }
@@ -1446,8 +1449,8 @@ struct bfd_session *bfd_key_lookup(struct bfd_key key)
                memset(bs.key.ifname, 0, sizeof(bs.key.ifname));
                bsp = hash_lookup(bfd_key_hash, &bs);
                if (bsp) {
-                       log_debug(" peer %s found, but ifp %s ignored",
-                                 peer_buf, key.ifname);
+                       zlog_debug(" peer %s found, but ifp %s ignored",
+                                  peer_buf, key.ifname);
                        return bsp;
                }
        }
@@ -1461,10 +1464,10 @@ struct bfd_session *bfd_key_lookup(struct bfd_key key)
 
                        inet_ntop(bs.key.family, &bs.key.local, addr_buf,
                                  sizeof(addr_buf));
-                       log_debug(" peer %s found, but ifp %s"
-                                 " and loc-addr %s ignored",
-                                 peer_buf, key.ifname,
-                                 addr_buf);
+                       zlog_debug(
+                               " peer %s found, but ifp %s"
+                               " and loc-addr %s ignored",
+                               peer_buf, key.ifname, addr_buf);
                        return bsp;
                }
        }
@@ -1482,8 +1485,10 @@ struct bfd_session *bfd_key_lookup(struct bfd_key key)
        /* change key */
        if (ctx.result) {
                bsp = ctx.result;
-               log_debug(" peer %s found, but ifp"
-                         " and/or loc-addr params ignored", peer_buf);
+               zlog_debug(
+                       " peer %s found, but ifp"
+                       " and/or loc-addr params ignored",
+                       peer_buf);
        }
        return bsp;
 }
@@ -1671,13 +1676,13 @@ void bfd_sessions_remove_manual(void)
  */
 static int bfd_vrf_new(struct vrf *vrf)
 {
-       log_debug("VRF Created: %s(%u)", vrf->name, vrf->vrf_id);
+       zlog_debug("VRF Created: %s(%u)", vrf->name, vrf->vrf_id);
        return 0;
 }
 
 static int bfd_vrf_delete(struct vrf *vrf)
 {
-       log_debug("VRF Deletion: %s(%u)", vrf->name, vrf->vrf_id);
+       zlog_debug("VRF Deletion: %s(%u)", vrf->name, vrf->vrf_id);
        return 0;
 }
 
@@ -1685,7 +1690,7 @@ static int bfd_vrf_update(struct vrf *vrf)
 {
        if (!vrf_is_enabled(vrf))
                return 0;
-       log_debug("VRF update: %s(%u)", vrf->name, vrf->vrf_id);
+       zlog_debug("VRF update: %s(%u)", vrf->name, vrf->vrf_id);
        /* a different name is given; update bfd list */
        bfdd_sessions_enable_vrf(vrf);
        return 0;
@@ -1702,7 +1707,7 @@ static int bfd_vrf_enable(struct vrf *vrf)
                vrf->info = (void *)bvrf;
        } else
                bvrf = vrf->info;
-       log_debug("VRF enable add %s id %u", vrf->name, vrf->vrf_id);
+       zlog_debug("VRF enable add %s id %u", vrf->name, vrf->vrf_id);
        if (vrf->vrf_id == VRF_DEFAULT ||
            vrf_get_backend() == VRF_BACKEND_NETNS) {
                if (!bvrf->bg_shop)
@@ -1758,7 +1763,7 @@ static int bfd_vrf_disable(struct vrf *vrf)
                bfdd_zclient_unregister(vrf->vrf_id);
        }
 
-       log_debug("VRF disable %s id %d", vrf->name, vrf->vrf_id);
+       zlog_debug("VRF disable %s id %d", vrf->name, vrf->vrf_id);
 
        /* Disable read/write poll triggering. */
        THREAD_OFF(bvrf->bg_ev[0]);
index 4f696a68bc424349e5147e9cae7f8d2cc8011d8f..a786bb71bc83837012447ad6f250e4c84499620f 100644 (file)
@@ -425,15 +425,9 @@ void pl_free(struct peer_label *pl);
 /*
  * logging - alias to zebra log
  */
-
-#define log_debug      zlog_debug
-#define log_info       zlog_info
-#define log_warning    zlog_warn
-#define log_error      zlog_err
-
-#define log_fatal(msg, ...)                                                    \
+#define zlog_fatal(msg, ...)                                                   \
        do {                                                                   \
-               zlog_err(msg, ## __VA_ARGS__);                                 \
+               zlog_err(msg, ##__VA_ARGS__);                                  \
                assert(!msg);                                                  \
                abort();                                                       \
        } while (0)
index f377c3a79af4e46ba79bc14511fa5ecb38ff8b98..79971fb3e25de10ba7ea1594ed6823a08125d322 100644 (file)
@@ -112,11 +112,11 @@ int _ptm_bfd_send(struct bfd_session *bs, uint16_t *port, const void *data,
 #endif /* HAVE_STRUCT_SOCKADDR_SA_LEN */
        rv = sendto(sd, data, datalen, 0, sa, slen);
        if (rv <= 0) {
-               log_debug("packet-send: send failure: %s", strerror(errno));
+               zlog_debug("packet-send: send failure: %s", strerror(errno));
                return -1;
        }
        if (rv < (ssize_t)datalen)
-               log_debug("packet-send: send partial: %s", strerror(errno));
+               zlog_debug("packet-send: send partial: %s", strerror(errno));
 
        return 0;
 }
@@ -190,13 +190,14 @@ static int ptm_bfd_process_echo_pkt(struct bfd_vrf_global *bvrf, int s)
        /* Your discriminator not zero - use it to find session */
        bfd = bfd_id_lookup(my_discr);
        if (bfd == NULL) {
-               log_debug("echo-packet: no matching session (id:%u)", my_discr);
+               zlog_debug("echo-packet: no matching session (id:%u)",
+                          my_discr);
                return -1;
        }
 
        if (!CHECK_FLAG(bfd->flags, BFD_SESS_FLAG_ECHO_ACTIVE)) {
-               log_debug("echo-packet: echo disabled [%s] (id:%u)",
-                         bs_to_string(bfd), my_discr);
+               zlog_debug("echo-packet: echo disabled [%s] (id:%u)",
+                          bs_to_string(bfd), my_discr);
                return -1;
        }
 
@@ -291,8 +292,7 @@ ssize_t bfd_recv_ipv4(int sd, uint8_t *msgbuf, size_t msgbuflen, uint8_t *ttl,
        mlen = recvmsg(sd, &msghdr, MSG_DONTWAIT);
        if (mlen == -1) {
                if (errno != EAGAIN)
-                       log_error("ipv4-recv: recv failed: %s",
-                                 strerror(errno));
+                       zlog_err("ipv4-recv: recv failed: %s", strerror(errno));
 
                return -1;
        }
@@ -313,7 +313,8 @@ ssize_t bfd_recv_ipv4(int sd, uint8_t *msgbuf, size_t msgbuflen, uint8_t *ttl,
 
                        memcpy(&ttlval, CMSG_DATA(cm), sizeof(ttlval));
                        if (ttlval > 255) {
-                               log_debug("ipv4-recv: invalid TTL: %u", ttlval);
+                               zlog_debug("ipv4-recv: invalid TTL: %u",
+                                          ttlval);
                                return -1;
                        }
                        *ttl = ttlval;
@@ -402,8 +403,7 @@ ssize_t bfd_recv_ipv6(int sd, uint8_t *msgbuf, size_t msgbuflen, uint8_t *ttl,
        mlen = recvmsg(sd, &msghdr6, MSG_DONTWAIT);
        if (mlen == -1) {
                if (errno != EAGAIN)
-                       log_error("ipv6-recv: recv failed: %s",
-                                 strerror(errno));
+                       zlog_err("ipv6-recv: recv failed: %s", strerror(errno));
 
                return -1;
        }
@@ -420,7 +420,8 @@ ssize_t bfd_recv_ipv6(int sd, uint8_t *msgbuf, size_t msgbuflen, uint8_t *ttl,
                if (cm->cmsg_type == IPV6_HOPLIMIT) {
                        memcpy(&ttlval, CMSG_DATA(cm), sizeof(ttlval));
                        if (ttlval > 255) {
-                               log_debug("ipv6-recv: invalid TTL: %u", ttlval);
+                               zlog_debug("ipv6-recv: invalid TTL: %u",
+                                          ttlval);
                                return -1;
                        }
 
@@ -511,8 +512,8 @@ static void cp_debug(bool mhop, struct sockaddr_any *peer,
        vsnprintf(buf, sizeof(buf), fmt, vl);
        va_end(vl);
 
-       log_debug("control-packet: %s [mhop:%s%s%s%s%s]", buf,
-                 mhop ? "yes" : "no", peerstr, localstr, portstr, vrfstr);
+       zlog_debug("control-packet: %s [mhop:%s%s%s%s%s]", buf,
+                  mhop ? "yes" : "no", peerstr, localstr, portstr, vrfstr);
 }
 
 int bfd_recv_cb(struct thread *t)
@@ -796,11 +797,12 @@ int bp_udp_send(int sd, uint8_t ttl, uint8_t *data, size_t datalen,
        /* Send echo back. */
        wlen = sendmsg(sd, &msg, 0);
        if (wlen <= 0) {
-               log_debug("udp-send: loopback failure: (%d) %s", errno, strerror(errno));
+               zlog_debug("udp-send: loopback failure: (%d) %s", errno,
+                          strerror(errno));
                return -1;
        } else if (wlen < (ssize_t)datalen) {
-               log_debug("udp-send: partial send: %zd expected %zu", wlen,
-                         datalen);
+               zlog_debug("udp-send: partial send: %zd expected %zu", wlen,
+                          datalen);
                return -1;
        }
 
@@ -821,8 +823,8 @@ int bp_set_ttl(int sd, uint8_t value)
        int ttl = value;
 
        if (setsockopt(sd, IPPROTO_IP, IP_TTL, &ttl, sizeof(ttl)) == -1) {
-               log_warning("set-ttl: setsockopt(IP_TTL, %d): %s", value,
-                           strerror(errno));
+               zlog_warn("set-ttl: setsockopt(IP_TTL, %d): %s", value,
+                         strerror(errno));
                return -1;
        }
 
@@ -834,8 +836,8 @@ int bp_set_tos(int sd, uint8_t value)
        int tos = value;
 
        if (setsockopt(sd, IPPROTO_IP, IP_TOS, &tos, sizeof(tos)) == -1) {
-               log_warning("set-tos: setsockopt(IP_TOS, %d): %s", value,
-                           strerror(errno));
+               zlog_warn("set-tos: setsockopt(IP_TOS, %d): %s", value,
+                         strerror(errno));
                return -1;
        }
 
@@ -847,12 +849,12 @@ static void bp_set_ipopts(int sd)
        int rcvttl = BFD_RCV_TTL_VAL;
 
        if (bp_set_ttl(sd, BFD_TTL_VAL) != 0)
-               log_fatal("set-ipopts: TTL configuration failed");
+               zlog_fatal("set-ipopts: TTL configuration failed");
 
        if (setsockopt(sd, IPPROTO_IP, IP_RECVTTL, &rcvttl, sizeof(rcvttl))
            == -1)
-               log_fatal("set-ipopts: setsockopt(IP_RECVTTL, %d): %s", rcvttl,
-                         strerror(errno));
+               zlog_fatal("set-ipopts: setsockopt(IP_RECVTTL, %d): %s", rcvttl,
+                          strerror(errno));
 
 #ifdef BFD_LINUX
        int pktinfo = BFD_PKT_INFO_VAL;
@@ -860,21 +862,21 @@ static void bp_set_ipopts(int sd)
        /* Figure out address and interface to do the peer matching. */
        if (setsockopt(sd, IPPROTO_IP, IP_PKTINFO, &pktinfo, sizeof(pktinfo))
            == -1)
-               log_fatal("set-ipopts: setsockopt(IP_PKTINFO, %d): %s", pktinfo,
-                         strerror(errno));
+               zlog_fatal("set-ipopts: setsockopt(IP_PKTINFO, %d): %s",
+                          pktinfo, strerror(errno));
 #endif /* BFD_LINUX */
 #ifdef BFD_BSD
        int yes = 1;
 
        /* Find out our address for peer matching. */
        if (setsockopt(sd, IPPROTO_IP, IP_RECVDSTADDR, &yes, sizeof(yes)) == -1)
-               log_fatal("set-ipopts: setsockopt(IP_RECVDSTADDR, %d): %s", yes,
-                         strerror(errno));
+               zlog_fatal("set-ipopts: setsockopt(IP_RECVDSTADDR, %d): %s",
+                          yes, strerror(errno));
 
        /* Find out interface where the packet came in. */
        if (setsockopt_ifindex(AF_INET, sd, yes) == -1)
-               log_fatal("set-ipopts: setsockopt_ipv4_ifindex(%d): %s", yes,
-                         strerror(errno));
+               zlog_fatal("set-ipopts: setsockopt_ipv4_ifindex(%d): %s", yes,
+                          strerror(errno));
 #endif /* BFD_BSD */
 }
 
@@ -887,7 +889,7 @@ static void bp_bind_ip(int sd, uint16_t port)
        sin.sin_addr.s_addr = htonl(INADDR_ANY);
        sin.sin_port = htons(port);
        if (bind(sd, (struct sockaddr *)&sin, sizeof(sin)) == -1)
-               log_fatal("bind-ip: bind: %s", strerror(errno));
+               zlog_fatal("bind-ip: bind: %s", strerror(errno));
 }
 
 int bp_udp_shop(const struct vrf *vrf)
@@ -899,7 +901,7 @@ int bp_udp_shop(const struct vrf *vrf)
                                vrf->name);
        }
        if (sd == -1)
-               log_fatal("udp-shop: socket: %s", strerror(errno));
+               zlog_fatal("udp-shop: socket: %s", strerror(errno));
 
        bp_set_ipopts(sd);
        bp_bind_ip(sd, BFD_DEFDESTPORT);
@@ -915,7 +917,7 @@ int bp_udp_mhop(const struct vrf *vrf)
                                vrf->name);
        }
        if (sd == -1)
-               log_fatal("udp-mhop: socket: %s", strerror(errno));
+               zlog_fatal("udp-mhop: socket: %s", strerror(errno));
 
        bp_set_ipopts(sd);
        bp_bind_ip(sd, BFD_DEF_MHOP_DEST_PORT);
@@ -941,8 +943,8 @@ int bp_peer_socket(const struct bfd_session *bs)
                                bs->vrf->vrf_id, device_to_bind);
        }
        if (sd == -1) {
-               log_error("ipv4-new: failed to create socket: %s",
-                         strerror(errno));
+               zlog_err("ipv4-new: failed to create socket: %s",
+                        strerror(errno));
                return -1;
        }
 
@@ -972,8 +974,8 @@ int bp_peer_socket(const struct bfd_session *bs)
        do {
                if ((++pcount) > (BFD_SRCPORTMAX - BFD_SRCPORTINIT)) {
                        /* Searched all ports, none available */
-                       log_error("ipv4-new: failed to bind port: %s",
-                                 strerror(errno));
+                       zlog_err("ipv4-new: failed to bind port: %s",
+                                strerror(errno));
                        close(sd);
                        return -1;
                }
@@ -1008,8 +1010,8 @@ int bp_peer_socketv6(const struct bfd_session *bs)
                                bs->vrf->vrf_id, device_to_bind);
        }
        if (sd == -1) {
-               log_error("ipv6-new: failed to create socket: %s",
-                         strerror(errno));
+               zlog_err("ipv6-new: failed to create socket: %s",
+                        strerror(errno));
                return -1;
        }
 
@@ -1039,8 +1041,8 @@ int bp_peer_socketv6(const struct bfd_session *bs)
        do {
                if ((++pcount) > (BFD_SRCPORTMAX - BFD_SRCPORTINIT)) {
                        /* Searched all ports, none available */
-                       log_error("ipv6-new: failed to bind port: %s",
-                                 strerror(errno));
+                       zlog_err("ipv6-new: failed to bind port: %s",
+                                strerror(errno));
                        close(sd);
                        return -1;
                }
@@ -1058,8 +1060,8 @@ int bp_set_ttlv6(int sd, uint8_t value)
 
        if (setsockopt(sd, IPPROTO_IPV6, IPV6_UNICAST_HOPS, &ttl, sizeof(ttl))
            == -1) {
-               log_warning("set-ttlv6: setsockopt(IPV6_UNICAST_HOPS, %d): %s",
-                           value, strerror(errno));
+               zlog_warn("set-ttlv6: setsockopt(IPV6_UNICAST_HOPS, %d): %s",
+                         value, strerror(errno));
                return -1;
        }
 
@@ -1072,8 +1074,8 @@ int bp_set_tosv6(int sd, uint8_t value)
 
        if (setsockopt(sd, IPPROTO_IPV6, IPV6_TCLASS, &tos, sizeof(tos))
            == -1) {
-               log_warning("set-tosv6: setsockopt(IPV6_TCLASS, %d): %s", value,
-                           strerror(errno));
+               zlog_warn("set-tosv6: setsockopt(IPV6_TCLASS, %d): %s", value,
+                         strerror(errno));
                return -1;
        }
 
@@ -1086,22 +1088,23 @@ static void bp_set_ipv6opts(int sd)
        int ipv6_only = BFD_IPV6_ONLY_VAL;
 
        if (bp_set_ttlv6(sd, BFD_TTL_VAL) == -1)
-               log_fatal("set-ipv6opts: setsockopt(IPV6_UNICAST_HOPS, %d): %s",
-                         BFD_TTL_VAL, strerror(errno));
+               zlog_fatal(
+                       "set-ipv6opts: setsockopt(IPV6_UNICAST_HOPS, %d): %s",
+                       BFD_TTL_VAL, strerror(errno));
 
        if (setsockopt_ipv6_hoplimit(sd, BFD_RCV_TTL_VAL) == -1)
-               log_fatal("set-ipv6opts: setsockopt(IPV6_HOPLIMIT, %d): %s",
-                         BFD_RCV_TTL_VAL, strerror(errno));
+               zlog_fatal("set-ipv6opts: setsockopt(IPV6_HOPLIMIT, %d): %s",
+                          BFD_RCV_TTL_VAL, strerror(errno));
 
        if (setsockopt_ipv6_pktinfo(sd, ipv6_pktinfo) == -1)
-               log_fatal("set-ipv6opts: setsockopt(IPV6_PKTINFO, %d): %s",
-                         ipv6_pktinfo, strerror(errno));
+               zlog_fatal("set-ipv6opts: setsockopt(IPV6_PKTINFO, %d): %s",
+                          ipv6_pktinfo, strerror(errno));
 
        if (setsockopt(sd, IPPROTO_IPV6, IPV6_V6ONLY, &ipv6_only,
                       sizeof(ipv6_only))
            == -1)
-               log_fatal("set-ipv6opts: setsockopt(IPV6_V6ONLY, %d): %s",
-                         ipv6_only, strerror(errno));
+               zlog_fatal("set-ipv6opts: setsockopt(IPV6_V6ONLY, %d): %s",
+                          ipv6_only, strerror(errno));
 }
 
 static void bp_bind_ipv6(int sd, uint16_t port)
@@ -1116,7 +1119,7 @@ static void bp_bind_ipv6(int sd, uint16_t port)
        sin6.sin6_len = sizeof(sin6);
 #endif /* HAVE_STRUCT_SOCKADDR_SA_LEN */
        if (bind(sd, (struct sockaddr *)&sin6, sizeof(sin6)) == -1)
-               log_fatal("bind-ipv6: bind: %s", strerror(errno));
+               zlog_fatal("bind-ipv6: bind: %s", strerror(errno));
 }
 
 int bp_udp6_shop(const struct vrf *vrf)
@@ -1128,7 +1131,7 @@ int bp_udp6_shop(const struct vrf *vrf)
                                vrf->name);
        }
        if (sd == -1)
-               log_fatal("udp6-shop: socket: %s", strerror(errno));
+               zlog_fatal("udp6-shop: socket: %s", strerror(errno));
 
        bp_set_ipv6opts(sd);
        bp_bind_ipv6(sd, BFD_DEFDESTPORT);
@@ -1145,7 +1148,7 @@ int bp_udp6_mhop(const struct vrf *vrf)
                                vrf->name);
        }
        if (sd == -1)
-               log_fatal("udp6-mhop: socket: %s", strerror(errno));
+               zlog_fatal("udp6-mhop: socket: %s", strerror(errno));
 
        bp_set_ipv6opts(sd);
        bp_bind_ipv6(sd, BFD_DEF_MHOP_DEST_PORT);
@@ -1161,7 +1164,7 @@ int bp_echo_socket(const struct vrf *vrf)
                s = vrf_socket(AF_INET, SOCK_DGRAM, 0, vrf->vrf_id, vrf->name);
        }
        if (s == -1)
-               log_fatal("echo-socket: socket: %s", strerror(errno));
+               zlog_fatal("echo-socket: socket: %s", strerror(errno));
 
        bp_set_ipopts(s);
        bp_bind_ip(s, BFD_DEF_ECHO_PORT);
@@ -1177,7 +1180,7 @@ int bp_echov6_socket(const struct vrf *vrf)
                s = vrf_socket(AF_INET6, SOCK_DGRAM, 0, vrf->vrf_id, vrf->name);
        }
        if (s == -1)
-               log_fatal("echov6-socket: socket: %s", strerror(errno));
+               zlog_fatal("echov6-socket: socket: %s", strerror(errno));
 
        bp_set_ipv6opts(s);
        bp_bind_ipv6(s, BFD_DEF_ECHO_PORT);
index 69f268ab016e811207c82b322145ea1945db5220..bed6ccd1421915a4f7032a3e2b9f5c6c775a077e 100644 (file)
@@ -49,8 +49,8 @@ void socket_close(int *s)
                return;
 
        if (close(*s) != 0)
-               log_error("%s: close(%d): (%d) %s", __func__, *s, errno,
-                         strerror(errno));
+               zlog_err("%s: close(%d): (%d) %s", __func__, *s, errno,
+                        strerror(errno));
 
        *s = -1;
 }
index a4f2e28b5cec05bf7042279aa89386c3a95dd78a..74ffd6d625b0a353cac3fc78e02c9c9190b5ce03 100644 (file)
@@ -305,7 +305,7 @@ static void _display_peer_json_iter(struct hash_bucket *hb, void *arg)
 
        jon = __display_peer_json(bs);
        if (jon == NULL) {
-               log_warning("%s: not enough memory", __func__);
+               zlog_warn("%s: not enough memory", __func__);
                return;
        }
 
@@ -415,7 +415,7 @@ static void _display_peer_counter_json_iter(struct hash_bucket *hb, void *arg)
 
        jon = __display_peer_counters_json(bs);
        if (jon == NULL) {
-               log_warning("%s: not enough memory", __func__);
+               zlog_warn("%s: not enough memory", __func__);
                return;
        }
 
index 9c2d621d39de7c18a8cf4e6e96b7d00589978a8b..b71670f012f09da795a59422d486bfe5b01e6c86 100644 (file)
@@ -92,8 +92,8 @@ static int parse_config_json(struct json_object *jo, bpc_handle h, void *arg)
                        error += parse_list(jo_val, PLT_LABEL, h, arg);
                } else {
                        sval = json_object_get_string(jo_val);
-                       log_warning("%s:%d invalid configuration: %s", __func__,
-                                   __LINE__, sval);
+                       zlog_warn("%s:%d invalid configuration: %s", __func__,
+                                 __LINE__, sval);
                        error++;
                }
        }
@@ -139,15 +139,15 @@ static int parse_list(struct json_object *jo, enum peer_list_type plt,
 
                switch (plt) {
                case PLT_IPV4:
-                       log_debug("ipv4 peers %d:", allen);
+                       zlog_debug("ipv4 peers %d:", allen);
                        bpc.bpc_ipv4 = true;
                        break;
                case PLT_IPV6:
-                       log_debug("ipv6 peers %d:", allen);
+                       zlog_debug("ipv6 peers %d:", allen);
                        bpc.bpc_ipv4 = false;
                        break;
                case PLT_LABEL:
-                       log_debug("label peers %d:", allen);
+                       zlog_debug("label peers %d:", allen);
                        if (parse_peer_label_config(jo_val, &bpc) != 0) {
                                error++;
                                continue;
@@ -156,8 +156,8 @@ static int parse_list(struct json_object *jo, enum peer_list_type plt,
 
                default:
                        error++;
-                       log_error("%s:%d: unsupported peer type", __func__,
-                                 __LINE__);
+                       zlog_err("%s:%d: unsupported peer type", __func__,
+                                __LINE__);
                        break;
                }
 
@@ -178,7 +178,7 @@ static int parse_peer_config(struct json_object *jo, struct bfd_peer_cfg *bpc)
        int family_type = (bpc->bpc_ipv4) ? AF_INET : AF_INET6;
        int error = 0;
 
-       log_debug("        peer: %s", bpc->bpc_ipv4 ? "ipv4" : "ipv6");
+       zlog_debug("        peer: %s", bpc->bpc_ipv4 ? "ipv4" : "ipv6");
 
        JSON_FOREACH (jo, joi, join) {
                key = json_object_iter_peek_name(&joi);
@@ -186,41 +186,41 @@ static int parse_peer_config(struct json_object *jo, struct bfd_peer_cfg *bpc)
 
                if (strcmp(key, "multihop") == 0) {
                        bpc->bpc_mhop = json_object_get_boolean(jo_val);
-                       log_debug("        multihop: %s",
-                                 bpc->bpc_mhop ? "true" : "false");
+                       zlog_debug("        multihop: %s",
+                                  bpc->bpc_mhop ? "true" : "false");
                } else if (strcmp(key, "peer-address") == 0) {
                        sval = json_object_get_string(jo_val);
                        if (strtosa(sval, &bpc->bpc_peer) != 0
                            || bpc->bpc_peer.sa_sin.sin_family != family_type) {
-                               log_info(
+                               zlog_debug(
                                        "%s:%d failed to parse peer-address '%s'",
                                        __func__, __LINE__, sval);
                                error++;
                        }
-                       log_debug("        peer-address: %s", sval);
+                       zlog_debug("        peer-address: %s", sval);
                } else if (strcmp(key, "local-address") == 0) {
                        sval = json_object_get_string(jo_val);
                        if (strtosa(sval, &bpc->bpc_local) != 0
                            || bpc->bpc_local.sa_sin.sin_family
                                       != family_type) {
-                               log_info(
+                               zlog_debug(
                                        "%s:%d failed to parse local-address '%s'",
                                        __func__, __LINE__, sval);
                                error++;
                        }
-                       log_debug("        local-address: %s", sval);
+                       zlog_debug("        local-address: %s", sval);
                } else if (strcmp(key, "local-interface") == 0) {
                        bpc->bpc_has_localif = true;
                        sval = json_object_get_string(jo_val);
                        if (strlcpy(bpc->bpc_localif, sval,
                                    sizeof(bpc->bpc_localif))
                            > sizeof(bpc->bpc_localif)) {
-                               log_debug(
+                               zlog_debug(
                                        "        local-interface: %s (truncated)",
                                        sval);
                                error++;
                        } else {
-                               log_debug("        local-interface: %s", sval);
+                               zlog_debug("        local-interface: %s", sval);
                        }
                } else if (strcmp(key, "vrf-name") == 0) {
                        bpc->bpc_has_vrfname = true;
@@ -228,67 +228,68 @@ static int parse_peer_config(struct json_object *jo, struct bfd_peer_cfg *bpc)
                        if (strlcpy(bpc->bpc_vrfname, sval,
                                    sizeof(bpc->bpc_vrfname))
                            > sizeof(bpc->bpc_vrfname)) {
-                               log_debug("        vrf-name: %s (truncated)",
-                                         sval);
+                               zlog_debug("        vrf-name: %s (truncated)",
+                                          sval);
                                error++;
                        } else {
-                               log_debug("        vrf-name: %s", sval);
+                               zlog_debug("        vrf-name: %s", sval);
                        }
                } else if (strcmp(key, "detect-multiplier") == 0) {
                        bpc->bpc_detectmultiplier =
                                json_object_get_int64(jo_val);
                        bpc->bpc_has_detectmultiplier = true;
-                       log_debug("        detect-multiplier: %u",
-                                 bpc->bpc_detectmultiplier);
+                       zlog_debug("        detect-multiplier: %u",
+                                  bpc->bpc_detectmultiplier);
                } else if (strcmp(key, "receive-interval") == 0) {
                        bpc->bpc_recvinterval = json_object_get_int64(jo_val);
                        bpc->bpc_has_recvinterval = true;
-                       log_debug("        receive-interval: %" PRIu64,
-                                 bpc->bpc_recvinterval);
+                       zlog_debug("        receive-interval: %" PRIu64,
+                                  bpc->bpc_recvinterval);
                } else if (strcmp(key, "transmit-interval") == 0) {
                        bpc->bpc_txinterval = json_object_get_int64(jo_val);
                        bpc->bpc_has_txinterval = true;
-                       log_debug("        transmit-interval: %" PRIu64,
-                                 bpc->bpc_txinterval);
+                       zlog_debug("        transmit-interval: %" PRIu64,
+                                  bpc->bpc_txinterval);
                } else if (strcmp(key, "echo-interval") == 0) {
                        bpc->bpc_echointerval = json_object_get_int64(jo_val);
                        bpc->bpc_has_echointerval = true;
-                       log_debug("        echo-interval: %" PRIu64,
-                                 bpc->bpc_echointerval);
+                       zlog_debug("        echo-interval: %" PRIu64,
+                                  bpc->bpc_echointerval);
                } else if (strcmp(key, "create-only") == 0) {
                        bpc->bpc_createonly = json_object_get_boolean(jo_val);
-                       log_debug("        create-only: %s",
-                                 bpc->bpc_createonly ? "true" : "false");
+                       zlog_debug("        create-only: %s",
+                                  bpc->bpc_createonly ? "true" : "false");
                } else if (strcmp(key, "shutdown") == 0) {
                        bpc->bpc_shutdown = json_object_get_boolean(jo_val);
-                       log_debug("        shutdown: %s",
-                                 bpc->bpc_shutdown ? "true" : "false");
+                       zlog_debug("        shutdown: %s",
+                                  bpc->bpc_shutdown ? "true" : "false");
                } else if (strcmp(key, "echo-mode") == 0) {
                        bpc->bpc_echo = json_object_get_boolean(jo_val);
-                       log_debug("        echo-mode: %s",
-                                 bpc->bpc_echo ? "true" : "false");
+                       zlog_debug("        echo-mode: %s",
+                                  bpc->bpc_echo ? "true" : "false");
                } else if (strcmp(key, "label") == 0) {
                        bpc->bpc_has_label = true;
                        sval = json_object_get_string(jo_val);
                        if (strlcpy(bpc->bpc_label, sval,
                                    sizeof(bpc->bpc_label))
                            > sizeof(bpc->bpc_label)) {
-                               log_debug("        label: %s (truncated)",
-                                         sval);
+                               zlog_debug("        label: %s (truncated)",
+                                          sval);
                                error++;
                        } else {
-                               log_debug("        label: %s", sval);
+                               zlog_debug("        label: %s", sval);
                        }
                } else {
                        sval = json_object_get_string(jo_val);
-                       log_warning("%s:%d invalid configuration: '%s: %s'",
-                                   __func__, __LINE__, key, sval);
+                       zlog_warn("%s:%d invalid configuration: '%s: %s'",
+                                 __func__, __LINE__, key, sval);
                        error++;
                }
        }
 
        if (bpc->bpc_peer.sa_sin.sin_family == 0) {
-               log_debug("%s:%d no peer address provided", __func__, __LINE__);
+               zlog_debug("%s:%d no peer address provided", __func__,
+                          __LINE__);
                error++;
        }
 
@@ -312,7 +313,7 @@ static int parse_peer_label_config(struct json_object *jo,
        if (pl == NULL)
                return 1;
 
-       log_debug("        peer-label: %s", sval);
+       zlog_debug("        peer-label: %s", sval);
 
        /* Translate the label into BFD address keys. */
        bs_to_bpc(pl->pl_bs, bpc);
@@ -573,7 +574,7 @@ struct peer_label *pl_new(const char *label, struct bfd_session *bs)
 
        if (strlcpy(pl->pl_label, label, sizeof(pl->pl_label))
            > sizeof(pl->pl_label))
-               log_warning("%s:%d: label was truncated", __func__, __LINE__);
+               zlog_warn("%s:%d: label was truncated", __func__, __LINE__);
 
        pl->pl_bs = bs;
        bs->pl = pl;
index ae6f5a3e793165aea49e13a592d8781e4a32c720..4adc54a64a25011ab49358b59bd4b4320a19e427 100644 (file)
@@ -86,13 +86,13 @@ static int sock_set_nonblock(int fd)
 
        flags = fcntl(fd, F_GETFL, 0);
        if (flags == -1) {
-               log_warning("%s: fcntl F_GETFL: %s", __func__, strerror(errno));
+               zlog_warn("%s: fcntl F_GETFL: %s", __func__, strerror(errno));
                return -1;
        }
 
        flags |= O_NONBLOCK;
        if (fcntl(fd, F_SETFL, flags) == -1) {
-               log_warning("%s: fcntl F_SETFL: %s", __func__, strerror(errno));
+               zlog_warn("%s: fcntl F_SETFL: %s", __func__, strerror(errno));
                return -1;
        }
 
@@ -116,20 +116,20 @@ int control_init(const char *path)
 
        sd = socket(AF_UNIX, SOCK_STREAM, PF_UNSPEC);
        if (sd == -1) {
-               log_error("%s: socket: %s", __func__, strerror(errno));
+               zlog_err("%s: socket: %s", __func__, strerror(errno));
                return -1;
        }
 
        umval = umask(0);
        if (bind(sd, (struct sockaddr *)&sun_, sizeof(sun_)) == -1) {
-               log_error("%s: bind: %s", __func__, strerror(errno));
+               zlog_err("%s: bind: %s", __func__, strerror(errno));
                close(sd);
                return -1;
        }
        umask(umval);
 
        if (listen(sd, SOMAXCONN) == -1) {
-               log_error("%s: listen: %s", __func__, strerror(errno));
+               zlog_err("%s: listen: %s", __func__, strerror(errno));
                close(sd);
                return -1;
        }
@@ -164,7 +164,7 @@ int control_accept(struct thread *t)
 
        csock = accept(sd, NULL, 0);
        if (csock == -1) {
-               log_warning("%s: accept: %s", __func__, strerror(errno));
+               zlog_warn("%s: accept: %s", __func__, strerror(errno));
                return 0;
        }
 
@@ -440,7 +440,7 @@ static int control_read(struct thread *t)
                if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR)
                        goto schedule_next_read;
 
-               log_warning("%s: read: %s", __func__, strerror(errno));
+               zlog_warn("%s: read: %s", __func__, strerror(errno));
                control_free(bcs);
                return 0;
        }
@@ -448,15 +448,15 @@ static int control_read(struct thread *t)
        /* Validate header fields. */
        plen = ntohl(bcm.bcm_length);
        if (plen < 2) {
-               log_debug("%s: client closed due small message length: %d",
-                         __func__, bcm.bcm_length);
+               zlog_debug("%s: client closed due small message length: %d",
+                          __func__, bcm.bcm_length);
                control_free(bcs);
                return 0;
        }
 
        if (bcm.bcm_ver != BMV_VERSION_1) {
-               log_debug("%s: client closed due bad version: %d", __func__,
-                         bcm.bcm_ver);
+               zlog_debug("%s: client closed due bad version: %d", __func__,
+                          bcm.bcm_ver);
                control_free(bcs);
                return 0;
        }
@@ -470,8 +470,8 @@ static int control_read(struct thread *t)
        bcb->bcb_buf = XMALLOC(MTYPE_BFDD_NOTIFICATION,
                               sizeof(bcm) + bcb->bcb_left + 1);
        if (bcb->bcb_buf == NULL) {
-               log_warning("%s: not enough memory for message size: %zu",
-                           __func__, bcb->bcb_left);
+               zlog_warn("%s: not enough memory for message size: %zu",
+                         __func__, bcb->bcb_left);
                control_free(bcs);
                return 0;
        }
@@ -492,7 +492,7 @@ skip_header:
                if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR)
                        goto schedule_next_read;
 
-               log_warning("%s: read: %s", __func__, strerror(errno));
+               zlog_warn("%s: read: %s", __func__, strerror(errno));
                control_free(bcs);
                return 0;
        }
@@ -521,8 +521,8 @@ skip_header:
                break;
 
        default:
-               log_debug("%s: unhandled message type: %d", __func__,
-                         bcb->bcb_bcm->bcm_type);
+               zlog_debug("%s: unhandled message type: %d", __func__,
+                          bcb->bcb_bcm->bcm_type);
                control_response(bcs, bcb->bcb_bcm->bcm_id, BCM_RESPONSE_ERROR,
                                 "invalid message type");
                break;
@@ -559,7 +559,7 @@ static int control_write(struct thread *t)
                        return 0;
                }
 
-               log_warning("%s: write: %s", __func__, strerror(errno));
+               zlog_warn("%s: write: %s", __func__, strerror(errno));
                control_free(bcs);
                return 0;
        }
@@ -723,8 +723,8 @@ static void control_response(struct bfd_control_socket *bcs, uint16_t id,
        /* Generate JSON response. */
        jsonstr = config_response(status, error);
        if (jsonstr == NULL) {
-               log_warning("%s: config_response: failed to get JSON str",
-                           __func__);
+               zlog_warn("%s: config_response: failed to get JSON str",
+                         __func__);
                return;
        }
 
@@ -753,8 +753,8 @@ static void _control_notify(struct bfd_control_socket *bcs,
        /* Generate JSON response. */
        jsonstr = config_notify(bs);
        if (jsonstr == NULL) {
-               log_warning("%s: config_notify: failed to get JSON str",
-                           __func__);
+               zlog_warn("%s: config_notify: failed to get JSON str",
+                         __func__);
                return;
        }
 
@@ -816,8 +816,8 @@ static void _control_notify_config(struct bfd_control_socket *bcs,
        /* Generate JSON response. */
        jsonstr = config_notify_config(op, bs);
        if (jsonstr == NULL) {
-               log_warning("%s: config_notify_config: failed to get JSON str",
-                           __func__);
+               zlog_warn("%s: config_notify_config: failed to get JSON str",
+                         __func__);
                return;
        }
 
index c03f384c72e811fbd43a0c04f51d9503174f34cf..686f39cc0a50e22a6604a3a1f489307800d60068 100644 (file)
@@ -49,7 +49,8 @@ void bfd_recvtimer_update(struct bfd_session *bs)
 
        tv_normalize(&tv);
 #ifdef BFD_EVENT_DEBUG
-       log_debug("%s: sec = %ld, usec = %ld", __func__, tv.tv_sec, tv.tv_usec);
+       zlog_debug("%s: sec = %ld, usec = %ld", __func__, tv.tv_sec,
+                  tv.tv_usec);
 #endif /* BFD_EVENT_DEBUG */
 
        thread_add_timer_tv(master, bfd_recvtimer_cb, bs, &tv,
@@ -70,7 +71,8 @@ void bfd_echo_recvtimer_update(struct bfd_session *bs)
 
        tv_normalize(&tv);
 #ifdef BFD_EVENT_DEBUG
-       log_debug("%s: sec = %ld, usec = %ld", __func__, tv.tv_sec, tv.tv_usec);
+       zlog_debug("%s: sec = %ld, usec = %ld", __func__, tv.tv_sec,
+                  tv.tv_usec);
 #endif /* BFD_EVENT_DEBUG */
 
        thread_add_timer_tv(master, bfd_echo_recvtimer_cb, bs, &tv,
@@ -91,7 +93,8 @@ void bfd_xmttimer_update(struct bfd_session *bs, uint64_t jitter)
 
        tv_normalize(&tv);
 #ifdef BFD_EVENT_DEBUG
-       log_debug("%s: sec = %ld, usec = %ld", __func__, tv.tv_sec, tv.tv_usec);
+       zlog_debug("%s: sec = %ld, usec = %ld", __func__, tv.tv_sec,
+                  tv.tv_usec);
 #endif /* BFD_EVENT_DEBUG */
 
        thread_add_timer_tv(master, bfd_xmt_cb, bs, &tv, &bs->xmttimer_ev);
@@ -111,7 +114,8 @@ void bfd_echo_xmttimer_update(struct bfd_session *bs, uint64_t jitter)
 
        tv_normalize(&tv);
 #ifdef BFD_EVENT_DEBUG
-       log_debug("%s: sec = %ld, usec = %ld", __func__, tv.tv_sec, tv.tv_usec);
+       zlog_debug("%s: sec = %ld, usec = %ld", __func__, tv.tv_sec,
+                  tv.tv_usec);
 #endif /* BFD_EVENT_DEBUG */
 
        thread_add_timer_tv(master, bfd_echo_xmt_cb, bs, &tv,
index ab014f1576a5bc93b3910a1c2c7e98a3215152d5..eae2158acbd3a2b3f4d68c6703ac4a3bc3d7d1b7 100644 (file)
@@ -120,9 +120,9 @@ static void debug_printbpc(const char *func, unsigned int line,
 
        sprintf(cbit_str, "CB %x", bpc->bpc_cbit);
 
-       log_debug("%s:%d: %s %s%s%s%s%s%s %s", func, line,
-                 bpc->bpc_mhop ? "multi-hop" : "single-hop", addr[0], addr[1],
-                 addr[2], timers[0], timers[1], timers[2], cbit_str);
+       zlog_debug("%s:%d: %s %s%s%s%s%s%s %s", func, line,
+                  bpc->bpc_mhop ? "multi-hop" : "single-hop", addr[0], addr[1],
+                  addr[2], timers[0], timers[1], timers[2], cbit_str);
 }
 
 #define DEBUG_PRINTBPC(bpc) debug_printbpc(__FILE__, __LINE__, (bpc))
@@ -260,7 +260,7 @@ static void _ptm_msg_read_address(struct stream *msg, struct sockaddr_any *sa)
                return;
 
        default:
-               log_warning("ptm-read-address: invalid family: %d", family);
+               zlog_warn("ptm-read-address: invalid family: %d", family);
                break;
        }
 
@@ -316,7 +316,7 @@ static int _ptm_msg_read(struct stream *msg, int command, vrf_id_t vrf_id,
 
        *pc = pc_new(pid);
        if (*pc == NULL) {
-               log_debug("ptm-read: failed to allocate memory");
+               zlog_debug("ptm-read: failed to allocate memory");
                return -1;
        }
 
@@ -358,7 +358,7 @@ static int _ptm_msg_read(struct stream *msg, int command, vrf_id_t vrf_id,
                 */
                STREAM_GETC(msg, ifnamelen);
                if (ifnamelen >= sizeof(bpc->bpc_localif)) {
-                       log_error("ptm-read: interface name is too big");
+                       zlog_err("ptm-read: interface name is too big");
                        return -1;
                }
 
@@ -376,7 +376,8 @@ static int _ptm_msg_read(struct stream *msg, int command, vrf_id_t vrf_id,
                        bpc->bpc_has_vrfname = true;
                        strlcpy(bpc->bpc_vrfname, vrf->name, sizeof(bpc->bpc_vrfname));
                } else {
-                       log_error("ptm-read: vrf id %u could not be identified", vrf_id);
+                       zlog_err("ptm-read: vrf id %u could not be identified",
+                                vrf_id);
                        return -1;
                }
        } else {
@@ -390,7 +391,7 @@ static int _ptm_msg_read(struct stream *msg, int command, vrf_id_t vrf_id,
        if (bpc->bpc_local.sa_sin.sin_family != 0
            && (bpc->bpc_local.sa_sin.sin_family
                != bpc->bpc_peer.sa_sin.sin_family)) {
-               log_warning("ptm-read: peer family doesn't match local type");
+               zlog_warn("ptm-read: peer family doesn't match local type");
                return -1;
        }
 
@@ -418,7 +419,8 @@ static void bfdd_dest_register(struct stream *msg, vrf_id_t vrf_id)
        if (bs == NULL) {
                bs = ptm_bfd_sess_new(&bpc);
                if (bs == NULL) {
-                       log_debug("ptm-add-dest: failed to create BFD session");
+                       zlog_debug(
+                               "ptm-add-dest: failed to create BFD session");
                        return;
                }
        } else {
@@ -431,7 +433,7 @@ static void bfdd_dest_register(struct stream *msg, vrf_id_t vrf_id)
        /* Create client peer notification register. */
        pcn = pcn_new(pc, bs);
        if (pcn == NULL) {
-               log_error("ptm-add-dest: failed to registrate notifications");
+               zlog_err("ptm-add-dest: failed to registrate notifications");
                return;
        }
 
@@ -454,7 +456,7 @@ static void bfdd_dest_deregister(struct stream *msg, vrf_id_t vrf_id)
        /* Find or start new BFD session. */
        bs = bs_peer_find(&bpc);
        if (bs == NULL) {
-               log_debug("ptm-del-dest: failed to find BFD session");
+               zlog_debug("ptm-del-dest: failed to find BFD session");
                return;
        }
 
@@ -485,14 +487,14 @@ static void bfdd_client_register(struct stream *msg)
 
        pc = pc_new(pid);
        if (pc == NULL) {
-               log_error("ptm-add-client: failed to register client: %u", pid);
+               zlog_err("ptm-add-client: failed to register client: %u", pid);
                return;
        }
 
        return;
 
 stream_failure:
-       log_error("ptm-add-client: failed to register client");
+       zlog_err("ptm-add-client: failed to register client");
 }
 
 /*
@@ -509,7 +511,7 @@ static void bfdd_client_deregister(struct stream *msg)
 
        pc = pc_lookup(pid);
        if (pc == NULL) {
-               log_debug("ptm-del-client: failed to find client: %u", pid);
+               zlog_debug("ptm-del-client: failed to find client: %u", pid);
                return;
        }
 
@@ -518,7 +520,7 @@ static void bfdd_client_deregister(struct stream *msg)
        return;
 
 stream_failure:
-       log_error("ptm-del-client: failed to deregister client");
+       zlog_err("ptm-del-client: failed to deregister client");
 }
 
 static int bfdd_replay(ZAPI_CALLBACK_ARGS)
@@ -544,14 +546,14 @@ static int bfdd_replay(ZAPI_CALLBACK_ARGS)
                break;
 
        default:
-               log_debug("ptm-replay: invalid message type %u", rcmd);
+               zlog_debug("ptm-replay: invalid message type %u", rcmd);
                return -1;
        }
 
        return 0;
 
 stream_failure:
-       log_error("ptm-replay: failed to find command");
+       zlog_err("ptm-replay: failed to find command");
        return -1;
 }