Merge pull request #16916 from nabahr/pim-coverity

pimd: Fix new issues found in coverity
This commit is contained in:
Donald Sharp 2024-09-25 12:30:19 -04:00 committed by GitHub
commit c57712c11d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 32 additions and 16 deletions

View File

@ -540,9 +540,13 @@ static void autorp_send_announcement(struct event *evt)
inet_pton(PIM_AF, PIM_AUTORP_ANNOUNCEMENT_GRP, &announceGrp.sin_addr);
if (autorp->annouce_pkt_sz >= MIN_AUTORP_PKT_SZ) {
setsockopt(autorp->sock, IPPROTO_IP, IP_MULTICAST_TTL,
&(autorp->announce_scope),
sizeof(autorp->announce_scope));
if (setsockopt(autorp->sock, IPPROTO_IP, IP_MULTICAST_TTL,
&(autorp->announce_scope),
sizeof(autorp->announce_scope)) < 0) {
if (PIM_DEBUG_AUTORP)
zlog_err("%s: Failed to set Multicast TTL for sending AutoRP announcement message, errno=%d, %s",
__func__, errno, safe_strerror(errno));
}
FOR_ALL_INTERFACES (autorp->pim->vrf, ifp) {
pim_ifp = ifp->info;
@ -553,14 +557,25 @@ static void autorp_send_announcement(struct event *evt)
pim_ifp && pim_ifp->pim_enable &&
!pim_ifp->pim_passive_enable &&
!pim_addr_is_any(pim_ifp->primary_address)) {
setsockopt(autorp->sock, IPPROTO_IP,
IP_MULTICAST_IF,
&(pim_ifp->primary_address),
sizeof(pim_ifp->primary_address));
sendto(autorp->sock, autorp->annouce_pkt,
autorp->annouce_pkt_sz, 0,
(struct sockaddr *)&announceGrp,
sizeof(announceGrp));
if (setsockopt(autorp->sock, IPPROTO_IP,
IP_MULTICAST_IF,
&(pim_ifp->primary_address),
sizeof(pim_ifp->primary_address)) <
0) {
if (PIM_DEBUG_AUTORP)
zlog_err("%s: Failed to set Multicast Interface for sending AutoRP announcement message, errno=%d, %s",
__func__, errno,
safe_strerror(errno));
}
if (sendto(autorp->sock, autorp->annouce_pkt,
autorp->annouce_pkt_sz, 0,
(struct sockaddr *)&announceGrp,
sizeof(announceGrp)) <= 0) {
if (PIM_DEBUG_AUTORP)
zlog_err("%s: Failed to send AutoRP announcement message, errno=%d, %s",
__func__, errno,
safe_strerror(errno));
}
}
}
}

View File

@ -3763,14 +3763,15 @@ int lib_interface_gmp_address_family_proxy_modify(struct nb_cb_modify_args *args
case NB_EV_APPLY:
ifp = nb_running_get_entry(args->dnode, NULL, true);
pim_ifp = ifp->info;
if (pim_ifp)
if (pim_ifp) {
pim_ifp->gm_proxy = yang_dnode_get_bool(args->dnode,
NULL);
if (pim_ifp->gm_proxy)
pim_if_gm_proxy_init(pim_ifp->pim, ifp);
else
pim_if_gm_proxy_finis(pim_ifp->pim, ifp);
if (pim_ifp->gm_proxy)
pim_if_gm_proxy_init(pim_ifp->pim, ifp);
else
pim_if_gm_proxy_finis(pim_ifp->pim, ifp);
}
}
return NB_OK;
}