Skip to content

Commit 5d4c7d2

Browse files
authored
Merge pull request FRRouting#18675 from mjstapp/fix_clang_18_warnings
lib,pimd,bgpd,bfdd: Fix clang 18 warnings
2 parents 0850ae7 + 2d42318 commit 5d4c7d2

File tree

6 files changed

+40
-37
lines changed

6 files changed

+40
-37
lines changed

bfdd/bfd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2518,7 +2518,7 @@ void sbfd_reflector_free(const uint32_t discr)
25182518
return;
25192519
}
25202520

2521-
void sbfd_reflector_flush()
2521+
void sbfd_reflector_flush(void)
25222522
{
25232523
sbfd_discr_iterate(_sbfd_reflector_free, NULL);
25242524
return;

bgpd/bgp_bmp.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3542,7 +3542,6 @@ static int bmp_bgp_attribute_updated(struct bgp *bgp, bool withdraw)
35423542
struct bmp_targets *bt;
35433543
struct listnode *node;
35443544
struct bmp_imported_bgp *bib;
3545-
int ret = 0;
35463545
struct stream *s = bmp_peerstate(bgp->peer_self, withdraw);
35473546
struct bmp *bmp;
35483547
afi_t afi;
@@ -3553,8 +3552,8 @@ static int bmp_bgp_attribute_updated(struct bgp *bgp, bool withdraw)
35533552

35543553
if (bmpbgp) {
35553554
frr_each (bmp_targets, &bmpbgp->targets, bt) {
3556-
ret = bmp_bgp_attribute_updated_instance(bt, &bmpbgp->vrf_state, bgp,
3557-
withdraw, s);
3555+
bmp_bgp_attribute_updated_instance(bt, &bmpbgp->vrf_state, bgp,
3556+
withdraw, s);
35583557
if (withdraw)
35593558
continue;
35603559
frr_each (bmp_session, &bt->sessions, bmp) {
@@ -3575,8 +3574,8 @@ static int bmp_bgp_attribute_updated(struct bgp *bgp, bool withdraw)
35753574
frr_each (bmp_imported_bgps, &bt->imported_bgps, bib) {
35763575
if (bgp_lookup_by_name(bib->name) != bgp)
35773576
continue;
3578-
ret += bmp_bgp_attribute_updated_instance(bt, &bib->vrf_state, bgp,
3579-
withdraw, s);
3577+
bmp_bgp_attribute_updated_instance(bt, &bib->vrf_state, bgp,
3578+
withdraw, s);
35803579
if (withdraw)
35813580
continue;
35823581
frr_each (bmp_session, &bt->sessions, bmp) {

lib/command_parse.y

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,14 @@
158158
ctx->docstr_start = ctx->docstr;
159159
}
160160

161+
%{
162+
#ifdef __clang__
163+
# if __clang_major__ > 12
164+
# pragma GCC diagnostic ignored "-Wunused-but-set-variable"
165+
# endif
166+
#endif
167+
%}
168+
161169
%%
162170

163171
start:

pimd/pim_autorp.c

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -306,8 +306,8 @@ static bool autorp_recv_announcement(struct pim_autorp *autorp, uint8_t rpcnt, u
306306
/* Ignore RP's limited to PIM version 1 or with an unknown version */
307307
if (rp->pimver == AUTORP_PIM_V1 || rp->pimver == AUTORP_PIM_VUNKNOWN) {
308308
if (PIM_DEBUG_AUTORP)
309-
zlog_debug("%s: Ignoring unsupported PIM version (%u) in AutoRP Announcement for RP %pI4",
310-
__func__, rp->pimver, (in_addr_t *)&(rp->addr));
309+
zlog_debug("%s: Ignoring unsupported PIM version (%u) in AutoRP Announcement for RP %pPA",
310+
__func__, rp->pimver, &rp_addr);
311311
/* Update the offset to skip past the groups advertised for this RP */
312312
offset += (AUTORP_GRPLEN * rp->grpcnt);
313313
continue;
@@ -316,14 +316,14 @@ static bool autorp_recv_announcement(struct pim_autorp *autorp, uint8_t rpcnt, u
316316
if (rp->grpcnt == 0) {
317317
/* No groups?? */
318318
if (PIM_DEBUG_AUTORP)
319-
zlog_debug("%s: Announcement message has no groups for RP %pI4",
320-
__func__, (in_addr_t *)&(rp->addr));
319+
zlog_debug("%s: Announcement message has no groups for RP %pPA",
320+
__func__, &rp_addr);
321321
continue;
322322
}
323323

324324
if ((buf_size - offset) < AUTORP_GRPLEN) {
325-
zlog_warn("%s: Buffer underrun parsing groups for RP %pI4", __func__,
326-
(in_addr_t *)&(rp->addr));
325+
zlog_warn("%s: Buffer underrun parsing groups for RP %pPA", __func__,
326+
&rp_addr);
327327
return false;
328328
}
329329

@@ -794,14 +794,14 @@ static bool autorp_recv_discovery(struct pim_autorp *autorp, uint8_t rpcnt, uint
794794
rp_addr.s_addr = rp->addr;
795795

796796
if (PIM_DEBUG_AUTORP)
797-
zlog_debug("%s: Parsing RP %pI4 (grpcnt=%u)", __func__,
798-
(in_addr_t *)&rp->addr, rp->grpcnt);
797+
zlog_debug("%s: Parsing RP %pPA (grpcnt=%u)", __func__, &rp_addr,
798+
rp->grpcnt);
799799

800800
/* Ignore RP's limited to PIM version 1 or with an unknown version */
801801
if (rp->pimver == AUTORP_PIM_V1 || rp->pimver == AUTORP_PIM_VUNKNOWN) {
802802
if (PIM_DEBUG_AUTORP)
803803
zlog_debug("%s: Ignoring unsupported PIM version in AutoRP Discovery for RP %pI4",
804-
__func__, (in_addr_t *)&(rp->addr));
804+
__func__, &rp_addr);
805805
/* Update the offset to skip past the groups advertised for this RP */
806806
offset += (AUTORP_GRPLEN * rp->grpcnt);
807807
continue;
@@ -810,17 +810,16 @@ static bool autorp_recv_discovery(struct pim_autorp *autorp, uint8_t rpcnt, uint
810810
if (rp->grpcnt == 0) {
811811
/* No groups?? */
812812
if (PIM_DEBUG_AUTORP)
813-
zlog_debug("%s: Discovery message has no groups for RP %pI4",
814-
__func__, (in_addr_t *)&(rp->addr));
813+
zlog_debug("%s: Discovery message has no groups for RP %pPA",
814+
__func__, &rp_addr);
815815
continue;
816816
}
817817

818818
/* Make sure there is enough buffer to parse all the groups */
819819
if ((buf_size - offset) < (AUTORP_GRPLEN * rp->grpcnt)) {
820820
if (PIM_DEBUG_AUTORP)
821-
zlog_debug("%s: Buffer underrun parsing groups for RP %pI4 (%u < %u)",
822-
__func__, (in_addr_t *)&(rp->addr),
823-
(uint32_t)(buf_size - offset),
821+
zlog_debug("%s: Buffer underrun parsing groups for RP %pPA (%u < %u)",
822+
__func__, &rp_addr, (uint32_t)(buf_size - offset),
824823
(uint32_t)(AUTORP_GRPLEN * rp->grpcnt));
825824
return false;
826825
}
@@ -838,8 +837,7 @@ static bool autorp_recv_discovery(struct pim_autorp *autorp, uint8_t rpcnt, uint
838837

839838
if (PIM_DEBUG_AUTORP)
840839
zlog_debug("%s: Parsing group %s%pFX for RP %pI4", __func__,
841-
(grp->negprefix ? "!" : ""), &grppfix,
842-
(in_addr_t *)&rp->addr);
840+
(grp->negprefix ? "!" : ""), &grppfix, &rp_addr);
843841

844842
if (!pim_autorp_add_rp(autorp, rp_addr, grppfix, NULL, holdtime))
845843
success = false;
@@ -885,9 +883,9 @@ static bool autorp_recv_discovery(struct pim_autorp *autorp, uint8_t rpcnt, uint
885883
prefix_list_entry_update_finish(ple);
886884

887885
if (PIM_DEBUG_AUTORP)
888-
zlog_debug("%s: Parsing group %s%pFX for RP %pI4", __func__,
886+
zlog_debug("%s: Parsing group %s%pFX for RP %pPA", __func__,
889887
(grp->negprefix ? "!" : ""), &ple->prefix,
890-
(in_addr_t *)&rp->addr);
888+
&rp_addr);
891889
}
892890

893891
if (!pim_autorp_add_rp(autorp, rp_addr, grppfix, plname, holdtime))

pimd/pim_bsm.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1562,8 +1562,7 @@ int pim_bsm_process(struct interface *ifp, pim_sgaddr *sg, uint8_t *buf,
15621562
(buf + PIM_BSM_HDR_LEN + PIM_MSG_HEADER_LEN),
15631563
(buf_size - PIM_BSM_HDR_LEN - PIM_MSG_HEADER_LEN),
15641564
frag_tag)) {
1565-
zlog_warn("BSM from %pPA failed to parse",
1566-
(pim_addr *)&bshdr->bsr_addr.addr);
1565+
zlog_warn("BSM from %pPA failed to parse", &bsr_addr);
15671566
pim->bsm_dropped++;
15681567
return -1;
15691568
}
@@ -1802,7 +1801,7 @@ bool cand_addrsel_update(struct cand_addrsel *asel, struct vrf *vrf)
18021801

18031802
case CAND_ADDR_ANY:
18041803
is_any = true;
1805-
/* fallthru */
1804+
fallthrough;
18061805
case CAND_ADDR_LO:
18071806
FOR_ALL_INTERFACES (vrf, ifp) {
18081807
if (!if_is_up(ifp))

pimd/pim_bsr_rpdb.c

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,8 @@ int pim_crp_process(struct interface *ifp, pim_sgaddr *src_dst, uint8_t *buf,
455455
struct pim_interface *pim_ifp = NULL;
456456
struct pim_instance *pim;
457457
struct bsm_scope *scope;
458+
size_t ngroups;
459+
pim_addr rpaddr = {};
458460

459461
pim_ifp = ifp->info;
460462
if (!pim_ifp) {
@@ -505,20 +507,19 @@ int pim_crp_process(struct interface *ifp, pim_sgaddr *src_dst, uint8_t *buf,
505507
/* ignore trailing data */
506508
(void)buf;
507509

508-
size_t ngroups = crp_hdr->prefix_cnt;
510+
ngroups = crp_hdr->prefix_cnt;
511+
rpaddr = crp_hdr->rp_addr.addr;
509512

510513
if (remain < ngroups * sizeof(struct pim_encoded_group_ipv4)) {
511514
if (PIM_DEBUG_BSM)
512515
zlog_debug("truncated Candidate-RP advertisement for RP %pPA from %pPA (too short for %zu groups)",
513-
(pim_addr *)&crp_hdr->rp_addr.addr,
514-
&src_dst->src, ngroups);
516+
&rpaddr, &src_dst->src, ngroups);
515517
return -1;
516518
}
517519

518520
if (PIM_DEBUG_BSM)
519521
zlog_debug("Candidate-RP: %pPA, prio=%u (from %pPA, %zu groups)",
520-
(pim_addr *)&crp_hdr->rp_addr.addr, crp_hdr->rp_prio,
521-
&src_dst->src, ngroups);
522+
(pim_addr *)&rpaddr, crp_hdr->rp_prio, &src_dst->src, ngroups);
522523

523524

524525
struct bsr_crp_rp *rp, ref;
@@ -529,16 +530,14 @@ int pim_crp_process(struct interface *ifp, pim_sgaddr *src_dst, uint8_t *buf,
529530
if (!rp) {
530531
if (bsr_crp_rps_count(scope->ebsr_rps) >= bsr_max_rps) {
531532
zlog_err("BSR: number of tracked Candidate RPs (%zu) exceeds DoS-protection limit (%zu), dropping advertisement for RP %pPA (packet source %pPA)",
532-
bsr_crp_rps_count(scope->ebsr_rps),
533-
bsr_max_rps, (pim_addr *)&crp_hdr->rp_addr.addr,
534-
&src_dst->src);
533+
bsr_crp_rps_count(scope->ebsr_rps), bsr_max_rps,
534+
(pim_addr *)&rpaddr, &src_dst->src);
535535
return -1;
536536
}
537537

538538
if (PIM_DEBUG_BSM)
539539
zlog_debug("new Candidate-RP: %pPA (from %pPA)",
540-
(pim_addr *)&crp_hdr->rp_addr.addr,
541-
&src_dst->src);
540+
(pim_addr *)&rpaddr, &src_dst->src);
542541

543542
rp = XCALLOC(MTYPE_PIM_BSR_CRP, sizeof(*rp));
544543
rp->scope = scope;

0 commit comments

Comments
 (0)