diff options
author | David Lamparter <equinox@opensourcerouting.org> | 2022-01-04 21:10:37 +0100 |
---|---|---|
committer | David Lamparter <equinox@opensourcerouting.org> | 2022-01-17 14:00:04 +0100 |
commit | 9bace5c2d389c7839ad3e949712728c938493e53 (patch) | |
tree | ac1e24583977f5c55f5a7bf2b7a91de8cbedf37e | |
parent | Merge pull request #10350 from Drumato/fix-zebra-srv6-segment-routing-block (diff) | |
download | frr-9bace5c2d389c7839ad3e949712728c938493e53.tar.xz frr-9bace5c2d389c7839ad3e949712728c938493e53.zip |
pimd: remove pim_str_sg_set()
... and replace with `%pSG` printfrr specifier.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
-rw-r--r-- | pimd/pim_ifchannel.c | 2 | ||||
-rw-r--r-- | pimd/pim_mlag.c | 33 | ||||
-rw-r--r-- | pimd/pim_msdp.c | 2 | ||||
-rw-r--r-- | pimd/pim_str.c | 2 | ||||
-rw-r--r-- | pimd/pim_str.h | 6 | ||||
-rw-r--r-- | pimd/pim_upstream.c | 2 | ||||
-rw-r--r-- | pimd/pim_vxlan.c | 2 | ||||
-rw-r--r-- | pimd/pim_zebra.c | 11 |
8 files changed, 23 insertions, 37 deletions
diff --git a/pimd/pim_ifchannel.c b/pimd/pim_ifchannel.c index c0d693071..6ceed3788 100644 --- a/pimd/pim_ifchannel.c +++ b/pimd/pim_ifchannel.c @@ -575,7 +575,7 @@ struct pim_ifchannel *pim_ifchannel_add(struct interface *ifp, pim_sgaddr *sg, ch->interface = ifp; ch->sg = *sg; - pim_str_sg_set(sg, ch->sg_str); + snprintfrr(ch->sg_str, sizeof(ch->sg_str), "%pSG", sg); ch->parent = pim_ifchannel_find_parent(ch); if (ch->sg.src.s_addr == INADDR_ANY) { ch->sources = list_new(); diff --git a/pimd/pim_mlag.c b/pimd/pim_mlag.c index 1f38b1c93..a9fb8205b 100644 --- a/pimd/pim_mlag.c +++ b/pimd/pim_mlag.c @@ -255,17 +255,14 @@ static void pim_mlag_up_peer_add(struct mlag_mroute_add *msg) int flags = 0; pim_sgaddr sg; struct vrf *vrf; - char sg_str[PIM_SG_LEN]; memset(&sg, 0, sizeof(sg)); sg.src.s_addr = htonl(msg->source_ip); sg.grp.s_addr = htonl(msg->group_ip); - if (PIM_DEBUG_MLAG) - pim_str_sg_set(&sg, sg_str); if (PIM_DEBUG_MLAG) - zlog_debug("peer MLAG mroute add %s:%s cost %d", - msg->vrf_name, sg_str, msg->cost_to_rp); + zlog_debug("peer MLAG mroute add %s:%pSG cost %d", + msg->vrf_name, &sg, msg->cost_to_rp); /* XXX - this is not correct. we MUST cache updates to avoid losing * an entry because of race conditions with the peer switch. @@ -273,8 +270,9 @@ static void pim_mlag_up_peer_add(struct mlag_mroute_add *msg) vrf = vrf_lookup_by_name(msg->vrf_name); if (!vrf) { if (PIM_DEBUG_MLAG) - zlog_debug("peer MLAG mroute add failed %s:%s; no vrf", - msg->vrf_name, sg_str); + zlog_debug( + "peer MLAG mroute add failed %s:%pSG; no vrf", + msg->vrf_name, &sg); return; } pim = vrf->info; @@ -294,8 +292,9 @@ static void pim_mlag_up_peer_add(struct mlag_mroute_add *msg) if (!up) { if (PIM_DEBUG_MLAG) - zlog_debug("peer MLAG mroute add failed %s:%s", - vrf->name, sg_str); + zlog_debug( + "peer MLAG mroute add failed %s:%pSG", + vrf->name, &sg); return; } } @@ -329,23 +328,20 @@ static void pim_mlag_up_peer_del(struct mlag_mroute_del *msg) struct pim_instance *pim; pim_sgaddr sg; struct vrf *vrf; - char sg_str[PIM_SG_LEN]; memset(&sg, 0, sizeof(sg)); sg.src.s_addr = htonl(msg->source_ip); sg.grp.s_addr = htonl(msg->group_ip); - if (PIM_DEBUG_MLAG) - pim_str_sg_set(&sg, sg_str); if (PIM_DEBUG_MLAG) - zlog_debug("peer MLAG mroute del %s:%s", msg->vrf_name, - sg_str); + zlog_debug("peer MLAG mroute del %s:%pSG", msg->vrf_name, &sg); vrf = vrf_lookup_by_name(msg->vrf_name); if (!vrf) { if (PIM_DEBUG_MLAG) - zlog_debug("peer MLAG mroute del skipped %s:%s; no vrf", - msg->vrf_name, sg_str); + zlog_debug( + "peer MLAG mroute del skipped %s:%pSG; no vrf", + msg->vrf_name, &sg); return; } pim = vrf->info; @@ -353,8 +349,9 @@ static void pim_mlag_up_peer_del(struct mlag_mroute_del *msg) up = pim_upstream_find(pim, &sg); if (!up) { if (PIM_DEBUG_MLAG) - zlog_debug("peer MLAG mroute del skipped %s:%s; no up", - vrf->name, sg_str); + zlog_debug( + "peer MLAG mroute del skipped %s:%pSG; no up", + vrf->name, &sg); return; } diff --git a/pimd/pim_msdp.c b/pimd/pim_msdp.c index 40d864d1d..ec9ee3dc7 100644 --- a/pimd/pim_msdp.c +++ b/pimd/pim_msdp.c @@ -245,7 +245,7 @@ static struct pim_msdp_sa *pim_msdp_sa_new(struct pim_instance *pim, sa->pim = pim; sa->sg = *sg; - pim_str_sg_set(sg, sa->sg_str); + snprintfrr(sa->sg_str, sizeof(sa->sg_str), "%pSG", sg); sa->rp = rp; sa->uptime = pim_time_monotonic_sec(); diff --git a/pimd/pim_str.c b/pimd/pim_str.c index 180ed69fd..1ec17cfab 100644 --- a/pimd/pim_str.c +++ b/pimd/pim_str.c @@ -46,7 +46,7 @@ char *pim_str_sg_dump(const pim_sgaddr *sg) { static char sg_str[PIM_SG_LEN]; - pim_str_sg_set(sg, sg_str); + snprintfrr(sg_str, sizeof(sg_str), "%pSG", sg); return sg_str; } diff --git a/pimd/pim_str.h b/pimd/pim_str.h index f6d209b79..a148ed0cb 100644 --- a/pimd/pim_str.h +++ b/pimd/pim_str.h @@ -39,12 +39,6 @@ #define PIM_SG_LEN PREFIX_SG_STR_LEN #define pim_inet4_dump prefix_mcast_inet4_dump -static inline const char *pim_str_sg_set(const pim_sgaddr *sg, char *str) -{ - snprintfrr(str, PREFIX_SG_STR_LEN, "%pSG", sg); - return str; -} - static inline void pim_addr_copy(pim_addr *dest, pim_addr *source) { dest->s_addr = source->s_addr; diff --git a/pimd/pim_upstream.c b/pimd/pim_upstream.c index ef356213e..bc1d6558d 100644 --- a/pimd/pim_upstream.c +++ b/pimd/pim_upstream.c @@ -873,7 +873,7 @@ static struct pim_upstream *pim_upstream_new(struct pim_instance *pim, up->pim = pim; up->sg = *sg; - pim_str_sg_set(sg, up->sg_str); + snprintfrr(up->sg_str, sizeof(up->sg_str), "%pSG", sg); if (ch) ch->upstream = up; diff --git a/pimd/pim_vxlan.c b/pimd/pim_vxlan.c index 3aa8bacb8..fe7d358ee 100644 --- a/pimd/pim_vxlan.c +++ b/pimd/pim_vxlan.c @@ -742,7 +742,7 @@ static struct pim_vxlan_sg *pim_vxlan_sg_new(struct pim_instance *pim, vxlan_sg->pim = pim; vxlan_sg->sg = *sg; - pim_str_sg_set(sg, vxlan_sg->sg_str); + snprintfrr(vxlan_sg->sg_str, sizeof(vxlan_sg->sg_str), "%pSG", sg); if (PIM_DEBUG_VXLAN) zlog_debug("vxlan SG %s alloc", vxlan_sg->sg_str); diff --git a/pimd/pim_zebra.c b/pimd/pim_zebra.c index 05b6f23ed..c7b35178e 100644 --- a/pimd/pim_zebra.c +++ b/pimd/pim_zebra.c @@ -340,14 +340,9 @@ static int pim_zebra_vxlan_sg_proc(ZAPI_CALLBACK_ARGS) stream_get(&sg.src.s_addr, s, prefixlen); stream_get(&sg.grp.s_addr, s, prefixlen); - if (PIM_DEBUG_ZEBRA) { - char sg_str[PIM_SG_LEN]; - - pim_str_sg_set(&sg, sg_str); - zlog_debug("%u:recv SG %s %s", vrf_id, - (cmd == ZEBRA_VXLAN_SG_ADD)?"add":"del", - sg_str); - } + if (PIM_DEBUG_ZEBRA) + zlog_debug("%u:recv SG %s %pSG", vrf_id, + (cmd == ZEBRA_VXLAN_SG_ADD) ? "add" : "del", &sg); if (cmd == ZEBRA_VXLAN_SG_ADD) pim_vxlan_sg_add(pim, &sg); |