add flag for fixing https://lists.quagga.net/pipermail/quagga-dev/2015-April/012195.html issue -- "router ospf" appearance in vtysh running-config while it is not present in ospfd's config
Signed-off-by: Semyon Verchenko <semverche...@gmail.com> --- ospfd/ospf_vty.c | 30 +++++++++++++++--------------- ospfd/ospfd.c | 11 +++++++++++ ospfd/ospfd.h | 2 ++ 3 files changed, 28 insertions(+), 15 deletions(-) diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index 9d04892..d3df383 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -150,7 +150,7 @@ DEFUN (router_ospf, "Start OSPF configuration\n") { vty->node = OSPF_NODE; - vty->index = ospf_get (); + vty->index = ospf_route (); return CMD_SUCCESS; } @@ -2700,7 +2700,7 @@ DEFUN (show_ip_ospf, /* Check OSPF is enable. */ ospf = ospf_lookup (); - if (ospf == NULL) + if (ospf == NULL || !ospf->is_routed) { vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); return CMD_SUCCESS; @@ -2986,7 +2986,7 @@ DEFUN (show_ip_ospf_interface, struct listnode *node; ospf = ospf_lookup (); - if (ospf == NULL) + if (ospf == NULL || !ospf->is_routed) { vty_out (vty, "OSPF Routing Process not enabled%s", VTY_NEWLINE); return CMD_SUCCESS; @@ -3069,7 +3069,7 @@ DEFUN (show_ip_ospf_neighbor, struct listnode *node; ospf = ospf_lookup (); - if (ospf == NULL) + if (ospf == NULL || !ospf->is_routed) { vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); return CMD_SUCCESS; @@ -3096,7 +3096,7 @@ DEFUN (show_ip_ospf_neighbor_all, struct listnode *node; struct ospf_interface *oi; - if (ospf == NULL) + if (ospf == NULL || !ospf->is_routed) { vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); return CMD_SUCCESS; @@ -3150,7 +3150,7 @@ DEFUN (show_ip_ospf_neighbor_int, } ospf = ospf_lookup (); - if (ospf == NULL) + if (ospf == NULL || !ospf->is_routed) { vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); return CMD_SUCCESS; @@ -3305,7 +3305,7 @@ DEFUN (show_ip_ospf_neighbor_id, } ospf = ospf_lookup (); - if (ospf == NULL) + if (ospf == NULL || !ospf->is_routed) { vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); return CMD_SUCCESS; @@ -3332,7 +3332,7 @@ DEFUN (show_ip_ospf_neighbor_detail, struct listnode *node; ospf = ospf_lookup (); - if (ospf == NULL) + if (ospf == NULL || !ospf->is_routed) { vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); return CMD_SUCCESS; @@ -3368,7 +3368,7 @@ DEFUN (show_ip_ospf_neighbor_detail_all, struct ospf_interface *oi; ospf = ospf_lookup (); - if (ospf == NULL) + if (ospf == NULL || !ospf->is_routed) { vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); return CMD_SUCCESS; @@ -3424,7 +3424,7 @@ DEFUN (show_ip_ospf_neighbor_int_detail, } ospf = ospf_lookup (); - if (ospf == NULL) + if (ospf == NULL || !ospf->is_routed) { vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); return CMD_SUCCESS; @@ -4112,7 +4112,7 @@ DEFUN (show_ip_ospf_database, struct in_addr id, adv_router; ospf = ospf_lookup (); - if (ospf == NULL) + if (ospf == NULL || !ospf->is_routed) { vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); return CMD_SUCCESS; @@ -4253,7 +4253,7 @@ DEFUN (show_ip_ospf_database_type_adv_router, struct in_addr adv_router; ospf = ospf_lookup (); - if (ospf == NULL) + if (ospf == NULL || !ospf->is_routed) { vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); return CMD_SUCCESS; @@ -6607,7 +6607,7 @@ DEFUN (show_ip_ospf_border_routers, { struct ospf *ospf; - if ((ospf = ospf_lookup ()) == NULL) + if ((ospf = ospf_lookup ()) == NULL || !ospf->is_routed) { vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); return CMD_SUCCESS; @@ -6638,7 +6638,7 @@ DEFUN (show_ip_ospf_route, { struct ospf *ospf; - if ((ospf = ospf_lookup ()) == NULL) + if ((ospf = ospf_lookup ()) == NULL || !ospf->is_routed) { vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); return CMD_SUCCESS; @@ -7247,7 +7247,7 @@ ospf_config_write (struct vty *vty) int write = 0; ospf = ospf_lookup (); - if (ospf != NULL) + if (ospf != NULL && ospf->is_routed) { /* `router ospf' print. */ vty_out (vty, "router ospf%s", VTY_NEWLINE); diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c index 019a22b..48770ac 100644 --- a/ospfd/ospfd.c +++ b/ospfd/ospfd.c @@ -169,6 +169,8 @@ ospf_new (void) new->router_id.s_addr = htonl (0); new->router_id_static.s_addr = htonl (0); + new->is_routed = 0; + new->abr_type = OSPF_ABR_DEFAULT; new->oiflist = list_new (); new->vlinks = list_new (); @@ -287,6 +289,15 @@ ospf_get () return ospf; } +struct ospf * +ospf_route () +{ + struct ospf * ospf; + ospf = ospf_get (); + ospf->is_routed = 1; + return ospf; +} + /* Handle the second half of deferred shutdown. This is called either * from the deferred-shutdown timer thread, or directly through * ospf_deferred_shutdown_check. diff --git a/ospfd/ospfd.h b/ospfd/ospfd.h index 06841b8..1d6181b 100644 --- a/ospfd/ospfd.h +++ b/ospfd/ospfd.h @@ -107,6 +107,7 @@ struct ospf struct in_addr router_id; /* Configured automatically. */ struct in_addr router_id_static; /* Configured manually. */ + u_char is_routed; /* True if there was route ospf command */ /* ABR/ASBR internal flags. */ u_char flags; #define OSPF_FLAG_ABR 0x0001 @@ -508,6 +509,7 @@ extern int ospf_zlog; extern const char *ospf_redist_string(u_int route_type); extern struct ospf *ospf_lookup (void); extern struct ospf *ospf_get (void); +extern struct ospf *ospf_route (void); extern void ospf_finish (struct ospf *); extern void ospf_router_id_update (struct ospf *ospf); extern int ospf_network_set (struct ospf *, struct prefix_ipv4 *, -- 2.5.2 _______________________________________________ Quagga-dev mailing list Quagga-dev@lists.quagga.net https://lists.quagga.net/mailman/listinfo/quagga-dev