else
state = ISM_DROther;
- memset(buf, 0, size);
-
snprintf(buf, size, "%s/%s",
lookup_msg(ospf_nsm_state_msg, nbr->state, NULL),
lookup_msg(ospf_ism_state_msg, state, NULL));
}
if (w > 99)
- snprintf(buf, size, "%ldw%1ldd", w, d);
+ snprintf(buf, size, "%luw%1lud", w, d);
else if (w)
- snprintf(buf, size, "%ldw%1ldd%02ldh", w, d, h);
+ snprintf(buf, size, "%luw%1lud%02luh", w, d, h);
else if (d)
- snprintf(buf, size, "%1ldd%02ldh%02ldm", d, h, m);
+ snprintf(buf, size, "%1lud%02luh%02lum", d, h, m);
else if (h)
- snprintf(buf, size, "%ldh%02ldm%02lds", h, m, (long)t->tv_sec);
+ snprintf(buf, size, "%luh%02lum%02lds", h, m, (long)t->tv_sec);
else if (m)
- snprintf(buf, size, "%ldm%02lds", m, (long)t->tv_sec);
+ snprintf(buf, size, "%lum%02lds", m, (long)t->tv_sec);
else if (ms)
- snprintf(buf, size, "%ld.%03lds", (long)t->tv_sec, ms);
+ snprintf(buf, size, "%ld.%03lus", (long)t->tv_sec, ms);
else
snprintf(buf, size, "%ld usecs", (long)t->tv_usec);
static char *ospf_dd_flags_dump(uint8_t flags, char *buf, size_t size)
{
- memset(buf, 0, size);
-
snprintf(buf, size, "%s|%s|%s", (flags & OSPF_DD_FLAG_I) ? "I" : "-",
(flags & OSPF_DD_FLAG_M) ? "M" : "-",
(flags & OSPF_DD_FLAG_MS) ? "MS" : "-");
static char *ospf_router_lsa_flags_dump(uint8_t flags, char *buf, size_t size)
{
- memset(buf, 0, size);
-
snprintf(buf, size, "%s|%s|%s",
(flags & ROUTER_LSA_VIRTUAL) ? "V" : "-",
(flags & ROUTER_LSA_EXTERNAL) ? "E" : "-",
stream_set_getp(s, sp);
}
-/* Expects header to be in host order */
-void ospf_ip_header_dump(struct ip *iph)
-{
- /* IP Header dump. */
- zlog_debug("ip_v %d", iph->ip_v);
- zlog_debug("ip_hl %d", iph->ip_hl);
- zlog_debug("ip_tos %d", iph->ip_tos);
- zlog_debug("ip_len %d", iph->ip_len);
- zlog_debug("ip_id %u", (uint32_t)iph->ip_id);
- zlog_debug("ip_off %u", (uint32_t)iph->ip_off);
- zlog_debug("ip_ttl %d", iph->ip_ttl);
- zlog_debug("ip_p %d", iph->ip_p);
- zlog_debug("ip_sum 0x%x", (uint32_t)iph->ip_sum);
- zlog_debug("ip_src %s", inet_ntoa(iph->ip_src));
- zlog_debug("ip_dst %s", inet_ntoa(iph->ip_dst));
-}
-
static void ospf_header_dump(struct ospf_header *ospfh)
{
char buf[9];
case OSPF_AUTH_NULL:
break;
case OSPF_AUTH_SIMPLE:
- memset(buf, 0, 9);
- strncpy(buf, (char *)ospfh->u.auth_data, 8);
+ strlcpy(buf, (char *)ospfh->u.auth_data, sizeof(buf));
zlog_debug(" Simple Password %s", buf);
break;
case OSPF_AUTH_CRYPTOGRAPHIC:
return CMD_SUCCESS;
if (ospf->instance)
- sprintf(str, " %d", ospf->instance);
+ sprintf(str, " %u", ospf->instance);
/* debug ospf ism (status|events|timers). */
if (IS_CONF_DEBUG_OSPF(ism, ISM) == OSPF_DEBUG_ISM)
}
/* Initialize debug commands. */
-void debug_init()
+void ospf_debug_init(void)
{
install_node(&debug_node, config_write_debug);