diff options
Diffstat (limited to 'ospfd/ospf_vty.c')
-rw-r--r-- | ospfd/ospf_vty.c | 306 |
1 files changed, 188 insertions, 118 deletions
diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index 2bb24b8c..4896d352 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -181,13 +181,16 @@ DEFUN (no_router_ospf, "Enable a routing process\n" "Start OSPF configuration\n") { - if (ospf_top == NULL) + struct ospf *ospf; + + ospf = ospf_lookup (); + if (ospf == NULL) { - vty_out (vty, "There isn't active ospf instance.%s", VTY_NEWLINE); + vty_out (vty, "There isn't active ospf instance%s", VTY_NEWLINE); return CMD_WARNING; } - ospf_finish (ospf_top); + ospf_finish (ospf); return CMD_SUCCESS; } @@ -213,9 +216,8 @@ DEFUN (ospf_router_id, ospf->router_id_static = router_id; if (ospf->t_router_id_update == NULL) - ospf->t_router_id_update = - thread_add_timer (master, ospf_router_id_update_timer, NULL, - OSPF_ROUTER_ID_UPDATE_DELAY); + OSPF_TIMER_ON (ospf->t_router_id_update, ospf_router_id_update_timer, + OSPF_ROUTER_ID_UPDATE_DELAY); return CMD_SUCCESS; } @@ -2298,8 +2300,8 @@ DEFUN (auto_cost_reference_bandwidth, vty_out (vty, "%% OSPF: Reference bandwidth is changed.%s", VTY_NEWLINE); vty_out (vty, " Please ensure reference bandwidth is consistent across all routers%s", VTY_NEWLINE); - for (node = listhead (ospf->iflist); node; nextnode (node)) - ospf_if_recalculate_output_cost (getdata (node)); + for (node = listhead (om->iflist); node; nextnode (node)) + ospf_if_recalculate_output_cost (getdata (node)); return CMD_SUCCESS; } @@ -2321,8 +2323,8 @@ DEFUN (no_auto_cost_reference_bandwidth, vty_out (vty, "%% OSPF: Reference bandwidth is changed.%s", VTY_NEWLINE); vty_out (vty, " Please ensure reference bandwidth is consistent across all routers%s", VTY_NEWLINE); - for (node = listhead (ospf->iflist); node; nextnode (node)) - ospf_if_recalculate_output_cost (getdata (node)); + for (node = listhead (om->iflist); node; nextnode (node)) + ospf_if_recalculate_output_cost (getdata (node)); return CMD_SUCCESS; } @@ -2386,7 +2388,7 @@ show_ip_ospf_area (struct vty *vty, struct ospf_area *area) if (area->external_routing == OSPF_AREA_NSSA) { vty_out (vty, " It is an NSSA configuration. %s Elected NSSA/ABR performs type-7/type-5 LSA translation. %s", VTY_NEWLINE, VTY_NEWLINE); - if (! OSPF_IS_ABR) + if (! IS_OSPF_ABR (area->ospf)) vty_out (vty, " It is not ABR, therefore not Translator. %s", VTY_NEWLINE); else @@ -2435,9 +2437,10 @@ DEFUN (show_ip_ospf, { listnode node; struct ospf_area * area; - struct ospf *ospf = ospf_top; + struct ospf *ospf; /* Check OSPF is enable. */ + ospf = ospf_lookup (); if (ospf == NULL) { vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); @@ -2619,9 +2622,11 @@ DEFUN (show_ip_ospf_interface, "Interface name\n") { struct interface *ifp; - struct ospf *ospf = ospf_top; + struct ospf *ospf; listnode node; + ospf = ospf_lookup (); + /* Show All Interfaces. */ if (argc == 0) for (node = listhead (iflist); node; nextnode (node)) @@ -2679,9 +2684,10 @@ DEFUN (show_ip_ospf_neighbor, "OSPF information\n" "Neighbor list\n") { - struct ospf *ospf = ospf_top; + struct ospf *ospf; listnode node; + ospf = ospf_lookup (); if (ospf == NULL) { vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); @@ -2694,7 +2700,7 @@ DEFUN (show_ip_ospf_neighbor, "RqstL DBsmL%s", VTY_NEWLINE, VTY_NEWLINE); for (node = listhead (ospf->oiflist); node; nextnode (node)) - show_ip_ospf_neighbor_sub (vty, getdata (node)); + show_ip_ospf_neighbor_sub (vty, getdata (node)); return CMD_SUCCESS; } @@ -2760,17 +2766,11 @@ DEFUN (show_ip_ospf_neighbor_int, "Neighbor list\n" "Interface name\n") { - struct ospf *ospf = ospf_top; + struct ospf *ospf; struct ospf_interface *oi; struct in_addr addr; int ret; - if (ospf == NULL) - { - vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); - return CMD_SUCCESS; - } - ret = inet_aton (argv[0], &addr); if (!ret) { @@ -2779,6 +2779,13 @@ DEFUN (show_ip_ospf_neighbor_int, return CMD_WARNING; } + ospf = ospf_lookup (); + if (ospf == NULL) + { + vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); + return CMD_SUCCESS; + } + if ((oi = ospf_if_is_configured (ospf, &addr)) == NULL) vty_out (vty, "No such interface address%s", VTY_NEWLINE); else @@ -2891,7 +2898,7 @@ DEFUN (show_ip_ospf_neighbor_id, "Neighbor list\n" "Neighbor ID\n") { - struct ospf *ospf = ospf_top; + struct ospf *ospf; listnode node; struct ospf_neighbor *nbr; struct in_addr router_id; @@ -2904,6 +2911,13 @@ DEFUN (show_ip_ospf_neighbor_id, return CMD_WARNING; } + ospf = ospf_lookup (); + if (ospf == NULL) + { + vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); + return CMD_SUCCESS; + } + for (node = listhead (ospf->oiflist); node; nextnode (node)) { struct ospf_interface *oi = getdata (node); @@ -2928,11 +2942,15 @@ DEFUN (show_ip_ospf_neighbor_detail, "Neighbor list\n" "detail of all neighbors\n") { - struct ospf *ospf = ospf_top; + struct ospf *ospf; listnode node; + ospf = ospf_lookup (); if (ospf == NULL) - return CMD_SUCCESS; + { + vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); + return CMD_SUCCESS; + } for (node = listhead (ospf->oiflist); node; nextnode (node)) { @@ -2960,11 +2978,15 @@ DEFUN (show_ip_ospf_neighbor_detail_all, "detail of all neighbors\n" "include down status neighbor\n") { - struct ospf *ospf = ospf_top; + struct ospf *ospf; listnode node; + ospf = ospf_lookup (); if (ospf == NULL) - return CMD_SUCCESS; + { + vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); + return CMD_SUCCESS; + } for (node = listhead (ospf->oiflist); node; nextnode (node)) { @@ -3005,6 +3027,7 @@ DEFUN (show_ip_ospf_neighbor_int_detail, "Interface address\n" "detail of all neighbors") { + struct ospf *ospf; struct ospf_interface *oi; struct in_addr addr; int ret; @@ -3017,10 +3040,14 @@ DEFUN (show_ip_ospf_neighbor_int_detail, return CMD_WARNING; } - if (ospf_top == NULL) - return CMD_WARNING; + ospf = ospf_lookup (); + if (ospf == NULL) + { + vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); + return CMD_SUCCESS; + } - if ((oi = ospf_if_is_configured (ospf_top, &addr)) == NULL) + if ((oi = ospf_if_is_configured (ospf, &addr)) == NULL) vty_out (vty, "No such interface address%s", VTY_NEWLINE); else { @@ -3040,9 +3067,8 @@ DEFUN (show_ip_ospf_neighbor_int_detail, /* Show functions */ int -show_lsa_summary (struct ospf_lsa *lsa, void *v, int self) +show_lsa_summary (struct vty *vty, struct ospf_lsa *lsa, int self) { - struct vty *vty = (struct vty *) v; struct router_lsa *rl; struct summary_lsa *sl; struct as_external_lsa *asel; @@ -3501,10 +3527,9 @@ show_lsa_detail_proc (struct vty *vty, struct route_table *rt, /* Show detail LSA information -- if id is NULL then show all LSAs. */ void -show_lsa_detail (struct vty *vty, int type, +show_lsa_detail (struct vty *vty, struct ospf *ospf, int type, struct in_addr *id, struct in_addr *adv_router) { - struct ospf *ospf = ospf_top; listnode node; switch (type) @@ -3553,10 +3578,9 @@ show_lsa_detail_adv_router_proc (struct vty *vty, struct route_table *rt, /* Show detail LSA information. */ void -show_lsa_detail_adv_router (struct vty *vty, int type, +show_lsa_detail_adv_router (struct vty *vty, struct ospf *ospf, int type, struct in_addr *adv_router) { - struct ospf *ospf = ospf_top; listnode node; switch (type) @@ -3586,9 +3610,10 @@ show_lsa_detail_adv_router (struct vty *vty, int type, } void -show_ip_ospf_database_summary (struct vty *vty, int self) +show_ip_ospf_database_summary (struct vty *vty, struct ospf *ospf, int self) { - struct ospf *ospf = ospf_top; + struct ospf_lsa *lsa; + struct route_node *rn; listnode node; int type; @@ -3616,7 +3641,8 @@ show_ip_ospf_database_summary (struct vty *vty, int self) VTY_NEWLINE, VTY_NEWLINE); vty_out (vty, "%s%s", show_database_header[type], VTY_NEWLINE); - foreach_lsa (AREA_LSDB (area, type), vty, self, show_lsa_summary); + LSDB_LOOP (AREA_LSDB (area, type), rn, lsa) + show_lsa_summary (vty, lsa, self); vty_out (vty, "%s", VTY_NEWLINE); } @@ -3643,7 +3669,10 @@ show_ip_ospf_database_summary (struct vty *vty, int self) VTY_NEWLINE, VTY_NEWLINE); vty_out (vty, "%s%s", show_database_header[type], VTY_NEWLINE); - foreach_lsa (AS_LSDB (ospf, type), vty, self, show_lsa_summary); + + LSDB_LOOP (AS_LSDB (ospf, type), rn, lsa) + show_lsa_summary (vty, lsa, self); + vty_out (vty, "%s", VTY_NEWLINE); } } @@ -3652,9 +3681,8 @@ show_ip_ospf_database_summary (struct vty *vty, int self) } void -show_ip_ospf_database_maxage (struct vty *vty) +show_ip_ospf_database_maxage (struct vty *vty, struct ospf *ospf) { - struct ospf *ospf = ospf_top; listnode node; struct ospf_lsa *lsa; @@ -3718,10 +3746,11 @@ DEFUN (show_ip_ospf_database, "OSPF information\n" "Database summary\n") { - struct ospf *ospf = ospf_top; + struct ospf *ospf; int type, ret; struct in_addr id, adv_router; + ospf = ospf_lookup (); if (ospf == NULL) return CMD_SUCCESS; @@ -3731,7 +3760,7 @@ DEFUN (show_ip_ospf_database, /* Show all LSA. */ if (argc == 0) { - show_ip_ospf_database_summary (vty, 0); + show_ip_ospf_database_summary (vty, ospf, 0); return CMD_SUCCESS; } @@ -3752,12 +3781,12 @@ DEFUN (show_ip_ospf_database, type = OSPF_AS_EXTERNAL_LSA; else if (strncmp (argv[0], "se", 2) == 0) { - show_ip_ospf_database_summary (vty, 1); + show_ip_ospf_database_summary (vty, ospf, 1); return CMD_SUCCESS; } else if (strncmp (argv[0], "m", 1) == 0) { - show_ip_ospf_database_maxage (vty); + show_ip_ospf_database_maxage (vty, ospf); return CMD_SUCCESS; } #ifdef HAVE_OPAQUE_LSA @@ -3773,7 +3802,7 @@ DEFUN (show_ip_ospf_database, /* `show ip ospf database LSA'. */ if (argc == 1) - show_lsa_detail (vty, type, NULL, NULL); + show_lsa_detail (vty, ospf, type, NULL, NULL); else if (argc >= 2) { ret = inet_aton (argv[1], &id); @@ -3782,7 +3811,7 @@ DEFUN (show_ip_ospf_database, /* `show ip ospf database LSA ID'. */ if (argc == 2) - show_lsa_detail (vty, type, &id, NULL); + show_lsa_detail (vty, ospf, type, &id, NULL); /* `show ip ospf database LSA ID adv-router ADV_ROUTER'. */ else if (argc == 3) { @@ -3794,7 +3823,7 @@ DEFUN (show_ip_ospf_database, if (!ret) return CMD_WARNING; } - show_lsa_detail (vty, type, &id, &adv_router); + show_lsa_detail (vty, ospf, type, &id, &adv_router); } } @@ -3857,10 +3886,11 @@ DEFUN (show_ip_ospf_database_type_adv_router, "Advertising Router link states\n" "Advertising Router (as an IP address)\n") { - struct ospf *ospf = ospf_top; + struct ospf *ospf; int type, ret; struct in_addr adv_router; + ospf = ospf_lookup (); if (ospf == NULL) return CMD_SUCCESS; @@ -3906,7 +3936,7 @@ DEFUN (show_ip_ospf_database_type_adv_router, return CMD_WARNING; } - show_lsa_detail_adv_router (vty, type, &adv_router); + show_lsa_detail_adv_router (vty, ospf, type, &adv_router); return CMD_SUCCESS; } @@ -4489,8 +4519,10 @@ DEFUN (ip_ospf_dead_interval, struct ospf_if_params *params; struct ospf_interface *oi; struct route_node *rn; - struct ospf *ospf = ospf_top; + struct ospf *ospf; + ospf = ospf_lookup (); + params = IF_DEF_PARAMS (ifp); seconds = strtol (argv[0], NULL, 10); @@ -4569,8 +4601,10 @@ DEFUN (no_ip_ospf_dead_interval, struct ospf_if_params *params; struct ospf_interface *oi; struct route_node *rn; - struct ospf *ospf = ospf_top; + struct ospf *ospf; + ospf = ospf_lookup (); + ifp = vty->index; params = IF_DEF_PARAMS (ifp); @@ -5263,6 +5297,7 @@ DEFUN (ospf_redistribute_source_metric_type, "Route map reference\n" "Pointer to route-map entries\n") { + struct ospf *ospf = vty->index; int source; int type = -1; int metric = -1; @@ -5282,11 +5317,11 @@ DEFUN (ospf_redistribute_source_metric_type, return CMD_WARNING; if (argc == 4) - ospf_routemap_set (source, argv[3]); + ospf_routemap_set (ospf, source, argv[3]); else - ospf_routemap_unset (source); + ospf_routemap_unset (ospf, source); - return ospf_redistribute_set (source, type, metric); + return ospf_redistribute_set (ospf, source, type, metric); } ALIAS (ospf_redistribute_source_metric_type, @@ -5333,6 +5368,7 @@ DEFUN (ospf_redistribute_source_type_metric, "Route map reference\n" "Pointer to route-map entries\n") { + struct ospf *ospf = vty->index; int source; int type = -1; int metric = -1; @@ -5352,11 +5388,11 @@ DEFUN (ospf_redistribute_source_type_metric, return CMD_WARNING; if (argc == 4) - ospf_routemap_set (source, argv[3]); + ospf_routemap_set (ospf, source, argv[3]); else - ospf_routemap_unset (source); + ospf_routemap_unset (ospf, source); - return ospf_redistribute_set (source, type, metric); + return ospf_redistribute_set (ospf, source, type, metric); } ALIAS (ospf_redistribute_source_type_metric, @@ -5411,6 +5447,7 @@ DEFUN (ospf_redistribute_source_metric_routemap, "Route map reference\n" "Pointer to route-map entries\n") { + struct ospf *ospf = vty->index; int source; int metric = -1; @@ -5424,11 +5461,11 @@ DEFUN (ospf_redistribute_source_metric_routemap, return CMD_WARNING; if (argc == 3) - ospf_routemap_set (source, argv[2]); + ospf_routemap_set (ospf, source, argv[2]); else - ospf_routemap_unset (source); + ospf_routemap_unset (ospf, source); - return ospf_redistribute_set (source, -1, metric); + return ospf_redistribute_set (ospf, source, -1, metric); } DEFUN (ospf_redistribute_source_type_routemap, @@ -5446,6 +5483,7 @@ DEFUN (ospf_redistribute_source_type_routemap, "Route map reference\n" "Pointer to route-map entries\n") { + struct ospf *ospf = vty->index; int source; int type = -1; @@ -5459,11 +5497,11 @@ DEFUN (ospf_redistribute_source_type_routemap, return CMD_WARNING; if (argc == 3) - ospf_routemap_set (source, argv[2]); + ospf_routemap_set (ospf, source, argv[2]); else - ospf_routemap_unset (source); + ospf_routemap_unset (ospf, source); - return ospf_redistribute_set (source, type, -1); + return ospf_redistribute_set (ospf, source, type, -1); } DEFUN (ospf_redistribute_source_routemap, @@ -5478,6 +5516,7 @@ DEFUN (ospf_redistribute_source_routemap, "Route map reference\n" "Pointer to route-map entries\n") { + struct ospf *ospf = vty->index; int source; /* Get distribute source. */ @@ -5485,11 +5524,11 @@ DEFUN (ospf_redistribute_source_routemap, return CMD_WARNING; if (argc == 2) - ospf_routemap_set (source, argv[1]); + ospf_routemap_set (ospf, source, argv[1]); else - ospf_routemap_unset (source); + ospf_routemap_unset (ospf, source); - return ospf_redistribute_set (source, -1, -1); + return ospf_redistribute_set (ospf, source, -1, -1); } DEFUN (no_ospf_redistribute_source, @@ -5503,13 +5542,14 @@ DEFUN (no_ospf_redistribute_source, "Routing Information Protocol (RIP)\n" "Border Gateway Protocol (BGP)\n") { + struct ospf *ospf = vty->index; int source; if (!str2distribute_source (argv[0], &source)) return CMD_WARNING; - ospf_routemap_unset (source); - return ospf_redistribute_unset (source); + ospf_routemap_unset (ospf, source); + return ospf_redistribute_unset (ospf, source); } DEFUN (ospf_distribute_list_out, @@ -5570,6 +5610,7 @@ DEFUN (ospf_default_information_originate_metric_type_routemap, "Route map reference\n" "Pointer to route-map entries\n") { + struct ospf *ospf = vty->index; int type = -1; int metric = -1; @@ -5584,11 +5625,12 @@ DEFUN (ospf_default_information_originate_metric_type_routemap, return CMD_WARNING; if (argc == 3) - ospf_routemap_set (DEFAULT_ROUTE, argv[2]); + ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[2]); else - ospf_routemap_unset (DEFAULT_ROUTE); + ospf_routemap_unset (ospf, DEFAULT_ROUTE); - return ospf_redistribute_default_set (DEFAULT_ORIGINATE_ZEBRA, type, metric); + return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ZEBRA, + type, metric); } ALIAS (ospf_default_information_originate_metric_type_routemap, @@ -5627,6 +5669,7 @@ DEFUN (ospf_default_information_originate_metric_routemap, "Route map reference\n" "Pointer to route-map entries\n") { + struct ospf *ospf = vty->index; int metric = -1; /* Get metric value. */ @@ -5635,11 +5678,12 @@ DEFUN (ospf_default_information_originate_metric_routemap, return CMD_WARNING; if (argc == 2) - ospf_routemap_set (DEFAULT_ROUTE, argv[1]); + ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[1]); else - ospf_routemap_unset (DEFAULT_ROUTE); + ospf_routemap_unset (ospf, DEFAULT_ROUTE); - return ospf_redistribute_default_set (DEFAULT_ORIGINATE_ZEBRA, -1, metric); + return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ZEBRA, + -1, metric); } /* Default information originate. */ @@ -5651,12 +5695,14 @@ DEFUN (ospf_default_information_originate_routemap, "Route map reference\n" "Pointer to route-map entries\n") { + struct ospf *ospf = vty->index; + if (argc == 1) - ospf_routemap_set (DEFAULT_ROUTE, argv[0]); + ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[0]); else - ospf_routemap_unset (DEFAULT_ROUTE); + ospf_routemap_unset (ospf, DEFAULT_ROUTE); - return ospf_redistribute_default_set (DEFAULT_ORIGINATE_ZEBRA, -1, -1); + return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ZEBRA, -1, -1); } DEFUN (ospf_default_information_originate_type_metric_routemap, @@ -5672,6 +5718,7 @@ DEFUN (ospf_default_information_originate_type_metric_routemap, "Route map reference\n" "Pointer to route-map entries\n") { + struct ospf *ospf = vty->index; int type = -1; int metric = -1; @@ -5686,11 +5733,12 @@ DEFUN (ospf_default_information_originate_type_metric_routemap, return CMD_WARNING; if (argc == 3) - ospf_routemap_set (DEFAULT_ROUTE, argv[2]); + ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[2]); else - ospf_routemap_unset (DEFAULT_ROUTE); + ospf_routemap_unset (ospf, DEFAULT_ROUTE); - return ospf_redistribute_default_set (DEFAULT_ORIGINATE_ZEBRA, type, metric); + return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ZEBRA, + type, metric); } ALIAS (ospf_default_information_originate_type_metric_routemap, @@ -5724,6 +5772,7 @@ DEFUN (ospf_default_information_originate_type_routemap, "Route map reference\n" "Pointer to route-map entries\n") { + struct ospf *ospf = vty->index; int type = -1; /* Get metric type. */ @@ -5732,11 +5781,12 @@ DEFUN (ospf_default_information_originate_type_routemap, return CMD_WARNING; if (argc == 2) - ospf_routemap_set (DEFAULT_ROUTE, argv[1]); + ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[1]); else - ospf_routemap_unset (DEFAULT_ROUTE); + ospf_routemap_unset (ospf, DEFAULT_ROUTE); - return ospf_redistribute_default_set (DEFAULT_ORIGINATE_ZEBRA, type, -1); + return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ZEBRA, + type, -1); } DEFUN (ospf_default_information_originate_always_metric_type_routemap, @@ -5753,6 +5803,7 @@ DEFUN (ospf_default_information_originate_always_metric_type_routemap, "Route map reference\n" "Pointer to route-map entries\n") { + struct ospf *ospf = vty->index; int type = -1; int metric = -1; @@ -5767,11 +5818,11 @@ DEFUN (ospf_default_information_originate_always_metric_type_routemap, return CMD_WARNING; if (argc == 3) - ospf_routemap_set (DEFAULT_ROUTE, argv[2]); + ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[2]); else - ospf_routemap_unset (DEFAULT_ROUTE); + ospf_routemap_unset (ospf, DEFAULT_ROUTE); - return ospf_redistribute_default_set (DEFAULT_ORIGINATE_ALWAYS, + return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ALWAYS, type, metric); } @@ -5815,6 +5866,7 @@ DEFUN (ospf_default_information_originate_always_metric_routemap, "Route map reference\n" "Pointer to route-map entries\n") { + struct ospf *ospf = vty->index; int metric = -1; /* Get metric value. */ @@ -5823,11 +5875,12 @@ DEFUN (ospf_default_information_originate_always_metric_routemap, return CMD_WARNING; if (argc == 2) - ospf_routemap_set (DEFAULT_ROUTE, argv[1]); + ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[1]); else - ospf_routemap_unset (DEFAULT_ROUTE); + ospf_routemap_unset (ospf, DEFAULT_ROUTE); - return ospf_redistribute_default_set (DEFAULT_ORIGINATE_ALWAYS, -1, metric); + return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ALWAYS, + -1, metric); } DEFUN (ospf_default_information_originate_always_routemap, @@ -5839,12 +5892,14 @@ DEFUN (ospf_default_information_originate_always_routemap, "Route map reference\n" "Pointer to route-map entries\n") { + struct ospf *ospf = vty->index; + if (argc == 1) - ospf_routemap_set (DEFAULT_ROUTE, argv[0]); + ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[0]); else - ospf_routemap_unset (DEFAULT_ROUTE); + ospf_routemap_unset (ospf, DEFAULT_ROUTE); - return ospf_redistribute_default_set (DEFAULT_ORIGINATE_ALWAYS, -1, -1); + return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ALWAYS, -1, -1); } DEFUN (ospf_default_information_originate_always_type_metric_routemap, @@ -5861,6 +5916,7 @@ DEFUN (ospf_default_information_originate_always_type_metric_routemap, "Route map reference\n" "Pointer to route-map entries\n") { + struct ospf *ospf = vty->index; int type = -1; int metric = -1; @@ -5875,11 +5931,11 @@ DEFUN (ospf_default_information_originate_always_type_metric_routemap, return CMD_WARNING; if (argc == 3) - ospf_routemap_set (DEFAULT_ROUTE, argv[2]); + ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[2]); else - ospf_routemap_unset (DEFAULT_ROUTE); + ospf_routemap_unset (ospf, DEFAULT_ROUTE); - return ospf_redistribute_default_set (DEFAULT_ORIGINATE_ALWAYS, + return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ALWAYS, type, metric); } @@ -5917,6 +5973,7 @@ DEFUN (ospf_default_information_originate_always_type_routemap, "Route map reference\n" "Pointer to route-map entries\n") { + struct ospf *ospf = vty->index; int type = -1; /* Get metric type. */ @@ -5925,11 +5982,11 @@ DEFUN (ospf_default_information_originate_always_type_routemap, return CMD_WARNING; if (argc == 2) - ospf_routemap_set (DEFAULT_ROUTE, argv[1]); + ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[1]); else - ospf_routemap_unset (DEFAULT_ROUTE); + ospf_routemap_unset (ospf, DEFAULT_ROUTE); - return ospf_redistribute_default_set (DEFAULT_ORIGINATE_ALWAYS, + return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ALWAYS, type, -1); } @@ -5956,8 +6013,8 @@ DEFUN (no_ospf_default_information_originate, EXTERNAL_INFO (DEFAULT_ROUTE) = NULL; } - ospf_routemap_unset (DEFAULT_ROUTE); - return ospf_redistribute_default_unset (); + ospf_routemap_unset (ospf, DEFAULT_ROUTE); + return ospf_redistribute_default_unset (ospf); } DEFUN (ospf_default_metric, @@ -6327,7 +6384,9 @@ DEFUN (ospf_distance_source, "Distance value\n" "IP source prefix\n") { - ospf_distance_set (vty, argv[0], argv[1], NULL); + struct ospf *ospf = vty->index; + + ospf_distance_set (vty, ospf, argv[0], argv[1], NULL); return CMD_SUCCESS; } @@ -6340,7 +6399,10 @@ DEFUN (no_ospf_distance_source, "Distance value\n" "IP source prefix\n") { - ospf_distance_unset (vty, argv[0], argv[1], NULL); + struct ospf *ospf = vty->index; + + ospf_distance_unset (vty, ospf, argv[0], argv[1], NULL); + return CMD_SUCCESS; } @@ -6352,7 +6414,10 @@ DEFUN (ospf_distance_source_access_list, "IP source prefix\n" "Access list name\n") { - ospf_distance_set (vty, argv[0], argv[1], argv[2]); + struct ospf *ospf = vty->index; + + ospf_distance_set (vty, ospf, argv[0], argv[1], argv[2]); + return CMD_SUCCESS; } @@ -6365,7 +6430,10 @@ DEFUN (no_ospf_distance_source_access_list, "IP source prefix\n" "Access list name\n") { - ospf_distance_unset (vty, argv[0], argv[1], argv[2]); + struct ospf *ospf = vty->index; + + ospf_distance_unset (vty, ospf, argv[0], argv[1], argv[2]); + return CMD_SUCCESS; } @@ -6528,8 +6596,9 @@ DEFUN (show_ip_ospf_border_routers, "show all the ABR's and ASBR's\n" "for this area\n") { - struct ospf *ospf = ospf_top; + struct ospf *ospf; + ospf = ospf_lookup (); if (ospf == NULL) { vty_out (vty, "OSPF is not enabled%s", VTY_NEWLINE); @@ -6543,7 +6612,7 @@ DEFUN (show_ip_ospf_border_routers, } /* Show Network routes. - show_ip_ospf_route_network (vty, ospf_top->new_table); */ + show_ip_ospf_route_network (vty, ospf->new_table); */ /* Show Router routes. */ show_ip_ospf_route_router (vty, ospf->new_rtrs); @@ -6560,8 +6629,9 @@ DEFUN (show_ip_ospf_route, "OSPF information\n" "OSPF routing table\n") { - struct ospf *ospf = ospf_top; + struct ospf *ospf; + ospf = ospf_lookup (); if (ospf == NULL) { vty_out (vty, "OSPF is not enabled%s", VTY_NEWLINE); @@ -7033,13 +7103,13 @@ config_write_ospf_redistribute (struct vty *vty, struct ospf *ospf) { vty_out (vty, " redistribute %s", distribute_str[type]); if (ospf->dmetric[type].value >= 0) - vty_out (vty, " metric %d", ospf_top->dmetric[type].value); + vty_out (vty, " metric %d", ospf->dmetric[type].value); if (ospf->dmetric[type].type == EXTERNAL_METRIC_TYPE_1) vty_out (vty, " metric-type 1"); - if (ROUTEMAP_NAME (type)) - vty_out (vty, " route-map %s", ROUTEMAP_NAME (type)); + if (ROUTEMAP_NAME (ospf, type)) + vty_out (vty, " route-map %s", ROUTEMAP_NAME (ospf, type)); vty_out (vty, "%s", VTY_NEWLINE); } @@ -7084,8 +7154,9 @@ config_write_ospf_distribute (struct vty *vty, struct ospf *ospf) if (ospf->dmetric[DEFAULT_ROUTE].type == EXTERNAL_METRIC_TYPE_1) vty_out (vty, " metric-type 1"); - if (ROUTEMAP_NAME (DEFAULT_ROUTE)) - vty_out (vty, " route-map %s", ROUTEMAP_NAME (DEFAULT_ROUTE)); + if (ROUTEMAP_NAME (ospf, DEFAULT_ROUTE)) + vty_out (vty, " route-map %s", + ROUTEMAP_NAME (ospf, DEFAULT_ROUTE)); vty_out (vty, "%s", VTY_NEWLINE); } @@ -7135,10 +7206,11 @@ config_write_ospf_distance (struct vty *vty, struct ospf *ospf) int ospf_config_write (struct vty *vty) { - struct ospf *ospf = ospf_top; + struct ospf *ospf; listnode node; int write = 0; + ospf = ospf_lookup (); if (ospf != NULL) { /* `router ospf' print. */ @@ -7183,7 +7255,7 @@ ospf_config_write (struct vty *vty) config_write_ospf_redistribute (vty, ospf); /* passive-interface print. */ - for (node = listhead (ospf->iflist); node; nextnode (node)) + for (node = listhead (om->iflist); node; nextnode (node)) { struct interface *ifp = getdata (node); @@ -7643,5 +7715,3 @@ ospf_vty_init () /* Init zebra related vty commands. */ ospf_vty_zebra_init (); } - - |