diff options
Diffstat (limited to 'ospf6d')
| -rw-r--r-- | ospf6d/ospf6_abr.c | 6 | ||||
| -rw-r--r-- | ospf6d/ospf6_asbr.c | 9 | ||||
| -rw-r--r-- | ospf6d/ospf6_intra.c | 8 | ||||
| -rw-r--r-- | ospf6d/ospf6_lsa.c | 21 | ||||
| -rw-r--r-- | ospf6d/ospf6_spf.c | 16 |
5 files changed, 35 insertions, 25 deletions
diff --git a/ospf6d/ospf6_abr.c b/ospf6d/ospf6_abr.c index abcdb40547..f6a246500b 100644 --- a/ospf6d/ospf6_abr.c +++ b/ospf6d/ospf6_abr.c @@ -1292,6 +1292,7 @@ static char *ospf6_inter_area_prefix_lsa_get_prefix_str(struct ospf6_lsa *lsa, { struct ospf6_inter_prefix_lsa *prefix_lsa; struct in6_addr in6; + char tbuf[16]; if (lsa != NULL) { prefix_lsa = @@ -1301,8 +1302,9 @@ static char *ospf6_inter_area_prefix_lsa_get_prefix_str(struct ospf6_lsa *lsa, ospf6_prefix_in6_addr(&in6, prefix_lsa, &prefix_lsa->prefix); if (buf) { inet_ntop(AF_INET6, &in6, buf, buflen); - sprintf(&buf[strlen(buf)], "/%d", - prefix_lsa->prefix.prefix_length); + snprintf(tbuf, sizeof(tbuf), "/%d", + prefix_lsa->prefix.prefix_length); + strlcat(buf, tbuf, buflen); } } diff --git a/ospf6d/ospf6_asbr.c b/ospf6d/ospf6_asbr.c index 3449f48267..d0c93dd577 100644 --- a/ospf6d/ospf6_asbr.c +++ b/ospf6d/ospf6_asbr.c @@ -1865,6 +1865,7 @@ static char *ospf6_as_external_lsa_get_prefix_str(struct ospf6_lsa *lsa, struct ospf6_as_external_lsa *external; struct in6_addr in6; int prefix_length = 0; + char tbuf[16]; if (lsa) { external = (struct ospf6_as_external_lsa *)OSPF6_LSA_HEADER_END( @@ -1885,9 +1886,11 @@ static char *ospf6_as_external_lsa_get_prefix_str(struct ospf6_lsa *lsa, } if (buf) { inet_ntop(AF_INET6, &in6, buf, buflen); - if (prefix_length) - sprintf(&buf[strlen(buf)], "/%d", - prefix_length); + if (prefix_length) { + snprintf(tbuf, sizeof(tbuf), "/%d", + prefix_length); + strlcat(buf, tbuf, buflen); + } } } return (buf); diff --git a/ospf6d/ospf6_intra.c b/ospf6d/ospf6_intra.c index 5394ba9786..2cffc3a397 100644 --- a/ospf6d/ospf6_intra.c +++ b/ospf6d/ospf6_intra.c @@ -84,7 +84,7 @@ static char *ospf6_router_lsa_get_nbr_id(struct ospf6_lsa *lsa, char *buf, sizeof(buf1)); inet_ntop(AF_INET, &lsdesc->neighbor_router_id, buf2, sizeof(buf2)); - sprintf(buf, "%s/%s", buf2, buf1); + snprintf(buf, buflen, "%s/%s", buf2, buf1); return buf; } @@ -866,6 +866,7 @@ static char *ospf6_intra_prefix_lsa_get_prefix_str(struct ospf6_lsa *lsa, struct in6_addr in6; int prefixnum, cnt = 0; struct ospf6_prefix *prefix; + char tbuf[16]; if (lsa) { intra_prefix_lsa = @@ -898,8 +899,9 @@ static char *ospf6_intra_prefix_lsa_get_prefix_str(struct ospf6_lsa *lsa, OSPF6_PREFIX_SPACE( prefix->prefix_length)); inet_ntop(AF_INET6, &in6, buf, buflen); - sprintf(&buf[strlen(buf)], "/%d", - prefix->prefix_length); + snprintf(tbuf, sizeof(tbuf), "/%d", + prefix->prefix_length); + strlcat(buf, tbuf, buflen); return (buf); } } diff --git a/ospf6d/ospf6_lsa.c b/ospf6d/ospf6_lsa.c index f1b04c9bec..e1c3b4038c 100644 --- a/ospf6d/ospf6_lsa.c +++ b/ospf6d/ospf6_lsa.c @@ -145,7 +145,7 @@ const char *ospf6_lstype_short_name(uint16_t type) const struct ospf6_lsa_handler *handler; handler = ospf6_get_lsa_handler(type); - if (handler && handler != &unknown_handler) + if (handler) return handler->lh_short_name; snprintf(buf, sizeof(buf), "0x%04hx", ntohs(type)); @@ -420,9 +420,10 @@ void ospf6_lsa_show_summary(struct vty *vty, struct ospf6_lsa *lsa, if (use_json) json_obj = json_object_new_object(); - if ((type == OSPF6_LSTYPE_INTER_PREFIX) - || (type == OSPF6_LSTYPE_INTER_ROUTER) - || (type == OSPF6_LSTYPE_AS_EXTERNAL)) { + switch (type) { + case OSPF6_LSTYPE_INTER_PREFIX: + case OSPF6_LSTYPE_INTER_ROUTER: + case OSPF6_LSTYPE_AS_EXTERNAL: if (use_json) { json_object_string_add( json_obj, "type", @@ -447,7 +448,13 @@ void ospf6_lsa_show_summary(struct vty *vty, struct ospf6_lsa *lsa, (unsigned long)ntohl(lsa->header->seqnum), handler->lh_get_prefix_str(lsa, buf, sizeof(buf), 0)); - } else if (type != OSPF6_LSTYPE_UNKNOWN) { + break; + case OSPF6_LSTYPE_ROUTER: + case OSPF6_LSTYPE_NETWORK: + case OSPF6_LSTYPE_GROUP_MEMBERSHIP: + case OSPF6_LSTYPE_TYPE_7: + case OSPF6_LSTYPE_LINK: + case OSPF6_LSTYPE_INTRA_PREFIX: while (handler->lh_get_prefix_str(lsa, buf, sizeof(buf), cnt) != NULL) { if (use_json) { @@ -481,7 +488,8 @@ void ospf6_lsa_show_summary(struct vty *vty, struct ospf6_lsa *lsa, } if (use_json) json_object_free(json_obj); - } else { + break; + default: if (use_json) { json_object_string_add( json_obj, "type", @@ -500,6 +508,7 @@ void ospf6_lsa_show_summary(struct vty *vty, struct ospf6_lsa *lsa, ospf6_lstype_short_name(lsa->header->type), id, adv_router, ospf6_lsa_age_current(lsa), (unsigned long)ntohl(lsa->header->seqnum)); + break; } } diff --git a/ospf6d/ospf6_spf.c b/ospf6d/ospf6_spf.c index f94252991c..b3c71462a3 100644 --- a/ospf6d/ospf6_spf.c +++ b/ospf6d/ospf6_spf.c @@ -649,14 +649,10 @@ static int ospf6_spf_calculation_thread(struct thread *t) ospf6_spf_reason_string(ospf6->spf_reason, rbuf, sizeof(rbuf)); if (IS_OSPF6_DEBUG_SPF(PROCESS) || IS_OSPF6_DEBUG_SPF(TIME)) - zlog_debug("SPF runtime: %lld sec %lld usec", - (long long)runtime.tv_sec, - (long long)runtime.tv_usec); - - zlog_info( - "SPF processing: # Areas: %d, SPF runtime: %lld sec %lld usec, Reason: %s", - areas_processed, (long long)runtime.tv_sec, - (long long)runtime.tv_usec, rbuf); + zlog_debug( + "SPF processing: # Areas: %d, SPF runtime: %lld sec %lld usec, Reason: %s", + areas_processed, (long long)runtime.tv_sec, + (long long)runtime.tv_usec, rbuf); ospf6->last_spf_reason = ospf6->spf_reason; ospf6_reset_spf_reason(ospf6); @@ -718,9 +714,7 @@ void ospf6_spf_schedule(struct ospf6 *ospf6, unsigned int reason) } if (IS_OSPF6_DEBUG_SPF(PROCESS) || IS_OSPF6_DEBUG_SPF(TIME)) - zlog_debug("SPF: calculation timer delay = %ld", delay); - - zlog_info("SPF: Scheduled in %ld msec", delay); + zlog_debug("SPF: Rescheduling in %ld msec", delay); ospf6->t_spf_calc = NULL; thread_add_timer_msec(master, ospf6_spf_calculation_thread, ospf6, |
