uint32_t hello_option_generation_id = 0;
struct list *hello_option_addr_list = 0;
- on_trace(__PRETTY_FUNCTION__, ifp, src_addr);
+ if (PIM_DEBUG_PIM_HELLO)
+ on_trace(__PRETTY_FUNCTION__, ifp, src_addr);
pim_ifp = ifp->info;
zassert(pim_ifp);
int remain = tlv_pastend - tlv_curr;
if (remain < PIM_TLV_MIN_SIZE) {
- char src_str[100];
- pim_inet4_dump("<src?>", src_addr, src_str, sizeof(src_str));
- zlog_warn("%s: short PIM hello TLV size=%d < min=%d from %s on interface %s",
- __PRETTY_FUNCTION__,
- remain, PIM_TLV_MIN_SIZE,
- src_str, ifp->name);
+ if (PIM_DEBUG_PIM_HELLO) {
+ char src_str[100];
+ pim_inet4_dump("<src?>", src_addr, src_str, sizeof(src_str));
+ zlog_debug("%s: short PIM hello TLV size=%d < min=%d from %s on interface %s",
+ __PRETTY_FUNCTION__,
+ remain, PIM_TLV_MIN_SIZE,
+ src_str, ifp->name);
+ }
FREE_ADDR_LIST_THEN_RETURN(-1);
}
tlv_curr += PIM_TLV_LENGTH_SIZE;
if ((tlv_curr + option_len) > tlv_pastend) {
- char src_str[100];
- pim_inet4_dump("<src?>", src_addr, src_str, sizeof(src_str));
- zlog_warn("%s: long PIM hello TLV type=%d length=%d > left=%td from %s on interface %s",
- __PRETTY_FUNCTION__,
- option_type, option_len, tlv_pastend - tlv_curr,
- src_str, ifp->name);
+ if (PIM_DEBUG_PIM_HELLO) {
+ char src_str[100];
+ pim_inet4_dump("<src?>", src_addr, src_str, sizeof(src_str));
+ zlog_debug("%s: long PIM hello TLV type=%d length=%d > left=%td from %s on interface %s",
+ __PRETTY_FUNCTION__,
+ option_type, option_len, tlv_pastend - tlv_curr,
+ src_str, ifp->name);
+ }
FREE_ADDR_LIST_THEN_RETURN(-2);
}
- if (PIM_DEBUG_PIM_TRACE || PIM_DEBUG_PIM_HELLO) {
+ if (PIM_DEBUG_PIM_HELLO) {
char src_str[100];
pim_inet4_dump("<src?>", src_addr, src_str, sizeof(src_str));
zlog_debug("%s: parse left_size=%d: PIM hello TLV type=%d length=%d from %s on %s",
}
break;
case PIM_MSG_OPTION_TYPE_DM_STATE_REFRESH:
- if (PIM_DEBUG_PIM_TRACE || PIM_DEBUG_PIM_HELLO) {
+ if (PIM_DEBUG_PIM_HELLO) {
char src_str[100];
pim_inet4_dump("<src?>", src_addr, src_str, sizeof(src_str));
zlog_debug("%s: ignoring PIM hello dense-mode state refresh TLV option type=%d length=%d from %s on interface %s",
}
break;
default:
- {
+ if (PIM_DEBUG_PIM_HELLO) {
char src_str[100];
pim_inet4_dump("<src?>", src_addr, src_str, sizeof(src_str));
- zlog_warn("%s: ignoring unknown PIM hello TLV type=%d length=%d from %s on interface %s",
- __PRETTY_FUNCTION__,
- option_type, option_len,
- src_str, ifp->name);
+ zlog_debug("%s: ignoring unknown PIM hello TLV type=%d length=%d from %s on interface %s",
+ __PRETTY_FUNCTION__,
+ option_type, option_len,
+ src_str, ifp->name);
}
}
Check received PIM hello options
*/
- if (PIM_DEBUG_PIM_TRACE) {
+ if (PIM_DEBUG_PIM_HELLO) {
tlv_trace_uint16(__PRETTY_FUNCTION__, "holdtime",
ifp->name, src_addr,
PIM_OPTION_IS_SET(hello_options, PIM_OPTION_MASK_HOLDTIME),
}
if (!PIM_OPTION_IS_SET(hello_options, PIM_OPTION_MASK_HOLDTIME)) {
- char src_str[100];
- pim_inet4_dump("<src?>", src_addr, src_str, sizeof(src_str));
- zlog_warn("%s: PIM hello missing holdtime from %s on interface %s",
- __PRETTY_FUNCTION__,
- src_str, ifp->name);
+ if (PIM_DEBUG_PIM_HELLO) {
+ char src_str[100];
+ pim_inet4_dump("<src?>", src_addr, src_str, sizeof(src_str));
+ zlog_debug("%s: PIM hello missing holdtime from %s on interface %s",
+ __PRETTY_FUNCTION__,
+ src_str, ifp->name);
+ }
}
/*
hello_option_generation_id,
hello_option_addr_list);
if (!neigh) {
- char src_str[100];
- pim_inet4_dump("<src?>", src_addr, src_str, sizeof(src_str));
- zlog_warn("%s: failure creating PIM neighbor %s on interface %s",
- __PRETTY_FUNCTION__,
- src_str, ifp->name);
+ if (PIM_DEBUG_PIM_HELLO) {
+ char src_str[100];
+ pim_inet4_dump("<src?>", src_addr, src_str, sizeof(src_str));
+ zlog_warn("%s: failure creating PIM neighbor %s on interface %s",
+ __PRETTY_FUNCTION__,
+ src_str, ifp->name);
+ }
FREE_ADDR_LIST_THEN_RETURN(-8);
}
/* GenID mismatch, then replace neighbor */
- if (PIM_DEBUG_PIM_TRACE) {
+ if (PIM_DEBUG_PIM_HELLO) {
char src_str[100];
pim_inet4_dump("<src?>", src_addr, src_str, sizeof(src_str));
zlog_debug("%s: GenId mismatch new=%08x old=%08x: replacing neighbor %s on %s",
hello_option_generation_id,
hello_option_addr_list);
if (!neigh) {
- char src_str[100];
- pim_inet4_dump("<src?>", src_addr, src_str, sizeof(src_str));
- zlog_warn("%s: failure re-creating PIM neighbor %s on interface %s",
- __PRETTY_FUNCTION__,
- src_str, ifp->name);
+ if (PIM_DEBUG_PIM_HELLO) {
+ char src_str[100];
+ pim_inet4_dump("<src?>", src_addr, src_str, sizeof(src_str));
+ zlog_debug("%s: failure re-creating PIM neighbor %s on interface %s",
+ __PRETTY_FUNCTION__,
+ src_str, ifp->name);
+ }
FREE_ADDR_LIST_THEN_RETURN(-9);
}
/* actual addr list is saved under neighbor */
PIM_MSG_OPTION_TYPE_HOLDTIME,
holdtime);
if (!curr) {
- zlog_warn("%s: could not set PIM hello Holdtime option for interface %s",
- __PRETTY_FUNCTION__, ifname);
+ if (PIM_DEBUG_PIM_HELLO) {
+ zlog_debug("%s: could not set PIM hello Holdtime option for interface %s",
+ __PRETTY_FUNCTION__, ifname);
+ }
return -1;
}
propagation_delay,
override_interval);
if (!tmp) {
- zlog_warn("%s: could not set PIM LAN Prune Delay option for interface %s",
- __PRETTY_FUNCTION__, ifname);
+ if (PIM_DEBUG_PIM_HELLO) {
+ zlog_debug("%s: could not set PIM LAN Prune Delay option for interface %s",
+ __PRETTY_FUNCTION__, ifname);
+ }
return -1;
}
if (can_disable_join_suppression) {
PIM_MSG_OPTION_TYPE_DR_PRIORITY,
dr_priority);
if (!curr) {
- zlog_warn("%s: could not set PIM hello DR Priority option for interface %s",
- __PRETTY_FUNCTION__, ifname);
+ if (PIM_DEBUG_PIM_HELLO) {
+ zlog_debug("%s: could not set PIM hello DR Priority option for interface %s",
+ __PRETTY_FUNCTION__, ifname);
+ }
return -2;
}
PIM_MSG_OPTION_TYPE_GENERATION_ID,
generation_id);
if (!curr) {
- zlog_warn("%s: could not set PIM hello Generation ID option for interface %s",
- __PRETTY_FUNCTION__, ifname);
+ if (PIM_DEBUG_PIM_HELLO) {
+ zlog_debug("%s: could not set PIM hello Generation ID option for interface %s",
+ __PRETTY_FUNCTION__, ifname);
+ }
return -3;
}
pastend,
ifconnected);
if (!curr) {
- zlog_warn("%s: could not set PIM hello Secondary Address List option for interface %s",
- __PRETTY_FUNCTION__, ifname);
+ if (PIM_DEBUG_PIM_HELLO) {
+ zlog_debug("%s: could not set PIM hello Secondary Address List option for interface %s",
+ __PRETTY_FUNCTION__, ifname);
+ }
return -4;
}
}
{
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;
{
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;
{
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;
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 */
}
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) {