From: Donald Sharp Date: Wed, 7 Dec 2016 13:18:09 +0000 (-0500) Subject: pimd: Add guard for pim_msg_send_frame X-Git-Tag: frr-3.0-branchpoint~64^2~10^2~26 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=67f771b3a32deac5de2fed20da6317b9ccf2ed80;p=matthieu%2Ffrr.git pimd: Add guard for pim_msg_send_frame In certain error conditions it is possible to attempt to send packets when the socket is not ready instead of dumping to the log a million error messages only note the issue if we have packet debugs on. Signed-off-by: Donald Sharp --- diff --git a/pimd/pim_pim.c b/pimd/pim_pim.c index b77f39f1c4..b973adacc4 100644 --- a/pimd/pim_pim.c +++ b/pimd/pim_pim.c @@ -506,11 +506,14 @@ pim_msg_send_frame (int fd, char *buf, size_t len, return -1; break; default: - pim_inet4_dump ("", ip->ip_dst, dst_str, sizeof (dst_str)); - zlog_warn ("%s: sendto() failure to %s: fd=%d msg_size=%zd: errno=%d: %s", - __PRETTY_FUNCTION__, - dst_str, fd, len, - errno, safe_strerror(errno)); + if (PIM_DEBUG_PIM_PACKETS) + { + pim_inet4_dump ("", ip->ip_dst, dst_str, sizeof (dst_str)); + zlog_warn ("%s: sendto() failure to %s: fd=%d msg_size=%zd: errno=%d: %s", + __PRETTY_FUNCTION__, + dst_str, fd, len, + errno, safe_strerror(errno)); + } return -1; break; }