summaryrefslogtreecommitdiff
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@cumulusnetwroks.com>2016-05-25 20:38:33 -0400
commitaea6cb942f4b3cfe92d6e6ec377d588269bed25a (patch)
tree2ff457f7a0ea599753e7989bfd3a606427712ae7 /pimd/pim_tlv.c
parent4d114a94232e1525d79372dc8caa125dad209de1 (diff)
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 95ee5ab0ec..ed4dbba2e5 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) {