summaryrefslogtreecommitdiffstats
path: root/pimd/pim_msdp_packet.c
diff options
context:
space:
mode:
authoranuradhak <anuradhak@cumulusnetworks.com>2016-12-02 22:41:11 +0100
committerDonald Sharp <sharpd@cumulusnetworks.com>2016-12-22 02:26:18 +0100
commit489e06bbcfaab04d4589fb316c7f3a9c0197ce16 (patch)
treebca931f9a65be9605aaed3f6399db5e0b7f7242b /pimd/pim_msdp_packet.c
parentpimd: With igmpv2 turned on don't accept 224.0.0.0/24 groups (diff)
downloadfrr-489e06bbcfaab04d4589fb316c7f3a9c0197ce16.tar.xz
frr-489e06bbcfaab04d4589fb316c7f3a9c0197ce16.zip
pimd: Add debug logs to help find problems with stream_read
Logs only. No functional change Ticket: CM-13852 Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
Diffstat (limited to 'pimd/pim_msdp_packet.c')
-rw-r--r--pimd/pim_msdp_packet.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/pimd/pim_msdp_packet.c b/pimd/pim_msdp_packet.c
index 3f3f9d1de..62d057975 100644
--- a/pimd/pim_msdp_packet.c
+++ b/pimd/pim_msdp_packet.c
@@ -586,16 +586,26 @@ pim_msdp_read_packet(struct pim_msdp_peer *mp)
{
int nbytes;
int readsize;
+ int old_endp;
+ int new_endp;
- readsize = mp->packet_size - stream_get_endp(mp->ibuf);
+ old_endp = stream_get_endp(mp->ibuf);
+ readsize = mp->packet_size - old_endp;
if (!readsize) {
return 0;
}
/* Read packet from fd */
nbytes = stream_read_try(mp->ibuf, mp->fd, readsize);
+ new_endp = stream_get_endp(mp->ibuf);
if (nbytes < 0) {
+ if (PIM_DEBUG_MSDP_INTERNAL) {
+ zlog_debug("MSDP peer %s read failed %d", mp->key_str, nbytes);
+ }
if (nbytes == -2) {
+ if (PIM_DEBUG_MSDP_INTERNAL) {
+ zlog_debug("MSDP peer %s pim_msdp_read io retry old_end: %d new_end: %d", mp->key_str, old_endp, new_endp);
+ }
/* transient error retry */
return -1;
}
@@ -604,13 +614,20 @@ pim_msdp_read_packet(struct pim_msdp_peer *mp)
}
if (!nbytes) {
+ if (PIM_DEBUG_MSDP_INTERNAL) {
+ zlog_debug("MSDP peer %s read failed %d", mp->key_str, nbytes);
+ }
pim_msdp_peer_reset_tcp_conn(mp, "peer-down");
return -1;
}
/* We read partial packet. */
- if (stream_get_endp(mp->ibuf) != mp->packet_size)
+ if (stream_get_endp(mp->ibuf) != mp->packet_size) {
+ if (PIM_DEBUG_MSDP_INTERNAL) {
+ zlog_debug("MSDP peer %s read partial len %d old_endp %d new_endp %d", mp->key_str, mp->packet_size, old_endp, new_endp);
+ }
return -1;
+ }
return 0;
}