Merge pull request #18675 from mjstapp/fix_clang_18_warnings

lib,pimd,bgpd,bfdd: Fix clang 18 warnings
This commit is contained in:
Donald Sharp 2025-04-17 18:38:21 -04:00 committed by GitHub
commit 5d4c7d2ece
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 40 additions and 37 deletions

View file

@ -2518,7 +2518,7 @@ void sbfd_reflector_free(const uint32_t discr)
return;
}
void sbfd_reflector_flush()
void sbfd_reflector_flush(void)
{
sbfd_discr_iterate(_sbfd_reflector_free, NULL);
return;

View file

@ -3542,7 +3542,6 @@ static int bmp_bgp_attribute_updated(struct bgp *bgp, bool withdraw)
struct bmp_targets *bt;
struct listnode *node;
struct bmp_imported_bgp *bib;
int ret = 0;
struct stream *s = bmp_peerstate(bgp->peer_self, withdraw);
struct bmp *bmp;
afi_t afi;
@ -3553,8 +3552,8 @@ static int bmp_bgp_attribute_updated(struct bgp *bgp, bool withdraw)
if (bmpbgp) {
frr_each (bmp_targets, &bmpbgp->targets, bt) {
ret = bmp_bgp_attribute_updated_instance(bt, &bmpbgp->vrf_state, bgp,
withdraw, s);
bmp_bgp_attribute_updated_instance(bt, &bmpbgp->vrf_state, bgp,
withdraw, s);
if (withdraw)
continue;
frr_each (bmp_session, &bt->sessions, bmp) {
@ -3575,8 +3574,8 @@ static int bmp_bgp_attribute_updated(struct bgp *bgp, bool withdraw)
frr_each (bmp_imported_bgps, &bt->imported_bgps, bib) {
if (bgp_lookup_by_name(bib->name) != bgp)
continue;
ret += bmp_bgp_attribute_updated_instance(bt, &bib->vrf_state, bgp,
withdraw, s);
bmp_bgp_attribute_updated_instance(bt, &bib->vrf_state, bgp,
withdraw, s);
if (withdraw)
continue;
frr_each (bmp_session, &bt->sessions, bmp) {

View file

@ -158,6 +158,14 @@
ctx->docstr_start = ctx->docstr;
}
%{
#ifdef __clang__
# if __clang_major__ > 12
# pragma GCC diagnostic ignored "-Wunused-but-set-variable"
# endif
#endif
%}
%%
start:

View file

@ -306,8 +306,8 @@ static bool autorp_recv_announcement(struct pim_autorp *autorp, uint8_t rpcnt, u
/* Ignore RP's limited to PIM version 1 or with an unknown version */
if (rp->pimver == AUTORP_PIM_V1 || rp->pimver == AUTORP_PIM_VUNKNOWN) {
if (PIM_DEBUG_AUTORP)
zlog_debug("%s: Ignoring unsupported PIM version (%u) in AutoRP Announcement for RP %pI4",
__func__, rp->pimver, (in_addr_t *)&(rp->addr));
zlog_debug("%s: Ignoring unsupported PIM version (%u) in AutoRP Announcement for RP %pPA",
__func__, rp->pimver, &rp_addr);
/* Update the offset to skip past the groups advertised for this RP */
offset += (AUTORP_GRPLEN * rp->grpcnt);
continue;
@ -316,14 +316,14 @@ static bool autorp_recv_announcement(struct pim_autorp *autorp, uint8_t rpcnt, u
if (rp->grpcnt == 0) {
/* No groups?? */
if (PIM_DEBUG_AUTORP)
zlog_debug("%s: Announcement message has no groups for RP %pI4",
__func__, (in_addr_t *)&(rp->addr));
zlog_debug("%s: Announcement message has no groups for RP %pPA",
__func__, &rp_addr);
continue;
}
if ((buf_size - offset) < AUTORP_GRPLEN) {
zlog_warn("%s: Buffer underrun parsing groups for RP %pI4", __func__,
(in_addr_t *)&(rp->addr));
zlog_warn("%s: Buffer underrun parsing groups for RP %pPA", __func__,
&rp_addr);
return false;
}
@ -794,14 +794,14 @@ static bool autorp_recv_discovery(struct pim_autorp *autorp, uint8_t rpcnt, uint
rp_addr.s_addr = rp->addr;
if (PIM_DEBUG_AUTORP)
zlog_debug("%s: Parsing RP %pI4 (grpcnt=%u)", __func__,
(in_addr_t *)&rp->addr, rp->grpcnt);
zlog_debug("%s: Parsing RP %pPA (grpcnt=%u)", __func__, &rp_addr,
rp->grpcnt);
/* Ignore RP's limited to PIM version 1 or with an unknown version */
if (rp->pimver == AUTORP_PIM_V1 || rp->pimver == AUTORP_PIM_VUNKNOWN) {
if (PIM_DEBUG_AUTORP)
zlog_debug("%s: Ignoring unsupported PIM version in AutoRP Discovery for RP %pI4",
__func__, (in_addr_t *)&(rp->addr));
__func__, &rp_addr);
/* Update the offset to skip past the groups advertised for this RP */
offset += (AUTORP_GRPLEN * rp->grpcnt);
continue;
@ -810,17 +810,16 @@ static bool autorp_recv_discovery(struct pim_autorp *autorp, uint8_t rpcnt, uint
if (rp->grpcnt == 0) {
/* No groups?? */
if (PIM_DEBUG_AUTORP)
zlog_debug("%s: Discovery message has no groups for RP %pI4",
__func__, (in_addr_t *)&(rp->addr));
zlog_debug("%s: Discovery message has no groups for RP %pPA",
__func__, &rp_addr);
continue;
}
/* Make sure there is enough buffer to parse all the groups */
if ((buf_size - offset) < (AUTORP_GRPLEN * rp->grpcnt)) {
if (PIM_DEBUG_AUTORP)
zlog_debug("%s: Buffer underrun parsing groups for RP %pI4 (%u < %u)",
__func__, (in_addr_t *)&(rp->addr),
(uint32_t)(buf_size - offset),
zlog_debug("%s: Buffer underrun parsing groups for RP %pPA (%u < %u)",
__func__, &rp_addr, (uint32_t)(buf_size - offset),
(uint32_t)(AUTORP_GRPLEN * rp->grpcnt));
return false;
}
@ -838,8 +837,7 @@ static bool autorp_recv_discovery(struct pim_autorp *autorp, uint8_t rpcnt, uint
if (PIM_DEBUG_AUTORP)
zlog_debug("%s: Parsing group %s%pFX for RP %pI4", __func__,
(grp->negprefix ? "!" : ""), &grppfix,
(in_addr_t *)&rp->addr);
(grp->negprefix ? "!" : ""), &grppfix, &rp_addr);
if (!pim_autorp_add_rp(autorp, rp_addr, grppfix, NULL, holdtime))
success = false;
@ -885,9 +883,9 @@ static bool autorp_recv_discovery(struct pim_autorp *autorp, uint8_t rpcnt, uint
prefix_list_entry_update_finish(ple);
if (PIM_DEBUG_AUTORP)
zlog_debug("%s: Parsing group %s%pFX for RP %pI4", __func__,
zlog_debug("%s: Parsing group %s%pFX for RP %pPA", __func__,
(grp->negprefix ? "!" : ""), &ple->prefix,
(in_addr_t *)&rp->addr);
&rp_addr);
}
if (!pim_autorp_add_rp(autorp, rp_addr, grppfix, plname, holdtime))

View file

@ -1562,8 +1562,7 @@ int pim_bsm_process(struct interface *ifp, pim_sgaddr *sg, uint8_t *buf,
(buf + PIM_BSM_HDR_LEN + PIM_MSG_HEADER_LEN),
(buf_size - PIM_BSM_HDR_LEN - PIM_MSG_HEADER_LEN),
frag_tag)) {
zlog_warn("BSM from %pPA failed to parse",
(pim_addr *)&bshdr->bsr_addr.addr);
zlog_warn("BSM from %pPA failed to parse", &bsr_addr);
pim->bsm_dropped++;
return -1;
}
@ -1802,7 +1801,7 @@ bool cand_addrsel_update(struct cand_addrsel *asel, struct vrf *vrf)
case CAND_ADDR_ANY:
is_any = true;
/* fallthru */
fallthrough;
case CAND_ADDR_LO:
FOR_ALL_INTERFACES (vrf, ifp) {
if (!if_is_up(ifp))

View file

@ -455,6 +455,8 @@ int pim_crp_process(struct interface *ifp, pim_sgaddr *src_dst, uint8_t *buf,
struct pim_interface *pim_ifp = NULL;
struct pim_instance *pim;
struct bsm_scope *scope;
size_t ngroups;
pim_addr rpaddr = {};
pim_ifp = ifp->info;
if (!pim_ifp) {
@ -505,20 +507,19 @@ int pim_crp_process(struct interface *ifp, pim_sgaddr *src_dst, uint8_t *buf,
/* ignore trailing data */
(void)buf;
size_t ngroups = crp_hdr->prefix_cnt;
ngroups = crp_hdr->prefix_cnt;
rpaddr = crp_hdr->rp_addr.addr;
if (remain < ngroups * sizeof(struct pim_encoded_group_ipv4)) {
if (PIM_DEBUG_BSM)
zlog_debug("truncated Candidate-RP advertisement for RP %pPA from %pPA (too short for %zu groups)",
(pim_addr *)&crp_hdr->rp_addr.addr,
&src_dst->src, ngroups);
&rpaddr, &src_dst->src, ngroups);
return -1;
}
if (PIM_DEBUG_BSM)
zlog_debug("Candidate-RP: %pPA, prio=%u (from %pPA, %zu groups)",
(pim_addr *)&crp_hdr->rp_addr.addr, crp_hdr->rp_prio,
&src_dst->src, ngroups);
(pim_addr *)&rpaddr, crp_hdr->rp_prio, &src_dst->src, ngroups);
struct bsr_crp_rp *rp, ref;
@ -529,16 +530,14 @@ int pim_crp_process(struct interface *ifp, pim_sgaddr *src_dst, uint8_t *buf,
if (!rp) {
if (bsr_crp_rps_count(scope->ebsr_rps) >= bsr_max_rps) {
zlog_err("BSR: number of tracked Candidate RPs (%zu) exceeds DoS-protection limit (%zu), dropping advertisement for RP %pPA (packet source %pPA)",
bsr_crp_rps_count(scope->ebsr_rps),
bsr_max_rps, (pim_addr *)&crp_hdr->rp_addr.addr,
&src_dst->src);
bsr_crp_rps_count(scope->ebsr_rps), bsr_max_rps,
(pim_addr *)&rpaddr, &src_dst->src);
return -1;
}
if (PIM_DEBUG_BSM)
zlog_debug("new Candidate-RP: %pPA (from %pPA)",
(pim_addr *)&crp_hdr->rp_addr.addr,
&src_dst->src);
(pim_addr *)&rpaddr, &src_dst->src);
rp = XCALLOC(MTYPE_PIM_BSR_CRP, sizeof(*rp));
rp->scope = scope;