summaryrefslogtreecommitdiffstats
path: root/pimd/pim_tlv.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2015-10-21 16:13:51 -0400
committerDonald Sharp <sharpd@cumulusnetworks.com>2015-12-08 14:11:18 -0500
commit6d853c43d9dd315eb42211150b7a4a43bae4cb62 (patch)
treecc5f6ab4037c4221b735a3ab483a8548b2f0ab88 /pimd/pim_tlv.c
parentbf99b420a57b7c5bf44c8ab528d0a2e416b66d81 (diff)
downloadquagga-6d853c43d9dd315eb42211150b7a4a43bae4cb62.tar.bz2
quagga-6d853c43d9dd315eb42211150b7a4a43bae4cb62.tar.xz
pimd: Limit pim hello log messages
pimd was outputting allot of data surrounding pim hello packets. In addition the debugging was inconsistent and not all turned on via 'debug pim packet hello'. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'pimd/pim_tlv.c')
-rw-r--r--pimd/pim_tlv.c36
1 files changed, 10 insertions, 26 deletions
diff --git a/pimd/pim_tlv.c b/pimd/pim_tlv.c
index 95ee5ab0..ed4dbba2 100644
--- a/pimd/pim_tlv.c
+++ b/pimd/pim_tlv.c
@@ -38,12 +38,8 @@ uint8_t *pim_tlv_append_uint16(uint8_t *buf,
{
uint16_t option_len = 2;
- if ((buf + PIM_TLV_OPTION_SIZE(option_len)) > buf_pastend) {
- zlog_warn("%s: buffer overflow: left=%zd needed=%d",
- __PRETTY_FUNCTION__,
- buf_pastend - buf, PIM_TLV_OPTION_SIZE(option_len));
- return 0;
- }
+ if ((buf + PIM_TLV_OPTION_SIZE(option_len)) > buf_pastend)
+ return NULL;
*(uint16_t *) buf = htons(option_type);
buf += 2;
@@ -63,12 +59,8 @@ uint8_t *pim_tlv_append_2uint16(uint8_t *buf,
{
uint16_t option_len = 4;
- if ((buf + PIM_TLV_OPTION_SIZE(option_len)) > buf_pastend) {
- zlog_warn("%s: buffer overflow: left=%zd needed=%d",
- __PRETTY_FUNCTION__,
- buf_pastend - buf, PIM_TLV_OPTION_SIZE(option_len));
- return 0;
- }
+ if ((buf + PIM_TLV_OPTION_SIZE(option_len)) > buf_pastend)
+ return NULL;
*(uint16_t *) buf = htons(option_type);
buf += 2;
@@ -89,12 +81,8 @@ uint8_t *pim_tlv_append_uint32(uint8_t *buf,
{
uint16_t option_len = 4;
- if ((buf + PIM_TLV_OPTION_SIZE(option_len)) > buf_pastend) {
- zlog_warn("%s: buffer overflow: left=%zd needed=%d",
- __PRETTY_FUNCTION__,
- buf_pastend - buf, PIM_TLV_OPTION_SIZE(option_len));
- return 0;
- }
+ if ((buf + PIM_TLV_OPTION_SIZE(option_len)) > buf_pastend)
+ return NULL;
*(uint16_t *) buf = htons(option_type);
buf += 2;
@@ -136,12 +124,8 @@ uint8_t *pim_tlv_append_addrlist_ucast(uint8_t *buf,
if (p->family != AF_INET)
continue;
- if ((curr + ucast_ipv4_encoding_len) > buf_pastend) {
- zlog_warn("%s: buffer overflow: left=%zd needed=%zu",
- __PRETTY_FUNCTION__,
- buf_pastend - curr, ucast_ipv4_encoding_len);
+ if ((curr + ucast_ipv4_encoding_len) > buf_pastend)
return 0;
- }
/* Write encoded unicast IPv4 address */
*(uint8_t *) curr = PIM_MSG_ADDRESS_FAMILY_IPV4; /* notice: AF_INET != PIM_MSG_ADDRESS_FAMILY_IPV4 */
@@ -155,9 +139,9 @@ uint8_t *pim_tlv_append_addrlist_ucast(uint8_t *buf,
}
if (PIM_DEBUG_PIM_TRACE) {
- zlog_warn("%s: number of encoded secondary unicast IPv4 addresses: %zu",
- __PRETTY_FUNCTION__,
- option_len / ucast_ipv4_encoding_len);
+ zlog_debug("%s: number of encoded secondary unicast IPv4 addresses: %zu",
+ __PRETTY_FUNCTION__,
+ option_len / ucast_ipv4_encoding_len);
}
if (option_len < 1) {