Skip to content

Commit

Permalink
pimd: Fix coverity checked return issue
Browse files Browse the repository at this point in the history
Signed-off-by: Nathan Bahr <[email protected]>
  • Loading branch information
nabahr committed Sep 25, 2024
1 parent 54bc821 commit 3e6cc0d
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 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,10 +557,16 @@ 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));
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,
Expand Down

0 comments on commit 3e6cc0d

Please sign in to comment.