diff options
author | David Lamparter <equinox@diac24.net> | 2021-03-12 02:44:45 +0100 |
---|---|---|
committer | David Lamparter <equinox@diac24.net> | 2021-03-14 22:56:07 +0100 |
commit | ef7b8be4592dae660b14ea4c73e5160f99482da7 (patch) | |
tree | 8b069a2458118db75c1b15ebc69405ea4624b6ab | |
parent | fpm: use printfrr exts (diff) | |
download | frr-ef7b8be4592dae660b14ea4c73e5160f99482da7.tar.xz frr-ef7b8be4592dae660b14ea4c73e5160f99482da7.zip |
zebra: use printfrr exts in EVPN/VXLAN code
Signed-off-by: David Lamparter <equinox@diac24.net>
-rw-r--r-- | zebra/rt_netlink.c | 57 | ||||
-rw-r--r-- | zebra/zebra_dplane.c | 23 | ||||
-rw-r--r-- | zebra/zebra_evpn.c | 36 | ||||
-rw-r--r-- | zebra/zebra_evpn_mac.c | 185 | ||||
-rw-r--r-- | zebra/zebra_evpn_neigh.c | 263 | ||||
-rw-r--r-- | zebra/zebra_evpn_neigh.h | 20 | ||||
-rw-r--r-- | zebra/zebra_vxlan.c | 96 |
7 files changed, 213 insertions, 467 deletions
diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c index 93961686f..fdeef2c88 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c @@ -2839,7 +2839,6 @@ static int netlink_macfdb_change(struct nlmsghdr *h, int len, ns_id_t ns_id) vlanid_t vid = 0; struct in_addr vtep_ip; int vid_present = 0, dst_present = 0; - char buf[ETHER_ADDR_STRLEN]; char vid_buf[20]; char dst_buf[30]; bool sticky; @@ -2918,11 +2917,10 @@ static int netlink_macfdb_change(struct nlmsghdr *h, int len, ns_id_t ns_id) } if (IS_ZEBRA_DEBUG_KERNEL) - zlog_debug("Rx %s AF_BRIDGE IF %u%s st 0x%x fl 0x%x MAC %s%s nhg %d", + zlog_debug("Rx %s AF_BRIDGE IF %u%s st 0x%x fl 0x%x MAC %pEA%s nhg %d", nl_msg_type_to_str(h->nlmsg_type), ndm->ndm_ifindex, vid_present ? vid_buf : "", - ndm->ndm_state, ndm->ndm_flags, - prefix_mac2str(&mac, buf, sizeof(buf)), + ndm->ndm_state, ndm->ndm_flags, &mac, dst_present ? dst_buf : "", nhg_id); /* The interface should exist. */ @@ -3123,7 +3121,6 @@ static int netlink_request_specific_mac_in_bridge(struct zebra_ns *zns, char buf[256]; } req; struct zebra_if *br_zif; - char buf[ETHER_ADDR_STRLEN]; memset(&req, 0, sizeof(req)); req.n.nlmsg_len = NLMSG_LENGTH(sizeof(struct ndmsg)); @@ -3142,11 +3139,10 @@ static int netlink_request_specific_mac_in_bridge(struct zebra_ns *zns, if (IS_ZEBRA_DEBUG_KERNEL) zlog_debug( - "%s: Tx family %s IF %s(%u) vrf %s(%u) MAC %s vid %u", + "%s: Tx family %s IF %s(%u) vrf %s(%u) MAC %pEA vid %u", __func__, nl_family_to_str(req.ndm.ndm_family), br_if->name, br_if->ifindex, - vrf_id_to_name(br_if->vrf_id), br_if->vrf_id, - prefix_mac2str(mac, buf, sizeof(buf)), vid); + vrf_id_to_name(br_if->vrf_id), br_if->vrf_id, mac, vid); return netlink_request(&zns->netlink_cmd, &req); } @@ -3231,8 +3227,6 @@ ssize_t netlink_macfdb_update_ctx(struct zebra_dplane_ctx *ctx, void *data, SET_IPADDR_V4(&vtep_ip); if (IS_ZEBRA_DEBUG_KERNEL) { - char ipbuf[PREFIX_STRLEN]; - char buf[ETHER_ADDR_STRLEN]; char vid_buf[20]; const struct ethaddr *mac = dplane_ctx_mac_get_addr(ctx); @@ -3243,12 +3237,11 @@ ssize_t netlink_macfdb_update_ctx(struct zebra_dplane_ctx *ctx, void *data, vid_buf[0] = '\0'; zlog_debug( - "Tx %s family %s IF %s(%u)%s %sMAC %s dst %s nhg %u%s%s%s%s%s", + "Tx %s family %s IF %s(%u)%s %sMAC %pEA dst %pIA nhg %u%s%s%s%s%s", nl_msg_type_to_str(cmd), nl_family_to_str(AF_BRIDGE), dplane_ctx_get_ifname(ctx), dplane_ctx_get_ifindex(ctx), vid_buf, dplane_ctx_mac_is_sticky(ctx) ? "sticky " : "", - prefix_mac2str(mac, buf, sizeof(buf)), - ipaddr2str(&vtep_ip, ipbuf, sizeof(ipbuf)), nhg_id, + mac, &vtep_ip, nhg_id, (update_flags & DPLANE_MAC_REMOTE) ? " rem" : "", (update_flags & DPLANE_MAC_WAS_STATIC) ? " clr_sync" : "", @@ -3309,7 +3302,6 @@ static int netlink_ipneigh_change(struct nlmsghdr *h, int len, ns_id_t ns_id) struct ipaddr ip; struct vrf *vrf; char buf[ETHER_ADDR_STRLEN]; - char buf2[INET6_ADDRSTRLEN]; int mac_present = 0; bool is_ext; bool is_router; @@ -3415,11 +3407,11 @@ static int netlink_ipneigh_change(struct nlmsghdr *h, int len, ns_id_t ns_id) if (IS_ZEBRA_DEBUG_KERNEL) zlog_debug( - "Rx %s family %s IF %s(%u) vrf %s(%u) IP %s MAC %s state 0x%x flags 0x%x ext_flags 0x%x", + "Rx %s family %s IF %s(%u) vrf %s(%u) IP %pIA MAC %s state 0x%x flags 0x%x ext_flags 0x%x", nl_msg_type_to_str(h->nlmsg_type), nl_family_to_str(ndm->ndm_family), ifp->name, ndm->ndm_ifindex, VRF_LOGNAME(vrf), ifp->vrf_id, - ipaddr2str(&ip, buf2, sizeof(buf2)), + &ip, mac_present ? prefix_mac2str(&mac, buf, sizeof(buf)) : "", @@ -3451,11 +3443,11 @@ static int netlink_ipneigh_change(struct nlmsghdr *h, int len, ns_id_t ns_id) } if (IS_ZEBRA_DEBUG_KERNEL) - zlog_debug("Rx %s family %s IF %s(%u) vrf %s(%u) IP %s", + zlog_debug("Rx %s family %s IF %s(%u) vrf %s(%u) IP %pIA", nl_msg_type_to_str(h->nlmsg_type), nl_family_to_str(ndm->ndm_family), ifp->name, ndm->ndm_ifindex, VRF_LOGNAME(vrf), ifp->vrf_id, - ipaddr2str(&ip, buf2, sizeof(buf2))); + &ip); /* Process the delete - it may result in re-adding the neighbor if it is * a valid "remote" neighbor. @@ -3582,14 +3574,11 @@ static int netlink_request_specific_neigh_in_vlan(struct zebra_ns *zns, nl_attr_put(&req.n, sizeof(req), NDA_DST, &ip->ip.addr, ipa_len); - if (IS_ZEBRA_DEBUG_KERNEL) { - char buf[INET6_ADDRSTRLEN]; - - zlog_debug("%s: Tx %s family %s IF %u IP %s flags 0x%x", + if (IS_ZEBRA_DEBUG_KERNEL) + zlog_debug("%s: Tx %s family %s IF %u IP %pIA flags 0x%x", __func__, nl_msg_type_to_str(type), - nl_family_to_str(req.ndm.ndm_family), ifindex, - ipaddr2str(ip, buf, sizeof(buf)), req.n.nlmsg_flags); - } + nl_family_to_str(req.ndm.ndm_family), ifindex, ip, + req.n.nlmsg_flags); return netlink_request(&zns->netlink_cmd, &req); } @@ -3600,7 +3589,6 @@ int netlink_neigh_read_specific_ip(struct ipaddr *ip, int ret = 0; struct zebra_ns *zns; struct zebra_vrf *zvrf = zebra_vrf_lookup_by_id(vlan_if->vrf_id); - char buf[INET6_ADDRSTRLEN]; struct zebra_dplane_info dp_info; zns = zvrf->zns; @@ -3608,9 +3596,8 @@ int netlink_neigh_read_specific_ip(struct ipaddr *ip, zebra_dplane_info_from_zns(&dp_info, zns, true /*is_cmd*/); if (IS_ZEBRA_DEBUG_KERNEL) - zlog_debug("%s: neigh request IF %s(%u) IP %s vrf %s(%u)", - __func__, vlan_if->name, vlan_if->ifindex, - ipaddr2str(ip, buf, sizeof(buf)), + zlog_debug("%s: neigh request IF %s(%u) IP %pIA vrf %s(%u)", + __func__, vlan_if->name, vlan_if->ifindex, ip, vrf_id_to_name(vlan_if->vrf_id), vlan_if->vrf_id); ret = netlink_request_specific_neigh_in_vlan(zns, RTM_GETNEIGH, ip, @@ -3702,18 +3689,12 @@ static ssize_t netlink_neigh_update_ctx(const struct zebra_dplane_ctx *ctx, if (update_flags & DPLANE_NEIGH_SET_STATIC) ext_flags |= NTF_E_MH_PEER_SYNC; } - if (IS_ZEBRA_DEBUG_KERNEL) { - char buf[INET6_ADDRSTRLEN]; - char buf2[ETHER_ADDR_STRLEN]; - + if (IS_ZEBRA_DEBUG_KERNEL) zlog_debug( - "Tx %s family %s IF %s(%u) Neigh %s MAC %s flags 0x%x state 0x%x %sext_flags 0x%x", + "Tx %s family %s IF %s(%u) Neigh %pIA MAC %pEA flags 0x%x state 0x%x %sext_flags 0x%x", nl_msg_type_to_str(cmd), nl_family_to_str(family), dplane_ctx_get_ifname(ctx), dplane_ctx_get_ifindex(ctx), - ipaddr2str(ip, buf, sizeof(buf)), - mac ? prefix_mac2str(mac, buf2, sizeof(buf2)) : "null", - flags, state, ext ? "ext " : "", ext_flags); - } + ip, mac, flags, state, ext ? "ext " : "", ext_flags); return netlink_neigh_update_msg_encode( ctx, cmd, mac, ip, true, family, RTN_UNICAST, flags, state, diff --git a/zebra/zebra_dplane.c b/zebra/zebra_dplane.c index 82546ce18..4e63d08ac 100644 --- a/zebra/zebra_dplane.c +++ b/zebra/zebra_dplane.c @@ -3539,15 +3539,9 @@ mac_update_common(enum dplane_op_e op, int ret; struct zebra_dplane_ctx *ctx = NULL; - if (IS_ZEBRA_DEBUG_DPLANE_DETAIL) { - char buf1[ETHER_ADDR_STRLEN], buf2[PREFIX_STRLEN]; - - zlog_debug("init mac ctx %s: mac %s, ifp %s, vtep %s", - dplane_op2str(op), - prefix_mac2str(mac, buf1, sizeof(buf1)), - ifp->name, - inet_ntop(AF_INET, &vtep_ip, buf2, sizeof(buf2))); - } + if (IS_ZEBRA_DEBUG_DPLANE_DETAIL) + zlog_debug("init mac ctx %s: mac %pEA, ifp %s, vtep %pI4", + dplane_op2str(op), mac, ifp->name, &vtep_ip); ctx = dplane_ctx_alloc(); ctx->zd_op = op; @@ -3725,14 +3719,9 @@ neigh_update_internal(enum dplane_op_e op, struct zebra_dplane_ctx *ctx = NULL; struct zebra_ns *zns; - if (IS_ZEBRA_DEBUG_DPLANE_DETAIL) { - char buf1[ETHER_ADDR_STRLEN], buf2[PREFIX_STRLEN]; - - zlog_debug("init neigh ctx %s: ifp %s, mac %s, ip %s", - dplane_op2str(op), ifp->name, - prefix_mac2str(mac, buf1, sizeof(buf1)), - ipaddr2str(ip, buf2, sizeof(buf2))); - } + if (IS_ZEBRA_DEBUG_DPLANE_DETAIL) + zlog_debug("init neigh ctx %s: ifp %s, mac %pEA, ip %pIA", + dplane_op2str(op), ifp->name, mac, ip); ctx = dplane_ctx_alloc(); diff --git a/zebra/zebra_evpn.c b/zebra/zebra_evpn.c index d7076ccce..27a5a07e4 100644 --- a/zebra/zebra_evpn.c +++ b/zebra/zebra_evpn.c @@ -447,8 +447,6 @@ int zebra_evpn_gw_macip_add(struct interface *ifp, zebra_evpn_t *zevpn, int zebra_evpn_gw_macip_del(struct interface *ifp, zebra_evpn_t *zevpn, struct ipaddr *ip) { - char buf1[ETHER_ADDR_STRLEN]; - char buf2[INET6_ADDRSTRLEN]; zebra_neigh_t *n = NULL; zebra_mac_t *mac = NULL; @@ -461,11 +459,8 @@ int zebra_evpn_gw_macip_del(struct interface *ifp, zebra_evpn_t *zevpn, mac = zebra_evpn_mac_lookup(zevpn, &n->emac); if (!mac) { if (IS_ZEBRA_DEBUG_VXLAN) - zlog_debug("MAC %s doesn't exist for neigh %s on VNI %u", - prefix_mac2str(&n->emac, - buf1, sizeof(buf1)), - ipaddr2str(ip, buf2, sizeof(buf2)), - zevpn->vni); + zlog_debug("MAC %pEA doesn't exist for neigh %pIA on VNI %u", + &n->emac, ip, zevpn->vni); return -1; } @@ -476,10 +471,9 @@ int zebra_evpn_gw_macip_del(struct interface *ifp, zebra_evpn_t *zevpn, /* only need to delete the entry from bgp if we sent it before */ if (IS_ZEBRA_DEBUG_VXLAN) zlog_debug( - "%u:SVI %s(%u) VNI %u, sending GW MAC %s IP %s del to BGP", + "%u:SVI %s(%u) VNI %u, sending GW MAC %pEA IP %pIA del to BGP", ifp->vrf_id, ifp->name, ifp->ifindex, zevpn->vni, - prefix_mac2str(&(n->emac), buf1, sizeof(buf1)), - ipaddr2str(ip, buf2, sizeof(buf2))); + &n->emac, ip); /* Remove neighbor from BGP. */ zebra_evpn_neigh_send_del_to_client(zevpn->vni, &n->ip, &n->emac, @@ -1321,7 +1315,6 @@ zebra_evpn_process_sync_macip_add(zebra_evpn_t *zevpn, struct ethaddr *macaddr, uint8_t flags, uint32_t seq, esi_t *esi) { struct sync_mac_ip_ctx ctx; - char macbuf[ETHER_ADDR_STRLEN]; char ipbuf[INET6_ADDRSTRLEN]; bool sticky; bool remote_gw; @@ -1334,9 +1327,9 @@ zebra_evpn_process_sync_macip_add(zebra_evpn_t *zevpn, struct ethaddr *macaddr, if (IS_ZEBRA_DEBUG_VXLAN || IS_ZEBRA_DEBUG_EVPN_MH_NEIGH || IS_ZEBRA_DEBUG_EVPN_MH_MAC) zlog_debug( - "Ignore sync-macip vni %u mac %s%s%s%s%s", + "Ignore sync-macip vni %u mac %pEA%s%s%s%s", zevpn->vni, - prefix_mac2str(macaddr, macbuf, sizeof(macbuf)), + macaddr, ipa_len ? " IP " : "", ipa_len ? ipaddr2str(ipaddr, ipbuf, sizeof(ipbuf)) @@ -1455,7 +1448,6 @@ void process_remote_macip_del(vni_t vni, struct ethaddr *macaddr, struct zebra_ns *zns; struct zebra_l2info_vxlan *vxl; struct zebra_vrf *zvrf; - char buf[ETHER_ADDR_STRLEN]; char buf1[INET6_ADDRSTRLEN]; /* Locate EVPN hash entry - expected to exist. */ @@ -1485,9 +1477,8 @@ void process_remote_macip_del(vni_t vni, struct ethaddr *macaddr, if (n && !mac) { zlog_warn( - "Failed to locate MAC %s for neigh %s VNI %u upon remote MACIP DEL", - prefix_mac2str(macaddr, buf, sizeof(buf)), - ipaddr2str(ipaddr, buf1, sizeof(buf1)), vni); + "Failed to locate MAC %pEA for neigh %pIA VNI %u upon remote MACIP DEL", + macaddr, ipaddr, vni); return; } @@ -1503,8 +1494,8 @@ void process_remote_macip_del(vni_t vni, struct ethaddr *macaddr, if (CHECK_FLAG(mac->flags, ZEBRA_MAC_LOCAL) && CHECK_FLAG(mac->flags, ZEBRA_MAC_DEF_GW)) { zlog_warn( - "Ignore remote MACIP DEL VNI %u MAC %s%s%s as MAC is already configured as gateway MAC", - vni, prefix_mac2str(macaddr, buf, sizeof(buf)), + "Ignore remote MACIP DEL VNI %u MAC %pEA%s%s as MAC is already configured as gateway MAC", + vni, macaddr, ipa_len ? " IP " : "", ipa_len ? ipaddr2str(ipaddr, buf1, sizeof(buf1)) : ""); return; @@ -1525,11 +1516,8 @@ void process_remote_macip_del(vni_t vni, struct ethaddr *macaddr, && CHECK_FLAG(mac->flags, ZEBRA_MAC_REMOTE)) { if (IS_ZEBRA_DEBUG_VXLAN) zlog_debug( - "%s: MAC %s (flags 0x%x) is remote and duplicate, read kernel for local entry", - __func__, - prefix_mac2str(macaddr, buf, - sizeof(buf)), - mac->flags); + "%s: MAC %pEA (flags 0x%x) is remote and duplicate, read kernel for local entry", + __func__, macaddr, mac->flags); macfdb_read_specific_mac(zns, zif->brslave_info.br_if, macaddr, vxl->access_vlan); } diff --git a/zebra/zebra_evpn_mac.c b/zebra/zebra_evpn_mac.c index 142a199bd..b36e8034b 100644 --- a/zebra/zebra_evpn_mac.c +++ b/zebra/zebra_evpn_mac.c @@ -384,7 +384,6 @@ static int zebra_evpn_dad_mac_auto_recovery_exp(struct thread *t) zebra_evpn_t *zevpn = NULL; struct listnode *node = NULL; zebra_neigh_t *nbr = NULL; - char buf[ETHER_ADDR_STRLEN]; mac = THREAD_ARG(t); @@ -405,9 +404,8 @@ static int zebra_evpn_dad_mac_auto_recovery_exp(struct thread *t) char mac_buf[MAC_BUF_SIZE]; zlog_debug( - "%s: duplicate addr mac %s flags %slearn count %u host count %u auto recovery expired", - __func__, - prefix_mac2str(&mac->macaddr, buf, sizeof(buf)), + "%s: duplicate addr mac %pEA flags %slearn count %u host count %u auto recovery expired", + __func__, &mac->macaddr, zebra_evpn_zebra_mac_flag_dump(mac, mac_buf, sizeof(mac_buf)), mac->dad_count, listcount(mac->neigh_list)); @@ -466,8 +464,6 @@ static void zebra_evpn_dup_addr_detect_for_mac(struct zebra_vrf *zvrf, zebra_neigh_t *nbr; struct listnode *node = NULL; struct timeval elapsed = {0, 0}; - char buf[ETHER_ADDR_STRLEN]; - char buf1[INET6_ADDRSTRLEN]; bool reset_params = false; if (!(zebra_evpn_do_dup_addr_detect(zvrf) && do_dad)) @@ -482,9 +478,8 @@ static void zebra_evpn_dup_addr_detect_for_mac(struct zebra_vrf *zvrf, char mac_buf[MAC_BUF_SIZE]; zlog_debug( - "%s: duplicate addr MAC %s flags %sskip update to client, learn count %u recover time %u", - __func__, - prefix_mac2str(&mac->macaddr, buf, sizeof(buf)), + "%s: duplicate addr MAC %pEA flags %sskip update to client, learn count %u recover time %u", + __func__, &mac->macaddr, zebra_evpn_zebra_mac_flag_dump(mac, mac_buf, sizeof(mac_buf)), mac->dad_count, zvrf->dad_freeze_time); @@ -520,9 +515,8 @@ static void zebra_evpn_dup_addr_detect_for_mac(struct zebra_vrf *zvrf, char mac_buf[MAC_BUF_SIZE]; zlog_debug( - "%s: duplicate addr MAC %s flags %sdetection time passed, reset learn count %u", - __func__, - prefix_mac2str(&mac->macaddr, buf, sizeof(buf)), + "%s: duplicate addr MAC %pEA flags %sdetection time passed, reset learn count %u", + __func__, &mac->macaddr, zebra_evpn_zebra_mac_flag_dump(mac, mac_buf, sizeof(mac_buf)), mac->dad_count); @@ -552,9 +546,8 @@ static void zebra_evpn_dup_addr_detect_for_mac(struct zebra_vrf *zvrf, if (mac->dad_count >= zvrf->dad_max_moves) { flog_warn(EC_ZEBRA_DUP_MAC_DETECTED, - "VNI %u: MAC %s detected as duplicate during %s VTEP %pI4", - mac->zevpn->vni, - prefix_mac2str(&mac->macaddr, buf, sizeof(buf)), + "VNI %u: MAC %pEA detected as duplicate during %s VTEP %pI4", + mac->zevpn->vni, &mac->macaddr, is_local ? "local update, last" : "remote update, from", &vtep_ip); @@ -577,11 +570,8 @@ static void zebra_evpn_dup_addr_detect_for_mac(struct zebra_vrf *zvrf, nbr->dad_dup_detect_time = monotime(NULL); flog_warn(EC_ZEBRA_DUP_IP_INHERIT_DETECTED, - "VNI %u: MAC %s IP %s detected as duplicate during %s update, inherit duplicate from MAC", - mac->zevpn->vni, - prefix_mac2str(&mac->macaddr, - buf, sizeof(buf)), - ipaddr2str(&nbr->ip, buf1, sizeof(buf1)), + "VNI %u: MAC %pEA IP %pIA detected as duplicate during %s update, inherit duplicate from MAC", + mac->zevpn->vni, &mac->macaddr, &nbr->ip, is_local ? "local" : "remote"); } @@ -592,10 +582,8 @@ static void zebra_evpn_dup_addr_detect_for_mac(struct zebra_vrf *zvrf, char mac_buf[MAC_BUF_SIZE]; zlog_debug( - "%s: duplicate addr MAC %s flags %sauto recovery time %u start", - __func__, - prefix_mac2str(&mac->macaddr, buf, - sizeof(buf)), + "%s: duplicate addr MAC %pEA flags %sauto recovery time %u start", + __func__, &mac->macaddr, zebra_evpn_zebra_mac_flag_dump( mac, mac_buf, sizeof(mac_buf)), zvrf->dad_freeze_time); @@ -1004,8 +992,6 @@ int zebra_evpn_macip_send_msg_to_client(vni_t vni, struct ethaddr *macaddr, uint32_t seq, int state, struct zebra_evpn_es *es, uint16_t cmd) { - char buf[ETHER_ADDR_STRLEN]; - char buf2[INET6_ADDRSTRLEN]; int ipa_len; struct zserv *client = NULL; struct stream *s = NULL; @@ -1050,12 +1036,11 @@ int zebra_evpn_macip_send_msg_to_client(vni_t vni, struct ethaddr *macaddr, char flag_buf[MACIP_BUF_SIZE]; zlog_debug( - "Send MACIP %s f %s MAC %s IP %s seq %u L2-VNI %u ESI %s to %s", + "Send MACIP %s f %s MAC %pEA IP %pIA seq %u L2-VNI %u ESI %s to %s", (cmd == ZEBRA_MACIP_ADD) ? "Add" : "Del", zclient_evpn_dump_macip_flags(flags, flag_buf, sizeof(flag_buf)), - prefix_mac2str(macaddr, buf, sizeof(buf)), - ipaddr2str(ip, buf2, sizeof(buf2)), seq, vni, + macaddr, ip, seq, vni, es ? es->esi_str : "-", zebra_route_string(client->proto)); } @@ -1129,11 +1114,10 @@ zebra_mac_t *zebra_evpn_mac_add(zebra_evpn_t *zevpn, struct ethaddr *macaddr) mac->uptime = monotime(NULL); if (IS_ZEBRA_DEBUG_VXLAN || IS_ZEBRA_DEBUG_EVPN_MH_MAC) { - char buf[ETHER_ADDR_STRLEN]; char mac_buf[MAC_BUF_SIZE]; - zlog_debug("%s: MAC %s flags %s", __func__, - prefix_mac2str(&mac->macaddr, buf, sizeof(buf)), + zlog_debug("%s: MAC %pEA flags %s", __func__, + &mac->macaddr, zebra_evpn_zebra_mac_flag_dump(mac, mac_buf, sizeof(mac_buf))); } @@ -1148,11 +1132,10 @@ int zebra_evpn_mac_del(zebra_evpn_t *zevpn, zebra_mac_t *mac) zebra_mac_t *tmp_mac; if (IS_ZEBRA_DEBUG_VXLAN || IS_ZEBRA_DEBUG_EVPN_MH_MAC) { - char buf[ETHER_ADDR_STRLEN]; char mac_buf[MAC_BUF_SIZE]; - zlog_debug("%s: MAC %s flags %s", __func__, - prefix_mac2str(&mac->macaddr, buf, sizeof(buf)), + zlog_debug("%s: MAC %pEA flags %s", __func__, + &mac->macaddr, zebra_evpn_zebra_mac_flag_dump(mac, mac_buf, sizeof(mac_buf))); } @@ -1201,12 +1184,11 @@ static bool zebra_evpn_check_mac_del_from_db(struct mac_walk_ctx *wctx, else if ((wctx->flags & DEL_LOCAL_MAC) && (mac->flags & ZEBRA_MAC_AUTO) && !listcount(mac->neigh_list)) { if (IS_ZEBRA_DEBUG_VXLAN) { - char buf[ETHER_ADDR_STRLEN]; char mac_buf[MAC_BUF_SIZE]; zlog_debug( - "%s: Del MAC %s flags %s", __func__, - prefix_mac2str(&mac->macaddr, buf, sizeof(buf)), + "%s: Del MAC %pEA flags %s", __func__, + &mac->macaddr, zebra_evpn_zebra_mac_flag_dump( mac, mac_buf, sizeof(mac_buf))); } @@ -1471,7 +1453,6 @@ static int zebra_evpn_mac_hold_exp_cb(struct thread *t) bool new_bgp_ready; bool old_static; bool new_static; - char macbuf[ETHER_ADDR_STRLEN]; mac = THREAD_ARG(t); /* the purpose of the hold timer is to age out the peer-active @@ -1490,9 +1471,8 @@ static int zebra_evpn_mac_hold_exp_cb(struct thread *t) char mac_buf[MAC_BUF_SIZE]; zlog_debug( - "sync-mac vni %u mac %s es %s %shold expired", - mac->zevpn->vni, - prefix_mac2str(&mac->macaddr, macbuf, sizeof(macbuf)), + "sync-mac vni %u mac %pEA es %s %shold expired", + mac->zevpn->vni, &mac->macaddr, mac->es ? mac->es->esi_str : "-", zebra_evpn_zebra_mac_flag_dump(mac, mac_buf, sizeof(mac_buf))); @@ -1516,8 +1496,6 @@ static int zebra_evpn_mac_hold_exp_cb(struct thread *t) static inline void zebra_evpn_mac_start_hold_timer(zebra_mac_t *mac) { - char macbuf[ETHER_ADDR_STRLEN]; - if (mac->hold_timer) return; @@ -1525,9 +1503,8 @@ static inline void zebra_evpn_mac_start_hold_timer(zebra_mac_t *mac) char mac_buf[MAC_BUF_SIZE]; zlog_debug( - "sync-mac vni %u mac %s es %s %shold started", - mac->zevpn->vni, - prefix_mac2str(&mac->macaddr, macbuf, sizeof(macbuf)), + "sync-mac vni %u mac %pEA es %s %shold started", + mac->zevpn->vni, &mac->macaddr, mac->es ? mac->es->esi_str : "-", zebra_evpn_zebra_mac_flag_dump(mac, mac_buf, sizeof(mac_buf))); @@ -1538,8 +1515,6 @@ static inline void zebra_evpn_mac_start_hold_timer(zebra_mac_t *mac) void zebra_evpn_mac_stop_hold_timer(zebra_mac_t *mac) { - char macbuf[ETHER_ADDR_STRLEN]; - if (!mac->hold_timer) return; @@ -1547,9 +1522,8 @@ void zebra_evpn_mac_stop_hold_timer(zebra_mac_t *mac) char mac_buf[MAC_BUF_SIZE]; zlog_debug( - "sync-mac vni %u mac %s es %s %shold stopped", - mac->zevpn->vni, - prefix_mac2str(&mac->macaddr, macbuf, sizeof(macbuf)), + "sync-mac vni %u mac %pEA es %s %shold stopped", + mac->zevpn->vni, &mac->macaddr, mac->es ? mac->es->esi_str : "-", zebra_evpn_zebra_mac_flag_dump(mac, mac_buf, sizeof(mac_buf))); @@ -1560,7 +1534,6 @@ void zebra_evpn_mac_stop_hold_timer(zebra_mac_t *mac) void zebra_evpn_sync_mac_del(zebra_mac_t *mac) { - char macbuf[ETHER_ADDR_STRLEN]; bool old_static; bool new_static; @@ -1568,9 +1541,8 @@ void zebra_evpn_sync_mac_del(zebra_mac_t *mac) char mac_buf[MAC_BUF_SIZE]; zlog_debug( - "sync-mac del vni %u mac %s es %s seq %d f %s", - mac->zevpn->vni, - prefix_mac2str(&mac->macaddr, macbuf, sizeof(macbuf)), + "sync-mac del vni %u mac %pEA es %s seq %d f %s", + mac->zevpn->vni, &mac->macaddr, mac->es ? mac->es->esi_str : "-", mac->loc_seq, zebra_evpn_zebra_mac_flag_dump(mac, mac_buf, sizeof(mac_buf))); @@ -1595,7 +1567,6 @@ static inline bool zebra_evpn_mac_is_bgp_seq_ok(zebra_evpn_t *zevpn, struct ipaddr *ipaddr, bool sync) { - char macbuf[ETHER_ADDR_STRLEN]; char ipbuf[INET6_ADDRSTRLEN]; uint32_t tmp_seq; const char *n_type; @@ -1620,11 +1591,10 @@ static inline bool zebra_evpn_mac_is_bgp_seq_ok(zebra_evpn_t *zevpn, char mac_buf[MAC_BUF_SIZE]; zlog_debug( - "%s-macip accept vni %u %s-mac %s%s%s lower seq %u f %s", + "%s-macip accept vni %u %s-mac %pEA%s%s lower seq %u f %s", sync ? "sync" : "rem", zevpn->vni, n_type, - prefix_mac2str(&mac->macaddr, macbuf, - sizeof(macbuf)), + &mac->macaddr, ipa_len ? " IP " : "", ipa_len ? ipaddr2str(ipaddr, ipbuf, sizeof(ipbuf)) @@ -1641,10 +1611,9 @@ static inline bool zebra_evpn_mac_is_bgp_seq_ok(zebra_evpn_t *zevpn, char mac_buf[MAC_BUF_SIZE]; zlog_debug( - "%s-macip ignore vni %u %s-mac %s%s%s as existing has higher seq %u f %s", + "%s-macip ignore vni %u %s-mac %pEA%s%s as existing has higher seq %u f %s", sync ? "sync" : "rem", zevpn->vni, n_type, - prefix_mac2str(&mac->macaddr, macbuf, - sizeof(macbuf)), + &mac->macaddr, ipa_len ? " IP " : "", ipa_len ? ipaddr2str(ipaddr, ipbuf, sizeof(ipbuf)) @@ -1671,7 +1640,6 @@ zebra_evpn_proc_sync_mac_update(zebra_evpn_t *zevpn, struct ethaddr *macaddr, bool seq_change = false; bool es_change = false; uint32_t tmp_seq; - char macbuf[ETHER_ADDR_STRLEN]; char ipbuf[INET6_ADDRSTRLEN]; bool old_local = false; bool old_bgp_ready; @@ -1719,10 +1687,8 @@ zebra_evpn_proc_sync_mac_update(zebra_evpn_t *zevpn, struct ethaddr *macaddr, if (sticky || remote_gw) { if (IS_ZEBRA_DEBUG_EVPN_MH_NEIGH) zlog_debug( - "Ignore sync-macip vni %u mac %s%s%s%s%s", - zevpn->vni, - prefix_mac2str(macaddr, macbuf, - sizeof(macbuf)), + "Ignore sync-macip vni %u mac %pEA%s%s%s%s", + zevpn->vni, macaddr, ipa_len ? " IP " : "", ipa_len ? ipaddr2str(ipaddr, ipbuf, sizeof(ipbuf)) @@ -1789,9 +1755,8 @@ zebra_evpn_proc_sync_mac_update(zebra_evpn_t *zevpn, struct ethaddr *macaddr, omac.flags = old_flags; zlog_debug( - "sync-mac vni %u mac %s old_f %snew_f %s", - zevpn->vni, - prefix_mac2str(macaddr, macbuf, sizeof(macbuf)), + "sync-mac vni %u mac %pEA old_f %snew_f %s", + zevpn->vni, macaddr, zebra_evpn_zebra_mac_flag_dump( &omac, omac_buf, sizeof(omac_buf)), zebra_evpn_zebra_mac_flag_dump( @@ -1834,9 +1799,9 @@ zebra_evpn_proc_sync_mac_update(zebra_evpn_t *zevpn, struct ethaddr *macaddr, if (IS_ZEBRA_DEBUG_EVPN_MH_MAC) { char mac_buf[MAC_BUF_SIZE]; - zlog_debug("sync-mac %s vni %u mac %s es %s seq %d f %s%s%s", - ctx->mac_created ? "created" : "updated", zevpn->vni, - prefix_mac2str(macaddr, macbuf, sizeof(macbuf)), + zlog_debug("sync-mac %s vni %u mac %pEA es %s seq %d f %s%s%s", + ctx->mac_created ? "created" : "updated", + zevpn->vni, macaddr, mac->es ? mac->es->esi_str : "-", mac->loc_seq, zebra_evpn_zebra_mac_flag_dump(mac, mac_buf, sizeof(mac_buf)), @@ -2000,7 +1965,6 @@ int process_mac_remote_macip_add(zebra_evpn_t *zevpn, struct zebra_vrf *zvrf, struct in_addr vtep_ip, uint8_t flags, uint32_t seq, esi_t *esi) { - char buf[ETHER_ADDR_STRLEN]; char buf1[INET6_ADDRSTRLEN]; bool sticky; bool remote_gw; @@ -2023,9 +1987,8 @@ int process_mac_remote_macip_add(zebra_evpn_t *zevpn, struct zebra_vrf *zvrf, && CHECK_FLAG(flags, ZEBRA_MACIP_TYPE_GW)) { if (IS_ZEBRA_DEBUG_VXLAN) zlog_debug( - "Ignore remote MACIP ADD VNI %u MAC %s%s%s as MAC is already configured as gateway MAC", - zevpn->vni, - prefix_mac2str(macaddr, buf, sizeof(buf)), + "Ignore remote MACIP ADD VNI %u MAC %pEA%s%s as MAC is already configured as gateway MAC", + zevpn->vni, macaddr, ipa_len ? " IP " : "", ipa_len ? ipaddr2str(ipaddr, buf1, sizeof(buf1)) : ""); @@ -2050,10 +2013,8 @@ int process_mac_remote_macip_add(zebra_evpn_t *zevpn, struct zebra_vrf *zvrf, mac = zebra_evpn_mac_add(zevpn, macaddr); if (!mac) { zlog_warn( - "Failed to add MAC %s VNI %u Remote VTEP %pI4", - prefix_mac2str(macaddr, buf, - sizeof(buf)), - zevpn->vni, &vtep_ip); + "Failed to add MAC %pEA VNI %u Remote VTEP %pI4", + macaddr, zevpn->vni, &vtep_ip); return -1; } @@ -2112,10 +2073,8 @@ int process_mac_remote_macip_add(zebra_evpn_t *zevpn, struct zebra_vrf *zvrf, char mac_buf[MAC_BUF_SIZE]; zlog_debug( - "sync-mac->remote vni %u mac %s es %s seq %d f %s", - zevpn->vni, - prefix_mac2str(macaddr, buf, - sizeof(buf)), + "sync-mac->remote vni %u mac %pEA es %s seq %d f %s", + zevpn->vni, macaddr, mac->es ? mac->es->esi_str : "-", mac->loc_seq, zebra_evpn_zebra_mac_flag_dump( @@ -2173,7 +2132,6 @@ int zebra_evpn_add_update_local_mac(struct zebra_vrf *zvrf, zebra_evpn_t *zevpn, bool sticky, bool local_inactive, bool dp_static, zebra_mac_t *mac) { - char buf[ETHER_ADDR_STRLEN]; bool mac_sticky = false; bool inform_client = false; bool upd_neigh = false; @@ -2194,9 +2152,8 @@ int zebra_evpn_add_update_local_mac(struct zebra_vrf *zvrf, zebra_evpn_t *zevpn, if (!mac) { if (IS_ZEBRA_DEBUG_VXLAN || IS_ZEBRA_DEBUG_EVPN_MH_MAC) zlog_debug( - "ADD %sMAC %s intf %s(%u) VID %u -> VNI %u%s", - sticky ? "sticky " : "", - prefix_mac2str(macaddr, buf, sizeof(buf)), + "ADD %sMAC %pEA intf %s(%u) VID %u -> VNI %u%s", + sticky ? "sticky " : "", macaddr, ifp->name, ifp->ifindex, vid, zevpn->vni, local_inactive ? " local-inactive" : ""); @@ -2204,9 +2161,9 @@ int zebra_evpn_add_update_local_mac(struct zebra_vrf *zvrf, zebra_evpn_t *zevpn, if (!mac) { flog_err( EC_ZEBRA_MAC_ADD_FAILED, - "Failed to add MAC %s intf %s(%u) VID %u VNI %u", - prefix_mac2str(macaddr, buf, sizeof(buf)), - ifp->name, ifp->ifindex, vid, zevpn->vni); + "Failed to add MAC %pEA intf %s(%u) VID %u VNI %u", + macaddr, ifp->name, ifp->ifindex, vid, + zevpn->vni); return -1; } SET_FLAG(mac->flags, ZEBRA_MAC_LOCAL); @@ -2219,9 +2176,8 @@ int zebra_evpn_add_update_local_mac(struct zebra_vrf *zvrf, zebra_evpn_t *zevpn, char mac_buf[MAC_BUF_SIZE]; zlog_debug( - "UPD %sMAC %s intf %s(%u) VID %u -> VNI %u %scurFlags %s", - sticky ? "sticky " : "", - prefix_mac2str(macaddr, buf, sizeof(buf)), + "UPD %sMAC %pEA intf %s(%u) VID %u -> VNI %u %scurFlags %s", + sticky ? "sticky " : "", macaddr, ifp->name, ifp->ifindex, vid, zevpn->vni, local_inactive ? "local-inactive " : "", zebra_evpn_zebra_mac_flag_dump( @@ -2254,13 +2210,11 @@ int zebra_evpn_add_update_local_mac(struct zebra_vrf *zvrf, zebra_evpn_t *zevpn, && dp_static == old_static && !es_change) { if (IS_ZEBRA_DEBUG_VXLAN) zlog_debug( - " Add/Update %sMAC %s intf %s(%u) VID %u -> VNI %u%s, " + " Add/Update %sMAC %pEA intf %s(%u) VID %u -> VNI %u%s, " "entry exists and has not changed ", - sticky ? "sticky " : "", - prefix_mac2str(macaddr, buf, - sizeof(buf)), - ifp->name, ifp->ifindex, vid, - zevpn->vni, + sticky ? "sticky " : "", + macaddr, ifp->name, + ifp->ifindex, vid, zevpn->vni, local_inactive ? " local_inactive" : ""); @@ -2315,9 +2269,8 @@ int zebra_evpn_add_update_local_mac(struct zebra_vrf *zvrf, zebra_evpn_t *zevpn, if (CHECK_FLAG(mac->flags, ZEBRA_MAC_STICKY)) { flog_warn( EC_ZEBRA_STICKY_MAC_ALREADY_LEARNT, - "MAC %s already learnt as remote sticky MAC behind VTEP %pI4 VNI %u", - prefix_mac2str(macaddr, buf, - sizeof(buf)), + "MAC %pEA already learnt as remote sticky MAC behind VTEP %pI4 VNI %u", + macaddr, &mac->fwd_info.r_vtep_ip, zevpn->vni); return 0; @@ -2382,9 +2335,8 @@ int zebra_evpn_add_update_local_mac(struct zebra_vrf *zvrf, zebra_evpn_t *zevpn, char mac_buf[MAC_BUF_SIZE]; zlog_debug( - "local mac vni %u mac %s es %s seq %d f %s%s", - zevpn->vni, - prefix_mac2str(macaddr, buf, sizeof(buf)), + "local mac vni %u mac %pEA es %s seq %d f %s%s", + zevpn->vni, macaddr, mac->es ? mac->es->esi_str : "", mac->loc_seq, zebra_evpn_zebra_mac_flag_dump(mac, mac_buf, sizeof(mac_buf)), @@ -2422,14 +2374,12 @@ int zebra_evpn_add_update_local_mac(struct zebra_vrf *zvrf, zebra_evpn_t *zevpn, int zebra_evpn_del_local_mac(zebra_evpn_t *zevpn, zebra_mac_t *mac, bool clear_static) { - char buf[ETHER_ADDR_STRLEN]; bool old_bgp_ready; bool new_bgp_ready; if (IS_ZEBRA_DEBUG_VXLAN) - zlog_debug("DEL MAC %s VNI %u seq %u flags 0x%x nbr count %u", - prefix_mac2str(&mac->macaddr, buf, sizeof(buf)), - zevpn->vni, mac->loc_seq, mac->flags, + zlog_debug("DEL MAC %pEA VNI %u seq %u flags 0x%x nbr count %u", + &mac->macaddr, zevpn->vni, mac->loc_seq, mac->flags, listcount(mac->neigh_list)); old_bgp_ready = zebra_evpn_mac_is_ready_for_bgp(mac->flags); @@ -2443,9 +2393,8 @@ int zebra_evpn_del_local_mac(zebra_evpn_t *zevpn, zebra_mac_t *mac, char mac_buf[MAC_BUF_SIZE]; zlog_debug( - "re-add sync-mac vni %u mac %s es %s seq %d f %s", - zevpn->vni, - prefix_mac2str(&mac->macaddr, buf, sizeof(buf)), + "re-add sync-mac vni %u mac %pEA es %s seq %d f %s", + zevpn->vni, &mac->macaddr, mac->es ? mac->es->esi_str : "-", mac->loc_seq, zebra_evpn_zebra_mac_flag_dump( mac, mac_buf, sizeof(mac_buf))); @@ -2503,7 +2452,6 @@ int zebra_evpn_mac_gw_macip_add(struct interface *ifp, zebra_evpn_t *zevpn, struct ethaddr *macaddr, vlanid_t vlan_id, bool def_gw) { - char buf[ETHER_ADDR_STRLEN]; zebra_mac_t *mac; ns_id_t local_ns_id = NS_DEFAULT; struct zebra_vrf *zvrf; @@ -2517,9 +2465,8 @@ int zebra_evpn_mac_gw_macip_add(struct interface *ifp, zebra_evpn_t *zevpn, mac = zebra_evpn_mac_add(zevpn, macaddr); if (!mac) { flog_err(EC_ZEBRA_MAC_ADD_FAILED, - "Failed to add MAC %s intf %s(%u) VID %u", - prefix_mac2str(macaddr, buf, sizeof(buf)), - ifp->name, ifp->ifindex, vlan_id); + "Failed to add MAC %pEA intf %s(%u) VID %u", + macaddr, ifp->name, ifp->ifindex, vlan_id); return -1; } } diff --git a/zebra/zebra_evpn_neigh.c b/zebra/zebra_evpn_neigh.c index dea0fea97..0e31617c4 100644 --- a/zebra/zebra_evpn_neigh.c +++ b/zebra/zebra_evpn_neigh.c @@ -209,8 +209,6 @@ static void zebra_evpn_local_neigh_ref_mac(zebra_neigh_t *n, zebra_mac_t *mac, bool send_mac_update) { - char macbuf[ETHER_ADDR_STRLEN]; - char ipbuf[INET6_ADDRSTRLEN]; bool old_static; bool new_static; @@ -228,11 +226,8 @@ static void zebra_evpn_local_neigh_ref_mac(zebra_neigh_t *n, new_static = zebra_evpn_mac_is_static(mac); if (IS_ZEBRA_DEBUG_EVPN_MH_NEIGH) zlog_debug( - "sync-neigh ref mac vni %u ip %s mac %s ref %d", - n->zevpn->vni, - ipaddr2str(&n->ip, ipbuf, sizeof(ipbuf)), - prefix_mac2str(&n->emac, macbuf, - sizeof(macbuf)), + "sync-neigh ref mac vni %u ip %pIA mac %pEA ref %d", + n->zevpn->vni, &n->ip, &n->emac, mac->sync_neigh_cnt); if ((old_static != new_static) && send_mac_update) /* program the local mac in the kernel */ @@ -248,8 +243,6 @@ static void zebra_evpn_sync_neigh_dp_install(zebra_neigh_t *n, bool force_clear_static, const char *caller) { - char macbuf[ETHER_ADDR_STRLEN]; - char ipbuf[INET6_ADDRSTRLEN]; struct zebra_ns *zns; struct interface *ifp; bool set_static; @@ -260,11 +253,8 @@ static void zebra_evpn_sync_neigh_dp_install(zebra_neigh_t *n, if (!ifp) { if (IS_ZEBRA_DEBUG_EVPN_MH_NEIGH) zlog_debug( - "%s: dp-install sync-neigh vni %u ip %s mac %s if %d f 0x%x skipped", - caller, n->zevpn->vni, - ipaddr2str(&n->ip, ipbuf, sizeof(ipbuf)), - prefix_mac2str(&n->emac, macbuf, - sizeof(macbuf)), + "%s: dp-install sync-neigh vni %u ip %pIA mac %pEA if %d f 0x%x skipped", + caller, n->zevpn->vni, &n->ip, &n->emac, n->ifindex, n->flags); return; } @@ -282,10 +272,8 @@ static void zebra_evpn_sync_neigh_dp_install(zebra_neigh_t *n, if (IS_ZEBRA_DEBUG_EVPN_MH_NEIGH) zlog_debug( - "%s: dp-install sync-neigh vni %u ip %s mac %s if %s(%d) f 0x%x%s%s%s", - caller, n->zevpn->vni, - ipaddr2str(&n->ip, ipbuf, sizeof(ipbuf)), - prefix_mac2str(&n->emac, macbuf, sizeof(macbuf)), + "%s: dp-install sync-neigh vni %u ip %pIA mac %pEA if %s(%d) f 0x%x%s%s%s", + caller, n->zevpn->vni, &n->ip, &n->emac, ifp->name, n->ifindex, n->flags, set_router ? " router" : "", set_static ? " static" : "", @@ -375,8 +363,6 @@ void zebra_evpn_sync_neigh_static_chg(zebra_neigh_t *n, bool old_n_static, zebra_mac_t *mac = n->mac; bool old_mac_static; bool new_mac_static; - char macbuf[ETHER_ADDR_STRLEN]; - char ipbuf[INET6_ADDRSTRLEN]; if (old_n_static == new_n_static) return; @@ -411,10 +397,9 @@ void zebra_evpn_sync_neigh_static_chg(zebra_neigh_t *n, bool old_n_static, if (IS_ZEBRA_DEBUG_EVPN_MH_NEIGH) zlog_debug( - "sync-neigh ref-chg vni %u ip %s mac %s f 0x%x %d%s%s%s%s by %s", - n->zevpn->vni, ipaddr2str(&n->ip, ipbuf, sizeof(ipbuf)), - prefix_mac2str(&n->emac, macbuf, sizeof(macbuf)), - n->flags, mac->sync_neigh_cnt, + "sync-neigh ref-chg vni %u ip %pIA mac %pEA f 0x%x %d%s%s%s%s by %s", + n->zevpn->vni, &n->ip, &n->emac, n->flags, + mac->sync_neigh_cnt, old_n_static ? " old_n_static" : "", new_n_static ? " new_n_static" : "", old_mac_static ? " old_mac_static" : "", @@ -434,8 +419,6 @@ static int zebra_evpn_neigh_hold_exp_cb(struct thread *t) bool new_bgp_ready; bool old_n_static; bool new_n_static; - char macbuf[ETHER_ADDR_STRLEN]; - char ipbuf[INET6_ADDRSTRLEN]; n = THREAD_ARG(t); /* the purpose of the hold timer is to age out the peer-active @@ -451,11 +434,8 @@ static int zebra_evpn_neigh_hold_exp_cb(struct thread *t) new_n_static = zebra_evpn_neigh_is_static(n); if (IS_ZEBRA_DEBUG_EVPN_MH_NEIGH) - zlog_debug("sync-neigh vni %u ip %s mac %s 0x%x hold expired", - n->zevpn->vni, - ipaddr2str(&n->ip, ipbuf, sizeof(ipbuf)), - prefix_mac2str(&n->emac, macbuf, sizeof(macbuf)), - n->flags); + zlog_debug("sync-neigh vni %u ip %pIA mac %pEA 0x%x hold expired", + n->zevpn->vni, &n->ip, &n->emac, n->flags); /* re-program the local neigh in the dataplane if the neigh is no * longer static @@ -475,18 +455,12 @@ static int zebra_evpn_neigh_hold_exp_cb(struct thread *t) static inline void zebra_evpn_neigh_start_hold_timer(zebra_neigh_t *n) { - char macbuf[ETHER_ADDR_STRLEN]; - char ipbuf[INET6_ADDRSTRLEN]; - if (n->hold_timer) return; if (IS_ZEBRA_DEBUG_EVPN_MH_NEIGH) - zlog_debug("sync-neigh vni %u ip %s mac %s 0x%x hold start", - n->zevpn->vni, - ipaddr2str(&n->ip, ipbuf, sizeof(ipbuf)), - prefix_mac2str(&n->emac, macbuf, sizeof(macbuf)), - n->flags); + zlog_debug("sync-neigh vni %u ip %pIA mac %pEA 0x%x hold start", + n->zevpn->vni, &n->ip, &n->emac, n->flags); thread_add_timer(zrouter.master, zebra_evpn_neigh_hold_exp_cb, n, zmh_info->neigh_hold_time, &n->hold_timer); } @@ -496,8 +470,6 @@ static void zebra_evpn_local_neigh_deref_mac(zebra_neigh_t *n, { zebra_mac_t *mac = n->mac; zebra_evpn_t *zevpn = n->zevpn; - char macbuf[ETHER_ADDR_STRLEN]; - char ipbuf[INET6_ADDRSTRLEN]; bool old_static; bool new_static; @@ -511,11 +483,8 @@ static void zebra_evpn_local_neigh_deref_mac(zebra_neigh_t *n, new_static = zebra_evpn_mac_is_static(mac); if (IS_ZEBRA_DEBUG_EVPN_MH_NEIGH) zlog_debug( - "sync-neigh deref mac vni %u ip %s mac %s ref %d", - n->zevpn->vni, - ipaddr2str(&n->ip, ipbuf, sizeof(ipbuf)), - prefix_mac2str(&n->emac, macbuf, - sizeof(macbuf)), + "sync-neigh deref mac vni %u ip %pIA mac %pEA ref %d", + n->zevpn->vni, &n->ip, &n->emac, mac->sync_neigh_cnt); if ((old_static != new_static) && send_mac_update) /* program the local mac in the kernel */ @@ -532,8 +501,6 @@ bool zebra_evpn_neigh_is_bgp_seq_ok(zebra_evpn_t *zevpn, zebra_neigh_t *n, struct ethaddr *macaddr, uint32_t seq, bool sync) { - char macbuf[ETHER_ADDR_STRLEN]; - char ipbuf[INET6_ADDRSTRLEN]; uint32_t tmp_seq; const char *n_type; @@ -555,24 +522,18 @@ bool zebra_evpn_neigh_is_bgp_seq_ok(zebra_evpn_t *zevpn, zebra_neigh_t *n, if (IS_ZEBRA_DEBUG_EVPN_MH_NEIGH || IS_ZEBRA_DEBUG_VXLAN) zlog_debug( - "%s-macip accept vni %u %s mac %s IP %s lower seq %u f 0x%x", + "%s-macip accept vni %u %s mac %pEA IP %pIA lower seq %u f 0x%x", sync ? "sync" : "remote", zevpn->vni, - n_type, - prefix_mac2str(macaddr, macbuf, - sizeof(macbuf)), - ipaddr2str(&n->ip, ipbuf, - sizeof(ipbuf)), + n_type, macaddr, &n->ip, tmp_seq, n->flags); return true; } if (IS_ZEBRA_DEBUG_EVPN_MH_NEIGH || IS_ZEBRA_DEBUG_VXLAN) zlog_debug( - "%s-macip ignore vni %u %s mac %s IP %s as existing has higher seq %u f 0x%x", + "%s-macip ignore vni %u %s mac %pEA IP %pIA as existing has higher seq %u f 0x%x", sync ? "sync" : "remote", zevpn->vni, n_type, - prefix_mac2str(macaddr, macbuf, sizeof(macbuf)), - ipaddr2str(&n->ip, ipbuf, sizeof(ipbuf)), - tmp_seq, n->flags); + macaddr, &n->ip, tmp_seq, n->flags); return false; } @@ -636,15 +597,10 @@ void zebra_evpn_sync_neigh_del(zebra_neigh_t *n) { bool old_n_static; bool new_n_static; - char macbuf[ETHER_ADDR_STRLEN]; - char ipbuf[INET6_ADDRSTRLEN]; if (IS_ZEBRA_DEBUG_EVPN_MH_NEIGH) - zlog_debug("sync-neigh del vni %u ip %s mac %s f 0x%x", - n->zevpn->vni, - ipaddr2str(&n->ip, ipbuf, sizeof(ipbuf)), - prefix_mac2str(&n->emac, macbuf, sizeof(macbuf)), - n->flags); + zlog_debug("sync-neigh del vni %u ip %pIA mac %pEA f 0x%x", + n->zevpn->vni, &n->ip, &n->emac, n->flags); old_n_static = zebra_evpn_neigh_is_static(n); UNSET_FLAG(n->flags, ZEBRA_NEIGH_ES_PEER_PROXY); @@ -676,8 +632,6 @@ zebra_evpn_proc_sync_neigh_update(zebra_evpn_t *zevpn, zebra_neigh_t *n, bool old_mac_static; bool new_mac_static; bool set_dp_inactive = false; - char macbuf[ETHER_ADDR_STRLEN]; - char ipbuf[INET6_ADDRSTRLEN]; bool created; ifindex_t ifindex = 0; @@ -778,11 +732,8 @@ zebra_evpn_proc_sync_neigh_update(zebra_evpn_t *zevpn, zebra_neigh_t *n, if (IS_ZEBRA_DEBUG_EVPN_MH_NEIGH && (old_flags != n->flags)) zlog_debug( - "sync-neigh vni %u ip %s mac %s old_f 0x%x new_f 0x%x", - n->zevpn->vni, - ipaddr2str(&n->ip, ipbuf, sizeof(ipbuf)), - prefix_mac2str(&n->emac, macbuf, - sizeof(macbuf)), + "sync-neigh vni %u ip %pIA mac %pEA old_f 0x%x new_f 0x%x", + n->zevpn->vni, &n->ip, &n->emac, old_flags, n->flags); new_n_static = zebra_evpn_neigh_is_static(n); @@ -844,10 +795,9 @@ zebra_evpn_proc_sync_neigh_update(zebra_evpn_t *zevpn, zebra_neigh_t *n, if (IS_ZEBRA_DEBUG_EVPN_MH_NEIGH) zlog_debug( - "sync-neigh %s vni %u ip %s mac %s if %s(%d) seq %d f 0x%x%s%s", + "sync-neigh %s vni %u ip %pIA mac %pEA if %s(%d) seq %d f 0x%x%s%s", created ? "created" : "updated", n->zevpn->vni, - ipaddr2str(&n->ip, ipbuf, sizeof(ipbuf)), - prefix_mac2str(&n->emac, macbuf, sizeof(macbuf)), + &n->ip, &n->emac, ifp ? ifp->name : "", ifindex, n->loc_seq, n->flags, inform_bgp ? " inform_bgp" : "", inform_dataplane ? " inform_dp" : ""); @@ -970,14 +920,13 @@ void zebra_evpn_process_neigh_on_local_mac_change(zebra_evpn_t *zevpn, zebra_neigh_t *n = NULL; struct listnode *node = NULL; struct zebra_vrf *zvrf = NULL; - char buf[ETHER_ADDR_STRLEN]; zvrf = vrf_info_lookup(zevpn->vxlan_if->vrf_id); if (IS_ZEBRA_DEBUG_VXLAN) - zlog_debug("Processing neighbors on local MAC %s %s, VNI %u", - prefix_mac2str(&zmac->macaddr, buf, sizeof(buf)), - seq_change ? "CHANGE" : "ADD", zevpn->vni); + zlog_debug("Processing neighbors on local MAC %pEA %s, VNI %u", + &zmac->macaddr, seq_change ? "CHANGE" : "ADD", + zevpn->vni); /* Walk all neighbors and mark any inactive local neighbors as * active and/or update sequence number upon a move, and inform BGP. @@ -1012,12 +961,10 @@ void zebra_evpn_process_neigh_on_local_mac_del(zebra_evpn_t *zevpn, { zebra_neigh_t *n = NULL; struct listnode *node = NULL; - char buf[ETHER_ADDR_STRLEN]; if (IS_ZEBRA_DEBUG_VXLAN) - zlog_debug("Processing neighbors on local MAC %s DEL, VNI %u", - prefix_mac2str(&zmac->macaddr, buf, sizeof(buf)), - zevpn->vni); + zlog_debug("Processing neighbors on local MAC %pEA DEL, VNI %u", + &zmac->macaddr, zevpn->vni); /* Walk all local neighbors and mark as inactive and inform * BGP, if needed. @@ -1047,12 +994,10 @@ void zebra_evpn_process_neigh_on_remote_mac_add(zebra_evpn_t *zevpn, { zebra_neigh_t *n = NULL; struct listnode *node = NULL; - char buf[ETHER_ADDR_STRLEN]; if (IS_ZEBRA_DEBUG_VXLAN) - zlog_debug("Processing neighbors on remote MAC %s ADD, VNI %u", - prefix_mac2str(&zmac->macaddr, buf, sizeof(buf)), - zevpn->vni); + zlog_debug("Processing neighbors on remote MAC %pEA ADD, VNI %u", + &zmac->macaddr, zevpn->vni); /* Walk all local neighbors and mark as inactive and inform * BGP, if needed. @@ -1085,15 +1030,11 @@ static inline void zebra_evpn_local_neigh_update_log( bool old_bgp_ready, bool new_bgp_ready, bool inform_dataplane, bool inform_bgp, const char *sfx) { - char macbuf[ETHER_ADDR_STRLEN]; - char ipbuf[INET6_ADDRSTRLEN]; - if (!IS_ZEBRA_DEBUG_EVPN_MH_NEIGH) return; - zlog_debug("%s neigh vni %u ip %s mac %s f 0x%x%s%s%s%s%s%s %s", pfx, - n->zevpn->vni, ipaddr2str(&n->ip, ipbuf, sizeof(ipbuf)), - prefix_mac2str(&n->emac, macbuf, sizeof(macbuf)), n->flags, + zlog_debug("%s neigh vni %u ip %pIA mac %pEA f 0x%x%s%s%s%s%s%s %s", pfx, + n->zevpn->vni, &n->ip, &n->emac, n->flags, is_router ? " router" : "", local_inactive ? " local-inactive" : "", old_bgp_ready ? " old_bgp_ready" : "", @@ -1154,8 +1095,6 @@ static int zebra_evpn_dad_ip_auto_recovery_exp(struct thread *t) struct zebra_vrf *zvrf = NULL; zebra_neigh_t *nbr = NULL; zebra_evpn_t *zevpn = NULL; - char buf1[INET6_ADDRSTRLEN]; - char buf2[ETHER_ADDR_STRLEN]; nbr = THREAD_ARG(t); @@ -1174,10 +1113,8 @@ static int zebra_evpn_dad_ip_auto_recovery_exp(struct thread *t) if (IS_ZEBRA_DEBUG_VXLAN) zlog_debug( - "%s: duplicate addr MAC %s IP %s flags 0x%x learn count %u vni %u auto recovery expired", - __func__, - prefix_mac2str(&nbr->emac, buf2, sizeof(buf2)), - ipaddr2str(&nbr->ip, buf1, sizeof(buf1)), nbr->flags, + "%s: duplicate addr MAC %pEA IP %pIA flags 0x%x learn count %u vni %u auto recovery expired", + __func__, &nbr->emac, &nbr->ip, nbr->flags, nbr->dad_count, zevpn->vni); UNSET_FLAG(nbr->flags, ZEBRA_NEIGH_DUPLICATE); @@ -1207,8 +1144,6 @@ zebra_evpn_dup_addr_detect_for_neigh(struct zebra_vrf *zvrf, zebra_neigh_t *nbr, { struct timeval elapsed = {0, 0}; - char buf[ETHER_ADDR_STRLEN]; - char buf1[INET6_ADDRSTRLEN]; bool reset_params = false; if (!zebra_evpn_do_dup_addr_detect(zvrf)) @@ -1221,10 +1156,8 @@ zebra_evpn_dup_addr_detect_for_neigh(struct zebra_vrf *zvrf, zebra_neigh_t *nbr, if (CHECK_FLAG(nbr->flags, ZEBRA_NEIGH_DUPLICATE)) { if (IS_ZEBRA_DEBUG_VXLAN) zlog_debug( - "%s: duplicate addr MAC %s IP %s flags 0x%x skip installing, learn count %u recover time %u", - __func__, - prefix_mac2str(&nbr->emac, buf, sizeof(buf)), - ipaddr2str(&nbr->ip, buf1, sizeof(buf1)), + "%s: duplicate addr MAC %pEA IP %pIA flags 0x%x skip installing, learn count %u recover time %u", + __func__, &nbr->emac, &nbr->ip, nbr->flags, nbr->dad_count, zvrf->dad_freeze_time); @@ -1261,10 +1194,8 @@ zebra_evpn_dup_addr_detect_for_neigh(struct zebra_vrf *zvrf, zebra_neigh_t *nbr, if (reset_params) { if (IS_ZEBRA_DEBUG_VXLAN) zlog_debug( - "%s: duplicate addr MAC %s IP %s flags 0x%x detection time passed, reset learn count %u", - __func__, - prefix_mac2str(&nbr->emac, buf, sizeof(buf)), - ipaddr2str(&nbr->ip, buf1, sizeof(buf1)), + "%s: duplicate addr MAC %pEA IP %pIA flags 0x%x detection time passed, reset learn count %u", + __func__, &nbr->emac, &nbr->ip, nbr->flags, nbr->dad_count); /* Reset learn count but do not start detection * during REMOTE learn event. @@ -1294,10 +1225,8 @@ zebra_evpn_dup_addr_detect_for_neigh(struct zebra_vrf *zvrf, zebra_neigh_t *nbr, if (nbr->dad_count >= zvrf->dad_max_moves) { flog_warn( EC_ZEBRA_DUP_IP_DETECTED, - "VNI %u: MAC %s IP %s detected as duplicate during %s VTEP %pI4", - nbr->zevpn->vni, - prefix_mac2str(&nbr->emac, buf, sizeof(buf)), - ipaddr2str(&nbr->ip, buf1, sizeof(buf1)), + "VNI %u: MAC %pEA IP %pIA detected as duplicate during %s VTEP %pI4", + nbr->zevpn->vni, &nbr->emac, &nbr->ip, is_local ? "local update, last" : "remote update, from", &vtep_ip); @@ -1311,12 +1240,8 @@ zebra_evpn_dup_addr_detect_for_neigh(struct zebra_vrf *zvrf, zebra_neigh_t *nbr, if (zvrf->dad_freeze && zvrf->dad_freeze_time) { if (IS_ZEBRA_DEBUG_VXLAN) zlog_debug( - "%s: duplicate addr MAC %s IP %s flags 0x%x auto recovery time %u start", - __func__, - prefix_mac2str(&nbr->emac, buf, - sizeof(buf)), - ipaddr2str(&nbr->ip, buf1, - sizeof(buf1)), + "%s: duplicate addr MAC %pEA IP %pIA flags 0x%x auto recovery time %u start", + __func__, &nbr->emac, &nbr->ip, nbr->flags, zvrf->dad_freeze_time); thread_add_timer(zrouter.master, @@ -1334,8 +1259,6 @@ int zebra_evpn_local_neigh_update(zebra_evpn_t *zevpn, struct interface *ifp, bool is_router, bool local_inactive, bool dp_static) { - char buf[ETHER_ADDR_STRLEN]; - char buf2[INET6_ADDRSTRLEN]; struct zebra_vrf *zvrf; zebra_neigh_t *n = NULL; zebra_mac_t *zmac = NULL, *old_zmac = NULL; @@ -1357,15 +1280,12 @@ int zebra_evpn_local_neigh_update(zebra_evpn_t *zevpn, struct interface *ifp, if (!zmac) { /* create a dummy MAC if the MAC is not already present */ if (IS_ZEBRA_DEBUG_VXLAN) - zlog_debug("AUTO MAC %s created for neigh %s on VNI %u", - prefix_mac2str(macaddr, buf, sizeof(buf)), - ipaddr2str(ip, buf2, sizeof(buf2)), - zevpn->vni); + zlog_debug("AUTO MAC %pEA created for neigh %pIA on VNI %u", + macaddr, ip, zevpn->vni); zmac = zebra_evpn_mac_add(zevpn, macaddr); if (!zmac) { - zlog_debug("Failed to add MAC %s VNI %u", - prefix_mac2str(macaddr, buf, sizeof(buf)), + zlog_debug("Failed to add MAC %pEA VNI %u", macaddr, zevpn->vni); return -1; } @@ -1402,10 +1322,9 @@ int zebra_evpn_local_neigh_update(zebra_evpn_t *zevpn, struct interface *ifp, if (!n) { flog_err( EC_ZEBRA_MAC_ADD_FAILED, - "Failed to add neighbor %s MAC %s intf %s(%u) -> VNI %u", - ipaddr2str(ip, buf2, sizeof(buf2)), - prefix_mac2str(macaddr, buf, sizeof(buf)), - ifp->name, ifp->ifindex, zevpn->vni); + "Failed to add neighbor %pIA MAC %pEA intf %s(%u) -> VNI %u", + ip, macaddr, ifp->name, ifp->ifindex, + zevpn->vni); return -1; } /* Set "local" forwarding info. */ @@ -1606,9 +1525,8 @@ int zebra_evpn_local_neigh_update(zebra_evpn_t *zevpn, struct interface *ifp, if (zebra_evpn_ip_inherit_dad_from_mac(zvrf, old_zmac, zmac, n)) { flog_warn( EC_ZEBRA_DUP_IP_INHERIT_DETECTED, - "VNI %u: MAC %s IP %s detected as duplicate during local update, inherit duplicate from MAC", - zevpn->vni, prefix_mac2str(macaddr, buf, sizeof(buf)), - ipaddr2str(&n->ip, buf2, sizeof(buf2))); + "VNI %u: MAC %pEA IP %pIA detected as duplicate during local update, inherit duplicate from MAC", + zevpn->vni, macaddr, &n->ip); } /* For IP Duplicate Address Detection (DAD) is trigger, @@ -1651,9 +1569,9 @@ int zebra_evpn_local_neigh_update(zebra_evpn_t *zevpn, struct interface *ifp, if (upd_mac_seq && zmac->loc_seq != mac_new_seq) { if (IS_ZEBRA_DEBUG_VXLAN) zlog_debug( - "Seq changed for MAC %s VNI %u - old %u new %u", - prefix_mac2str(macaddr, buf, sizeof(buf)), - zevpn->vni, zmac->loc_seq, mac_new_seq); + "Seq changed for MAC %pEA VNI %u - old %u new %u", + macaddr, zevpn->vni, + zmac->loc_seq, mac_new_seq); zmac->loc_seq = mac_new_seq; if (zebra_evpn_mac_send_add_to_client(zevpn->vni, macaddr, zmac->flags, @@ -1682,8 +1600,6 @@ int zebra_evpn_remote_neigh_update(zebra_evpn_t *zevpn, struct interface *ifp, struct ipaddr *ip, struct ethaddr *macaddr, uint16_t state) { - char buf[ETHER_ADDR_STRLEN]; - char buf2[INET6_ADDRSTRLEN]; zebra_neigh_t *n = NULL; zebra_mac_t *zmac = NULL; @@ -1708,10 +1624,8 @@ int zebra_evpn_remote_neigh_update(zebra_evpn_t *zevpn, struct interface *ifp, zmac = zebra_evpn_mac_lookup(zevpn, macaddr); if (!zmac || !CHECK_FLAG(zmac->flags, ZEBRA_MAC_REMOTE)) { zlog_debug( - "Ignore remote neigh %s (MAC %s) on L2-VNI %u - MAC unknown or local", - ipaddr2str(&n->ip, buf2, sizeof(buf2)), - prefix_mac2str(macaddr, buf, sizeof(buf)), - zevpn->vni); + "Ignore remote neigh %pIA (MAC %pEA) on L2-VNI %u - MAC unknown or local", + &n->ip, macaddr, zevpn->vni); return -1; } @@ -2140,8 +2054,6 @@ void process_neigh_remote_macip_add(zebra_evpn_t *zevpn, struct zebra_vrf *zvrf, { zebra_neigh_t *n; int update_neigh = 0; - char buf[ETHER_ADDR_STRLEN]; - char buf1[INET6_ADDRSTRLEN]; zebra_mac_t *old_mac = NULL; bool old_static = false; bool do_dad = false; @@ -2167,11 +2079,9 @@ void process_neigh_remote_macip_add(zebra_evpn_t *zevpn, struct zebra_vrf *zvrf, mac, 0); if (!n) { zlog_warn( - "Failed to add Neigh %s MAC %s VNI %u Remote VTEP %pI4", - ipaddr2str(ipaddr, buf1, sizeof(buf1)), - prefix_mac2str(&mac->macaddr, buf, - sizeof(buf)), - zevpn->vni, &vtep_ip); + "Failed to add Neigh %pIA MAC %pEA VNI %u Remote VTEP %pI4", + ipaddr, &mac->macaddr, zevpn->vni, + &vtep_ip); return; } @@ -2192,12 +2102,8 @@ void process_neigh_remote_macip_add(zebra_evpn_t *zevpn, struct zebra_vrf *zvrf, old_static = zebra_evpn_neigh_is_static(n); if (IS_ZEBRA_DEBUG_EVPN_MH_NEIGH) zlog_debug( - "sync->remote neigh vni %u ip %s mac %s seq %d f0x%x", - n->zevpn->vni, - ipaddr2str(&n->ip, buf1, - sizeof(buf1)), - prefix_mac2str(&n->emac, buf, - sizeof(buf)), + "sync->remote neigh vni %u ip %pIA mac %pEA seq %d f0x%x", + n->zevpn->vni, &n->ip, &n->emac, seq, n->flags); zebra_evpn_neigh_clear_sync_info(n); if (IS_ZEBRA_NEIGH_ACTIVE(n)) @@ -2258,10 +2164,8 @@ void process_neigh_remote_macip_add(zebra_evpn_t *zevpn, struct zebra_vrf *zvrf, if (zebra_evpn_ip_inherit_dad_from_mac(zvrf, old_mac, mac, n)) { flog_warn( EC_ZEBRA_DUP_IP_INHERIT_DETECTED, - "VNI %u: MAC %s IP %s detected as duplicate during remote update, inherit duplicate from MAC", - zevpn->vni, - prefix_mac2str(&mac->macaddr, buf, sizeof(buf)), - ipaddr2str(&n->ip, buf1, sizeof(buf1))); + "VNI %u: MAC %pEA IP %pIA detected as duplicate during remote update, inherit duplicate from MAC", + zevpn->vni, &mac->macaddr, &n->ip); } /* Check duplicate address detection for IP */ @@ -2280,8 +2184,6 @@ int zebra_evpn_neigh_gw_macip_add(struct interface *ifp, zebra_evpn_t *zevpn, struct ipaddr *ip, zebra_mac_t *mac) { zebra_neigh_t *n; - char buf[ETHER_ADDR_STRLEN]; - char buf2[INET6_ADDRSTRLEN]; assert(mac); @@ -2291,9 +2193,8 @@ int zebra_evpn_neigh_gw_macip_add(struct interface *ifp, zebra_evpn_t *zevpn, if (!n) { flog_err( EC_ZEBRA_MAC_ADD_FAILED, - "Failed to add neighbor %s MAC %s intf %s(%u) -> VNI %u", - ipaddr2str(ip, buf2, sizeof(buf2)), - prefix_mac2str(&mac->macaddr, buf, sizeof(buf)), + "Failed to add neighbor %pIA MAC %pEA intf %s(%u) -> VNI %u", + ip, &mac->macaddr, ifp->name, ifp->ifindex, zevpn->vni); return -1; } @@ -2316,10 +2217,9 @@ int zebra_evpn_neigh_gw_macip_add(struct interface *ifp, zebra_evpn_t *zevpn, if (IS_ZEBRA_DEBUG_VXLAN) zlog_debug( - "SVI %s(%u) L2-VNI %u, sending GW MAC %s IP %s add to BGP with flags 0x%x", + "SVI %s(%u) L2-VNI %u, sending GW MAC %pEA IP %pIA add to BGP with flags 0x%x", ifp->name, ifp->ifindex, zevpn->vni, - prefix_mac2str(&mac->macaddr, buf, sizeof(buf)), - ipaddr2str(ip, buf2, sizeof(buf2)), n->flags); + &mac->macaddr, ip, n->flags); zebra_evpn_neigh_send_add_to_client( zevpn->vni, ip, &n->emac, n->mac, n->flags, n->loc_seq); @@ -2328,10 +2228,9 @@ int zebra_evpn_neigh_gw_macip_add(struct interface *ifp, zebra_evpn_t *zevpn, SET_FLAG(n->flags, ZEBRA_NEIGH_SVI_IP); if (IS_ZEBRA_DEBUG_VXLAN) zlog_debug( - "SVI %s(%u) L2-VNI %u, sending SVI MAC %s IP %s add to BGP with flags 0x%x", + "SVI %s(%u) L2-VNI %u, sending SVI MAC %pEA IP %pIA add to BGP with flags 0x%x", ifp->name, ifp->ifindex, zevpn->vni, - prefix_mac2str(&mac->macaddr, buf, sizeof(buf)), - ipaddr2str(ip, buf2, sizeof(buf2)), n->flags); + &mac->macaddr, ip, n->flags); zebra_evpn_neigh_send_add_to_client( zevpn->vni, ip, &n->emac, n->mac, n->flags, n->loc_seq); @@ -2344,8 +2243,6 @@ void zebra_evpn_neigh_remote_uninstall(zebra_evpn_t *zevpn, struct zebra_vrf *zvrf, zebra_neigh_t *n, zebra_mac_t *mac, struct ipaddr *ipaddr) { - char buf1[INET6_ADDRSTRLEN]; - if (zvrf->dad_freeze && CHECK_FLAG(n->flags, ZEBRA_NEIGH_DUPLICATE) && CHECK_FLAG(n->flags, ZEBRA_NEIGH_REMOTE) && (memcmp(n->emac.octet, mac->macaddr.octet, ETH_ALEN) == 0)) { @@ -2354,10 +2251,9 @@ void zebra_evpn_neigh_remote_uninstall(zebra_evpn_t *zevpn, vlan_if = zevpn_map_to_svi(zevpn); if (IS_ZEBRA_DEBUG_VXLAN) zlog_debug( - "%s: IP %s (flags 0x%x intf %s) is remote and duplicate, read kernel for local entry", - __func__, - ipaddr2str(ipaddr, buf1, sizeof(buf1)), - n->flags, vlan_if ? vlan_if->name : "Unknown"); + "%s: IP %pIA (flags 0x%x intf %s) is remote and duplicate, read kernel for local entry", + __func__, ipaddr, n->flags, + vlan_if ? vlan_if->name : "Unknown"); if (vlan_if) neigh_read_specific_ip(ipaddr, vlan_if); } @@ -2384,8 +2280,6 @@ int zebra_evpn_neigh_del_ip(zebra_evpn_t *zevpn, struct ipaddr *ip) zebra_mac_t *zmac; bool old_bgp_ready; bool new_bgp_ready; - char buf[INET6_ADDRSTRLEN]; - char buf2[ETHER_ADDR_STRLEN]; struct zebra_vrf *zvrf; /* If entry doesn't exist, nothing to do. */ @@ -2397,9 +2291,8 @@ int zebra_evpn_neigh_del_ip(zebra_evpn_t *zevpn, struct ipaddr *ip) if (!zmac) { if (IS_ZEBRA_DEBUG_VXLAN) zlog_debug( - "Trying to del a neigh %s without a mac %s on VNI %u", - ipaddr2str(ip, buf, sizeof(buf)), - prefix_mac2str(&n->emac, buf2, sizeof(buf2)), + "Trying to del a neigh %pIA without a mac %pEA on VNI %u", + ip, &n->emac, zevpn->vni); return 0; @@ -2419,10 +2312,8 @@ int zebra_evpn_neigh_del_ip(zebra_evpn_t *zevpn, struct ipaddr *ip) old_bgp_ready = zebra_evpn_neigh_is_ready_for_bgp(n); if (zebra_evpn_neigh_is_static(n)) { if (IS_ZEBRA_DEBUG_EVPN_MH_NEIGH) - zlog_debug("re-add sync neigh vni %u ip %s mac %s 0x%x", - n->zevpn->vni, - ipaddr2str(&n->ip, buf, sizeof(buf)), - prefix_mac2str(&n->emac, buf2, sizeof(buf2)), + zlog_debug("re-add sync neigh vni %u ip %pIA mac %pEA 0x%x", + n->zevpn->vni, &n->ip, &n->emac, n->flags); if (!CHECK_FLAG(n->flags, ZEBRA_NEIGH_LOCAL_INACTIVE)) diff --git a/zebra/zebra_evpn_neigh.h b/zebra/zebra_evpn_neigh.h index eac17a09b..05156c125 100644 --- a/zebra/zebra_evpn_neigh.h +++ b/zebra/zebra_evpn_neigh.h @@ -167,18 +167,12 @@ static inline bool zebra_evpn_neigh_is_ready_for_bgp(zebra_neigh_t *n) static inline void zebra_evpn_neigh_stop_hold_timer(zebra_neigh_t *n) { - char macbuf[ETHER_ADDR_STRLEN]; - char ipbuf[INET6_ADDRSTRLEN]; - if (!n->hold_timer) return; if (IS_ZEBRA_DEBUG_EVPN_MH_NEIGH) - zlog_debug("sync-neigh vni %u ip %s mac %s 0x%x hold stop", - n->zevpn->vni, - ipaddr2str(&n->ip, ipbuf, sizeof(ipbuf)), - prefix_mac2str(&n->emac, macbuf, sizeof(macbuf)), - n->flags); + zlog_debug("sync-neigh vni %u ip %pIA mac %pEA 0x%x hold stop", + n->zevpn->vni, &n->ip, &n->emac, n->flags); THREAD_OFF(n->hold_timer); } @@ -188,19 +182,13 @@ void zebra_evpn_sync_neigh_static_chg(zebra_neigh_t *n, bool old_n_static, static inline bool zebra_evpn_neigh_clear_sync_info(zebra_neigh_t *n) { - char macbuf[ETHER_ADDR_STRLEN]; - char ipbuf[INET6_ADDRSTRLEN]; bool old_n_static = false; bool new_n_static = false; if (n->flags & ZEBRA_NEIGH_ALL_PEER_FLAGS) { if (IS_ZEBRA_DEBUG_EVPN_MH_NEIGH) - zlog_debug("sync-neigh vni %u ip %s mac %s 0x%x clear", - n->zevpn->vni, - ipaddr2str(&n->ip, ipbuf, sizeof(ipbuf)), - prefix_mac2str(&n->emac, macbuf, - sizeof(macbuf)), - n->flags); + zlog_debug("sync-neigh vni %u ip %pIA mac %pEA 0x%x clear", + n->zevpn->vni, &n->ip, &n->emac, n->flags); old_n_static = zebra_evpn_neigh_is_static(n); UNSET_FLAG(n->flags, ZEBRA_NEIGH_ALL_PEER_FLAGS); diff --git a/zebra/zebra_vxlan.c b/zebra/zebra_vxlan.c index 6cb801036..e5efbe0d4 100644 --- a/zebra/zebra_vxlan.c +++ b/zebra/zebra_vxlan.c @@ -1226,7 +1226,6 @@ static int zl3vni_rmac_install(zebra_l3vni_t *zl3vni, zebra_mac_t *zrmac) */ static int zl3vni_rmac_uninstall(zebra_l3vni_t *zl3vni, zebra_mac_t *zrmac) { - char buf[ETHER_ADDR_STRLEN]; const struct zebra_if *zif = NULL, *br_zif; const struct zebra_l2info_vxlan *vxl = NULL; const struct interface *br_ifp; @@ -1240,10 +1239,8 @@ static int zl3vni_rmac_uninstall(zebra_l3vni_t *zl3vni, zebra_mac_t *zrmac) if (!zl3vni->vxlan_if) { if (IS_ZEBRA_DEBUG_VXLAN) zlog_debug( - "RMAC %s on L3-VNI %u hash %p couldn't be uninstalled - no vxlan_if", - prefix_mac2str(&zrmac->macaddr, - buf, sizeof(buf)), - zl3vni->vni, zl3vni); + "RMAC %pEA on L3-VNI %u hash %p couldn't be uninstalled - no vxlan_if", + &zrmac->macaddr, zl3vni->vni, zl3vni); return -1; } @@ -1277,8 +1274,6 @@ static int zl3vni_remote_rmac_add(zebra_l3vni_t *zl3vni, const struct ipaddr *vtep_ip, const struct prefix *host_prefix) { - char buf[ETHER_ADDR_STRLEN]; - char buf1[INET6_ADDRSTRLEN]; zebra_mac_t *zrmac = NULL; zrmac = zl3vni_rmac_lookup(zl3vni, rmac); @@ -1288,11 +1283,8 @@ static int zl3vni_remote_rmac_add(zebra_l3vni_t *zl3vni, zrmac = zl3vni_rmac_add(zl3vni, rmac); if (!zrmac) { zlog_debug( - "Failed to add RMAC %s L3VNI %u Remote VTEP %s, prefix %pFX", - prefix_mac2str(rmac, buf, sizeof(buf)), - zl3vni->vni, - ipaddr2str(vtep_ip, buf1, sizeof(buf1)), - host_prefix); + "Failed to add RMAC %pEA L3VNI %u Remote VTEP %pIA, prefix %pFX", + rmac, zl3vni->vni, vtep_ip, host_prefix); return -1; } memset(&zrmac->fwd_info, 0, sizeof(zrmac->fwd_info)); @@ -1308,12 +1300,9 @@ static int zl3vni_remote_rmac_add(zebra_l3vni_t *zl3vni, &vtep_ip->ipaddr_v4)) { if (IS_ZEBRA_DEBUG_VXLAN) zlog_debug( - "L3VNI %u Remote VTEP change(%pI4 -> %s) for RMAC %s, prefix %pFX", - zl3vni->vni, - &zrmac->fwd_info.r_vtep_ip, - ipaddr2str(vtep_ip, buf1, sizeof(buf1)), - prefix_mac2str(rmac, buf, sizeof(buf)), - host_prefix); + "L3VNI %u Remote VTEP change(%pI4 -> %pIA) for RMAC %pEA, prefix %pFX", + zl3vni->vni, &zrmac->fwd_info.r_vtep_ip, + vtep_ip, rmac, host_prefix); zrmac->fwd_info.r_vtep_ip = vtep_ip->ipaddr_v4; @@ -1470,9 +1459,6 @@ static int zl3vni_remote_nh_add(zebra_l3vni_t *zl3vni, const struct ethaddr *rmac, const struct prefix *host_prefix) { - char buf[ETHER_ADDR_STRLEN]; - char buf1[ETHER_ADDR_STRLEN]; - char buf2[INET6_ADDRSTRLEN]; zebra_neigh_t *nh = NULL; /* Create the next hop entry, or update its mac, if necessary. */ @@ -1481,10 +1467,8 @@ static int zl3vni_remote_nh_add(zebra_l3vni_t *zl3vni, nh = zl3vni_nh_add(zl3vni, vtep_ip, rmac); if (!nh) { zlog_debug( - "Failed to add NH %s as Neigh (RMAC %s L3-VNI %u prefix %pFX)", - ipaddr2str(vtep_ip, buf1, sizeof(buf2)), - prefix_mac2str(rmac, buf, sizeof(buf)), - zl3vni->vni, host_prefix); + "Failed to add NH %pIA as Neigh (RMAC %pEA L3-VNI %u prefix %pFX)", + vtep_ip, rmac, zl3vni->vni, host_prefix); return -1; } @@ -1493,11 +1477,8 @@ static int zl3vni_remote_nh_add(zebra_l3vni_t *zl3vni, } else if (memcmp(&nh->emac, rmac, ETH_ALEN) != 0) { if (IS_ZEBRA_DEBUG_VXLAN) zlog_debug( - "L3VNI %u RMAC change(%s --> %s) for nexthop %s, prefix %pFX", - zl3vni->vni, - prefix_mac2str(&nh->emac, buf, sizeof(buf)), - prefix_mac2str(rmac, buf1, sizeof(buf1)), - ipaddr2str(vtep_ip, buf2, sizeof(buf2)), + "L3VNI %u RMAC change(%pEA --> %pEA) for nexthop %pIA, prefix %pFX", + zl3vni->vni, &nh->emac, rmac, vtep_ip, host_prefix); memcpy(&nh->emac, rmac, ETH_ALEN); @@ -1878,8 +1859,6 @@ static int zl3vni_send_add_to_client(zebra_l3vni_t *zl3vni) struct zserv *client = NULL; struct ethaddr svi_rmac, vrr_rmac = {.octet = {0} }; struct zebra_vrf *zvrf; - char buf[ETHER_ADDR_STRLEN]; - char buf1[ETHER_ADDR_STRLEN]; bool is_anycast_mac = true; client = zserv_find_client(ZEBRA_ROUTE_BGP, 0); @@ -1920,11 +1899,9 @@ static int zl3vni_send_add_to_client(zebra_l3vni_t *zl3vni) if (IS_ZEBRA_DEBUG_VXLAN) zlog_debug( - "Send L3_VNI_ADD %u VRF %s RMAC %s VRR %s local-ip %pI4 filter %s to %s", + "Send L3_VNI_ADD %u VRF %s RMAC %pEA VRR %pEA local-ip %pI4 filter %s to %s", zl3vni->vni, vrf_id_to_name(zl3vni_vrf_id(zl3vni)), - prefix_mac2str(&svi_rmac, buf, sizeof(buf)), - prefix_mac2str(&vrr_rmac, buf1, sizeof(buf1)), - &zl3vni->local_vtep_ip, + &svi_rmac, &vrr_rmac, &zl3vni->local_vtep_ip, CHECK_FLAG(zl3vni->filter, PREFIX_ROUTES_ONLY) ? "prefix-routes-only" : "none", @@ -2138,7 +2115,6 @@ static void zl3vni_del_nh_hash_entry(struct hash_bucket *bucket, void *ctx) static int zebra_vxlan_readd_remote_rmac(zebra_l3vni_t *zl3vni, struct ethaddr *rmac) { - char buf[ETHER_ADDR_STRLEN]; zebra_mac_t *zrmac = NULL; zrmac = zl3vni_rmac_lookup(zl3vni, rmac); @@ -2146,8 +2122,8 @@ static int zebra_vxlan_readd_remote_rmac(zebra_l3vni_t *zl3vni, return 0; if (IS_ZEBRA_DEBUG_VXLAN) - zlog_debug("Del remote RMAC %s L3VNI %u - readd", - prefix_mac2str(rmac, buf, sizeof(buf)), zl3vni->vni); + zlog_debug("Del remote RMAC %pEA L3VNI %u - readd", + rmac, zl3vni->vni); zl3vni_rmac_install(zl3vni, zrmac); return 0; @@ -3667,7 +3643,6 @@ int zebra_vxlan_handle_kernel_neigh_del(struct interface *ifp, struct interface *link_if, struct ipaddr *ip) { - char buf[INET6_ADDRSTRLEN]; zebra_evpn_t *zevpn = NULL; zebra_l3vni_t *zl3vni = NULL; @@ -3685,9 +3660,8 @@ int zebra_vxlan_handle_kernel_neigh_del(struct interface *ifp, if (!zevpn) { if (IS_ZEBRA_DEBUG_VXLAN) zlog_debug( - "%s: Del neighbor %s EVPN is not present for interface %s", - __func__, ipaddr2str(ip, buf, sizeof(buf)), - ifp->name); + "%s: Del neighbor %pIA EVPN is not present for interface %s", + __func__, ip, ifp->name); return 0; } @@ -3699,9 +3673,8 @@ int zebra_vxlan_handle_kernel_neigh_del(struct interface *ifp, } if (IS_ZEBRA_DEBUG_VXLAN) - zlog_debug("Del neighbor %s intf %s(%u) -> L2-VNI %u", - ipaddr2str(ip, buf, sizeof(buf)), ifp->name, - ifp->ifindex, zevpn->vni); + zlog_debug("Del neighbor %pIA intf %s(%u) -> L2-VNI %u", + ip, ifp->name, ifp->ifindex, zevpn->vni); return zebra_evpn_neigh_del_ip(zevpn, ip); } @@ -3721,8 +3694,6 @@ int zebra_vxlan_handle_kernel_neigh_update(struct interface *ifp, bool is_router, bool local_inactive, bool dp_static) { - char buf[ETHER_ADDR_STRLEN]; - char buf2[INET6_ADDRSTRLEN]; zebra_evpn_t *zevpn = NULL; zebra_l3vni_t *zl3vni = NULL; @@ -3742,9 +3713,8 @@ int zebra_vxlan_handle_kernel_neigh_update(struct interface *ifp, if (IS_ZEBRA_DEBUG_VXLAN || IS_ZEBRA_DEBUG_EVPN_MH_NEIGH) zlog_debug( - "Add/Update neighbor %s MAC %s intf %s(%u) state 0x%x %s%s%s%s-> L2-VNI %u", - ipaddr2str(ip, buf2, sizeof(buf2)), - prefix_mac2str(macaddr, buf, sizeof(buf)), ifp->name, + "Add/Update neighbor %pIA MAC %pEA intf %s(%u) state 0x%x %s%s%s%s-> L2-VNI %u", + ip, macaddr, ifp->name, ifp->ifindex, state, is_ext ? "ext-learned " : "", is_router ? "router " : "", local_inactive ? "local_inactive " : "", @@ -3822,7 +3792,6 @@ void zebra_vxlan_remote_macip_del(ZAPI_HANDLER_ARGS) struct ipaddr ip; struct in_addr vtep_ip; uint16_t l = 0, ipa_len; - char buf[ETHER_ADDR_STRLEN]; char buf1[INET6_ADDRSTRLEN]; memset(&macaddr, 0, sizeof(struct ethaddr)); @@ -3842,9 +3811,8 @@ void zebra_vxlan_remote_macip_del(ZAPI_HANDLER_ARGS) l += res_length; if (IS_ZEBRA_DEBUG_VXLAN) zlog_debug( - "Recv MACIP DEL VNI %u MAC %s%s%s Remote VTEP %pI4 from %s", - vni, - prefix_mac2str(&macaddr, buf, sizeof(buf)), + "Recv MACIP DEL VNI %u MAC %pEA%s%s Remote VTEP %pI4 from %s", + vni, &macaddr, ipa_len ? " IP " : "", ipa_len ? ipaddr2str(&ip, buf1, sizeof(buf1)) : "", @@ -3872,7 +3840,6 @@ void zebra_vxlan_remote_macip_add(ZAPI_HANDLER_ARGS) uint16_t l = 0, ipa_len; uint8_t flags = 0; uint32_t seq; - char buf[ETHER_ADDR_STRLEN]; char buf1[INET6_ADDRSTRLEN]; esi_t esi; char esi_buf[ESI_STR_LEN]; @@ -3903,11 +3870,10 @@ void zebra_vxlan_remote_macip_add(ZAPI_HANDLER_ARGS) else strlcpy(esi_buf, "-", ESI_STR_LEN); zlog_debug( - "Recv %sMACIP ADD VNI %u MAC %s%s%s flags 0x%x seq %u VTEP %pI4 ESI %s from %s", + "Recv %sMACIP ADD VNI %u MAC %pEA%s%s flags 0x%x seq %u VTEP %pI4 ESI %s from %s", (flags & ZEBRA_MACIP_TYPE_SYNC_PATH) ? "sync-" : "", - vni, - prefix_mac2str(&macaddr, buf, sizeof(buf)), + vni, &macaddr, ipa_len ? " IP " : "", ipa_len ? ipaddr2str(&ip, buf1, sizeof(buf1)) : "", @@ -3984,7 +3950,6 @@ static int zebra_vxlan_check_del_local_mac(struct interface *ifp, vni_t vni; zebra_evpn_t *zevpn; zebra_mac_t *mac; - char buf[ETHER_ADDR_STRLEN]; zif = ifp->info; assert(zif); @@ -4011,9 +3976,8 @@ static int zebra_vxlan_check_del_local_mac(struct interface *ifp, if (IS_ZEBRA_DEBUG_VXLAN) zlog_debug( - "Add/update remote MAC %s intf %s(%u) VNI %u flags 0x%x - del local", - prefix_mac2str(macaddr, buf, sizeof(buf)), ifp->name, - ifp->ifindex, vni, mac->flags); + "Add/update remote MAC %pEA intf %s(%u) VNI %u flags 0x%x - del local", + macaddr, ifp->name, ifp->ifindex, vni, mac->flags); /* Remove MAC from BGP. */ zebra_evpn_mac_send_del_to_client(zevpn->vni, macaddr, mac->flags, @@ -4175,7 +4139,6 @@ int zebra_vxlan_local_mac_add_update(struct interface *ifp, { zebra_evpn_t *zevpn; struct zebra_vrf *zvrf; - char buf[ETHER_ADDR_STRLEN]; assert(ifp); @@ -4186,9 +4149,8 @@ int zebra_vxlan_local_mac_add_update(struct interface *ifp, if (!zevpn) { if (IS_ZEBRA_DEBUG_VXLAN) zlog_debug( - " Add/Update %sMAC %s intf %s(%u) VID %u, could not find EVPN", - sticky ? "sticky " : "", - prefix_mac2str(macaddr, buf, sizeof(buf)), + " Add/Update %sMAC %pEA intf %s(%u) VID %u, could not find EVPN", + sticky ? "sticky " : "", macaddr, ifp->name, ifp->ifindex, vid); return 0; } |