From 67f771b3a32deac5de2fed20da6317b9ccf2ed80 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Wed, 7 Dec 2016 08:18:09 -0500 Subject: [PATCH] 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 --- pimd/pim_pim.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) 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; } -- 2.39.5