diff options
Diffstat (limited to 'ospfd/ospf_dump.c')
| -rw-r--r-- | ospfd/ospf_dump.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/ospfd/ospf_dump.c b/ospfd/ospf_dump.c index a712ecde95..3dcb2b481d 100644 --- a/ospfd/ospf_dump.c +++ b/ospfd/ospf_dump.c @@ -82,9 +82,8 @@ const char *ospf_area_name_string(struct ospf_area *area) return "-"; area_id = ntohl(area->area_id.s_addr); - snprintf(buf, OSPF_AREA_STRING_MAXLEN, "%d.%d.%d.%d", - (area_id >> 24) & 0xff, (area_id >> 16) & 0xff, - (area_id >> 8) & 0xff, area_id & 0xff); + snprintf(buf, sizeof(buf), "%d.%d.%d.%d", (area_id >> 24) & 0xff, + (area_id >> 16) & 0xff, (area_id >> 8) & 0xff, area_id & 0xff); return buf; } @@ -100,11 +99,11 @@ const char *ospf_area_desc_string(struct ospf_area *area) type = area->external_routing; switch (type) { case OSPF_AREA_NSSA: - snprintf(buf, OSPF_AREA_DESC_STRING_MAXLEN, "%s [NSSA]", + snprintf(buf, sizeof(buf), "%s [NSSA]", ospf_area_name_string(area)); break; case OSPF_AREA_STUB: - snprintf(buf, OSPF_AREA_DESC_STRING_MAXLEN, "%s [Stub]", + snprintf(buf, sizeof(buf), "%s [Stub]", ospf_area_name_string(area)); break; default: @@ -127,7 +126,7 @@ const char *ospf_if_name_string(struct ospf_interface *oi) return oi->ifp->name; ifaddr = ntohl(oi->address->u.prefix4.s_addr); - snprintf(buf, OSPF_IF_STRING_MAXLEN, "%s:%d.%d.%d.%d", oi->ifp->name, + snprintf(buf, sizeof(buf), "%s:%d.%d.%d.%d", oi->ifp->name, (ifaddr >> 24) & 0xff, (ifaddr >> 16) & 0xff, (ifaddr >> 8) & 0xff, ifaddr & 0xff); return buf; @@ -1640,9 +1639,13 @@ DEFUN_NOSH (show_debugging_ospf_instance, return show_debugging_ospf_common(vty, ospf); } +static int config_write_debug(struct vty *vty); /* Debug node. */ static struct cmd_node debug_node = { - DEBUG_NODE, "", 1 /* VTYSH */ + .name = "debug", + .node = DEBUG_NODE, + .prompt = "", + .config_write = config_write_debug, }; static int config_write_debug(struct vty *vty) @@ -1665,7 +1668,7 @@ static int config_write_debug(struct vty *vty) return CMD_SUCCESS; if (ospf->instance) - sprintf(str, " %u", ospf->instance); + snprintf(str, sizeof(str), " %u", ospf->instance); /* debug ospf ism (status|events|timers). */ if (IS_CONF_DEBUG_OSPF(ism, ISM) == OSPF_DEBUG_ISM) @@ -1783,7 +1786,7 @@ static int config_write_debug(struct vty *vty) /* Initialize debug commands. */ void ospf_debug_init(void) { - install_node(&debug_node, config_write_debug); + install_node(&debug_node); install_element(ENABLE_NODE, &show_debugging_ospf_cmd); install_element(ENABLE_NODE, &debug_ospf_ism_cmd); |
