diff options
| -rw-r--r-- | bgpd/bgp_attr.c | 28 | ||||
| -rw-r--r-- | bgpd/bgp_evpn.c | 77 | ||||
| -rw-r--r-- | bgpd/bgp_fsm.c | 16 | ||||
| -rw-r--r-- | bgpd/bgp_label.c | 16 | ||||
| -rw-r--r-- | bgpd/bgp_mpath.c | 24 | ||||
| -rw-r--r-- | bgpd/bgp_network.c | 22 | ||||
| -rw-r--r-- | bgpd/bgp_route.c | 16 | ||||
| -rw-r--r-- | bgpd/bgp_updgrp_packet.c | 27 | ||||
| -rw-r--r-- | bgpd/bgp_zebra.c | 34 | ||||
| -rw-r--r-- | nhrpd/netlink_arp.c | 18 | ||||
| -rw-r--r-- | nhrpd/nhrp_cache.c | 35 | ||||
| -rw-r--r-- | nhrpd/nhrp_interface.c | 6 | ||||
| -rw-r--r-- | nhrpd/nhrp_nhs.c | 22 | ||||
| -rw-r--r-- | nhrpd/nhrp_peer.c | 56 | ||||
| -rw-r--r-- | nhrpd/nhrp_route.c | 6 | ||||
| -rw-r--r-- | nhrpd/nhrp_shortcut.c | 25 | ||||
| -rw-r--r-- | nhrpd/nhrp_vc.c | 7 | ||||
| -rw-r--r-- | ospfd/ospf_flood.c | 18 | ||||
| -rw-r--r-- | ospfd/ospf_packet.c | 59 | ||||
| -rw-r--r-- | ospfd/ospf_spf.c | 45 | ||||
| -rw-r--r-- | ripd/ripd.c | 21 | ||||
| -rw-r--r-- | ripngd/ripngd.c | 7 | ||||
| -rw-r--r-- | watchfrr/watchfrr.c | 6 |
23 files changed, 182 insertions, 409 deletions
diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c index bd57b63997..f658b0d0f0 100644 --- a/bgpd/bgp_attr.c +++ b/bgpd/bgp_attr.c @@ -2133,19 +2133,11 @@ int bgp_mp_reach_parse(struct bgp_attr_parser_args *args, } stream_get(&attr->mp_nexthop_local, s, IPV6_MAX_BYTELEN); if (!IN6_IS_ADDR_LINKLOCAL(&attr->mp_nexthop_local)) { - char buf1[INET6_ADDRSTRLEN]; - char buf2[INET6_ADDRSTRLEN]; - if (bgp_debug_update(peer, NULL, NULL, 1)) zlog_debug( - "%s sent next-hops %s and %s. Ignoring non-LL value", - peer->host, - inet_ntop(AF_INET6, - &attr->mp_nexthop_global, - buf1, INET6_ADDRSTRLEN), - inet_ntop(AF_INET6, - &attr->mp_nexthop_local, buf2, - INET6_ADDRSTRLEN)); + "%s sent next-hops %pI6 and %pI6. Ignoring non-LL value", + peer->host, &attr->mp_nexthop_global, + &attr->mp_nexthop_local); attr->mp_nexthop_len = IPV6_MAX_BYTELEN; } @@ -2344,16 +2336,10 @@ bgp_attr_ext_communities(struct bgp_attr_parser_args *args) /* Extract the Rmac, if any */ if (bgp_attr_rmac(attr, &attr->rmac)) { - if (bgp_debug_update(peer, NULL, NULL, 1) && - bgp_mac_exist(&attr->rmac)) { - char buf1[ETHER_ADDR_STRLEN]; - - zlog_debug("%s: router mac %s is self mac", - __func__, - prefix_mac2str(&attr->rmac, buf1, - sizeof(buf1))); - } - + if (bgp_debug_update(peer, NULL, NULL, 1) + && bgp_mac_exist(&attr->rmac)) + zlog_debug("%s: router mac %pEA is self mac", __func__, + &attr->rmac); } /* Get the tunnel type from encap extended community */ diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c index c976632678..7b29f1e4c9 100644 --- a/bgpd/bgp_evpn.c +++ b/bgpd/bgp_evpn.c @@ -592,9 +592,6 @@ static int bgp_zebra_send_remote_macip(struct bgp *bgp, struct bgpevpn *vpn, { struct stream *s; int ipa_len; - char buf1[ETHER_ADDR_STRLEN]; - char buf2[INET6_ADDRSTRLEN]; - char buf3[INET6_ADDRSTRLEN]; static struct in_addr zero_remote_vtep_ip; /* Check socket. */ @@ -649,14 +646,10 @@ static int bgp_zebra_send_remote_macip(struct bgp *bgp, struct bgpevpn *vpn, if (bgp_debug_zebra(NULL)) zlog_debug( - "Tx %s MACIP, VNI %u MAC %s IP %s flags 0x%x seq %u remote VTEP %s", + "Tx %s MACIP, VNI %u MAC %pEA IP %pIA flags 0x%x seq %u remote VTEP %pI4", add ? "ADD" : "DEL", vpn->vni, - prefix_mac2str(&p->prefix.macip_addr.mac, - buf1, sizeof(buf1)), - ipaddr2str(&p->prefix.macip_addr.ip, - buf3, sizeof(buf3)), flags, seq, - inet_ntop(AF_INET, &remote_vtep_ip, buf2, - sizeof(buf2))); + &p->prefix.macip_addr.mac, &p->prefix.macip_addr.ip, + flags, seq, &remote_vtep_ip); return zclient_send_message(zclient); } @@ -1319,16 +1312,11 @@ static int update_evpn_type5_route(struct bgp *bgp_vrf, struct prefix_evpn *evp, vrf_id_to_name(bgp_vrf->vrf_id), evp); } - if (bgp_debug_zebra(NULL)) { - char buf[ETHER_ADDR_STRLEN]; - char buf2[INET6_ADDRSTRLEN]; - - zlog_debug("VRF %s type-5 route evp %pFX RMAC %s nexthop %s", - vrf_id_to_name(bgp_vrf->vrf_id), evp, - prefix_mac2str(&attr.rmac, buf, sizeof(buf)), - inet_ntop(AF_INET, &attr.nexthop, buf2, - INET_ADDRSTRLEN)); - } + if (bgp_debug_zebra(NULL)) + zlog_debug( + "VRF %s type-5 route evp %pFX RMAC %pEA nexthop %pI4", + vrf_id_to_name(bgp_vrf->vrf_id), evp, &attr.rmac, + &attr.nexthop); attr.mp_nexthop_len = BGP_ATTR_NHLEN_IPV4; @@ -1725,16 +1713,13 @@ static int update_evpn_route(struct bgp *bgp, struct bgpevpn *vpn, } if (bgp_debug_zebra(NULL)) { - char buf[ETHER_ADDR_STRLEN]; char buf3[ESI_STR_LEN]; zlog_debug( - "VRF %s vni %u type-2 route evp %pFX RMAC %s nexthop %pI4 esi %s", + "VRF %s vni %u type-2 route evp %pFX RMAC %pEA nexthop %pI4 esi %s", vpn->bgp_vrf ? vrf_id_to_name(vpn->bgp_vrf->vrf_id) : " ", - vpn->vni, p, - prefix_mac2str(&attr.rmac, buf, sizeof(buf)), - &attr.mp_nexthop_global_in, + vpn->vni, p, &attr.rmac, &attr.mp_nexthop_global_in, esi_to_str(esi, buf3, sizeof(buf3))); } /* router mac is only needed for type-2 routes here. */ @@ -2004,16 +1989,13 @@ static void bgp_evpn_update_type2_route_entry(struct bgp *bgp, seq = mac_mobility_seqnum(local_pi->attr); if (bgp_debug_zebra(NULL)) { - char buf[ETHER_ADDR_STRLEN]; char buf3[ESI_STR_LEN]; zlog_debug( - "VRF %s vni %u evp %pFX RMAC %s nexthop %pI4 esi %s esf 0x%x from %s", + "VRF %s vni %u evp %pFX RMAC %pEA nexthop %pI4 esi %s esf 0x%x from %s", vpn->bgp_vrf ? vrf_id_to_name(vpn->bgp_vrf->vrf_id) : " ", - vpn->vni, evp, - prefix_mac2str(&attr.rmac, buf, sizeof(buf)), - &attr.mp_nexthop_global_in, + vpn->vni, evp, &attr.rmac, &attr.mp_nexthop_global_in, esi_to_str(&attr.esi, buf3, sizeof(buf3)), attr.es_flags, caller); } @@ -5300,18 +5282,14 @@ int bgp_evpn_local_macip_add(struct bgp *bgp, vni_t vni, struct ethaddr *mac, /* Create EVPN type-2 route and schedule for processing. */ build_evpn_type2_prefix(&p, mac, ip); if (update_evpn_route(bgp, vpn, &p, flags, seq, esi)) { - char buf[ETHER_ADDR_STRLEN]; - char buf2[INET6_ADDRSTRLEN]; - flog_err( EC_BGP_EVPN_ROUTE_CREATE, - "%u:Failed to create Type-2 route, VNI %u %s MAC %s IP %s (flags: 0x%x)", + "%u:Failed to create Type-2 route, VNI %u %s MAC %pEA IP %pIA (flags: 0x%x)", bgp->vrf_id, vpn->vni, CHECK_FLAG(flags, ZEBRA_MACIP_TYPE_STICKY) ? "sticky gateway" : "", - prefix_mac2str(mac, buf, sizeof(buf)), - ipaddr2str(ip, buf2, sizeof(buf2)), flags); + mac, ip, flags); return -1; } @@ -5396,23 +5374,16 @@ int bgp_evpn_local_l3vni_add(vni_t l3vni, vrf_id_t vrf_id, if (is_zero_mac(&bgp_vrf->evpn_info->pip_rmac_static)) memcpy(&bgp_vrf->evpn_info->pip_rmac, svi_rmac, ETH_ALEN); - if (bgp_debug_zebra(NULL)) { - char buf[ETHER_ADDR_STRLEN]; - char buf1[ETHER_ADDR_STRLEN]; - char buf2[ETHER_ADDR_STRLEN]; - - zlog_debug("VRF %s vni %u pip %s RMAC %s sys RMAC %s static RMAC %s is_anycast_mac %s", - vrf_id_to_name(bgp_vrf->vrf_id), - bgp_vrf->l3vni, - bgp_vrf->evpn_info->advertise_pip ? "enable" - : "disable", - prefix_mac2str(&bgp_vrf->rmac, buf, sizeof(buf)), - prefix_mac2str(&bgp_vrf->evpn_info->pip_rmac, - buf1, sizeof(buf1)), - prefix_mac2str(&bgp_vrf->evpn_info->pip_rmac_static, - buf2, sizeof(buf2)), - is_anycast_mac ? "Enable" : "Disable"); - } + if (bgp_debug_zebra(NULL)) + zlog_debug( + "VRF %s vni %u pip %s RMAC %pEA sys RMAC %pEA static RMAC %pEA is_anycast_mac %s", + vrf_id_to_name(bgp_vrf->vrf_id), bgp_vrf->l3vni, + bgp_vrf->evpn_info->advertise_pip ? "enable" + : "disable", + &bgp_vrf->rmac, &bgp_vrf->evpn_info->pip_rmac, + &bgp_vrf->evpn_info->pip_rmac_static, + is_anycast_mac ? "Enable" : "Disable"); + /* set the right filter - are we using l3vni only for prefix routes? */ if (filter) { SET_FLAG(bgp_vrf->vrf_flags, BGP_VRF_L3VNI_PREFIX_ROUTES_ONLY); diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c index 30e2c3d489..757d76f69e 100644 --- a/bgpd/bgp_fsm.c +++ b/bgpd/bgp_fsm.c @@ -1556,13 +1556,9 @@ static int bgp_connect_success(struct peer *peer) bgp_reads_on(peer); if (bgp_debug_neighbor_events(peer)) { - char buf1[SU_ADDRSTRLEN]; - if (!CHECK_FLAG(peer->sflags, PEER_STATUS_ACCEPT_PEER)) - zlog_debug("%s open active, local address %s", - peer->host, - sockunion2str(peer->su_local, buf1, - SU_ADDRSTRLEN)); + zlog_debug("%s open active, local address %pSU", + peer->host, peer->su_local); else zlog_debug("%s passive open", peer->host); } @@ -1598,13 +1594,9 @@ static int bgp_connect_success_w_delayopen(struct peer *peer) bgp_reads_on(peer); if (bgp_debug_neighbor_events(peer)) { - char buf1[SU_ADDRSTRLEN]; - if (!CHECK_FLAG(peer->sflags, PEER_STATUS_ACCEPT_PEER)) - zlog_debug("%s open active, local address %s", - peer->host, - sockunion2str(peer->su_local, buf1, - SU_ADDRSTRLEN)); + zlog_debug("%s open active, local address %pSU", + peer->host, peer->su_local); else zlog_debug("%s passive open", peer->host); } diff --git a/bgpd/bgp_label.c b/bgpd/bgp_label.c index 5a31bd0243..bdab2ec36a 100644 --- a/bgpd/bgp_label.c +++ b/bgpd/bgp_label.c @@ -420,27 +420,19 @@ int bgp_nlri_parse_label(struct peer *peer, struct attr *attr, /* Check address. */ if (afi == AFI_IP6 && safi == SAFI_LABELED_UNICAST) { if (IN6_IS_ADDR_LINKLOCAL(&p.u.prefix6)) { - char buf[BUFSIZ]; - flog_err( EC_BGP_UPDATE_RCV, - "%s: IPv6 labeled-unicast NLRI is link-local address %s, ignoring", - peer->host, - inet_ntop(AF_INET6, &p.u.prefix6, buf, - BUFSIZ)); + "%s: IPv6 labeled-unicast NLRI is link-local address %pI6, ignoring", + peer->host, &p.u.prefix6); continue; } if (IN6_IS_ADDR_MULTICAST(&p.u.prefix6)) { - char buf[BUFSIZ]; - flog_err( EC_BGP_UPDATE_RCV, - "%s: IPv6 unicast NLRI is multicast address %s, ignoring", - peer->host, - inet_ntop(AF_INET6, &p.u.prefix6, buf, - BUFSIZ)); + "%s: IPv6 unicast NLRI is multicast address %pI6, ignoring", + peer->host, &p.u.prefix6); continue; } diff --git a/bgpd/bgp_mpath.c b/bgpd/bgp_mpath.c index 37639f4bce..d5fce115de 100644 --- a/bgpd/bgp_mpath.c +++ b/bgpd/bgp_mpath.c @@ -519,7 +519,6 @@ void bgp_path_info_mpath_update(struct bgp_dest *dest, struct listnode *mp_node, *mp_next_node; struct bgp_path_info *cur_mpath, *new_mpath, *next_mpath, *prev_mpath; int mpath_changed, debug; - char nh_buf[2][INET6_ADDRSTRLEN]; bool all_paths_lb; char path_buf[PATH_ADDPATH_STR_BUFFER]; @@ -630,14 +629,10 @@ void bgp_path_info_mpath_update(struct bgp_dest *dest, cur_mpath, path_buf, sizeof(path_buf)); zlog_debug( - "%pRN: remove mpath %s nexthop %s, cur count %d", + "%pRN: remove mpath %s nexthop %pI4, cur count %d", bgp_dest_to_rnode(dest), path_buf, - inet_ntop(AF_INET, - &cur_mpath->attr - ->nexthop, - nh_buf[0], - sizeof(nh_buf[0])), + &cur_mpath->attr->nexthop, mpath_count); } } @@ -664,12 +659,9 @@ void bgp_path_info_mpath_update(struct bgp_dest *dest, bgp_path_info_path_with_addpath_rx_str( cur_mpath, path_buf, sizeof(path_buf)); zlog_debug( - "%pRN: remove mpath %s nexthop %s, cur count %d", + "%pRN: remove mpath %s nexthop %pI4, cur count %d", bgp_dest_to_rnode(dest), path_buf, - inet_ntop(AF_INET, - &cur_mpath->attr->nexthop, - nh_buf[0], sizeof(nh_buf[0])), - mpath_count); + &cur_mpath->attr->nexthop, mpath_count); } cur_mpath = next_mpath; } else { @@ -715,14 +707,10 @@ void bgp_path_info_mpath_update(struct bgp_dest *dest, new_mpath, path_buf, sizeof(path_buf)); zlog_debug( - "%pRN: add mpath %s nexthop %s, cur count %d", + "%pRN: add mpath %s nexthop %pI4, cur count %d", bgp_dest_to_rnode(dest), path_buf, - inet_ntop(AF_INET, - &new_mpath->attr - ->nexthop, - nh_buf[0], - sizeof(nh_buf[0])), + &new_mpath->attr->nexthop, mpath_count); } } diff --git a/bgpd/bgp_network.c b/bgpd/bgp_network.c index be2c474493..03ff27c7ca 100644 --- a/bgpd/bgp_network.c +++ b/bgpd/bgp_network.c @@ -233,7 +233,6 @@ int bgp_md5_unset(struct peer *peer) int bgp_set_socket_ttl(struct peer *peer, int bgp_sock) { - char buf[INET_ADDRSTRLEN]; int ret = 0; /* In case of peer is EBGP, we should set TTL for this connection. */ @@ -242,11 +241,8 @@ int bgp_set_socket_ttl(struct peer *peer, int bgp_sock) if (ret) { flog_err( EC_LIB_SOCKET, - "%s: Can't set TxTTL on peer (rtrid %s) socket, err = %d", - __func__, - inet_ntop(AF_INET, &peer->remote_id, buf, - sizeof(buf)), - errno); + "%s: Can't set TxTTL on peer (rtrid %pI4) socket, err = %d", + __func__, &peer->remote_id, errno); return ret; } } else if (peer->gtsm_hops) { @@ -258,11 +254,8 @@ int bgp_set_socket_ttl(struct peer *peer, int bgp_sock) if (ret) { flog_err( EC_LIB_SOCKET, - "%s: Can't set TxTTL on peer (rtrid %s) socket, err = %d", - __func__, - inet_ntop(AF_INET, &peer->remote_id, buf, - sizeof(buf)), - errno); + "%s: Can't set TxTTL on peer (rtrid %pI4) socket, err = %d", + __func__, &peer->remote_id, errno); return ret; } ret = sockopt_minttl(peer->su.sa.sa_family, bgp_sock, @@ -270,11 +263,8 @@ int bgp_set_socket_ttl(struct peer *peer, int bgp_sock) if (ret) { flog_err( EC_LIB_SOCKET, - "%s: Can't set MinTTL on peer (rtrid %s) socket, err = %d", - __func__, - inet_ntop(AF_INET, &peer->remote_id, buf, - sizeof(buf)), - errno); + "%s: Can't set MinTTL on peer (rtrid %pI4) socket, err = %d", + __func__, &peer->remote_id, errno); return ret; } } diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index a753b7ef60..9165dcc1d7 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -5255,26 +5255,18 @@ int bgp_nlri_parse_ip(struct peer *peer, struct attr *attr, /* Check address. */ if (afi == AFI_IP6 && safi == SAFI_UNICAST) { if (IN6_IS_ADDR_LINKLOCAL(&p.u.prefix6)) { - char buf[BUFSIZ]; - flog_err( EC_BGP_UPDATE_RCV, - "%s: IPv6 unicast NLRI is link-local address %s, ignoring", - peer->host, - inet_ntop(AF_INET6, &p.u.prefix6, buf, - BUFSIZ)); + "%s: IPv6 unicast NLRI is link-local address %pI6, ignoring", + peer->host, &p.u.prefix6); continue; } if (IN6_IS_ADDR_MULTICAST(&p.u.prefix6)) { - char buf[BUFSIZ]; - flog_err( EC_BGP_UPDATE_RCV, - "%s: IPv6 unicast NLRI is multicast address %s, ignoring", - peer->host, - inet_ntop(AF_INET6, &p.u.prefix6, buf, - BUFSIZ)); + "%s: IPv6 unicast NLRI is multicast address %pI6, ignoring", + peer->host, &p.u.prefix6); continue; } diff --git a/bgpd/bgp_updgrp_packet.c b/bgpd/bgp_updgrp_packet.c index 05452beacd..6418decd16 100644 --- a/bgpd/bgp_updgrp_packet.c +++ b/bgpd/bgp_updgrp_packet.c @@ -350,8 +350,6 @@ struct stream *bpacket_reformat_for_peer(struct bpacket *pkt, struct stream *s = NULL; bpacket_attr_vec *vec; struct peer *peer; - char buf[BUFSIZ]; - char buf2[BUFSIZ]; struct bgp_filter *filter; s = stream_dup(pkt->buffer); @@ -568,25 +566,24 @@ struct stream *bpacket_reformat_for_peer(struct bpacket *pkt, if (nhlen == BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL || nhlen == BGP_ATTR_NHLEN_VPNV6_GLOBAL_AND_LL) zlog_debug( - "u%" PRIu64 ":s%" PRIu64" %s send UPDATE w/ mp_nexthops %s, %s%s", + "u%" PRIu64 ":s%" PRIu64 + " %s send UPDATE w/ mp_nexthops %pI6, %pI6%s", PAF_SUBGRP(paf)->update_group->id, PAF_SUBGRP(paf)->id, peer->host, - inet_ntop(AF_INET6, mod_v6nhg, buf, - BUFSIZ), - inet_ntop(AF_INET6, mod_v6nhl, buf2, - BUFSIZ), + mod_v6nhg, mod_v6nhl, (nhlen == BGP_ATTR_NHLEN_VPNV6_GLOBAL_AND_LL ? " and RD" : "")); else - zlog_debug("u%" PRIu64 ":s%" PRIu64" %s send UPDATE w/ mp_nexthop %s%s", - PAF_SUBGRP(paf)->update_group->id, - PAF_SUBGRP(paf)->id, peer->host, - inet_ntop(AF_INET6, mod_v6nhg, buf, - BUFSIZ), - (nhlen == BGP_ATTR_NHLEN_VPNV6_GLOBAL - ? " and RD" - : "")); + zlog_debug( + "u%" PRIu64 ":s%" PRIu64 + " %s send UPDATE w/ mp_nexthop %pI6%s", + PAF_SUBGRP(paf)->update_group->id, + PAF_SUBGRP(paf)->id, peer->host, + mod_v6nhg, + (nhlen == BGP_ATTR_NHLEN_VPNV6_GLOBAL + ? " and RD" + : "")); } } else if (paf->afi == AFI_L2VPN) { struct in_addr v4nh, *mod_v4nh; diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c index 3be721824e..9547de2869 100644 --- a/bgpd/bgp_zebra.c +++ b/bgpd/bgp_zebra.c @@ -942,12 +942,9 @@ static bool bgp_table_map_apply(struct route_map *map, const struct prefix *p, if (bgp_debug_zebra(p)) { if (p->family == AF_INET) { - char buf[2][INET_ADDRSTRLEN]; zlog_debug( - "Zebra rmap deny: IPv4 route %pFX nexthop %s", - p, - inet_ntop(AF_INET, &path->attr->nexthop, buf[1], - sizeof(buf[1]))); + "Zebra rmap deny: IPv4 route %pFX nexthop %pI4", + p, &path->attr->nexthop); } if (p->family == AF_INET6) { char buf[2][INET6_ADDRSTRLEN]; @@ -2742,14 +2739,12 @@ static int bgp_zebra_process_local_es_evi(ZAPI_CALLBACK_ARGS) static int bgp_zebra_process_local_l3vni(ZAPI_CALLBACK_ARGS) { int filter = 0; - char buf[ETHER_ADDR_STRLEN]; vni_t l3vni = 0; struct ethaddr svi_rmac, vrr_rmac = {.octet = {0} }; struct in_addr originator_ip; struct stream *s; ifindex_t svi_ifindex; bool is_anycast_mac = false; - char buf1[ETHER_ADDR_STRLEN]; memset(&svi_rmac, 0, sizeof(struct ethaddr)); memset(&originator_ip, 0, sizeof(struct in_addr)); @@ -2764,13 +2759,12 @@ static int bgp_zebra_process_local_l3vni(ZAPI_CALLBACK_ARGS) is_anycast_mac = stream_getl(s); if (BGP_DEBUG(zebra, ZEBRA)) - zlog_debug("Rx L3-VNI ADD VRF %s VNI %u RMAC svi-mac %s vrr-mac %s filter %s svi-if %u", - vrf_id_to_name(vrf_id), l3vni, - prefix_mac2str(&svi_rmac, buf, sizeof(buf)), - prefix_mac2str(&vrr_rmac, buf1, - sizeof(buf1)), - filter ? "prefix-routes-only" : "none", - svi_ifindex); + zlog_debug( + "Rx L3-VNI ADD VRF %s VNI %u RMAC svi-mac %pEA vrr-mac %pEA filter %s svi-if %u", + vrf_id_to_name(vrf_id), l3vni, &svi_rmac, + &vrr_rmac, + filter ? "prefix-routes-only" : "none", + svi_ifindex); bgp_evpn_local_l3vni_add(l3vni, vrf_id, &svi_rmac, &vrr_rmac, originator_ip, filter, svi_ifindex, @@ -2830,8 +2824,6 @@ static int bgp_zebra_process_local_macip(ZAPI_CALLBACK_ARGS) struct ethaddr mac; struct ipaddr ip; int ipa_len; - char buf[ETHER_ADDR_STRLEN]; - char buf1[INET6_ADDRSTRLEN]; uint8_t flags = 0; uint32_t seqnum = 0; int state = 0; @@ -2871,11 +2863,11 @@ static int bgp_zebra_process_local_macip(ZAPI_CALLBACK_ARGS) return 0; if (BGP_DEBUG(zebra, ZEBRA)) - zlog_debug("%u:Recv MACIP %s f 0x%x MAC %s IP %s VNI %u seq %u state %d ESI %s", - vrf_id, (cmd == ZEBRA_MACIP_ADD) ? "Add" : "Del", - flags, prefix_mac2str(&mac, buf, sizeof(buf)), - ipaddr2str(&ip, buf1, sizeof(buf1)), vni, seqnum, - state, esi_to_str(&esi, buf2, sizeof(buf2))); + zlog_debug( + "%u:Recv MACIP %s f 0x%x MAC %pEA IP %pI4 VNI %u seq %u state %d ESI %s", + vrf_id, (cmd == ZEBRA_MACIP_ADD) ? "Add" : "Del", flags, + &mac, &ip, vni, seqnum, state, + esi_to_str(&esi, buf2, sizeof(buf2))); if (cmd == ZEBRA_MACIP_ADD) return bgp_evpn_local_macip_add(bgp, vni, &mac, &ip, diff --git a/nhrpd/netlink_arp.c b/nhrpd/netlink_arp.c index 309f733526..dc4697cda0 100644 --- a/nhrpd/netlink_arp.c +++ b/nhrpd/netlink_arp.c @@ -67,7 +67,6 @@ static void netlink_neigh_msg(struct nlmsghdr *msg, struct zbuf *zb) struct zbuf payload; union sockunion addr, lladdr; size_t len; - char buf[4][SU_ADDRSTRLEN]; int state; memset(&lladdr, 0, sizeof(lladdr)); @@ -99,27 +98,20 @@ static void netlink_neigh_msg(struct nlmsghdr *msg, struct zbuf *zb) return; debugf(NHRP_DEBUG_KERNEL, - "Netlink: %s %s dev %s lladdr %s nud 0x%x cache used %u type %u", + "Netlink: %s %pSU dev %s lladdr %pSU nud 0x%x cache used %u type %u", (msg->nlmsg_type == RTM_GETNEIGH) ? "who-has" : (msg->nlmsg_type == RTM_NEWNEIGH) ? "new-neigh" : "del-neigh", - sockunion2str(&addr, buf[0], sizeof(buf[0])), ifp->name, - sockunion2str(&lladdr, buf[1], sizeof(buf[1])), ndm->ndm_state, - c->used, c->cur.type); + &addr, ifp->name, &lladdr, ndm->ndm_state, c->used, c->cur.type); if (msg->nlmsg_type == RTM_GETNEIGH) { if (c->cur.type >= NHRP_CACHE_CACHED) { nhrp_cache_set_used(c, 1); debugf(NHRP_DEBUG_KERNEL, - "Netlink: update binding for %s dev %s from c %s peer.vc.nbma %s to lladdr %s", - sockunion2str(&addr, buf[0], sizeof(buf[0])), - ifp->name, - sockunion2str(&c->cur.remote_nbma_natoa, buf[1], - sizeof(buf[1])), - sockunion2str(&c->cur.peer->vc->remote.nbma, - buf[2], sizeof(buf[2])), - sockunion2str(&lladdr, buf[3], sizeof(buf[3]))); + "Netlink: update binding for %pSU dev %s from c %pSU peer.vc.nbma %pSU to lladdr %pSU", + &addr, ifp->name, &c->cur.remote_nbma_natoa, + &c->cur.peer->vc->remote.nbma, &lladdr); /* In case of shortcuts, nbma is given by lladdr, not * vc->remote.nbma. */ diff --git a/nhrpd/nhrp_cache.c b/nhrpd/nhrp_cache.c index 0b5a0427e6..cb298b1a09 100644 --- a/nhrpd/nhrp_cache.c +++ b/nhrpd/nhrp_cache.c @@ -220,7 +220,6 @@ static void nhrp_cache_update_route(struct nhrp_cache *c) { struct prefix pfx; struct nhrp_peer *p = c->cur.peer; - char buf[3][SU_ADDRSTRLEN]; struct nhrp_interface *nifp; if (!sockunion2hostprefix(&c->remote_addr, &pfx)) @@ -233,26 +232,18 @@ static void nhrp_cache_update_route(struct nhrp_cache *c) * nbma. */ debugf(NHRP_DEBUG_COMMON, - "cache (remote_nbma_natoa set): Update binding for %s dev %s from (deleted) peer.vc.nbma %s to %s", - sockunion2str(&c->remote_addr, buf[0], - sizeof(buf[0])), - p->ifp->name, - sockunion2str(&p->vc->remote.nbma, buf[1], - sizeof(buf[1])), - sockunion2str(&c->cur.remote_nbma_natoa, buf[2], - sizeof(buf[2]))); + "cache (remote_nbma_natoa set): Update binding for %pSU dev %s from (deleted) peer.vc.nbma %pSU to %pSU", + &c->remote_addr, p->ifp->name, + &p->vc->remote.nbma, &c->cur.remote_nbma_natoa); netlink_update_binding(p->ifp, &c->remote_addr, &c->cur.remote_nbma_natoa); } else { /* update binding to peer->vc->remote->nbma */ debugf(NHRP_DEBUG_COMMON, - "cache (remote_nbma_natoa unspec): Update binding for %s dev %s from (deleted) to peer.vc.nbma %s", - sockunion2str(&c->remote_addr, buf[0], - sizeof(buf[0])), - p->ifp->name, - sockunion2str(&p->vc->remote.nbma, buf[1], - sizeof(buf[1]))); + "cache (remote_nbma_natoa unspec): Update binding for %pSU dev %s from (deleted) to peer.vc.nbma %pSU", + &c->remote_addr, p->ifp->name, + &p->vc->remote.nbma); netlink_update_binding(p->ifp, &c->remote_addr, &p->vc->remote.nbma); @@ -353,9 +344,8 @@ static void nhrp_cache_authorize_binding(struct nhrp_reqid *r, void *arg) struct nhrp_cache *c = container_of(r, struct nhrp_cache, eventid); char buf[3][SU_ADDRSTRLEN]; - debugf(NHRP_DEBUG_COMMON, "cache: %s %s: %s", c->ifp->name, - sockunion2str(&c->remote_addr, buf[0], sizeof(buf[0])), - (const char *)arg); + debugf(NHRP_DEBUG_COMMON, "cache: %s %pSU: %s", c->ifp->name, + &c->remote_addr, (const char *)arg); nhrp_reqid_free(&nhrp_event_reqid, r); @@ -377,16 +367,13 @@ static void nhrp_cache_authorize_binding(struct nhrp_reqid *r, void *arg) if (sockunion_family(&c->cur.remote_nbma_natoa) != AF_UNSPEC) { debugf(NHRP_DEBUG_COMMON, - "cache: update binding for %s dev %s from (deleted) peer.vc.nbma %s to %s", - sockunion2str(&c->remote_addr, buf[0], - sizeof(buf[0])), - c->ifp->name, + "cache: update binding for %pSU dev %s from (deleted) peer.vc.nbma %s to %pSU", + &c->remote_addr, c->ifp->name, (c->cur.peer ? sockunion2str( &c->cur.peer->vc->remote.nbma, buf[1], sizeof(buf[1])) : "(no peer)"), - sockunion2str(&c->cur.remote_nbma_natoa, buf[2], - sizeof(buf[2]))); + &c->cur.remote_nbma_natoa); if (c->cur.peer) netlink_update_binding( diff --git a/nhrpd/nhrp_interface.c b/nhrpd/nhrp_interface.c index 269499cc59..f86dbe3d29 100644 --- a/nhrpd/nhrp_interface.c +++ b/nhrpd/nhrp_interface.c @@ -117,7 +117,6 @@ static void nhrp_interface_interface_notifier(struct notifier_block *n, container_of(n, struct nhrp_interface, nbmanifp_notifier); struct interface *nbmaifp = nifp->nbmaifp; struct nhrp_interface *nbmanifp = nbmaifp->info; - char buf[SU_ADDRSTRLEN]; switch (cmd) { case NOTIFY_INTERFACE_CHANGED: @@ -129,9 +128,8 @@ static void nhrp_interface_interface_notifier(struct notifier_block *n, nhrp_interface_update(nifp->ifp); notifier_call(&nifp->notifier_list, NOTIFY_INTERFACE_NBMA_CHANGED); - debugf(NHRP_DEBUG_IF, "%s: NBMA change: address %s", - nifp->ifp->name, - sockunion2str(&nifp->nbma, buf, sizeof(buf))); + debugf(NHRP_DEBUG_IF, "%s: NBMA change: address %pSU", + nifp->ifp->name, &nifp->nbma); break; } } diff --git a/nhrpd/nhrp_nhs.c b/nhrpd/nhrp_nhs.c index 540708f1ae..9ed03098ac 100644 --- a/nhrpd/nhrp_nhs.c +++ b/nhrpd/nhrp_nhs.c @@ -33,7 +33,6 @@ static void nhrp_reg_reply(struct nhrp_reqid *reqid, void *arg) struct nhrp_cache *c; struct zbuf extpl; union sockunion cie_nbma, cie_proto, *proto; - char buf[64]; int ok = 0, holdtime; unsigned short mtu = 0; @@ -52,8 +51,8 @@ static void nhrp_reg_reply(struct nhrp_reqid *reqid, void *arg) proto = sockunion_family(&cie_proto) != AF_UNSPEC ? &cie_proto : &p->src_proto; - debugf(NHRP_DEBUG_COMMON, "NHS: CIE registration: %s: %d", - sockunion2str(proto, buf, sizeof(buf)), cie->code); + debugf(NHRP_DEBUG_COMMON, "NHS: CIE registration: %pSU: %d", + proto, cie->code); if (!((cie->code == NHRP_CODE_SUCCESS) || (cie->code == NHRP_CODE_ADMINISTRATIVELY_PROHIBITED && nhs->hub))) @@ -76,10 +75,8 @@ static void nhrp_reg_reply(struct nhrp_reqid *reqid, void *arg) &cie_proto)) { nifp->nat_nbma = cie_nbma; debugf(NHRP_DEBUG_IF, - "%s: NAT detected, real NBMA address: %s", - ifp->name, - sockunion2str(&nifp->nbma, buf, - sizeof(buf))); + "%s: NAT detected, real NBMA address: %pSU", + ifp->name, &nifp->nbma); } break; } @@ -130,16 +127,14 @@ static void nhrp_reg_peer_notify(struct notifier_block *n, unsigned long cmd) { struct nhrp_registration *r = container_of(n, struct nhrp_registration, peer_notifier); - char buf[SU_ADDRSTRLEN]; switch (cmd) { case NOTIFY_PEER_UP: case NOTIFY_PEER_DOWN: case NOTIFY_PEER_IFCONFIG_CHANGED: case NOTIFY_PEER_MTU_CHANGED: - debugf(NHRP_DEBUG_COMMON, "NHS: Flush timer for %s", - sockunion2str(&r->peer->vc->remote.nbma, buf, - sizeof(buf))); + debugf(NHRP_DEBUG_COMMON, "NHS: Flush timer for %pSU", + &r->peer->vc->remote.nbma); THREAD_OFF(r->t_register); thread_add_timer_msec(master, nhrp_reg_send_req, r, 10, &r->t_register); @@ -163,9 +158,8 @@ static int nhrp_reg_send_req(struct thread *t) r->t_register = NULL; if (!nhrp_peer_check(r->peer, 2)) { - debugf(NHRP_DEBUG_COMMON, "NHS: Waiting link for %s", - sockunion2str(&r->peer->vc->remote.nbma, buf1, - sizeof(buf1))); + debugf(NHRP_DEBUG_COMMON, "NHS: Waiting link for %pSU", + &r->peer->vc->remote.nbma); thread_add_timer(master, nhrp_reg_send_req, r, 120, &r->t_register); return 0; diff --git a/nhrpd/nhrp_peer.c b/nhrpd/nhrp_peer.c index 9aaa9dec1e..622cb4ebb6 100644 --- a/nhrpd/nhrp_peer.c +++ b/nhrpd/nhrp_peer.c @@ -38,16 +38,13 @@ static void nhrp_packet_debug(struct zbuf *zb, const char *dir); static void nhrp_peer_check_delete(struct nhrp_peer *p) { - char buf[2][256]; struct nhrp_interface *nifp = p->ifp->info; if (p->ref || notifier_active(&p->notifier_list)) return; - debugf(NHRP_DEBUG_COMMON, "Deleting peer ref:%d remote:%s local:%s", - p->ref, - sockunion2str(&p->vc->remote.nbma, buf[0], sizeof(buf[0])), - sockunion2str(&p->vc->local.nbma, buf[1], sizeof(buf[1]))); + debugf(NHRP_DEBUG_COMMON, "Deleting peer ref:%d remote:%pSU local:%pSU", + p->ref, &p->vc->remote.nbma, &p->vc->local.nbma); THREAD_OFF(p->t_fallback); hash_release(nifp->peer_hash, p); @@ -326,16 +323,13 @@ void nhrp_peer_notify_del(struct nhrp_peer *p, struct notifier_block *n) void nhrp_peer_send(struct nhrp_peer *p, struct zbuf *zb) { - char buf[2][256]; - nhrp_packet_debug(zb, "Send"); if (!p->online) return; - debugf(NHRP_DEBUG_KERNEL, "PACKET: Send %s -> %s", - sockunion2str(&p->vc->local.nbma, buf[0], sizeof(buf[0])), - sockunion2str(&p->vc->remote.nbma, buf[1], sizeof(buf[1]))); + debugf(NHRP_DEBUG_KERNEL, "PACKET: Send %pSU -> %pSU", + &p->vc->local.nbma, &p->vc->remote.nbma); os_sendmsg(zb->head, zbuf_used(zb), p->ifp->ifindex, sockunion_get_addr(&p->vc->remote.nbma), @@ -658,7 +652,6 @@ void nhrp_peer_send_indication(struct interface *ifp, uint16_t protocol_type, struct nhrp_afi_data *if_ad; struct nhrp_packet_header *hdr; struct nhrp_peer *p; - char buf[2][SU_ADDRSTRLEN]; if (!nifp->enabled) return; @@ -673,17 +666,14 @@ void nhrp_peer_send_indication(struct interface *ifp, uint16_t protocol_type, if_ad = &nifp->afi[family2afi(sockunion_family(&dst))]; if (!(if_ad->flags & NHRP_IFF_REDIRECT)) { debugf(NHRP_DEBUG_COMMON, - "Send Traffic Indication to %s about packet to %s ignored", - sockunion2str(&p->vc->remote.nbma, buf[0], - sizeof(buf[0])), - sockunion2str(&dst, buf[1], sizeof(buf[1]))); + "Send Traffic Indication to %pSU about packet to %pSU ignored", + &p->vc->remote.nbma, &dst); return; } debugf(NHRP_DEBUG_COMMON, - "Send Traffic Indication to %s (online=%d) about packet to %s", - sockunion2str(&p->vc->remote.nbma, buf[0], sizeof(buf[0])), - p->online, sockunion2str(&dst, buf[1], sizeof(buf[1]))); + "Send Traffic Indication to %pSU (online=%d) about packet to %pSU", + &p->vc->remote.nbma, p->online, &dst); /* Create reply */ zb = zbuf_alloc(1500); @@ -705,16 +695,14 @@ static void nhrp_handle_error_ind(struct nhrp_packet_parser *pp) struct nhrp_packet_header *hdr; struct nhrp_reqid *reqid; union sockunion src_nbma, src_proto, dst_proto; - char buf[2][SU_ADDRSTRLEN]; hdr = nhrp_packet_pull(&origmsg, &src_nbma, &src_proto, &dst_proto); if (!hdr) return; debugf(NHRP_DEBUG_COMMON, - "Error Indication from %s about packet to %s ignored", - sockunion2str(&pp->src_proto, buf[0], sizeof(buf[0])), - sockunion2str(&dst_proto, buf[1], sizeof(buf[1]))); + "Error Indication from %pSU about packet to %pSU ignored", + &pp->src_proto, &dst_proto); reqid = nhrp_reqid_lookup(&nhrp_packet_reqid, htonl(hdr->u.request_id)); if (reqid) @@ -724,16 +712,14 @@ static void nhrp_handle_error_ind(struct nhrp_packet_parser *pp) static void nhrp_handle_traffic_ind(struct nhrp_packet_parser *p) { union sockunion dst; - char buf[2][SU_ADDRSTRLEN]; if (!parse_ether_packet(&p->payload, htons(p->hdr->protocol_type), NULL, &dst)) return; debugf(NHRP_DEBUG_COMMON, - "Traffic Indication from %s about packet to %s: %s", - sockunion2str(&p->src_proto, buf[0], sizeof(buf[0])), - sockunion2str(&dst, buf[1], sizeof(buf[1])), + "Traffic Indication from %pSU about packet to %pSU: %s", + &p->src_proto, &dst, (p->if_ad->flags & NHRP_IFF_SHORTCUT) ? "trying shortcut" : "ignored"); @@ -929,7 +915,6 @@ struct nhrp_route_info { void nhrp_peer_recv(struct nhrp_peer *p, struct zbuf *zb) { - char buf[2][SU_ADDRSTRLEN]; struct nhrp_packet_header *hdr; struct nhrp_vc *vc = p->vc; struct interface *ifp = p->ifp; @@ -942,9 +927,8 @@ void nhrp_peer_recv(struct nhrp_peer *p, struct zbuf *zb) unsigned paylen, extoff, extlen, realsize; afi_t nbma_afi, proto_afi; - debugf(NHRP_DEBUG_KERNEL, "PACKET: Recv %s -> %s", - sockunion2str(&vc->remote.nbma, buf[0], sizeof(buf[0])), - sockunion2str(&vc->local.nbma, buf[1], sizeof(buf[1]))); + debugf(NHRP_DEBUG_KERNEL, "PACKET: Recv %pSU -> %pSU", &vc->remote.nbma, + &vc->local.nbma); if (!p->online) { info = "peer not online"; @@ -975,10 +959,9 @@ void nhrp_peer_recv(struct nhrp_peer *p, struct zbuf *zb) || packet_types[hdr->type].type == PACKET_UNKNOWN || htons(hdr->packet_size) > realsize) { zlog_info( - "From %s: error: packet type %d, version %d, AFI %d, proto %x, size %d (real size %d)", - sockunion2str(&vc->remote.nbma, buf[0], sizeof(buf[0])), - (int)hdr->type, (int)hdr->version, (int)nbma_afi, - (int)htons(hdr->protocol_type), + "From %pSU: error: packet type %d, version %d, AFI %d, proto %x, size %d (real size %d)", + &vc->remote.nbma, (int)hdr->type, (int)hdr->version, + (int)nbma_afi, (int)htons(hdr->protocol_type), (int)htons(hdr->packet_size), (int)realsize); goto drop; } @@ -1055,10 +1038,7 @@ void nhrp_peer_recv(struct nhrp_peer *p, struct zbuf *zb) drop: if (info) { - zlog_info( - "From %s: error: %s", - sockunion2str(&vc->remote.nbma, buf[0], sizeof(buf[0])), - info); + zlog_info("From %pSU: error: %s", &vc->remote.nbma, info); } if (peer) nhrp_peer_unref(peer); diff --git a/nhrpd/nhrp_route.c b/nhrpd/nhrp_route.c index 334f468c18..737772dbc7 100644 --- a/nhrpd/nhrp_route.c +++ b/nhrpd/nhrp_route.c @@ -200,7 +200,6 @@ int nhrp_route_read(ZAPI_CALLBACK_ARGS) struct zapi_nexthop *api_nh; struct interface *ifp = NULL; union sockunion nexthop_addr; - char buf[PREFIX_STRLEN]; int added; if (zapi_route_decode(zclient->ibuf, &api) < 0) @@ -233,9 +232,8 @@ int nhrp_route_read(ZAPI_CALLBACK_ARGS) } added = (cmd == ZEBRA_REDISTRIBUTE_ROUTE_ADD); - debugf(NHRP_DEBUG_ROUTE, "if-route-%s: %pFX via %s dev %s", - added ? "add" : "del", &api.prefix, - sockunion2str(&nexthop_addr, buf, sizeof(buf)), + debugf(NHRP_DEBUG_ROUTE, "if-route-%s: %pFX via %pSU dev %s", + added ? "add" : "del", &api.prefix, &nexthop_addr, ifp ? ifp->name : "(none)"); nhrp_route_update_zebra(&api.prefix, &nexthop_addr, added ? ifp : NULL); diff --git a/nhrpd/nhrp_shortcut.c b/nhrpd/nhrp_shortcut.c index fbb883185a..ef3be82ca9 100644 --- a/nhrpd/nhrp_shortcut.c +++ b/nhrpd/nhrp_shortcut.c @@ -94,8 +94,6 @@ static void nhrp_shortcut_update_binding(struct nhrp_shortcut *s, enum nhrp_cache_type type, struct nhrp_cache *c, int holding_time) { - char buf[2][PREFIX_STRLEN]; - s->type = type; if (c != s->cache) { if (s->cache) { @@ -111,13 +109,9 @@ static void nhrp_shortcut_update_binding(struct nhrp_shortcut *s, * change */ s->route_installed = 0; debugf(NHRP_DEBUG_ROUTE, - "Shortcut: forcing renewal of zebra announce on prefix change peer %s ht %u cur nbma %s dev %s", - sockunion2str(&s->cache->remote_addr, - buf[0], sizeof(buf[0])), - holding_time, - sockunion2str( - &s->cache->cur.remote_nbma_natoa, - buf[1], sizeof(buf[1])), + "Shortcut: forcing renewal of zebra announce on prefix change peer %pSU ht %u cur nbma %pSU dev %s", + &s->cache->remote_addr, holding_time, + &s->cache->cur.remote_nbma_natoa, s->cache->ifp->name); nhrp_shortcut_cache_notify(&s->cache_notifier, NOTIFY_CACHE_UP); @@ -255,9 +249,9 @@ static void nhrp_shortcut_recv_resolution_rep(struct nhrp_reqid *reqid, prefix2sockunion(s->p, &cie_proto); if (!sockunion_same(&cie_proto, &pp->dst_proto)) { debugf(NHRP_DEBUG_COMMON, - "Shortcut: Warning dst_proto altered from %s to %s", - sockunion2str(&cie_proto, buf[0], sizeof(buf[0])), - sockunion2str(&pp->dst_proto, buf[1], sizeof(buf[1]))); + "Shortcut: Warning dst_proto altered from %pSU to %pSU", + &cie_proto, &pp->dst_proto); + ; } /* One or more CIEs should be given as reply, we support only one */ @@ -287,11 +281,8 @@ static void nhrp_shortcut_recv_resolution_rep(struct nhrp_reqid *reqid, } debugf(NHRP_DEBUG_COMMON, - "Shortcut: %pFX is at proto %s dst_proto %s cie-nbma %s nat-nbma %s cie-holdtime %d", - &prefix, sockunion2str(proto, buf[0], sizeof(buf[0])), - sockunion2str(&pp->dst_proto, buf[1], sizeof(buf[1])), - sockunion2str(&cie_nbma, buf[2], sizeof(buf[2])), - sockunion2str(&nat_nbma, buf[3], sizeof(buf[3])), + "Shortcut: %pFX is at proto %pSU dst_proto %pSU cie-nbma %pSU nat-nbma %pSU cie-holdtime %d", + &prefix, proto, &pp->dst_proto, &cie_nbma, &nat_nbma, htons(cie->holding_time)); /* Update cache entry for the protocol to nbma binding */ diff --git a/nhrpd/nhrp_vc.c b/nhrpd/nhrp_vc.c index 6567b231a9..d538163e90 100644 --- a/nhrpd/nhrp_vc.c +++ b/nhrpd/nhrp_vc.c @@ -100,7 +100,6 @@ static void nhrp_vc_ipsec_reset(struct nhrp_vc *vc) int nhrp_vc_ipsec_updown(uint32_t child_id, struct nhrp_vc *vc) { - char buf[2][SU_ADDRSTRLEN]; struct child_sa *sa = NULL, *lsa; uint32_t child_hash = child_id % array_size(childlist_head); int abort_migration = 0; @@ -140,10 +139,8 @@ int nhrp_vc_ipsec_updown(uint32_t child_id, struct nhrp_vc *vc) if (sa->vc && vc) { /* Notify old VC of migration */ sa->vc->abort_migration = 0; - debugf(NHRP_DEBUG_COMMON, "IPsec NBMA change of %s to %s", - sockunion2str(&sa->vc->remote.nbma, buf[0], - sizeof(buf[0])), - sockunion2str(&vc->remote.nbma, buf[1], sizeof(buf[1]))); + debugf(NHRP_DEBUG_COMMON, "IPsec NBMA change of %pSU to %pSU", + &sa->vc->remote.nbma, &vc->remote.nbma); nhrp_vc_update(sa->vc, NOTIFY_VC_IPSEC_UPDATE_NBMA); abort_migration = sa->vc->abort_migration; } diff --git a/ospfd/ospf_flood.c b/ospfd/ospf_flood.c index 5f74984c66..caba03c1b5 100644 --- a/ospfd/ospf_flood.c +++ b/ospfd/ospf_flood.c @@ -537,11 +537,9 @@ static int ospf_flood_through_interface(struct ospf_interface *oi, if (!CHECK_FLAG(onbr->options, OSPF_OPTION_O)) { if (IS_DEBUG_OSPF(lsa, LSA_FLOODING)) zlog_debug( - "%s: Skipping neighbor %s via %s -- Not Opaque-capable.", + "%s: Skipping neighbor %s via %pI4 -- Not Opaque-capable.", __func__, IF_NAME(oi), - inet_ntop(AF_INET, - &onbr->router_id, buf, - sizeof(buf))); + &onbr->router_id); continue; } } @@ -557,11 +555,9 @@ static int ospf_flood_through_interface(struct ospf_interface *oi, &onbr->router_id)) { if (IS_DEBUG_OSPF(lsa, LSA_FLOODING)) zlog_debug( - "%s: Skipping neighbor %s via %s -- inbr == onbr.", + "%s: Skipping neighbor %s via %pI4 -- inbr == onbr.", __func__, IF_NAME(oi), - inet_ntop(AF_INET, - &inbr->router_id, buf, - sizeof(buf))); + &inbr->router_id); continue; } } else { @@ -573,11 +569,9 @@ static int ospf_flood_through_interface(struct ospf_interface *oi, &onbr->router_id)) { if (IS_DEBUG_OSPF(lsa, LSA_FLOODING)) zlog_debug( - "%s: Skipping neighbor %s via %s -- lsah->adv_router == onbr.", + "%s: Skipping neighbor %s via %pI4 -- lsah->adv_router == onbr.", __func__, IF_NAME(oi), - inet_ntop(AF_INET, - &onbr->router_id, buf, - sizeof(buf))); + &onbr->router_id); continue; } } diff --git a/ospfd/ospf_packet.c b/ospfd/ospf_packet.c index 343e406f28..0fd4803c79 100644 --- a/ospfd/ospf_packet.c +++ b/ospfd/ospf_packet.c @@ -1881,20 +1881,10 @@ static void ospf_ls_upd(struct ospf *ospf, struct ip *iph, struct ospf_lsa *ls_ret, *current; int ret = 1; - if (IS_DEBUG_OSPF_NSSA) { - char buf1[INET_ADDRSTRLEN]; - char buf2[INET_ADDRSTRLEN]; - char buf3[INET_ADDRSTRLEN]; - - zlog_debug("LSA Type-%d from %s, ID: %s, ADV: %s", - lsa->data->type, - inet_ntop(AF_INET, &ospfh->router_id, buf1, - INET_ADDRSTRLEN), - inet_ntop(AF_INET, &lsa->data->id, buf2, - INET_ADDRSTRLEN), - inet_ntop(AF_INET, &lsa->data->adv_router, - buf3, INET_ADDRSTRLEN)); - } + if (IS_DEBUG_OSPF_NSSA) + zlog_debug("LSA Type-%d from %pI4, ID: %pI4, ADV: %pI4", + lsa->data->type, &ospfh->router_id, + &lsa->data->id, &lsa->data->adv_router); listnode_delete(lsas, lsa); /* We don't need it in list anymore */ @@ -1940,19 +1930,11 @@ static void ospf_ls_upd(struct ospf *ospf, struct ip *iph, if (lsa->data->type == OSPF_ROUTER_LSA) if (!IPV4_ADDR_SAME(&lsa->data->id, &lsa->data->adv_router)) { - char buf1[INET_ADDRSTRLEN]; - char buf2[INET_ADDRSTRLEN]; - char buf3[INET_ADDRSTRLEN]; - - flog_err(EC_OSPF_ROUTER_LSA_MISMATCH, - "Incoming Router-LSA from %s with Adv-ID[%s] != LS-ID[%s]", - inet_ntop(AF_INET, &ospfh->router_id, - buf1, INET_ADDRSTRLEN), - inet_ntop(AF_INET, &lsa->data->id, - buf2, INET_ADDRSTRLEN), - inet_ntop(AF_INET, - &lsa->data->adv_router, buf3, - INET_ADDRSTRLEN)); + flog_err( + EC_OSPF_ROUTER_LSA_MISMATCH, + "Incoming Router-LSA from %pI4 with Adv-ID[%pI4] != LS-ID[%pI4]", + &ospfh->router_id, &lsa->data->id, + &lsa->data->adv_router); flog_err( EC_OSPF_DOMAIN_CORRUPT, "OSPF domain compromised by attack or corruption. Verify correct operation of -ALL- OSPF routers."); @@ -3045,17 +3027,11 @@ static enum ospf_read_return_enum ospf_read_helper(struct ospf *ospf) /* If incoming interface is passive one, ignore it. */ if (oi && OSPF_IF_PASSIVE_STATUS(oi) == OSPF_IF_PASSIVE) { - char buf[3][INET_ADDRSTRLEN]; - if (IS_DEBUG_OSPF_EVENT) zlog_debug( - "ignoring packet from router %s sent to %s, received on a passive interface, %s", - inet_ntop(AF_INET, &ospfh->router_id, buf[0], - sizeof(buf[0])), - inet_ntop(AF_INET, &iph->ip_dst, buf[1], - sizeof(buf[1])), - inet_ntop(AF_INET, &oi->address->u.prefix4, - buf[2], sizeof(buf[2]))); + "ignoring packet from router %pI4 sent to %pI4, received on a passive interface, %pI4", + &ospfh->router_id, &iph->ip_dst, + &oi->address->u.prefix4); if (iph->ip_dst.s_addr == htonl(OSPF_ALLSPFROUTERS)) { /* Try to fix multicast membership. @@ -3097,16 +3073,11 @@ static enum ospf_read_return_enum ospf_read_helper(struct ospf *ospf) &iph->ip_src, ifp->name); return OSPF_READ_CONTINUE; } else if (oi->state == ISM_Down) { - char buf[2][INET_ADDRSTRLEN]; - flog_warn( EC_OSPF_PACKET, - "Ignoring packet from %s to %s received on interface that is down [%s]; interface flags are %s", - inet_ntop(AF_INET, &iph->ip_src, buf[0], - sizeof(buf[0])), - inet_ntop(AF_INET, &iph->ip_dst, buf[1], - sizeof(buf[1])), - ifp->name, if_flag_dump(ifp->flags)); + "Ignoring packet from %pI4 to %pI4 received on interface that is down [%s]; interface flags are %s", + &iph->ip_src, &iph->ip_dst, ifp->name, + if_flag_dump(ifp->flags)); /* Fix multicast memberships? */ if (iph->ip_dst.s_addr == htonl(OSPF_ALLSPFROUTERS)) OI_MEMBER_JOINED(oi, MEMBER_ALLROUTERS); diff --git a/ospfd/ospf_spf.c b/ospfd/ospf_spf.c index 82acd0829c..6cd6a47098 100644 --- a/ospfd/ospf_spf.c +++ b/ospfd/ospf_spf.c @@ -251,15 +251,11 @@ static void ospf_vertex_dump(const char *msg, struct vertex *v, struct vertex_parent *vp; for (ALL_LIST_ELEMENTS_RO(v->parents, node, vp)) { - char buf1[BUFSIZ]; - if (vp) { zlog_debug( - "parent %pI4 backlink %d nexthop %s lsa pos %d", - &vp->parent->lsa->id, - vp->backlink, - inet_ntop(AF_INET, &vp->nexthop->router, - buf1, BUFSIZ), + "parent %pI4 backlink %d nexthop %pI4 lsa pos %d", + &vp->parent->lsa->id, vp->backlink, + &vp->nexthop->router, vp->nexthop->lsa_pos); } } @@ -707,14 +703,9 @@ static void ospf_spf_add_parent(struct vertex *v, struct vertex *w, else w->distance = distance; - if (IS_DEBUG_OSPF_EVENT) { - char buf[2][INET_ADDRSTRLEN]; - zlog_debug( - "%s: Adding %s as parent of %s", __func__, - inet_ntop(AF_INET, &v->lsa->id, buf[0], sizeof(buf[0])), - inet_ntop(AF_INET, &w->lsa->id, buf[1], - sizeof(buf[1]))); - } + if (IS_DEBUG_OSPF_EVENT) + zlog_debug("%s: Adding %pI4 as parent of %pI4", __func__, + &v->lsa->id, &w->lsa->id); /* * Adding parent for a new, better path: flush existing parents from W. @@ -805,8 +796,6 @@ static unsigned int ospf_nexthop_calculation(struct ospf_area *area, struct vertex_nexthop *nh, *lnh; struct vertex_parent *vp; unsigned int added = 0; - char buf1[BUFSIZ]; - char buf2[BUFSIZ]; if (IS_DEBUG_OSPF_EVENT) { zlog_debug("ospf_nexthop_calculation(): Start"); @@ -828,14 +817,11 @@ static unsigned int ospf_nexthop_calculation(struct ospf_area *area, /* we *must* be supplied with the link data */ assert(l != NULL); - if (IS_DEBUG_OSPF_EVENT) { + if (IS_DEBUG_OSPF_EVENT) zlog_debug( - "%s: considering link type:%d link_id:%s link_data:%s", - __func__, l->m[0].type, - inet_ntop(AF_INET, &l->link_id, buf1, BUFSIZ), - inet_ntop(AF_INET, &l->link_data, buf2, - BUFSIZ)); - } + "%s: considering link type:%d link_id:%pI4 link_data:%pI4", + __func__, l->m[0].type, &l->link_id, + &l->link_data); if (w->type == OSPF_VERTEX_ROUTER) { /* @@ -852,15 +838,10 @@ static unsigned int ospf_nexthop_calculation(struct ospf_area *area, lsa_pos); if (!oi) { zlog_debug( - "%s: OI not found in LSA: lsa_pos: %d link_id:%s link_data:%s", + "%s: OI not found in LSA: lsa_pos: %d link_id:%pI4 link_data:%pI4", __func__, lsa_pos, - inet_ntop(AF_INET, - &l->link_id, - buf1, BUFSIZ), - inet_ntop(AF_INET, - &l->link_data, - buf2, - BUFSIZ)); + &l->link_id, + &l->link_data); return 0; } } diff --git a/ripd/ripd.c b/ripd/ripd.c index a276dedec8..4a56efb6f8 100644 --- a/ripd/ripd.c +++ b/ripd/ripd.c @@ -698,7 +698,6 @@ static void rip_packet_dump(struct rip_packet *packet, int size, caddr_t lim; struct rte *rte; const char *command_str; - char pbuf[BUFSIZ], nbuf[BUFSIZ]; uint8_t netmask = 0; uint8_t *p; @@ -766,24 +765,18 @@ static void rip_packet_dump(struct rip_packet *packet, int size, } } else zlog_debug( - " %s/%d -> %s family %d tag %" ROUTE_TAG_PRI + " %pI4/%d -> %pI4 family %d tag %" ROUTE_TAG_PRI " metric %ld", - inet_ntop(AF_INET, &rte->prefix, pbuf, - BUFSIZ), - netmask, - inet_ntop(AF_INET, &rte->nexthop, nbuf, - BUFSIZ), + &rte->prefix, netmask, &rte->nexthop, ntohs(rte->family), (route_tag_t)ntohs(rte->tag), (unsigned long)ntohl(rte->metric)); } else { - zlog_debug( - " %s family %d tag %" ROUTE_TAG_PRI - " metric %ld", - inet_ntop(AF_INET, &rte->prefix, pbuf, BUFSIZ), - ntohs(rte->family), - (route_tag_t)ntohs(rte->tag), - (unsigned long)ntohl(rte->metric)); + zlog_debug(" %pI4 family %d tag %" ROUTE_TAG_PRI + " metric %ld", + &rte->prefix, ntohs(rte->family), + (route_tag_t)ntohs(rte->tag), + (unsigned long)ntohl(rte->metric)); } } } diff --git a/ripngd/ripngd.c b/ripngd/ripngd.c index a9f570598f..37e23046e8 100644 --- a/ripngd/ripngd.c +++ b/ripngd/ripngd.c @@ -351,8 +351,6 @@ void ripng_packet_dump(struct ripng_packet *packet, int size, static void ripng_nexthop_rte(struct rte *rte, struct sockaddr_in6 *from, struct ripng_nexthop *nexthop) { - char buf[INET6_BUFSIZ]; - /* Logging before checking RTE. */ if (IS_RIPNG_DEBUG_RECV) zlog_debug("RIPng nexthop RTE address %s tag %" ROUTE_TAG_PRI @@ -398,9 +396,8 @@ static void ripng_nexthop_rte(struct rte *rte, struct sockaddr_in6 *from, information is ignored, a possibly sub-optimal, but absolutely valid, route may be taken. If the received next hop address is not a link-local address, it should be treated as 0:0:0:0:0:0:0:0. */ - zlog_warn("RIPng nexthop RTE with non link-local address %s from %s", - inet6_ntoa(rte->addr), - inet_ntop(AF_INET6, &from->sin6_addr, buf, INET6_BUFSIZ)); + zlog_warn("RIPng nexthop RTE with non link-local address %s from %pI6", + inet6_ntoa(rte->addr), &from->sin6_addr); nexthop->flag = RIPNG_NEXTHOP_UNSPEC; memset(&nexthop->address, 0, sizeof(struct in6_addr)); diff --git a/watchfrr/watchfrr.c b/watchfrr/watchfrr.c index 441320b193..5f4d564507 100644 --- a/watchfrr/watchfrr.c +++ b/watchfrr/watchfrr.c @@ -316,7 +316,7 @@ static pid_t run_background(char *shell_cmd) /* Use separate process group so child processes can be killed * easily. */ if (setpgid(0, 0) < 0) - zlog_warn("warning: setpgid(0,0) failed: %s", + zlog_warn("setpgid(0,0) failed: %s", safe_strerror(errno)); { char shell[] = "sh"; @@ -356,7 +356,7 @@ static int restart_kill(struct thread *t_kill) time_elapsed(&delay, &restart->time); zlog_warn( - "Warning: %s %s child process %d still running after %ld seconds, sending signal %d", + "%s %s child process %d still running after %ld seconds, sending signal %d", restart->what, restart->name, (int)restart->pid, (long)delay.tv_sec, (restart->kills ? SIGKILL : SIGTERM)); kill(-restart->pid, (restart->kills ? SIGKILL : SIGTERM)); @@ -423,7 +423,7 @@ static void sigchild(void) what = "background"; } if (WIFSTOPPED(status)) - zlog_warn("warning: %s %s process %d is stopped", what, name, + zlog_warn("%s %s process %d is stopped", what, name, (int)child); else if (WIFSIGNALED(status)) zlog_warn("%s %s process %d terminated due to signal %d", what, |
