diff options
Diffstat (limited to 'ospfd/ospfd.c')
-rw-r--r-- | ospfd/ospfd.c | 75 |
1 files changed, 40 insertions, 35 deletions
diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c index 0c3230d36..fb6503013 100644 --- a/ospfd/ospfd.c +++ b/ospfd/ospfd.c @@ -1,22 +1,22 @@ /* OSPF version 2 daemon program. - Copyright (C) 1999, 2000 Toshiaki Takada - -This file is part of GNU Zebra. - -GNU Zebra is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) any -later version. - -GNU Zebra is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Zebra; see the file COPYING. If not, write to the Free -Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ + * Copyright (C) 1999, 2000 Toshiaki Takada + * + * This file is part of GNU Zebra. + * + * GNU Zebra is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any + * later version. + * + * GNU Zebra is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; see the file COPYING; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ #include <zebra.h> @@ -720,6 +720,7 @@ ospf_area_new (struct ospf *ospf, struct in_addr area_id) new->ospf = ospf; new->area_id = area_id; + new->area_id_fmt = OSPF_AREA_ID_FMT_DOTTEDQUAD; new->external_routing = OSPF_AREA_DEFAULT; new->default_cost = 1; @@ -812,7 +813,7 @@ ospf_area_check_free (struct ospf *ospf, struct in_addr area_id) } struct ospf_area * -ospf_area_get (struct ospf *ospf, struct in_addr area_id, int format) +ospf_area_get (struct ospf *ospf, struct in_addr area_id) { struct ospf_area *area; @@ -820,7 +821,6 @@ ospf_area_get (struct ospf *ospf, struct in_addr area_id, int format) if (!area) { area = ospf_area_new (ospf, area_id); - area->format = format; listnode_add_sort (ospf->areas, area); ospf_check_abr_status (ospf); if (ospf->stub_router_admin_set == OSPF_STUB_ROUTER_ADMINISTRATIVE_SET) @@ -923,13 +923,13 @@ static void update_redistributed(struct ospf *ospf, int add_to_ospf) /* Config network statement related functions. */ static struct ospf_network * -ospf_network_new (struct in_addr area_id, int format) +ospf_network_new (struct in_addr area_id) { struct ospf_network *new; new = XCALLOC (MTYPE_OSPF_NETWORK, sizeof (struct ospf_network)); new->area_id = area_id; - new->format = format; + new->area_id_fmt = OSPF_AREA_ID_FMT_DOTTEDQUAD; return new; } @@ -944,12 +944,11 @@ ospf_network_free (struct ospf *ospf, struct ospf_network *network) int ospf_network_set (struct ospf *ospf, struct prefix_ipv4 *p, - struct in_addr area_id) + struct in_addr area_id, int df) { struct ospf_network *network; struct ospf_area *area; struct route_node *rn; - int ret = OSPF_AREA_ID_FORMAT_ADDRESS; rn = route_node_get (ospf->networks, (struct prefix *)p); if (rn->info) @@ -959,8 +958,10 @@ ospf_network_set (struct ospf *ospf, struct prefix_ipv4 *p, return 0; } - rn->info = network = ospf_network_new (area_id, ret); - area = ospf_area_get (ospf, area_id, ret); + rn->info = network = ospf_network_new (area_id); + network->area_id_fmt = df; + area = ospf_area_get (ospf, area_id); + ospf_area_display_format_set (ospf, area, df); /* Run network config now. */ ospf_network_run ((struct prefix *)p, area); @@ -1040,7 +1041,6 @@ ospf_interface_set (struct interface *ifp, struct in_addr area_id) struct ospf *ospf; struct ospf_if_params *params; struct ospf_interface *oi; - int ret = OSPF_AREA_ID_FORMAT_ADDRESS; if ((ospf = ospf_lookup ()) == NULL) return 1; /* Ospf not ready yet */ @@ -1050,7 +1050,7 @@ ospf_interface_set (struct interface *ifp, struct in_addr area_id) SET_IF_PARAM (params, if_area); params->if_area = area_id; - area = ospf_area_get (ospf, area_id, ret); + area = ospf_area_get (ospf, area_id); for (ALL_LIST_ELEMENTS_RO (ifp->connected, cnode, co)) { @@ -1238,7 +1238,7 @@ ospf_if_update (struct ospf *ospf, struct interface *ifp) if (rn->info != NULL) { network = (struct ospf_network *) rn->info; - area = ospf_area_get (ospf, network->area_id, network->format); + area = ospf_area_get (ospf, network->area_id); ospf_network_run_interface (&rn->p, area, ifp); } @@ -1372,12 +1372,19 @@ ospf_area_vlink_count (struct ospf *ospf, struct ospf_area *area) } int +ospf_area_display_format_set (struct ospf *ospf, struct ospf_area *area, int df) +{ + area->area_id_fmt = df; + + return 1; +} + +int ospf_area_stub_set (struct ospf *ospf, struct in_addr area_id) { struct ospf_area *area; - int format = OSPF_AREA_ID_FORMAT_ADDRESS; - area = ospf_area_get (ospf, area_id, format); + area = ospf_area_get (ospf, area_id); if (ospf_area_vlink_count (ospf, area)) return 0; @@ -1408,9 +1415,8 @@ int ospf_area_no_summary_set (struct ospf *ospf, struct in_addr area_id) { struct ospf_area *area; - int format = OSPF_AREA_ID_FORMAT_ADDRESS; - area = ospf_area_get (ospf, area_id, format); + area = ospf_area_get (ospf, area_id); area->no_summary = 1; return 1; @@ -1435,9 +1441,8 @@ int ospf_area_nssa_set (struct ospf *ospf, struct in_addr area_id) { struct ospf_area *area; - int format = OSPF_AREA_ID_FORMAT_ADDRESS; - area = ospf_area_get (ospf, area_id, format); + area = ospf_area_get (ospf, area_id); if (ospf_area_vlink_count (ospf, area)) return 0; |