diff options
Diffstat (limited to 'ospf6d')
-rw-r--r-- | ospf6d/ospf6_area.c | 6 | ||||
-rw-r--r-- | ospf6d/ospf6_asbr.c | 3 | ||||
-rw-r--r-- | ospf6d/ospf6_interface.c | 10 | ||||
-rw-r--r-- | ospf6d/ospf6_intra.h | 3 | ||||
-rw-r--r-- | ospf6d/ospf6_lsa.c | 10 | ||||
-rw-r--r-- | ospf6d/ospf6_lsa.h | 1 | ||||
-rw-r--r-- | ospf6d/ospf6_message.c | 15 | ||||
-rw-r--r-- | ospf6d/ospf6_message.h | 1 | ||||
-rw-r--r-- | ospf6d/ospf6_route.h | 1 | ||||
-rw-r--r-- | ospf6d/ospf6_top.c | 18 | ||||
-rw-r--r-- | ospf6d/ospf6_zebra.c | 7 | ||||
-rw-r--r-- | ospf6d/ospf6d.c | 124 |
12 files changed, 168 insertions, 31 deletions
diff --git a/ospf6d/ospf6_area.c b/ospf6d/ospf6_area.c index 3bfc0cae..3c999bbc 100644 --- a/ospf6d/ospf6_area.c +++ b/ospf6d/ospf6_area.c @@ -353,6 +353,12 @@ DEFUN (area_range, UNSET_FLAG (range->flag, OSPF6_ROUTE_DO_NOT_ADVERTISE); } + if (range->rnode) + { + vty_out (vty, "Range already defined: %s%s", argv[-1], VNL); + return CMD_WARNING; + } + ospf6_route_add (range, oa->range_table); return CMD_SUCCESS; } diff --git a/ospf6d/ospf6_asbr.c b/ospf6d/ospf6_asbr.c index 37b912b4..685b147c 100644 --- a/ospf6d/ospf6_asbr.c +++ b/ospf6d/ospf6_asbr.c @@ -504,8 +504,7 @@ ospf6_asbr_redistribute_add (int type, int ifindex, struct prefix *prefix, memcpy (&route->prefix, prefix, sizeof (struct prefix)); info = (struct ospf6_external_info *) - XMALLOC (MTYPE_OSPF6_EXTERNAL_INFO, sizeof (struct ospf6_external_info)); - memset (info, 0, sizeof (struct ospf6_external_info)); + XCALLOC (MTYPE_OSPF6_EXTERNAL_INFO, sizeof (struct ospf6_external_info)); route->route_option = info; info->id = ospf6->external_id++; diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c index 8d9a7f01..aaaa9b8e 100644 --- a/ospf6d/ospf6_interface.c +++ b/ospf6d/ospf6_interface.c @@ -96,11 +96,9 @@ ospf6_interface_create (struct interface *ifp) unsigned int iobuflen; oi = (struct ospf6_interface *) - XMALLOC (MTYPE_OSPF6_IF, sizeof (struct ospf6_interface)); + XCALLOC (MTYPE_OSPF6_IF, sizeof (struct ospf6_interface)); - if (oi) - memset (oi, 0, sizeof (struct ospf6_interface)); - else + if (!oi) { zlog_err ("Can't malloc ospf6_interface for ifindex %d", ifp->ifindex); return (struct ospf6_interface *) NULL; @@ -692,6 +690,7 @@ neighbor_change (struct thread *thread) return 0; } +#if 0 static int loopind (struct thread *thread) { @@ -708,6 +707,7 @@ loopind (struct thread *thread) return 0; } +#endif int interface_down (struct thread *thread) @@ -1511,7 +1511,7 @@ config_write_ospf6_interface (struct vty *vty) return 0; } -struct cmd_node interface_node = +static struct cmd_node interface_node = { INTERFACE_NODE, "%s(config-if)# ", diff --git a/ospf6d/ospf6_intra.h b/ospf6d/ospf6_intra.h index 31643fd8..19c1f121 100644 --- a/ospf6d/ospf6_intra.h +++ b/ospf6d/ospf6_intra.h @@ -210,5 +210,8 @@ extern void ospf6_intra_init (void); extern int config_write_ospf6_debug_brouter (struct vty *vty); extern void install_element_ospf6_debug_brouter (void); +int config_write_ospf6_debug_brouter (struct vty *vty); +void install_element_ospf6_debug_brouter (); + #endif /* OSPF6_LSA_H */ diff --git a/ospf6d/ospf6_lsa.c b/ospf6d/ospf6_lsa.c index 87df7418..3111b631 100644 --- a/ospf6d/ospf6_lsa.c +++ b/ospf6d/ospf6_lsa.c @@ -468,8 +468,7 @@ ospf6_lsa_create (struct ospf6_lsa_header *header) /* LSA information structure */ /* allocate memory */ lsa = (struct ospf6_lsa *) - XMALLOC (MTYPE_OSPF6_LSA, sizeof (struct ospf6_lsa)); - memset (lsa, 0, sizeof (struct ospf6_lsa)); + XCALLOC (MTYPE_OSPF6_LSA, sizeof (struct ospf6_lsa)); lsa->header = (struct ospf6_lsa_header *) new_header; @@ -498,8 +497,7 @@ ospf6_lsa_create_headeronly (struct ospf6_lsa_header *header) /* LSA information structure */ /* allocate memory */ lsa = (struct ospf6_lsa *) - XMALLOC (MTYPE_OSPF6_LSA, sizeof (struct ospf6_lsa)); - memset (lsa, 0, sizeof (struct ospf6_lsa)); + XCALLOC (MTYPE_OSPF6_LSA, sizeof (struct ospf6_lsa)); lsa->header = (struct ospf6_lsa_header *) new_header; SET_FLAG (lsa->flag, OSPF6_LSA_HEADERONLY); @@ -710,8 +708,8 @@ ospf6_lsa_init (void) } -static char * -ospf6_lsa_handler_name (struct ospf6_lsa_handler *h) +const char * +ospf6_lsa_handler_name (const struct ospf6_lsa_handler *h) { static char buf[64]; unsigned int i; diff --git a/ospf6d/ospf6_lsa.h b/ospf6d/ospf6_lsa.h index fb0f27cd..989dfb57 100644 --- a/ospf6d/ospf6_lsa.h +++ b/ospf6d/ospf6_lsa.h @@ -223,6 +223,7 @@ extern void ospf6_lsa_show_summary (struct vty *vty, struct ospf6_lsa *lsa); extern void ospf6_lsa_show_dump (struct vty *vty, struct ospf6_lsa *lsa); extern void ospf6_lsa_show_internal (struct vty *vty, struct ospf6_lsa *lsa); extern void ospf6_lsa_show (struct vty *vty, struct ospf6_lsa *lsa); +extern const char *ospf6_lsa_handler_name (const struct ospf6_lsa_handler *h); extern struct ospf6_lsa *ospf6_lsa_create (struct ospf6_lsa_header *header); extern struct ospf6_lsa *ospf6_lsa_create_headeronly (struct ospf6_lsa_header *header); diff --git a/ospf6d/ospf6_message.c b/ospf6d/ospf6_message.c index c257092a..176e2244 100644 --- a/ospf6d/ospf6_message.c +++ b/ospf6d/ospf6_message.c @@ -2057,11 +2057,11 @@ ALIAS (no_debug_ospf6_message, "Debug only receiving message\n" ) +const char *ospf6_packet_type_str[] = {"unknown", "hello", "dbdesc", + "lsreq", "lsupdate", "lsack"}; int config_write_ospf6_debug_message (struct vty *vty) { - const char *type_str[] = {"unknown", "hello", "dbdesc", - "lsreq", "lsupdate", "lsack"}; unsigned char s = 0, r = 0; int i; @@ -2103,13 +2103,14 @@ config_write_ospf6_debug_message (struct vty *vty) { if (IS_OSPF6_DEBUG_MESSAGE (i, SEND) && IS_OSPF6_DEBUG_MESSAGE (i, RECV)) - vty_out (vty, "debug ospf6 message %s%s", type_str[i], VNL); + vty_out (vty, "debug ospf6 message %s%s", + ospf6_packet_type_str[i], VNL); else if (IS_OSPF6_DEBUG_MESSAGE (i, SEND)) - vty_out (vty, "debug ospf6 message %s send%s", type_str[i], - VNL); + vty_out (vty, "debug ospf6 message %s send%s", + ospf6_packet_type_str[i], VNL); else if (IS_OSPF6_DEBUG_MESSAGE (i, RECV)) - vty_out (vty, "debug ospf6 message %s recv%s", type_str[i], - VNL); + vty_out (vty, "debug ospf6 message %s recv%s", + ospf6_packet_type_str[i], VNL); } return 0; diff --git a/ospf6d/ospf6_message.h b/ospf6d/ospf6_message.h index ebb6308e..454a291a 100644 --- a/ospf6d/ospf6_message.h +++ b/ospf6d/ospf6_message.h @@ -47,6 +47,7 @@ extern unsigned char conf_debug_ospf6_message[]; #define OSPF6_MESSAGE_TYPE_CANONICAL(T) \ ((T) > OSPF6_MESSAGE_TYPE_LSACK ? OSPF6_MESSAGE_TYPE_UNKNOWN : (T)) +extern const char *ospf6_packet_type_str[]; extern const char *ospf6_message_type_str[]; #define OSPF6_MESSAGE_TYPE_NAME(T) \ (ospf6_message_type_str[ OSPF6_MESSAGE_TYPE_CANONICAL (T) ]) diff --git a/ospf6d/ospf6_route.h b/ospf6d/ospf6_route.h index 8dcc877f..3ee52b5f 100644 --- a/ospf6d/ospf6_route.h +++ b/ospf6d/ospf6_route.h @@ -284,7 +284,6 @@ extern struct ospf6_route_table *ospf6_route_table_create (int s, int t); extern void ospf6_route_table_delete (struct ospf6_route_table *); extern void ospf6_route_dump (struct ospf6_route_table *table); - extern void ospf6_route_show (struct vty *vty, struct ospf6_route *route); extern void ospf6_route_show_detail (struct vty *vty, struct ospf6_route *route); diff --git a/ospf6d/ospf6_top.c b/ospf6d/ospf6_top.c index f59b6f95..ce21f979 100644 --- a/ospf6d/ospf6_top.c +++ b/ospf6d/ospf6_top.c @@ -114,8 +114,7 @@ ospf6_create (void) { struct ospf6 *o; - o = XMALLOC (MTYPE_OSPF6_TOP, sizeof (struct ospf6)); - memset (o, 0, sizeof (struct ospf6)); + o = XCALLOC (MTYPE_OSPF6_TOP, sizeof (struct ospf6)); /* initialize */ gettimeofday (&o->starttime, (struct timezone *) NULL); @@ -144,6 +143,7 @@ ospf6_create (void) return o; } +#if 0 static void ospf6_delete (struct ospf6 *o) { @@ -164,6 +164,7 @@ ospf6_delete (struct ospf6 *o) XFREE (MTYPE_OSPF6_TOP, o); } +#endif static void ospf6_enable (struct ospf6 *o) @@ -404,6 +405,13 @@ DEFUN (no_ospf6_interface_area, return CMD_SUCCESS; } + /* Verify Area */ + if (oi->area == NULL) + { + vty_out (vty, "No such Area-ID: %s%s", argv[1], VNL); + return CMD_SUCCESS; + } + if (oi->area->area_id != area_id) { vty_out (vty, "Wrong Area-ID: %s is attached to area %s%s", @@ -562,7 +570,7 @@ ALIAS (show_ipv6_ospf6_route_match, ROUTE_STR "Specify IPv6 prefix\n" "Display routes longer than the specified route\n" - ) + ); DEFUN (show_ipv6_ospf6_route_match_detail, show_ipv6_ospf6_route_longer_detail_cmd, @@ -651,7 +659,7 @@ config_write_ospf6 (struct vty *vty) } /* OSPF6 node structure. */ -struct cmd_node ospf6_node = +static struct cmd_node ospf6_node = { OSPF6_NODE, "%s(config-ospf6)# ", @@ -668,6 +676,7 @@ ospf6_top_init (void) install_element (VIEW_NODE, &show_ipv6_ospf6_cmd); install_element (ENABLE_NODE, &show_ipv6_ospf6_cmd); install_element (CONFIG_NODE, &router_ospf6_cmd); + install_element (CONFIG_NODE, &no_router_ospf6_cmd); install_element (VIEW_NODE, &show_ipv6_ospf6_route_cmd); install_element (VIEW_NODE, &show_ipv6_ospf6_route_detail_cmd); @@ -690,7 +699,6 @@ ospf6_top_init (void) install_element (OSPF6_NODE, &ospf6_router_id_cmd); install_element (OSPF6_NODE, &ospf6_interface_area_cmd); install_element (OSPF6_NODE, &no_ospf6_interface_area_cmd); - install_element (OSPF6_NODE, &no_router_ospf6_cmd); } diff --git a/ospf6d/ospf6_zebra.c b/ospf6d/ospf6_zebra.c index b5ffc0aa..a2a97d29 100644 --- a/ospf6d/ospf6_zebra.c +++ b/ospf6d/ospf6_zebra.c @@ -134,8 +134,9 @@ ospf6_zebra_if_state_update (int command, struct zclient *zclient, ifp = zebra_interface_state_read (zclient->ibuf); if (IS_OSPF6_DEBUG_ZEBRA (RECV)) zlog_debug ("Zebra Interface state change: " - "%s index %d flags %ld metric %d mtu %d", - ifp->name, ifp->ifindex, ifp->flags, ifp->metric, ifp->mtu6); + "%s index %d flags %#llx metric %d mtu %d", + ifp->name, ifp->ifindex, (unsigned long long)ifp->flags, + ifp->metric, ifp->mtu6); ospf6_interface_state_update (ifp); return 0; @@ -335,7 +336,7 @@ config_write_ospf6_zebra (struct vty *vty) } /* Zebra node structure. */ -struct cmd_node zebra_node = +static struct cmd_node zebra_node = { ZEBRA_NODE, "%s(config-zebra)# ", diff --git a/ospf6d/ospf6d.c b/ospf6d/ospf6d.c index 1a615ffa..80598da1 100644 --- a/ospf6d/ospf6d.c +++ b/ospf6d/ospf6d.c @@ -48,7 +48,9 @@ #include "ospf6_snmp.h" #endif /*HAVE_SNMP*/ -char ospf6_daemon_version[] = OSPF6_DAEMON_VERSION; +const char ospf6_daemon_version[] = OSPF6_DAEMON_VERSION; + +extern vector ospf6_lsa_handler_vector; struct route_node * route_prev (struct route_node *node) @@ -92,7 +94,118 @@ DEFUN (show_version_ospf6, return CMD_SUCCESS; } -struct cmd_node debug_node = + +DEFUN (show_debugging_ospf6, + show_debugging_ospf6_cmd, + "show debugging ospf6", + SHOW_STR + DEBUG_STR + OSPF6_STR) +{ + int i; + char buf[INET6_ADDRSTRLEN]; + + vty_out (vty, "OSPF6 debugging status:%s", VNL); + + if (IS_OSPF6_DEBUG_ABR) + vty_out (vty, " OSPF6 ABR debugging is on%s", VNL); + + if (IS_OSPF6_DEBUG_ASBR) + vty_out (vty, " OSPF6 ASBR debugging is on%s", VNL); + + if (IS_OSPF6_DEBUG_INTERFACE) + vty_out (vty, " OSPF6 Interface debugging is on%s", VNL); + + if (IS_OSPF6_DEBUG_FLOODING) + vty_out (vty, " OSPF6 flooding debugging is on%s", VNL); + + /* show packet debugging */ + for (i = 0; i < 6; i++) + { + if (IS_OSPF6_DEBUG_MESSAGE (i, SEND) && IS_OSPF6_DEBUG_MESSAGE (i, RECV)) + vty_out (vty, " OSPF6 packet %s debugging is on%s", + ospf6_packet_type_str[i], VNL); + + else if (IS_OSPF6_DEBUG_MESSAGE (i, SEND)) + vty_out (vty, " OSPF6 packet %s send debugging is on%s", + ospf6_packet_type_str[i], VNL); + else if (IS_OSPF6_DEBUG_MESSAGE (i, RECV)) + vty_out (vty, " OSPF6 packet %s receive debugging is on%s", + ospf6_packet_type_str[i], VNL); + } + + if (IS_OSPF6_DEBUG_SPF (PROCESS)) + vty_out (vty, " OSPF6 SPF process debugging is on%s", VNL); + if (IS_OSPF6_DEBUG_SPF (TIME)) + vty_out (vty, " OSPF6 SPF time debugging is on%s", VNL); + if (IS_OSPF6_DEBUG_SPF (DATABASE)) + vty_out (vty, " OSPF6 SPF database debugging is on%s", VNL); + + if (IS_OSPF6_DEBUG_ROUTE (TABLE)) + vty_out (vty, " OSPF6 route table debugging is on%s", VNL); + if (IS_OSPF6_DEBUG_ROUTE (INTRA)) + vty_out (vty, " OSPF6 route intra-area debugging is on%s", VNL); + if (IS_OSPF6_DEBUG_ROUTE (INTER)) + vty_out (vty, " OSPF6 route inter-area debugging is on%s", VNL); + if (IS_OSPF6_DEBUG_ROUTE (MEMORY)) + vty_out (vty, " OSPF6 route memory debugging is on%s", VNL); + + + /* Show neighbor debugging */ + if (IS_OSPF6_DEBUG_NEIGHBOR (STATE) && IS_OSPF6_DEBUG_NEIGHBOR (EVENT)) + vty_out (vty, " OSPF6 neighbor debugging is on%s", VNL); + else if (IS_OSPF6_DEBUG_NEIGHBOR (STATE)) + vty_out (vty, " OSPF6 neighbor state debugging is on%s", VNL); + else if (IS_OSPF6_DEBUG_NEIGHBOR (EVENT)) + vty_out (vty, " OSPF6 neighbor event debugging is on%s", VNL); + + /* Show debug status for OSPF LSAs. */ + for (i = 0; i < vector_active (ospf6_lsa_handler_vector); i++) + { + const struct ospf6_lsa_handler *handler + = vector_slot (ospf6_lsa_handler_vector, i); + if (handler == NULL) + continue; + + if (CHECK_FLAG (handler->debug, OSPF6_LSA_DEBUG)) + vty_out (vty, " OSPF6 LSA %s debugging is on%s", + ospf6_lsa_handler_name (handler), VNL); + if (CHECK_FLAG (handler->debug, OSPF6_LSA_DEBUG_ORIGINATE)) + vty_out (vty, " OSPF6 LSA %s origination debugging is on%s", + ospf6_lsa_handler_name (handler), VNL); + if (CHECK_FLAG (handler->debug, OSPF6_LSA_DEBUG_EXAMIN)) + vty_out (vty, " OSPF6 LSA %s examination debugging is on%s", + ospf6_lsa_handler_name (handler), VNL); + if (CHECK_FLAG (handler->debug, OSPF6_LSA_DEBUG_FLOOD)) + vty_out (vty, " OSPF6 LSA %s flooding debugging is on%s", + ospf6_lsa_handler_name (handler), VNL); + } + + /* Show debug status for brouter */ + if (IS_OSPF6_DEBUG_BROUTER) + vty_out (vty, " OSPF6 border-router debugging is on%s", VNL); + if (IS_OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER) + vty_out (vty, " OSPF6 border-routers router-id %s debugging is on%s", + inet_ntop (AF_INET, &conf_debug_ospf6_brouter_specific_router_id, + buf, sizeof (buf)), VNL); + if (IS_OSPF6_DEBUG_BROUTER_SPECIFIC_AREA) + vty_out (vty, " OSPF6 border-routers area-id %s debugging is on%s", + inet_ntop (AF_INET, &conf_debug_ospf6_brouter_specific_area_id, + buf, sizeof (buf)), VNL); + + + /* Show debug status for Zebra. */ + if (IS_OSPF6_DEBUG_ZEBRA (SEND) && IS_OSPF6_DEBUG_ZEBRA (RECV)) + vty_out (vty, " OSPF6 Zebra debugging is on%s", VNL); + else if (IS_OSPF6_DEBUG_ZEBRA (SEND)) + vty_out (vty, " OSPF6 Zebra send debugging is on%s", VNL); + else if (IS_OSPF6_DEBUG_ZEBRA (RECV)) + vty_out (vty, " OSPF6 Zebra recv debugging is on%s", VNL); + + return CMD_SUCCESS; +} + +static struct cmd_node debug_node = { DEBUG_NODE, "", @@ -1647,6 +1760,12 @@ DEFUN (show_ipv6_ospf6_border_routers, ospf6_linkstate_prefix (adv_router, 0, &prefix); ro = ospf6_route_lookup (&prefix, ospf6->brouter_table); + if (!ro) + { + vty_out (vty, "No Route found for Router ID: %s%s", argv[0], VNL); + return CMD_SUCCESS; + } + ospf6_route_show_detail (vty, ro); return CMD_SUCCESS; } @@ -1772,6 +1891,7 @@ ospf6_init (void) install_node (&debug_node, config_write_ospf6_debug); + install_element (ENABLE_NODE, &show_debugging_ospf6_cmd); install_element_ospf6_debug_message (); install_element_ospf6_debug_lsa (); install_element_ospf6_debug_interface (); |