diff options
Diffstat (limited to 'pimd/pim_hello.c')
-rw-r--r-- | pimd/pim_hello.c | 115 |
1 files changed, 68 insertions, 47 deletions
diff --git a/pimd/pim_hello.c b/pimd/pim_hello.c index 12857831..bfc128b9 100644 --- a/pimd/pim_hello.c +++ b/pimd/pim_hello.c @@ -160,7 +160,8 @@ int pim_hello_recv(struct interface *ifp, 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); @@ -180,12 +181,14 @@ int pim_hello_recv(struct interface *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); } @@ -195,16 +198,18 @@ int pim_hello_recv(struct interface *ifp, 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", @@ -262,7 +267,7 @@ int pim_hello_recv(struct interface *ifp, } 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", @@ -272,13 +277,13 @@ int pim_hello_recv(struct interface *ifp, } 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); } } @@ -289,7 +294,7 @@ int pim_hello_recv(struct interface *ifp, 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), @@ -321,11 +326,13 @@ int pim_hello_recv(struct interface *ifp, } 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); + } } /* @@ -345,11 +352,13 @@ int pim_hello_recv(struct interface *ifp, 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); } @@ -372,7 +381,7 @@ int pim_hello_recv(struct interface *ifp, /* 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", @@ -394,11 +403,13 @@ int pim_hello_recv(struct interface *ifp, 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 */ @@ -445,8 +456,10 @@ int pim_hello_build_tlv(const char *ifname, 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; } @@ -457,8 +470,10 @@ int pim_hello_build_tlv(const char *ifname, 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) { @@ -472,8 +487,10 @@ int pim_hello_build_tlv(const char *ifname, 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; } @@ -483,8 +500,10 @@ int pim_hello_build_tlv(const char *ifname, 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; } @@ -494,8 +513,10 @@ int pim_hello_build_tlv(const char *ifname, 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; } } |