Skip to content

Commit

Permalink
Merge pull request FRRouting#16916 from nabahr/pim-coverity
Browse files Browse the repository at this point in the history
pimd: Fix new issues found in coverity
  • Loading branch information
donaldsharp authored Sep 25, 2024
2 parents f5fb095 + 3e6cc0d commit c57712c
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 16 deletions.
37 changes: 26 additions & 11 deletions pimd/pim_autorp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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));
}
}
}
}
Expand Down
11 changes: 6 additions & 5 deletions pimd/pim_nb_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit c57712c

Please sign in to comment.