summaryrefslogtreecommitdiffstats
path: root/pimd/pim_pim.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2016-11-17 15:39:56 +0100
committerDonald Sharp <sharpd@cumulusnetworks.com>2016-12-22 02:26:16 +0100
commit0f055c0d5d2be277d2ecb0271e55620b13f5f341 (patch)
tree8bb9a3193683bd8308b7141fd2d4c284d621f5ef /pimd/pim_pim.c
parentpimd: Allow storing of sg in string format (diff)
downloadfrr-0f055c0d5d2be277d2ecb0271e55620b13f5f341.tar.xz
frr-0f055c0d5d2be277d2ecb0271e55620b13f5f341.zip
pimd: Further refine debugs in pim_sock_read path
When we received a packet we were dumping packet information with debugs on 2 times for each packet where we had overlapping data being passed. Since debugs are expensive, reduce the count to 1. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'pimd/pim_pim.c')
-rw-r--r--pimd/pim_pim.c47
1 files changed, 10 insertions, 37 deletions
diff --git a/pimd/pim_pim.c b/pimd/pim_pim.c
index bef3a8a34..96d2111ce 100644
--- a/pimd/pim_pim.c
+++ b/pimd/pim_pim.c
@@ -150,20 +150,8 @@ int pim_pim_packet(struct interface *ifp, uint8_t *buf, size_t len)
}
ip_hdr = (struct ip *) buf;
-
- if (PIM_DEBUG_PIM_PACKETS)
- {
- pim_inet4_dump("<src?>", ip_hdr->ip_src, src_str, sizeof(src_str));
- pim_inet4_dump("<dst?>", ip_hdr->ip_dst, dst_str, sizeof(dst_str));
- }
-
ip_hlen = ip_hdr->ip_hl << 2; /* ip_hl gives length in 4-byte words */
- if (PIM_DEBUG_PIM_PACKETS) {
- zlog_debug("Recv IP packet from %s to %s on %s: size=%zu ip_header_size=%zu ip_proto=%d",
- src_str, dst_str, ifp->name, len, ip_hlen, ip_hdr->ip_p);
- }
-
if (ip_hdr->ip_p != PIM_IP_PROTO_PIM) {
if (PIM_DEBUG_PIM_PACKETS)
zlog_debug("IP packet protocol=%d is not PIM=%d",
@@ -174,26 +162,23 @@ int pim_pim_packet(struct interface *ifp, uint8_t *buf, size_t len)
if (ip_hlen < PIM_IP_HEADER_MIN_LEN) {
if (PIM_DEBUG_PIM_PACKETS)
zlog_debug("IP packet header size=%zu shorter than minimum=%d",
- ip_hlen, PIM_IP_HEADER_MIN_LEN);
+ ip_hlen, PIM_IP_HEADER_MIN_LEN);
return -1;
}
if (ip_hlen > PIM_IP_HEADER_MAX_LEN) {
if (PIM_DEBUG_PIM_PACKETS)
zlog_debug("IP packet header size=%zu greater than maximum=%d",
- ip_hlen, PIM_IP_HEADER_MAX_LEN);
+ ip_hlen, PIM_IP_HEADER_MAX_LEN);
return -1;
}
pim_msg = buf + ip_hlen;
pim_msg_len = len - ip_hlen;
- if (PIM_DEBUG_PIM_PACKETDUMP_RECV) {
- pim_pkt_dump(__PRETTY_FUNCTION__, pim_msg, pim_msg_len);
- }
-
if (pim_msg_len < PIM_PIM_MIN_LEN) {
- zlog_warn("PIM message size=%d shorter than minimum=%d",
- pim_msg_len, PIM_PIM_MIN_LEN);
+ if (PIM_DEBUG_PIM_PACKETS)
+ zlog_debug("PIM message size=%d shorter than minimum=%d",
+ pim_msg_len, PIM_PIM_MIN_LEN);
return -1;
}
@@ -222,9 +207,14 @@ int pim_pim_packet(struct interface *ifp, uint8_t *buf, size_t len)
}
if (PIM_DEBUG_PIM_PACKETS) {
+ pim_inet4_dump("<src?>", ip_hdr->ip_src, src_str, sizeof(src_str));
+ pim_inet4_dump("<dst?>", ip_hdr->ip_dst, dst_str, sizeof(dst_str));
zlog_debug("Recv PIM %s packet from %s to %s on %s: ttl=%d pim_version=%d pim_msg_size=%d checksum=%x",
pim_pim_msgtype2str (pim_type), src_str, dst_str, ifp->name,
ip_hdr->ip_ttl, pim_version, pim_msg_len, checksum);
+ if (PIM_DEBUG_PIM_PACKETDUMP_RECV) {
+ pim_pkt_dump(__PRETTY_FUNCTION__, pim_msg, pim_msg_len);
+ }
}
switch (pim_type)
@@ -310,23 +300,6 @@ static int pim_sock_read(struct thread *t)
&to, &tolen,
&ifindex);
- if (PIM_DEBUG_PIM_PACKETS) {
- char from_str[INET_ADDRSTRLEN];
- char to_str[INET_ADDRSTRLEN];
-
- if (!inet_ntop(AF_INET, &from.sin_addr, from_str, sizeof(from_str)))
- sprintf(from_str, "<from?>");
- if (!inet_ntop(AF_INET, &to.sin_addr, to_str, sizeof(to_str)))
- sprintf(to_str, "<to?>");
-
- zlog_debug("Recv IP PIM pkt size=%d from %s to %s on fd=%d on ifindex=%d (sock_ifindex=%d)",
- len, from_str, to_str, fd, ifindex, ifp->ifindex);
-
- if (PIM_DEBUG_PIM_PACKETDUMP_RECV) {
- pim_pkt_dump(__PRETTY_FUNCTION__, buf, len);
- }
- }
-
#ifdef PIM_CHECK_RECV_IFINDEX_SANITY
/* ifindex sanity check */
if (ifindex != (int) ifp->ifindex) {