forked from Mirror/frr
pimd: clean up clang warnings
Clean up clang warnings in pimd; mostly address-of-packed issues (removed some ugly casts too). Signed-off-by: Mark Stapp <mjs@cisco.com>
This commit is contained in:
parent
c65fdc9a49
commit
d378275106
|
@ -283,8 +283,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 */
|
/* 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 (rp->pimver == AUTORP_PIM_V1 || rp->pimver == AUTORP_PIM_VUNKNOWN) {
|
||||||
if (PIM_DEBUG_AUTORP)
|
if (PIM_DEBUG_AUTORP)
|
||||||
zlog_debug("%s: Ignoring unsupported PIM version (%u) in AutoRP Announcement for RP %pI4",
|
zlog_debug("%s: Ignoring unsupported PIM version (%u) in AutoRP Announcement for RP %pPA",
|
||||||
__func__, rp->pimver, (in_addr_t *)&(rp->addr));
|
__func__, rp->pimver, &rp_addr);
|
||||||
/* Update the offset to skip past the groups advertised for this RP */
|
/* Update the offset to skip past the groups advertised for this RP */
|
||||||
offset += (AUTORP_GRPLEN * rp->grpcnt);
|
offset += (AUTORP_GRPLEN * rp->grpcnt);
|
||||||
continue;
|
continue;
|
||||||
|
@ -293,14 +293,14 @@ static bool autorp_recv_announcement(struct pim_autorp *autorp, uint8_t rpcnt, u
|
||||||
if (rp->grpcnt == 0) {
|
if (rp->grpcnt == 0) {
|
||||||
/* No groups?? */
|
/* No groups?? */
|
||||||
if (PIM_DEBUG_AUTORP)
|
if (PIM_DEBUG_AUTORP)
|
||||||
zlog_debug("%s: Announcement message has no groups for RP %pI4",
|
zlog_debug("%s: Announcement message has no groups for RP %pPA",
|
||||||
__func__, (in_addr_t *)&(rp->addr));
|
__func__, &rp_addr);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((buf_size - offset) < AUTORP_GRPLEN) {
|
if ((buf_size - offset) < AUTORP_GRPLEN) {
|
||||||
zlog_warn("%s: Buffer underrun parsing groups for RP %pI4", __func__,
|
zlog_warn("%s: Buffer underrun parsing groups for RP %pPA", __func__,
|
||||||
(in_addr_t *)&(rp->addr));
|
&rp_addr);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -765,14 +765,14 @@ static bool autorp_recv_discovery(struct pim_autorp *autorp, uint8_t rpcnt, uint
|
||||||
rp_addr.s_addr = rp->addr;
|
rp_addr.s_addr = rp->addr;
|
||||||
|
|
||||||
if (PIM_DEBUG_AUTORP)
|
if (PIM_DEBUG_AUTORP)
|
||||||
zlog_debug("%s: Parsing RP %pI4 (grpcnt=%u)", __func__,
|
zlog_debug("%s: Parsing RP %pPA (grpcnt=%u)", __func__, &rp_addr,
|
||||||
(in_addr_t *)&rp->addr, rp->grpcnt);
|
rp->grpcnt);
|
||||||
|
|
||||||
/* Ignore RP's limited to PIM version 1 or with an unknown version */
|
/* 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 (rp->pimver == AUTORP_PIM_V1 || rp->pimver == AUTORP_PIM_VUNKNOWN) {
|
||||||
if (PIM_DEBUG_AUTORP)
|
if (PIM_DEBUG_AUTORP)
|
||||||
zlog_debug("%s: Ignoring unsupported PIM version in AutoRP Discovery for RP %pI4",
|
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 */
|
/* Update the offset to skip past the groups advertised for this RP */
|
||||||
offset += (AUTORP_GRPLEN * rp->grpcnt);
|
offset += (AUTORP_GRPLEN * rp->grpcnt);
|
||||||
continue;
|
continue;
|
||||||
|
@ -781,17 +781,16 @@ static bool autorp_recv_discovery(struct pim_autorp *autorp, uint8_t rpcnt, uint
|
||||||
if (rp->grpcnt == 0) {
|
if (rp->grpcnt == 0) {
|
||||||
/* No groups?? */
|
/* No groups?? */
|
||||||
if (PIM_DEBUG_AUTORP)
|
if (PIM_DEBUG_AUTORP)
|
||||||
zlog_debug("%s: Discovery message has no groups for RP %pI4",
|
zlog_debug("%s: Discovery message has no groups for RP %pPA",
|
||||||
__func__, (in_addr_t *)&(rp->addr));
|
__func__, &rp_addr);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make sure there is enough buffer to parse all the groups */
|
/* Make sure there is enough buffer to parse all the groups */
|
||||||
if ((buf_size - offset) < (AUTORP_GRPLEN * rp->grpcnt)) {
|
if ((buf_size - offset) < (AUTORP_GRPLEN * rp->grpcnt)) {
|
||||||
if (PIM_DEBUG_AUTORP)
|
if (PIM_DEBUG_AUTORP)
|
||||||
zlog_debug("%s: Buffer underrun parsing groups for RP %pI4 (%u < %u)",
|
zlog_debug("%s: Buffer underrun parsing groups for RP %pPA (%u < %u)",
|
||||||
__func__, (in_addr_t *)&(rp->addr),
|
__func__, &rp_addr, (uint32_t)(buf_size - offset),
|
||||||
(uint32_t)(buf_size - offset),
|
|
||||||
(uint32_t)(AUTORP_GRPLEN * rp->grpcnt));
|
(uint32_t)(AUTORP_GRPLEN * rp->grpcnt));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -809,8 +808,7 @@ static bool autorp_recv_discovery(struct pim_autorp *autorp, uint8_t rpcnt, uint
|
||||||
|
|
||||||
if (PIM_DEBUG_AUTORP)
|
if (PIM_DEBUG_AUTORP)
|
||||||
zlog_debug("%s: Parsing group %s%pFX for RP %pI4", __func__,
|
zlog_debug("%s: Parsing group %s%pFX for RP %pI4", __func__,
|
||||||
(grp->negprefix ? "!" : ""), &grppfix,
|
(grp->negprefix ? "!" : ""), &grppfix, &rp_addr);
|
||||||
(in_addr_t *)&rp->addr);
|
|
||||||
|
|
||||||
if (!pim_autorp_add_rp(autorp, rp_addr, grppfix, NULL, holdtime))
|
if (!pim_autorp_add_rp(autorp, rp_addr, grppfix, NULL, holdtime))
|
||||||
success = false;
|
success = false;
|
||||||
|
@ -856,9 +854,9 @@ static bool autorp_recv_discovery(struct pim_autorp *autorp, uint8_t rpcnt, uint
|
||||||
prefix_list_entry_update_finish(ple);
|
prefix_list_entry_update_finish(ple);
|
||||||
|
|
||||||
if (PIM_DEBUG_AUTORP)
|
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,
|
(grp->negprefix ? "!" : ""), &ple->prefix,
|
||||||
(in_addr_t *)&rp->addr);
|
&rp_addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!pim_autorp_add_rp(autorp, rp_addr, grppfix, plname, holdtime))
|
if (!pim_autorp_add_rp(autorp, rp_addr, grppfix, plname, holdtime))
|
||||||
|
|
|
@ -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 + PIM_BSM_HDR_LEN + PIM_MSG_HEADER_LEN),
|
||||||
(buf_size - PIM_BSM_HDR_LEN - PIM_MSG_HEADER_LEN),
|
(buf_size - PIM_BSM_HDR_LEN - PIM_MSG_HEADER_LEN),
|
||||||
frag_tag)) {
|
frag_tag)) {
|
||||||
zlog_warn("BSM from %pPA failed to parse",
|
zlog_warn("BSM from %pPA failed to parse", &bsr_addr);
|
||||||
(pim_addr *)&bshdr->bsr_addr.addr);
|
|
||||||
pim->bsm_dropped++;
|
pim->bsm_dropped++;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -1802,7 +1801,7 @@ bool cand_addrsel_update(struct cand_addrsel *asel, struct vrf *vrf)
|
||||||
|
|
||||||
case CAND_ADDR_ANY:
|
case CAND_ADDR_ANY:
|
||||||
is_any = true;
|
is_any = true;
|
||||||
/* fallthru */
|
fallthrough;
|
||||||
case CAND_ADDR_LO:
|
case CAND_ADDR_LO:
|
||||||
FOR_ALL_INTERFACES (vrf, ifp) {
|
FOR_ALL_INTERFACES (vrf, ifp) {
|
||||||
if (!if_is_up(ifp))
|
if (!if_is_up(ifp))
|
||||||
|
|
|
@ -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_interface *pim_ifp = NULL;
|
||||||
struct pim_instance *pim;
|
struct pim_instance *pim;
|
||||||
struct bsm_scope *scope;
|
struct bsm_scope *scope;
|
||||||
|
size_t ngroups;
|
||||||
|
pim_addr rpaddr = {};
|
||||||
|
|
||||||
pim_ifp = ifp->info;
|
pim_ifp = ifp->info;
|
||||||
if (!pim_ifp) {
|
if (!pim_ifp) {
|
||||||
|
@ -505,20 +507,19 @@ int pim_crp_process(struct interface *ifp, pim_sgaddr *src_dst, uint8_t *buf,
|
||||||
/* ignore trailing data */
|
/* ignore trailing data */
|
||||||
(void)buf;
|
(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 (remain < ngroups * sizeof(struct pim_encoded_group_ipv4)) {
|
||||||
if (PIM_DEBUG_BSM)
|
if (PIM_DEBUG_BSM)
|
||||||
zlog_debug("truncated Candidate-RP advertisement for RP %pPA from %pPA (too short for %zu groups)",
|
zlog_debug("truncated Candidate-RP advertisement for RP %pPA from %pPA (too short for %zu groups)",
|
||||||
(pim_addr *)&crp_hdr->rp_addr.addr,
|
&rpaddr, &src_dst->src, ngroups);
|
||||||
&src_dst->src, ngroups);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PIM_DEBUG_BSM)
|
if (PIM_DEBUG_BSM)
|
||||||
zlog_debug("Candidate-RP: %pPA, prio=%u (from %pPA, %zu groups)",
|
zlog_debug("Candidate-RP: %pPA, prio=%u (from %pPA, %zu groups)",
|
||||||
(pim_addr *)&crp_hdr->rp_addr.addr, crp_hdr->rp_prio,
|
(pim_addr *)&rpaddr, crp_hdr->rp_prio, &src_dst->src, ngroups);
|
||||||
&src_dst->src, ngroups);
|
|
||||||
|
|
||||||
|
|
||||||
struct bsr_crp_rp *rp, ref;
|
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 (!rp) {
|
||||||
if (bsr_crp_rps_count(scope->ebsr_rps) >= bsr_max_rps) {
|
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)",
|
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_crp_rps_count(scope->ebsr_rps), bsr_max_rps,
|
||||||
bsr_max_rps, (pim_addr *)&crp_hdr->rp_addr.addr,
|
(pim_addr *)&rpaddr, &src_dst->src);
|
||||||
&src_dst->src);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PIM_DEBUG_BSM)
|
if (PIM_DEBUG_BSM)
|
||||||
zlog_debug("new Candidate-RP: %pPA (from %pPA)",
|
zlog_debug("new Candidate-RP: %pPA (from %pPA)",
|
||||||
(pim_addr *)&crp_hdr->rp_addr.addr,
|
(pim_addr *)&rpaddr, &src_dst->src);
|
||||||
&src_dst->src);
|
|
||||||
|
|
||||||
rp = XCALLOC(MTYPE_PIM_BSR_CRP, sizeof(*rp));
|
rp = XCALLOC(MTYPE_PIM_BSR_CRP, sizeof(*rp));
|
||||||
rp->scope = scope;
|
rp->scope = scope;
|
||||||
|
|
Loading…
Reference in a new issue