summaryrefslogtreecommitdiffstats
path: root/zebra/interface.c
diff options
context:
space:
mode:
authorMark Stapp <mjs@voltanet.io>2020-10-29 17:03:25 +0100
committerMark Stapp <mjs@voltanet.io>2020-10-29 17:03:25 +0100
commit904e9b057031e7063fb3c4094f6009c0c4aa8a14 (patch)
treee2d027ea1dce24b1a5ae4969e7a5c109d183b6b3 /zebra/interface.c
parentospfd: clean up SA warning in ospf_finish_final() (diff)
downloadfrr-904e9b057031e7063fb3c4094f6009c0c4aa8a14.tar.xz
frr-904e9b057031e7063fb3c4094f6009c0c4aa8a14.zip
zebra: clean up zebra_protodown_rc_str()
Clean up api SA warning, use 'const', and replace snprintf+ pointer math with strlcat. Signed-off-by: Mark Stapp <mjs@voltanet.io>
Diffstat (limited to 'zebra/interface.c')
-rw-r--r--zebra/interface.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/zebra/interface.c b/zebra/interface.c
index 67be78193..ddad9c9e5 100644
--- a/zebra/interface.c
+++ b/zebra/interface.c
@@ -1400,36 +1400,30 @@ static void ifs_dump_brief_vty(struct vty *vty, struct vrf *vrf)
vty_out(vty, "\n");
}
-char *zebra_protodown_rc_str(enum protodown_reasons protodown_rc, char *pd_buf,
- uint32_t pd_buf_len)
+const char *zebra_protodown_rc_str(enum protodown_reasons protodown_rc,
+ char *pd_buf, uint32_t pd_buf_len)
{
bool first = true;
pd_buf[0] = '\0';
- snprintf(pd_buf + strlen(pd_buf), pd_buf_len - strlen(pd_buf), "(");
+ strlcat(pd_buf, "(", pd_buf_len);
if (protodown_rc & ZEBRA_PROTODOWN_EVPN_STARTUP_DELAY) {
if (first)
first = false;
else
- snprintf(pd_buf + strlen(pd_buf),
- pd_buf_len - strlen(pd_buf), ",");
- snprintf(pd_buf + strlen(pd_buf), pd_buf_len - strlen(pd_buf),
- "startup-delay");
+ strlcat(pd_buf, ",", pd_buf_len);
+ strlcat(pd_buf, "startup-delay", pd_buf_len);
}
if (protodown_rc & ZEBRA_PROTODOWN_EVPN_UPLINK_DOWN) {
- if (first)
- first = false;
- else
- snprintf(pd_buf + strlen(pd_buf),
- pd_buf_len - strlen(pd_buf), ",");
- snprintf(pd_buf + strlen(pd_buf), pd_buf_len - strlen(pd_buf),
- "uplinks-down");
+ if (!first)
+ strlcat(pd_buf, ",", pd_buf_len);
+ strlcat(pd_buf, "uplinks-down", pd_buf_len);
}
- snprintf(pd_buf + strlen(pd_buf), pd_buf_len - strlen(pd_buf), ")");
+ strlcat(pd_buf, ")", pd_buf_len);
return pd_buf;
}