2002-12-13 21:15:29 +01:00
|
|
|
/* OSPF version 2 daemon program.
|
2017-05-13 10:25:29 +02:00
|
|
|
* 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
|
|
|
|
*/
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
#include <zebra.h>
|
|
|
|
|
|
|
|
#include "thread.h"
|
|
|
|
#include "vty.h"
|
|
|
|
#include "command.h"
|
|
|
|
#include "linklist.h"
|
|
|
|
#include "prefix.h"
|
|
|
|
#include "table.h"
|
|
|
|
#include "if.h"
|
|
|
|
#include "memory.h"
|
|
|
|
#include "stream.h"
|
|
|
|
#include "log.h"
|
|
|
|
#include "sockunion.h" /* for inet_aton () */
|
|
|
|
#include "zclient.h"
|
2018-01-25 01:41:07 +01:00
|
|
|
#include "routemap.h"
|
2002-12-13 21:15:29 +01:00
|
|
|
#include "plist.h"
|
2007-09-18 11:01:13 +02:00
|
|
|
#include "sockopt.h"
|
2016-05-09 05:11:18 +02:00
|
|
|
#include "bfd.h"
|
2017-09-12 04:05:16 +02:00
|
|
|
#include "libfrr.h"
|
2017-03-09 19:00:19 +01:00
|
|
|
#include "defaults.h"
|
2018-06-19 22:41:28 +02:00
|
|
|
#include "lib_errors.h"
|
2020-07-22 19:31:14 +02:00
|
|
|
#include "ldp_sync.h"
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
#include "ospfd/ospfd.h"
|
2021-03-03 21:22:47 +01:00
|
|
|
#include "ospfd/ospf_bfd.h"
|
2002-12-13 21:15:29 +01:00
|
|
|
#include "ospfd/ospf_network.h"
|
|
|
|
#include "ospfd/ospf_interface.h"
|
|
|
|
#include "ospfd/ospf_ism.h"
|
|
|
|
#include "ospfd/ospf_asbr.h"
|
|
|
|
#include "ospfd/ospf_lsa.h"
|
|
|
|
#include "ospfd/ospf_lsdb.h"
|
|
|
|
#include "ospfd/ospf_neighbor.h"
|
|
|
|
#include "ospfd/ospf_nsm.h"
|
|
|
|
#include "ospfd/ospf_spf.h"
|
|
|
|
#include "ospfd/ospf_packet.h"
|
|
|
|
#include "ospfd/ospf_dump.h"
|
2018-08-21 14:40:51 +02:00
|
|
|
#include "ospfd/ospf_route.h"
|
2002-12-13 21:15:29 +01:00
|
|
|
#include "ospfd/ospf_zebra.h"
|
|
|
|
#include "ospfd/ospf_abr.h"
|
|
|
|
#include "ospfd/ospf_flood.h"
|
|
|
|
#include "ospfd/ospf_ase.h"
|
2020-07-22 19:31:14 +02:00
|
|
|
#include "ospfd/ospf_ldp_sync.h"
|
2021-05-31 15:27:51 +02:00
|
|
|
#include "ospfd/ospf_gr.h"
|
2022-06-23 00:10:13 +02:00
|
|
|
#include "ospfd/ospf_apiserver.h"
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2014-06-04 06:53:35 +02:00
|
|
|
|
2016-12-07 13:25:38 +01:00
|
|
|
DEFINE_QOBJ_TYPE(ospf);
|
2003-06-04 15:59:38 +02:00
|
|
|
|
2003-04-04 04:44:16 +02:00
|
|
|
/* OSPF process wide configuration. */
|
|
|
|
static struct ospf_master ospf_master;
|
|
|
|
|
|
|
|
/* OSPF process wide configuration pointer to export. */
|
|
|
|
struct ospf_master *om;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2021-01-28 00:41:07 +01:00
|
|
|
unsigned short ospf_instance;
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
extern struct zclient *zclient;
|
|
|
|
|
2014-06-04 06:53:35 +02:00
|
|
|
|
2005-10-29 Paul Jakma <paul.jakma@sun.com>
* (general) RFC3137 stub-router support
* ospfd.h: Add OSPF_OUTPUT_COST_INFINITE define.
(struct ospf_master) Add a OSPF_MASTER_SHUTDOWN flag for
options, to allow shutdown to distinguish between complete
shutdown and shutdown of a subset of ospf instances.
(struct ospf)
Add stub_router_{startup,shutdown_}time, configuration of startup
and shutdown time for stub-router.
Add t_graceful_shutdown struct thread, timer for graceful
shutdown, if needed.
(struct ospf_area) Add stub_router_state - run time state of
stub-router for an area. Add flags for ADMIN, IS and WAS
states.
Add t_stub_router, timer thread to resend router-lsa for an
area.
* ospf_lsa.c: (ospf_link_cost) new simple function to spit out
either the given lnks cost or infinite cost if stub-router is
in effect.
(lsa_link_{ptop,broadcast,virtuallink,ptomp}_set) use
previous function for transit-links.
(ospf_stub_router_timer) timer thread for end of startup stub
router. Change state as required for the area and setup
re-origination of router-lsa.
(ospf_stub_router_check) Check/do whether stub-router should be
enabled, and whether it requires timer to be setup.
(ospf_router_lsa_new) call previous function at top.
(ospf_router_lsa_originate) no external callers, made static.
* ospf_lsa.h: (ospf_router_lsa_originate) removed.
* ospf_main.c: (sigint) make static.
remove call to exit, as ospf_terminate now deals with
exiting.
* ospf_route.c: (ospf_terminate) removed, now in ospfd.c.
* ospf_vty.c: (show_ip_ospf_area) print out state of
stub-router, if active.
(show_ip_ospf) print out configuration of stub-router
support, and details of graceful-shutdown if the timer is
active.
((no)?ospf_max_metric_router_lsa_{admin,startup,shutdown}) new
commands to (de-)?configure stub-router support.
(config_write_stub_router) write out config of stub-router.
(ospf_config_write) call previous.
(ospf_vty_init) install the new stub-router commands.
* ospfd.c: various functions made static.
(ospf_new) Set defaults for stub-router. Graceful shutdown
is made to default on, just to be adventerous.
(ospf_graceful_shutdown_finish) new function, final part of
shutdown.
(ospf_graceful_shutdown_timer) timer thread wrapper for
graceful-shutdown.
(ospf_graceful_shutdown_check) check whether to setup timer
for shutdown or proceed directly to final shutdown.
(ospf_terminate) moved here from ospf_route.c, call
ospf_finish for each instance.
(ospf_finish) renamed to ospf_finish_final and made static.
(ospf_finish) new function, exported wrapper around
ospf_graceful_shutdown_check.
(ospf_finish_final) complete shutdown of an instance.
Add missing TIMER_OFF's of two timer threads.
(ospf_area_free) opaque self lsa timer should be turned off.
2005-10-29 14:50:09 +02:00
|
|
|
static void ospf_remove_vls_through_area(struct ospf *, struct ospf_area *);
|
|
|
|
static void ospf_network_free(struct ospf *, struct ospf_network *);
|
|
|
|
static void ospf_area_free(struct ospf_area *);
|
2008-09-02 20:06:31 +02:00
|
|
|
static void ospf_network_run(struct prefix *, struct ospf_area *);
|
2009-08-27 17:51:42 +02:00
|
|
|
static void ospf_network_run_interface(struct ospf *, struct interface *,
|
|
|
|
struct prefix *, struct ospf_area *);
|
|
|
|
static void ospf_network_run_subnet(struct ospf *, struct connected *,
|
|
|
|
struct prefix *, struct ospf_area *);
|
2009-12-03 17:07:00 +01:00
|
|
|
static int ospf_network_match_iface(const struct connected *,
|
|
|
|
const struct prefix *);
|
2005-10-29 Paul Jakma <paul.jakma@sun.com>
* (general) RFC3137 stub-router support
* ospfd.h: Add OSPF_OUTPUT_COST_INFINITE define.
(struct ospf_master) Add a OSPF_MASTER_SHUTDOWN flag for
options, to allow shutdown to distinguish between complete
shutdown and shutdown of a subset of ospf instances.
(struct ospf)
Add stub_router_{startup,shutdown_}time, configuration of startup
and shutdown time for stub-router.
Add t_graceful_shutdown struct thread, timer for graceful
shutdown, if needed.
(struct ospf_area) Add stub_router_state - run time state of
stub-router for an area. Add flags for ADMIN, IS and WAS
states.
Add t_stub_router, timer thread to resend router-lsa for an
area.
* ospf_lsa.c: (ospf_link_cost) new simple function to spit out
either the given lnks cost or infinite cost if stub-router is
in effect.
(lsa_link_{ptop,broadcast,virtuallink,ptomp}_set) use
previous function for transit-links.
(ospf_stub_router_timer) timer thread for end of startup stub
router. Change state as required for the area and setup
re-origination of router-lsa.
(ospf_stub_router_check) Check/do whether stub-router should be
enabled, and whether it requires timer to be setup.
(ospf_router_lsa_new) call previous function at top.
(ospf_router_lsa_originate) no external callers, made static.
* ospf_lsa.h: (ospf_router_lsa_originate) removed.
* ospf_main.c: (sigint) make static.
remove call to exit, as ospf_terminate now deals with
exiting.
* ospf_route.c: (ospf_terminate) removed, now in ospfd.c.
* ospf_vty.c: (show_ip_ospf_area) print out state of
stub-router, if active.
(show_ip_ospf) print out configuration of stub-router
support, and details of graceful-shutdown if the timer is
active.
((no)?ospf_max_metric_router_lsa_{admin,startup,shutdown}) new
commands to (de-)?configure stub-router support.
(config_write_stub_router) write out config of stub-router.
(ospf_config_write) call previous.
(ospf_vty_init) install the new stub-router commands.
* ospfd.c: various functions made static.
(ospf_new) Set defaults for stub-router. Graceful shutdown
is made to default on, just to be adventerous.
(ospf_graceful_shutdown_finish) new function, final part of
shutdown.
(ospf_graceful_shutdown_timer) timer thread wrapper for
graceful-shutdown.
(ospf_graceful_shutdown_check) check whether to setup timer
for shutdown or proceed directly to final shutdown.
(ospf_terminate) moved here from ospf_route.c, call
ospf_finish for each instance.
(ospf_finish) renamed to ospf_finish_final and made static.
(ospf_finish) new function, exported wrapper around
ospf_graceful_shutdown_check.
(ospf_finish_final) complete shutdown of an instance.
Add missing TIMER_OFF's of two timer threads.
(ospf_area_free) opaque self lsa timer should be turned off.
2005-10-29 14:50:09 +02:00
|
|
|
static void ospf_finish_final(struct ospf *);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2022-11-22 10:59:40 +01:00
|
|
|
/* API to clean refresh queues and LSAs */
|
|
|
|
static void ospf_free_refresh_queue(struct ospf *ospf)
|
|
|
|
{
|
|
|
|
for (int i = 0; i < OSPF_LSA_REFRESHER_SLOTS; i++) {
|
|
|
|
struct list *list = ospf->lsa_refresh_queue.qs[i];
|
|
|
|
struct listnode *node, *nnode;
|
|
|
|
struct ospf_lsa *lsa;
|
|
|
|
|
|
|
|
if (list) {
|
|
|
|
for (ALL_LIST_ELEMENTS(list, node, nnode, lsa)) {
|
|
|
|
listnode_delete(list, lsa);
|
|
|
|
lsa->refresh_list = -1;
|
|
|
|
ospf_lsa_unlock(&lsa);
|
|
|
|
}
|
|
|
|
list_delete(&list);
|
|
|
|
ospf->lsa_refresh_queue.qs[i] = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
#define OSPF_EXTERNAL_LSA_ORIGINATE_DELAY 1
|
2014-06-04 06:53:35 +02:00
|
|
|
|
2020-08-05 10:44:21 +02:00
|
|
|
int p_spaces_compare_func(const struct p_space *a, const struct p_space *b)
|
|
|
|
{
|
2020-10-26 12:27:09 +01:00
|
|
|
if (a->protected_resource->type == OSPF_TI_LFA_LINK_PROTECTION
|
|
|
|
&& b->protected_resource->type == OSPF_TI_LFA_LINK_PROTECTION)
|
|
|
|
return (a->protected_resource->link->link_id.s_addr
|
|
|
|
- b->protected_resource->link->link_id.s_addr);
|
|
|
|
|
|
|
|
if (a->protected_resource->type == OSPF_TI_LFA_NODE_PROTECTION
|
|
|
|
&& b->protected_resource->type == OSPF_TI_LFA_NODE_PROTECTION)
|
|
|
|
return (a->protected_resource->router_id.s_addr
|
|
|
|
- b->protected_resource->router_id.s_addr);
|
|
|
|
|
|
|
|
/* This should not happen */
|
|
|
|
return 0;
|
2020-08-05 10:44:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
int q_spaces_compare_func(const struct q_space *a, const struct q_space *b)
|
|
|
|
{
|
|
|
|
return (a->root->id.s_addr - b->root->id.s_addr);
|
|
|
|
}
|
|
|
|
|
|
|
|
DECLARE_RBTREE_UNIQ(p_spaces, struct p_space, p_spaces_item,
|
|
|
|
p_spaces_compare_func);
|
|
|
|
|
2020-12-23 14:20:22 +01:00
|
|
|
void ospf_process_refresh_data(struct ospf *ospf, bool reset)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
2017-10-03 03:06:01 +02:00
|
|
|
struct vrf *vrf = vrf_lookup_by_id(ospf->vrf_id);
|
2002-12-13 21:15:29 +01:00
|
|
|
struct in_addr router_id, router_id_old;
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
struct ospf_interface *oi;
|
2006-07-28 00:29:06 +02:00
|
|
|
struct interface *ifp;
|
2020-12-23 14:20:22 +01:00
|
|
|
struct listnode *node, *nnode;
|
|
|
|
struct ospf_area *area;
|
|
|
|
bool rid_change = false;
|
2015-05-20 03:04:07 +02:00
|
|
|
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
if (!ospf->oi_running) {
|
|
|
|
if (IS_DEBUG_OSPF_EVENT)
|
2009-11-19 15:27:30 +01:00
|
|
|
zlog_debug(
|
|
|
|
"Router ospf not configured -- Router-ID update postponed");
|
2016-07-20 04:17:38 +02:00
|
|
|
return;
|
2009-11-19 15:27:30 +01:00
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
if (IS_DEBUG_OSPF_EVENT)
|
2020-10-21 19:56:26 +02:00
|
|
|
zlog_debug("Router-ID[OLD:%pI4]: Update",
|
|
|
|
&ospf->router_id);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2003-03-25 06:07:42 +01:00
|
|
|
router_id_old = ospf->router_id;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2006-07-28 00:29:06 +02:00
|
|
|
/* Select the router ID based on these priorities:
|
|
|
|
1. Statically assigned router ID is always the first choice.
|
|
|
|
2. If there is no statically assigned router ID, then try to stick
|
|
|
|
with the most recent value, since changing router ID's is very
|
|
|
|
disruptive.
|
|
|
|
3. Last choice: just go with whatever the zebra daemon recommends.
|
2017-07-17 14:03:14 +02:00
|
|
|
*/
|
2020-12-14 20:01:31 +01:00
|
|
|
if (ospf->router_id_static.s_addr != INADDR_ANY)
|
2003-03-25 06:07:42 +01:00
|
|
|
router_id = ospf->router_id_static;
|
2020-12-14 20:01:31 +01:00
|
|
|
else if (ospf->router_id.s_addr != INADDR_ANY)
|
2006-07-28 00:29:06 +02:00
|
|
|
router_id = ospf->router_id;
|
2017-07-17 14:03:14 +02:00
|
|
|
else
|
2017-11-02 15:54:45 +01:00
|
|
|
router_id = ospf->router_id_zebra;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2017-08-25 22:51:12 +02:00
|
|
|
if (IS_DEBUG_OSPF_EVENT)
|
2020-10-21 19:56:26 +02:00
|
|
|
zlog_debug("Router-ID[OLD:%pI4]: Update to %pI4",
|
|
|
|
&ospf->router_id, &router_id);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2020-12-23 14:20:22 +01:00
|
|
|
rid_change = !(IPV4_ADDR_SAME(&router_id_old, &router_id));
|
|
|
|
if (rid_change || (reset)) {
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
for (ALL_LIST_ELEMENTS_RO(ospf->oiflist, node, oi)) {
|
2009-11-19 15:27:30 +01:00
|
|
|
/* Some nbrs are identified by router_id, these needs
|
|
|
|
* to be rebuilt. Possible optimization would be to do
|
|
|
|
* oi->nbr_self->router_id = router_id for
|
|
|
|
* !(virtual | ptop) links
|
2017-07-17 14:03:14 +02:00
|
|
|
*/
|
2009-08-07 13:48:15 +02:00
|
|
|
ospf_nbr_self_reset(oi, router_id);
|
2020-07-08 03:48:34 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* If the old router id was not set, but now it
|
|
|
|
* is and the interface is operative and the
|
|
|
|
* state is ISM_Down we should kick the state
|
|
|
|
* machine as that we processed the interfaces
|
|
|
|
* based upon the network statement( or intf config )
|
|
|
|
* but could not start it at that time.
|
|
|
|
*/
|
|
|
|
if (if_is_operative(oi->ifp) && oi->state == ISM_Down
|
|
|
|
&& router_id_old.s_addr == INADDR_ANY)
|
|
|
|
ospf_if_up(oi);
|
2017-07-17 14:03:14 +02:00
|
|
|
}
|
|
|
|
|
2020-12-23 14:20:22 +01:00
|
|
|
/* Flush (inline) all the self originated LSAs */
|
|
|
|
ospf_flush_self_originated_lsas_now(ospf);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2015-05-20 03:04:07 +02:00
|
|
|
ospf->router_id = router_id;
|
|
|
|
if (IS_DEBUG_OSPF_EVENT)
|
2020-10-21 19:56:26 +02:00
|
|
|
zlog_debug("Router-ID[NEW:%pI4]: Update",
|
|
|
|
&ospf->router_id);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2015-05-20 03:04:07 +02:00
|
|
|
/* Flush (inline) all external LSAs which now match the new
|
|
|
|
router-id,
|
2018-10-25 20:06:59 +02:00
|
|
|
need to adjust the OSPF_LSA_SELF flag, so the flush doesn't
|
2017-07-17 14:03:14 +02:00
|
|
|
hit
|
2015-05-20 03:04:07 +02:00
|
|
|
asserts in ospf_refresher_unregister_lsa(). This step is
|
2017-07-17 14:03:14 +02:00
|
|
|
needed
|
2021-11-11 20:40:17 +01:00
|
|
|
because the current frr code does look-up for
|
2015-05-20 03:04:07 +02:00
|
|
|
self-originated LSAs
|
|
|
|
based on the self router-id alone but expects OSPF_LSA_SELF
|
2017-07-17 14:03:14 +02:00
|
|
|
to be
|
2015-05-20 03:04:07 +02:00
|
|
|
properly set */
|
|
|
|
if (ospf->lsdb) {
|
|
|
|
struct route_node *rn;
|
|
|
|
struct ospf_lsa *lsa;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2018-01-17 19:28:17 +01:00
|
|
|
LSDB_LOOP (EXTERNAL_LSDB(ospf), rn, lsa) {
|
2015-05-20 03:04:07 +02:00
|
|
|
/* AdvRouter and Router ID is the same. */
|
|
|
|
if (IPV4_ADDR_SAME(&lsa->data->adv_router,
|
2020-12-23 14:20:22 +01:00
|
|
|
&ospf->router_id) && rid_change) {
|
2015-05-20 03:04:07 +02:00
|
|
|
SET_FLAG(lsa->flags,
|
|
|
|
OSPF_LSA_SELF_CHECKED);
|
|
|
|
SET_FLAG(lsa->flags, OSPF_LSA_SELF);
|
|
|
|
ospf_lsa_flush_schedule(ospf, lsa);
|
2017-07-17 14:03:14 +02:00
|
|
|
}
|
2020-12-23 14:20:22 +01:00
|
|
|
/* The above flush will send immediately
|
|
|
|
* So discard the LSA to originate new
|
|
|
|
*/
|
|
|
|
ospf_discard_from_db(ospf, ospf->lsdb, lsa);
|
2017-07-17 14:03:14 +02:00
|
|
|
}
|
2020-12-23 14:20:22 +01:00
|
|
|
|
|
|
|
LSDB_LOOP (OPAQUE_AS_LSDB(ospf), rn, lsa)
|
|
|
|
ospf_discard_from_db(ospf, ospf->lsdb, lsa);
|
|
|
|
|
|
|
|
ospf_lsdb_delete_all(ospf->lsdb);
|
2017-07-17 14:03:14 +02:00
|
|
|
}
|
|
|
|
|
2021-09-01 11:11:48 +02:00
|
|
|
/* Since the LSAs are deleted, need reset the aggr flag */
|
|
|
|
ospf_unset_all_aggr_flag(ospf);
|
|
|
|
|
2020-12-23 14:20:22 +01:00
|
|
|
/* Delete the LSDB */
|
|
|
|
for (ALL_LIST_ELEMENTS(ospf->areas, node, nnode, area))
|
|
|
|
ospf_area_lsdb_discard_delete(area);
|
|
|
|
|
2003-03-25 06:07:42 +01:00
|
|
|
/* update router-lsa's for each area */
|
|
|
|
ospf_router_lsa_update(ospf);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2003-03-25 06:07:42 +01:00
|
|
|
/* update ospf_interface's */
|
2020-12-23 14:20:22 +01:00
|
|
|
FOR_ALL_INTERFACES (vrf, ifp) {
|
|
|
|
if (reset)
|
|
|
|
ospf_if_reset(ifp);
|
|
|
|
else
|
|
|
|
ospf_if_update(ospf, ifp);
|
|
|
|
}
|
2019-07-29 12:27:25 +02:00
|
|
|
|
|
|
|
ospf_external_lsa_rid_change(ospf);
|
2022-06-23 00:10:13 +02:00
|
|
|
|
|
|
|
#ifdef SUPPORT_OSPF_API
|
|
|
|
ospf_apiserver_clients_notify_router_id_change(router_id);
|
|
|
|
#endif
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
2020-12-23 14:20:22 +01:00
|
|
|
|
|
|
|
ospf->inst_shutdown = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ospf_router_id_update(struct ospf *ospf)
|
|
|
|
{
|
|
|
|
ospf_process_refresh_data(ospf, false);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ospf_process_reset(struct ospf *ospf)
|
|
|
|
{
|
|
|
|
ospf_process_refresh_data(ospf, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ospf_neighbor_reset(struct ospf *ospf, struct in_addr nbr_id,
|
|
|
|
const char *nbr_str)
|
|
|
|
{
|
|
|
|
struct route_node *rn;
|
|
|
|
struct ospf_neighbor *nbr;
|
|
|
|
struct ospf_interface *oi;
|
|
|
|
struct listnode *node;
|
|
|
|
|
|
|
|
/* Clear only a particular nbr with nbr router id as nbr_id */
|
|
|
|
if (nbr_str != NULL) {
|
|
|
|
for (ALL_LIST_ELEMENTS_RO(ospf->oiflist, node, oi)) {
|
|
|
|
nbr = ospf_nbr_lookup_by_routerid(oi->nbrs, &nbr_id);
|
|
|
|
if (nbr)
|
|
|
|
OSPF_NSM_EVENT_EXECUTE(nbr, NSM_KillNbr);
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* send Neighbor event KillNbr to all associated neighbors. */
|
|
|
|
for (ALL_LIST_ELEMENTS_RO(ospf->oiflist, node, oi)) {
|
|
|
|
for (rn = route_top(oi->nbrs); rn; rn = route_next(rn)) {
|
|
|
|
nbr = rn->info;
|
|
|
|
if (nbr && (nbr != oi->nbr_self))
|
|
|
|
OSPF_NSM_EVENT_EXECUTE(nbr, NSM_KillNbr);
|
|
|
|
}
|
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
2014-06-04 06:53:35 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* For OSPF area sort by area id. */
|
|
|
|
static int ospf_area_id_cmp(struct ospf_area *a1, struct ospf_area *a2)
|
|
|
|
{
|
|
|
|
if (ntohl(a1->area_id.s_addr) > ntohl(a2->area_id.s_addr))
|
|
|
|
return 1;
|
|
|
|
if (ntohl(a1->area_id.s_addr) < ntohl(a2->area_id.s_addr))
|
|
|
|
return -1;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2021-08-12 14:49:54 +02:00
|
|
|
static void ospf_add(struct ospf *ospf)
|
|
|
|
{
|
|
|
|
listnode_add(om->ospf, ospf);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void ospf_delete(struct ospf *ospf)
|
|
|
|
{
|
|
|
|
listnode_delete(om->ospf, ospf);
|
|
|
|
}
|
|
|
|
|
2020-08-05 10:44:21 +02:00
|
|
|
struct ospf *ospf_new_alloc(unsigned short instance, const char *name)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
|
|
|
int i;
|
2017-08-25 22:51:12 +02:00
|
|
|
struct vrf *vrf = NULL;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
struct ospf *new = XCALLOC(MTYPE_OSPF_TOP, sizeof(struct ospf));
|
|
|
|
|
Multi-Instance OSPF Summary
——————————————-------------
- etc/init.d/quagga is modified to support creating separate ospf daemon
process for each instance. Each individual instance is monitored by
watchquagga just like any protocol daemons.(requires initd-mi.patch).
- Vtysh is modified to able to connect to multiple daemons of the same
protocol (supported for OSPF only for now).
- ospfd is modified to remember the Instance-ID that its invoked with. For
the entire life of the process it caters to any command request that
matches that instance-ID (unless its a non instance specific command).
Routes/messages to zebra are tagged with instance-ID.
- zebra route/redistribute mechanisms are modified to work with
[protocol type + instance-id]
- bgpd now has ability to have multiple instance specific redistribution
for a protocol (OSPF only supported/tested for now).
- zlog ability to display instance-id besides the protocol/daemon name.
- Changes in other daemons are to because of the needed integration with
some of the modified APIs/routines. (Didn’t prefer replicating too many
separate instance specific APIs.)
- config/show/debug commands are modified to take instance-id argument
as appropriate.
Guidelines to start using multi-instance ospf
---------------------------------------------
The patch is backward compatible, i.e for any previous way of single ospf
deamon(router ospf <cr>) will continue to work as is, including all the
show commands etc.
To enable multiple instances, do the following:
1. service quagga stop
2. Modify /etc/quagga/daemons to add instance-ids of each desired
instance in the following format:
ospfd=“yes"
ospfd_instances="1,2,3"
assuming you want to enable 3 instances with those instance ids.
3. Create corresponding ospfd config files as ospfd-1.conf, ospfd-2.conf
and ospfd-3.conf.
4. service quagga start/restart
5. Verify that the deamons are started as expected. You should see
ospfd started with -n <instance-id> option.
ps –ef | grep quagga
With that /var/run/quagga/ should have ospfd-<instance-id>.pid and
ospfd-<instance-id>/vty to each instance.
6. vtysh to work with instances as you would with any other deamons.
7. Overall most quagga semantics are the same working with the instance
deamon, like it is for any other daemon.
NOTE:
To safeguard against errors leading to too many processes getting invoked,
a hard limit on number of instance-ids is in place, currently its 5.
Allowed instance-id range is <1-65535>
Once daemons are up, show running from vtysh should show the instance-id
of each daemon as 'router ospf <instance-id>’ (without needing explicit
configuration)
Instance-id can not be changed via vtysh, other router ospf configuration
is allowed as before.
Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
2015-05-20 03:03:42 +02:00
|
|
|
new->instance = instance;
|
2002-12-13 21:15:29 +01:00
|
|
|
new->router_id.s_addr = htonl(0);
|
|
|
|
new->router_id_static.s_addr = htonl(0);
|
*: rework renaming the default VRF
Currently, it is possible to rename the default VRF either by passing
`-o` option to zebra or by creating a file in `/var/run/netns` and
binding it to `/proc/self/ns/net`.
In both cases, only zebra knows about the rename and other daemons learn
about it only after they connect to zebra. This is a problem, because
daemons may read their config before they connect to zebra. To handle
this rename after the config is read, we have some special code in every
single daemon, which is not very bad but not desirable in my opinion.
But things are getting worse when we need to handle this in northbound
layer as we have to manually rewrite the config nodes. This approach is
already hacky, but still works as every daemon handles its own NB
structures. But it is completely incompatible with the central
management daemon architecture we are aiming for, as mgmtd doesn't even
have a connection with zebra to learn from it. And it shouldn't have it,
because operational state changes should never affect configuration.
To solve the problem and simplify the code, I propose to expand the `-o`
option to all daemons. By using the startup option, we let daemons know
about the rename before they read their configs so we don't need any
special code to deal with it. There's an easy way to pass the option to
all daemons by using `frr_global_options` variable.
Unfortunately, the second way of renaming by creating a file in
`/var/run/netns` is incompatible with the new mgmtd architecture.
Theoretically, we could force daemons to read their configs only after
they connect to zebra, but it means adding even more code to handle a
very specific use-case. And anyway this won't work for mgmtd as it
doesn't have a connection with zebra. So I had to remove this option.
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-12-03 23:22:55 +01:00
|
|
|
|
|
|
|
vrf = vrf_lookup_by_name(name);
|
|
|
|
if (vrf)
|
|
|
|
new->vrf_id = vrf->vrf_id;
|
|
|
|
else
|
|
|
|
new->vrf_id = VRF_UNKNOWN;
|
|
|
|
|
|
|
|
/* Freed in ospf_finish_final */
|
|
|
|
new->name = XSTRDUP(MTYPE_OSPF_TOP, name);
|
|
|
|
if (IS_DEBUG_OSPF_EVENT)
|
|
|
|
zlog_debug(
|
|
|
|
"%s: Create new ospf instance with vrf_name %s vrf_id %u",
|
|
|
|
__func__, name, new->vrf_id);
|
2018-06-25 15:43:04 +02:00
|
|
|
|
|
|
|
if (vrf)
|
|
|
|
ospf_vrf_link(new, vrf);
|
|
|
|
|
2017-08-25 22:51:12 +02:00
|
|
|
ospf_zebra_vrf_register(new);
|
|
|
|
|
2005-07-12 22:04:22 +02:00
|
|
|
new->abr_type = OSPF_ABR_DEFAULT;
|
2002-12-13 21:15:29 +01:00
|
|
|
new->oiflist = list_new();
|
|
|
|
new->vlinks = list_new();
|
|
|
|
new->areas = list_new();
|
|
|
|
new->areas->cmp = (int (*)(void *, void *))ospf_area_id_cmp;
|
|
|
|
new->networks = route_table_init();
|
|
|
|
new->nbr_nbma = route_table_init();
|
|
|
|
|
|
|
|
new->lsdb = ospf_lsdb_new();
|
|
|
|
|
|
|
|
new->default_originate = DEFAULT_ORIGINATE_NONE;
|
|
|
|
|
2006-10-22 22:07:53 +02:00
|
|
|
new->passive_interface_default = OSPF_IF_ACTIVE;
|
2012-12-03 20:17:24 +01:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
new->new_external_route = route_table_init();
|
|
|
|
new->old_external_route = route_table_init();
|
|
|
|
new->external_lsas = route_table_init();
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2005-10-29 Paul Jakma <paul.jakma@sun.com>
* (general) RFC3137 stub-router support
* ospfd.h: Add OSPF_OUTPUT_COST_INFINITE define.
(struct ospf_master) Add a OSPF_MASTER_SHUTDOWN flag for
options, to allow shutdown to distinguish between complete
shutdown and shutdown of a subset of ospf instances.
(struct ospf)
Add stub_router_{startup,shutdown_}time, configuration of startup
and shutdown time for stub-router.
Add t_graceful_shutdown struct thread, timer for graceful
shutdown, if needed.
(struct ospf_area) Add stub_router_state - run time state of
stub-router for an area. Add flags for ADMIN, IS and WAS
states.
Add t_stub_router, timer thread to resend router-lsa for an
area.
* ospf_lsa.c: (ospf_link_cost) new simple function to spit out
either the given lnks cost or infinite cost if stub-router is
in effect.
(lsa_link_{ptop,broadcast,virtuallink,ptomp}_set) use
previous function for transit-links.
(ospf_stub_router_timer) timer thread for end of startup stub
router. Change state as required for the area and setup
re-origination of router-lsa.
(ospf_stub_router_check) Check/do whether stub-router should be
enabled, and whether it requires timer to be setup.
(ospf_router_lsa_new) call previous function at top.
(ospf_router_lsa_originate) no external callers, made static.
* ospf_lsa.h: (ospf_router_lsa_originate) removed.
* ospf_main.c: (sigint) make static.
remove call to exit, as ospf_terminate now deals with
exiting.
* ospf_route.c: (ospf_terminate) removed, now in ospfd.c.
* ospf_vty.c: (show_ip_ospf_area) print out state of
stub-router, if active.
(show_ip_ospf) print out configuration of stub-router
support, and details of graceful-shutdown if the timer is
active.
((no)?ospf_max_metric_router_lsa_{admin,startup,shutdown}) new
commands to (de-)?configure stub-router support.
(config_write_stub_router) write out config of stub-router.
(ospf_config_write) call previous.
(ospf_vty_init) install the new stub-router commands.
* ospfd.c: various functions made static.
(ospf_new) Set defaults for stub-router. Graceful shutdown
is made to default on, just to be adventerous.
(ospf_graceful_shutdown_finish) new function, final part of
shutdown.
(ospf_graceful_shutdown_timer) timer thread wrapper for
graceful-shutdown.
(ospf_graceful_shutdown_check) check whether to setup timer
for shutdown or proceed directly to final shutdown.
(ospf_terminate) moved here from ospf_route.c, call
ospf_finish for each instance.
(ospf_finish) renamed to ospf_finish_final and made static.
(ospf_finish) new function, exported wrapper around
ospf_graceful_shutdown_check.
(ospf_finish_final) complete shutdown of an instance.
Add missing TIMER_OFF's of two timer threads.
(ospf_area_free) opaque self lsa timer should be turned off.
2005-10-29 14:50:09 +02:00
|
|
|
new->stub_router_startup_time = OSPF_STUB_ROUTER_UNCONFIGURED;
|
2005-11-14 12:11:11 +01:00
|
|
|
new->stub_router_shutdown_time = OSPF_STUB_ROUTER_UNCONFIGURED;
|
2012-12-03 20:17:24 +01:00
|
|
|
new->stub_router_admin_set = OSPF_STUB_ROUTER_ADMINISTRATIVE_UNSET;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Distribute parameter init. */
|
|
|
|
for (i = 0; i <= ZEBRA_ROUTE_MAX; i++) {
|
2015-05-20 02:46:33 +02:00
|
|
|
new->dtag[i] = 0;
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
new->default_metric = -1;
|
|
|
|
new->ref_bandwidth = OSPF_DEFAULT_REF_BANDWIDTH;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2015-07-27 07:56:25 +02:00
|
|
|
/* LSA timers */
|
|
|
|
new->min_ls_interval = OSPF_MIN_LS_INTERVAL;
|
|
|
|
new->min_ls_arrival = OSPF_MIN_LS_ARRIVAL;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* SPF timer value init. */
|
|
|
|
new->spf_delay = OSPF_SPF_DELAY_DEFAULT;
|
|
|
|
new->spf_holdtime = OSPF_SPF_HOLDTIME_DEFAULT;
|
2005-10-21 Paul Jakma <paul.jakma@sun.com>
* (general) SPF millisecond resolution timer with adaptive,
linear back-off holdtime. Prettification of ospf_timer_dump.
* ospf_dump.c: (ospf_timeval_dump) new function. The guts of
ospf_timer_dump, but made to be more dynamic in printing out
the relative timeval, sliding the precision printed out
according to the value.
(ospf_timer_dump) guts moved to ospf_timeval_dump.
* ospf_dump.h: export ospf_timeval_dump.
* ospf_flood.c: (ospf_flood) remove gettimeofday, use
the libzebra exported recent_time instead, as it's not
terribly critical to have time exactly right - the dropped
LSA will be retransmited to us if we don't ACK it.
* ospf_packet.c: (ospf_ls_upd_timer) Ditto, but here we're
not transmitting, just putting LSA back on update transmit list.
* ospfd.h: delay and holdtimes should be unsigned.
Add spf_max_holdtime and spf_hold_multiplier.
Update default defines for delay and hold time to be in msec.
(struct ospf) change the SPF timestamp to a struct timeval.
Remove ospf_timers_spf_(un)?set.
* ospfd.c: (ospf_timers_spf_{set,unset}) removed.
(ospf_new) initialise spf_max_holdtime and spf_hold_multiplier
* ospf_spf.c: (ospf_spf_calculate) SPF timestamp is a timeval
now, update with gettimeofday.
(ospf_spf_calculate_schedule) Change SPF timers to millisecond
resolution.
Make the holdtime be adaptive, with a linear increase in
holdtime ever consecutive SPF run which occurs within holdtime
of previous SPF, bounded by spf_max_holdtime.
* ospf_vty.c: Update spf timers commands.
(ospf_timers_spf_set) trivial helper.
(ospf_timers_throttle_spf_cmd) new command to set SPF delay,
initial hold and max hold times with millisecond resolution.
(ospf_timers_spf_cmd) Deprecated. Accept the old values,
convert to msec, truncate to new limits.
(no_ospf_timers_throttle_spf_cmd) set timers to defaults.
(no_ospf_timers_spf_cmd) deprecated form, same as previous.
(show_ip_ospf_cmd) Display SPF parameters and times.
(show_ip_ospf_neighbour_header) Centralise the 'sh ip os ne'
header.
(show_ip_ospf_neighbor_sub) Fix the field widths. Get rid of
the multiple spaces which were making the lines even longer.
(show_ip_ospf_neighbor_cmd) Use show_ip_ospf_neighbour_header
(show_ip_ospf_neighbor_all_cmd) ditto and fix the field
widths for NBMA neighbours.
(show_ip_ospf_neighbor_int) Use header function.
(show_ip_ospf_nbr_nbma_detail_sub) use sizeof for timebuf,
local array - safer.
(show_ip_ospf_neighbor_detail_sub) ditto
(ospf_vty_init) install the new SPF throttle timer commands.
2005-10-21 11:23:12 +02:00
|
|
|
new->spf_max_holdtime = OSPF_SPF_MAX_HOLDTIME_DEFAULT;
|
|
|
|
new->spf_hold_multiplier = 1;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* MaxAge init. */
|
2013-08-24 09:54:17 +02:00
|
|
|
new->maxage_delay = OSPF_LSA_MAXAGE_REMOVE_DELAY_DEFAULT;
|
2012-12-04 19:46:37 +01:00
|
|
|
new->maxage_lsa = route_table_init();
|
2017-05-05 23:22:25 +02:00
|
|
|
new->t_maxage_walker = NULL;
|
2021-08-12 14:49:54 +02:00
|
|
|
thread_add_timer(master, ospf_lsa_maxage_walker, new,
|
|
|
|
OSPF_LSA_MAXAGE_CHECK_INTERVAL, &new->t_maxage_walker);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2021-02-11 11:05:12 +01:00
|
|
|
/* Max paths initialization */
|
|
|
|
new->max_multipath = MULTIPATH_NUM;
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Distance table init. */
|
|
|
|
new->distance_table = route_table_init();
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
new->lsa_refresh_queue.index = 0;
|
|
|
|
new->lsa_refresh_interval = OSPF_LSA_REFRESH_INTERVAL_DEFAULT;
|
2022-08-26 09:58:37 +02:00
|
|
|
new->lsa_refresh_timer = OSPF_LS_REFRESH_TIME;
|
2017-05-05 23:22:25 +02:00
|
|
|
new->t_lsa_refresher = NULL;
|
2021-08-12 14:49:54 +02:00
|
|
|
thread_add_timer(master, ospf_lsa_refresh_walker, new,
|
|
|
|
new->lsa_refresh_interval, &new->t_lsa_refresher);
|
2017-01-18 01:30:43 +01:00
|
|
|
new->lsa_refresher_started = monotime(NULL);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2018-08-20 20:05:53 +02:00
|
|
|
new->ibuf = stream_new(OSPF_MAX_PACKET_SIZE + 1);
|
|
|
|
|
2017-05-05 23:22:25 +02:00
|
|
|
new->t_read = NULL;
|
2002-12-13 21:15:29 +01:00
|
|
|
new->oi_write_q = list_new();
|
2015-05-20 02:24:43 +02:00
|
|
|
new->write_oi_count = OSPF_WRITE_INTERFACE_COUNT_DEFAULT;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2020-08-19 14:19:19 +02:00
|
|
|
new->proactive_arp = OSPF_PROACTIVE_ARP_DEFAULT;
|
|
|
|
|
2021-05-31 15:27:51 +02:00
|
|
|
ospf_gr_helper_instance_init(new);
|
2020-08-21 19:03:05 +02:00
|
|
|
|
2020-08-15 10:27:40 +02:00
|
|
|
ospf_asbr_external_aggregator_init(new);
|
|
|
|
|
2021-08-12 14:49:54 +02:00
|
|
|
ospf_opaque_type11_lsa_init(new);
|
|
|
|
|
2016-12-07 13:25:38 +01:00
|
|
|
QOBJ_REG(new, ospf);
|
|
|
|
|
2018-01-29 16:56:11 +01:00
|
|
|
new->fd = -1;
|
2020-08-05 10:44:21 +02:00
|
|
|
|
|
|
|
return new;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Allocate new ospf structure. */
|
|
|
|
static struct ospf *ospf_new(unsigned short instance, const char *name)
|
|
|
|
{
|
|
|
|
struct ospf *new;
|
|
|
|
|
|
|
|
new = ospf_new_alloc(instance, name);
|
2021-08-12 14:49:54 +02:00
|
|
|
ospf_add(new);
|
|
|
|
|
|
|
|
if (new->vrf_id == VRF_UNKNOWN)
|
|
|
|
return new;
|
2020-08-05 10:44:21 +02:00
|
|
|
|
2018-01-29 16:56:11 +01:00
|
|
|
if ((ospf_sock_init(new)) < 0) {
|
2021-08-12 14:49:54 +02:00
|
|
|
flog_err(EC_LIB_SOCKET,
|
|
|
|
"%s: ospf_sock_init is unable to open a socket",
|
|
|
|
__func__);
|
2018-01-29 16:56:11 +01:00
|
|
|
return new;
|
|
|
|
}
|
2020-08-05 10:44:21 +02:00
|
|
|
|
2018-01-29 16:56:11 +01:00
|
|
|
thread_add_read(master, ospf_read, new, new->fd, &new->t_read);
|
|
|
|
|
2021-08-12 14:49:54 +02:00
|
|
|
new->oi_running = 1;
|
|
|
|
ospf_router_id_update(new);
|
|
|
|
|
2021-05-31 15:27:51 +02:00
|
|
|
/*
|
|
|
|
* Read from non-volatile memory whether this instance is performing a
|
|
|
|
* graceful restart or not.
|
|
|
|
*/
|
|
|
|
ospf_gr_nvm_read(new);
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
return new;
|
|
|
|
}
|
|
|
|
|
2018-03-27 21:13:34 +02:00
|
|
|
struct ospf *ospf_lookup_instance(unsigned short instance)
|
Multi-Instance OSPF Summary
——————————————-------------
- etc/init.d/quagga is modified to support creating separate ospf daemon
process for each instance. Each individual instance is monitored by
watchquagga just like any protocol daemons.(requires initd-mi.patch).
- Vtysh is modified to able to connect to multiple daemons of the same
protocol (supported for OSPF only for now).
- ospfd is modified to remember the Instance-ID that its invoked with. For
the entire life of the process it caters to any command request that
matches that instance-ID (unless its a non instance specific command).
Routes/messages to zebra are tagged with instance-ID.
- zebra route/redistribute mechanisms are modified to work with
[protocol type + instance-id]
- bgpd now has ability to have multiple instance specific redistribution
for a protocol (OSPF only supported/tested for now).
- zlog ability to display instance-id besides the protocol/daemon name.
- Changes in other daemons are to because of the needed integration with
some of the modified APIs/routines. (Didn’t prefer replicating too many
separate instance specific APIs.)
- config/show/debug commands are modified to take instance-id argument
as appropriate.
Guidelines to start using multi-instance ospf
---------------------------------------------
The patch is backward compatible, i.e for any previous way of single ospf
deamon(router ospf <cr>) will continue to work as is, including all the
show commands etc.
To enable multiple instances, do the following:
1. service quagga stop
2. Modify /etc/quagga/daemons to add instance-ids of each desired
instance in the following format:
ospfd=“yes"
ospfd_instances="1,2,3"
assuming you want to enable 3 instances with those instance ids.
3. Create corresponding ospfd config files as ospfd-1.conf, ospfd-2.conf
and ospfd-3.conf.
4. service quagga start/restart
5. Verify that the deamons are started as expected. You should see
ospfd started with -n <instance-id> option.
ps –ef | grep quagga
With that /var/run/quagga/ should have ospfd-<instance-id>.pid and
ospfd-<instance-id>/vty to each instance.
6. vtysh to work with instances as you would with any other deamons.
7. Overall most quagga semantics are the same working with the instance
deamon, like it is for any other daemon.
NOTE:
To safeguard against errors leading to too many processes getting invoked,
a hard limit on number of instance-ids is in place, currently its 5.
Allowed instance-id range is <1-65535>
Once daemons are up, show running from vtysh should show the instance-id
of each daemon as 'router ospf <instance-id>’ (without needing explicit
configuration)
Instance-id can not be changed via vtysh, other router ospf configuration
is allowed as before.
Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
2015-05-20 03:03:42 +02:00
|
|
|
{
|
|
|
|
struct ospf *ospf;
|
|
|
|
struct listnode *node, *nnode;
|
|
|
|
|
|
|
|
if (listcount(om->ospf) == 0)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
for (ALL_LIST_ELEMENTS(om->ospf, node, nnode, ospf))
|
|
|
|
if ((ospf->instance == 0 && instance == 0)
|
|
|
|
|| (ospf->instance && instance
|
|
|
|
&& ospf->instance == instance))
|
|
|
|
return ospf;
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2009-08-27 17:51:42 +02:00
|
|
|
static int ospf_is_ready(struct ospf *ospf)
|
|
|
|
{
|
|
|
|
/* OSPF must be on and Router-ID must be configured. */
|
2020-02-06 07:49:02 +01:00
|
|
|
if (!ospf || ospf->router_id.s_addr == INADDR_ANY)
|
2009-08-27 17:51:42 +02:00
|
|
|
return 0;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2009-08-27 17:51:42 +02:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2018-03-27 21:13:34 +02:00
|
|
|
struct ospf *ospf_lookup_by_inst_name(unsigned short instance, const char *name)
|
2017-08-25 22:51:12 +02:00
|
|
|
{
|
|
|
|
struct ospf *ospf = NULL;
|
|
|
|
struct listnode *node, *nnode;
|
|
|
|
|
|
|
|
for (ALL_LIST_ELEMENTS(om->ospf, node, nnode, ospf)) {
|
|
|
|
if ((ospf->instance == instance)
|
|
|
|
&& ((ospf->name == NULL && name == NULL)
|
|
|
|
|| (ospf->name && name
|
|
|
|
&& strcmp(ospf->name, name) == 0)))
|
|
|
|
return ospf;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2021-01-28 00:41:07 +01:00
|
|
|
struct ospf *ospf_lookup(unsigned short instance, const char *name)
|
2020-12-02 01:36:10 +01:00
|
|
|
{
|
|
|
|
struct ospf *ospf;
|
|
|
|
|
2021-01-28 00:41:07 +01:00
|
|
|
if (ospf_instance) {
|
|
|
|
ospf = ospf_lookup_instance(instance);
|
|
|
|
} else {
|
2017-08-25 22:51:12 +02:00
|
|
|
ospf = ospf_lookup_by_inst_name(instance, name);
|
Multi-Instance OSPF Summary
——————————————-------------
- etc/init.d/quagga is modified to support creating separate ospf daemon
process for each instance. Each individual instance is monitored by
watchquagga just like any protocol daemons.(requires initd-mi.patch).
- Vtysh is modified to able to connect to multiple daemons of the same
protocol (supported for OSPF only for now).
- ospfd is modified to remember the Instance-ID that its invoked with. For
the entire life of the process it caters to any command request that
matches that instance-ID (unless its a non instance specific command).
Routes/messages to zebra are tagged with instance-ID.
- zebra route/redistribute mechanisms are modified to work with
[protocol type + instance-id]
- bgpd now has ability to have multiple instance specific redistribution
for a protocol (OSPF only supported/tested for now).
- zlog ability to display instance-id besides the protocol/daemon name.
- Changes in other daemons are to because of the needed integration with
some of the modified APIs/routines. (Didn’t prefer replicating too many
separate instance specific APIs.)
- config/show/debug commands are modified to take instance-id argument
as appropriate.
Guidelines to start using multi-instance ospf
---------------------------------------------
The patch is backward compatible, i.e for any previous way of single ospf
deamon(router ospf <cr>) will continue to work as is, including all the
show commands etc.
To enable multiple instances, do the following:
1. service quagga stop
2. Modify /etc/quagga/daemons to add instance-ids of each desired
instance in the following format:
ospfd=“yes"
ospfd_instances="1,2,3"
assuming you want to enable 3 instances with those instance ids.
3. Create corresponding ospfd config files as ospfd-1.conf, ospfd-2.conf
and ospfd-3.conf.
4. service quagga start/restart
5. Verify that the deamons are started as expected. You should see
ospfd started with -n <instance-id> option.
ps –ef | grep quagga
With that /var/run/quagga/ should have ospfd-<instance-id>.pid and
ospfd-<instance-id>/vty to each instance.
6. vtysh to work with instances as you would with any other deamons.
7. Overall most quagga semantics are the same working with the instance
deamon, like it is for any other daemon.
NOTE:
To safeguard against errors leading to too many processes getting invoked,
a hard limit on number of instance-ids is in place, currently its 5.
Allowed instance-id range is <1-65535>
Once daemons are up, show running from vtysh should show the instance-id
of each daemon as 'router ospf <instance-id>’ (without needing explicit
configuration)
Instance-id can not be changed via vtysh, other router ospf configuration
is allowed as before.
Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
2015-05-20 03:03:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return ospf;
|
|
|
|
}
|
|
|
|
|
2021-01-28 00:41:07 +01:00
|
|
|
struct ospf *ospf_get(unsigned short instance, const char *name, bool *created)
|
Multi-Instance OSPF Summary
——————————————-------------
- etc/init.d/quagga is modified to support creating separate ospf daemon
process for each instance. Each individual instance is monitored by
watchquagga just like any protocol daemons.(requires initd-mi.patch).
- Vtysh is modified to able to connect to multiple daemons of the same
protocol (supported for OSPF only for now).
- ospfd is modified to remember the Instance-ID that its invoked with. For
the entire life of the process it caters to any command request that
matches that instance-ID (unless its a non instance specific command).
Routes/messages to zebra are tagged with instance-ID.
- zebra route/redistribute mechanisms are modified to work with
[protocol type + instance-id]
- bgpd now has ability to have multiple instance specific redistribution
for a protocol (OSPF only supported/tested for now).
- zlog ability to display instance-id besides the protocol/daemon name.
- Changes in other daemons are to because of the needed integration with
some of the modified APIs/routines. (Didn’t prefer replicating too many
separate instance specific APIs.)
- config/show/debug commands are modified to take instance-id argument
as appropriate.
Guidelines to start using multi-instance ospf
---------------------------------------------
The patch is backward compatible, i.e for any previous way of single ospf
deamon(router ospf <cr>) will continue to work as is, including all the
show commands etc.
To enable multiple instances, do the following:
1. service quagga stop
2. Modify /etc/quagga/daemons to add instance-ids of each desired
instance in the following format:
ospfd=“yes"
ospfd_instances="1,2,3"
assuming you want to enable 3 instances with those instance ids.
3. Create corresponding ospfd config files as ospfd-1.conf, ospfd-2.conf
and ospfd-3.conf.
4. service quagga start/restart
5. Verify that the deamons are started as expected. You should see
ospfd started with -n <instance-id> option.
ps –ef | grep quagga
With that /var/run/quagga/ should have ospfd-<instance-id>.pid and
ospfd-<instance-id>/vty to each instance.
6. vtysh to work with instances as you would with any other deamons.
7. Overall most quagga semantics are the same working with the instance
deamon, like it is for any other daemon.
NOTE:
To safeguard against errors leading to too many processes getting invoked,
a hard limit on number of instance-ids is in place, currently its 5.
Allowed instance-id range is <1-65535>
Once daemons are up, show running from vtysh should show the instance-id
of each daemon as 'router ospf <instance-id>’ (without needing explicit
configuration)
Instance-id can not be changed via vtysh, other router ospf configuration
is allowed as before.
Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
2015-05-20 03:03:42 +02:00
|
|
|
{
|
|
|
|
struct ospf *ospf;
|
|
|
|
|
2021-01-28 00:41:07 +01:00
|
|
|
ospf = ospf_lookup(instance, name);
|
|
|
|
|
2019-08-01 18:49:50 +02:00
|
|
|
*created = (ospf == NULL);
|
2021-08-12 14:49:54 +02:00
|
|
|
if (ospf == NULL)
|
2021-01-28 00:41:07 +01:00
|
|
|
ospf = ospf_new(instance, name);
|
2003-03-25 06:07:42 +01:00
|
|
|
|
|
|
|
return ospf;
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
2014-06-04 06:53:35 +02:00
|
|
|
|
2017-08-25 22:51:12 +02:00
|
|
|
struct ospf *ospf_lookup_by_vrf_id(vrf_id_t vrf_id)
|
|
|
|
{
|
|
|
|
struct vrf *vrf = NULL;
|
|
|
|
|
|
|
|
vrf = vrf_lookup_by_id(vrf_id);
|
|
|
|
if (!vrf)
|
|
|
|
return NULL;
|
|
|
|
return (vrf->info) ? (struct ospf *)vrf->info : NULL;
|
|
|
|
}
|
|
|
|
|
2021-03-29 13:47:43 +02:00
|
|
|
uint32_t ospf_count_area_params(struct ospf *ospf)
|
|
|
|
{
|
|
|
|
struct vrf *vrf;
|
|
|
|
struct interface *ifp;
|
|
|
|
uint32_t count = 0;
|
|
|
|
|
|
|
|
if (ospf->vrf_id != VRF_UNKNOWN) {
|
|
|
|
vrf = vrf_lookup_by_id(ospf->vrf_id);
|
|
|
|
|
|
|
|
FOR_ALL_INTERFACES (vrf, ifp) {
|
|
|
|
count += ospf_if_count_area_params(ifp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return count;
|
|
|
|
}
|
|
|
|
|
2017-09-07 17:08:09 +02:00
|
|
|
/* It should only be used when processing incoming info update from zebra.
|
|
|
|
* Other situations, it is not sufficient to lookup the ospf instance by
|
|
|
|
* vrf_name only without using the instance number.
|
|
|
|
*/
|
|
|
|
static struct ospf *ospf_lookup_by_name(const char *vrf_name)
|
2017-08-25 22:51:12 +02:00
|
|
|
{
|
|
|
|
struct ospf *ospf = NULL;
|
|
|
|
struct listnode *node, *nnode;
|
|
|
|
|
|
|
|
for (ALL_LIST_ELEMENTS(om->ospf, node, nnode, ospf))
|
2017-09-07 17:08:09 +02:00
|
|
|
if ((ospf->name == NULL && vrf_name == NULL)
|
|
|
|
|| (ospf->name && vrf_name
|
|
|
|
&& strcmp(ospf->name, vrf_name) == 0))
|
2017-08-25 22:51:12 +02:00
|
|
|
return ospf;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2005-11-26 14:31:11 +01:00
|
|
|
/* Handle the second half of deferred shutdown. This is called either
|
|
|
|
* from the deferred-shutdown timer thread, or directly through
|
|
|
|
* ospf_deferred_shutdown_check.
|
2005-10-29 Paul Jakma <paul.jakma@sun.com>
* (general) RFC3137 stub-router support
* ospfd.h: Add OSPF_OUTPUT_COST_INFINITE define.
(struct ospf_master) Add a OSPF_MASTER_SHUTDOWN flag for
options, to allow shutdown to distinguish between complete
shutdown and shutdown of a subset of ospf instances.
(struct ospf)
Add stub_router_{startup,shutdown_}time, configuration of startup
and shutdown time for stub-router.
Add t_graceful_shutdown struct thread, timer for graceful
shutdown, if needed.
(struct ospf_area) Add stub_router_state - run time state of
stub-router for an area. Add flags for ADMIN, IS and WAS
states.
Add t_stub_router, timer thread to resend router-lsa for an
area.
* ospf_lsa.c: (ospf_link_cost) new simple function to spit out
either the given lnks cost or infinite cost if stub-router is
in effect.
(lsa_link_{ptop,broadcast,virtuallink,ptomp}_set) use
previous function for transit-links.
(ospf_stub_router_timer) timer thread for end of startup stub
router. Change state as required for the area and setup
re-origination of router-lsa.
(ospf_stub_router_check) Check/do whether stub-router should be
enabled, and whether it requires timer to be setup.
(ospf_router_lsa_new) call previous function at top.
(ospf_router_lsa_originate) no external callers, made static.
* ospf_lsa.h: (ospf_router_lsa_originate) removed.
* ospf_main.c: (sigint) make static.
remove call to exit, as ospf_terminate now deals with
exiting.
* ospf_route.c: (ospf_terminate) removed, now in ospfd.c.
* ospf_vty.c: (show_ip_ospf_area) print out state of
stub-router, if active.
(show_ip_ospf) print out configuration of stub-router
support, and details of graceful-shutdown if the timer is
active.
((no)?ospf_max_metric_router_lsa_{admin,startup,shutdown}) new
commands to (de-)?configure stub-router support.
(config_write_stub_router) write out config of stub-router.
(ospf_config_write) call previous.
(ospf_vty_init) install the new stub-router commands.
* ospfd.c: various functions made static.
(ospf_new) Set defaults for stub-router. Graceful shutdown
is made to default on, just to be adventerous.
(ospf_graceful_shutdown_finish) new function, final part of
shutdown.
(ospf_graceful_shutdown_timer) timer thread wrapper for
graceful-shutdown.
(ospf_graceful_shutdown_check) check whether to setup timer
for shutdown or proceed directly to final shutdown.
(ospf_terminate) moved here from ospf_route.c, call
ospf_finish for each instance.
(ospf_finish) renamed to ospf_finish_final and made static.
(ospf_finish) new function, exported wrapper around
ospf_graceful_shutdown_check.
(ospf_finish_final) complete shutdown of an instance.
Add missing TIMER_OFF's of two timer threads.
(ospf_area_free) opaque self lsa timer should be turned off.
2005-10-29 14:50:09 +02:00
|
|
|
*
|
|
|
|
* Function is to cleanup G-R state, if required then call ospf_finish_final
|
|
|
|
* to complete shutdown of this ospf instance. Possibly exit if the
|
|
|
|
* whole process is being shutdown and this was the last OSPF instance.
|
|
|
|
*/
|
2005-11-26 14:31:11 +01:00
|
|
|
static void ospf_deferred_shutdown_finish(struct ospf *ospf)
|
2005-10-29 Paul Jakma <paul.jakma@sun.com>
* (general) RFC3137 stub-router support
* ospfd.h: Add OSPF_OUTPUT_COST_INFINITE define.
(struct ospf_master) Add a OSPF_MASTER_SHUTDOWN flag for
options, to allow shutdown to distinguish between complete
shutdown and shutdown of a subset of ospf instances.
(struct ospf)
Add stub_router_{startup,shutdown_}time, configuration of startup
and shutdown time for stub-router.
Add t_graceful_shutdown struct thread, timer for graceful
shutdown, if needed.
(struct ospf_area) Add stub_router_state - run time state of
stub-router for an area. Add flags for ADMIN, IS and WAS
states.
Add t_stub_router, timer thread to resend router-lsa for an
area.
* ospf_lsa.c: (ospf_link_cost) new simple function to spit out
either the given lnks cost or infinite cost if stub-router is
in effect.
(lsa_link_{ptop,broadcast,virtuallink,ptomp}_set) use
previous function for transit-links.
(ospf_stub_router_timer) timer thread for end of startup stub
router. Change state as required for the area and setup
re-origination of router-lsa.
(ospf_stub_router_check) Check/do whether stub-router should be
enabled, and whether it requires timer to be setup.
(ospf_router_lsa_new) call previous function at top.
(ospf_router_lsa_originate) no external callers, made static.
* ospf_lsa.h: (ospf_router_lsa_originate) removed.
* ospf_main.c: (sigint) make static.
remove call to exit, as ospf_terminate now deals with
exiting.
* ospf_route.c: (ospf_terminate) removed, now in ospfd.c.
* ospf_vty.c: (show_ip_ospf_area) print out state of
stub-router, if active.
(show_ip_ospf) print out configuration of stub-router
support, and details of graceful-shutdown if the timer is
active.
((no)?ospf_max_metric_router_lsa_{admin,startup,shutdown}) new
commands to (de-)?configure stub-router support.
(config_write_stub_router) write out config of stub-router.
(ospf_config_write) call previous.
(ospf_vty_init) install the new stub-router commands.
* ospfd.c: various functions made static.
(ospf_new) Set defaults for stub-router. Graceful shutdown
is made to default on, just to be adventerous.
(ospf_graceful_shutdown_finish) new function, final part of
shutdown.
(ospf_graceful_shutdown_timer) timer thread wrapper for
graceful-shutdown.
(ospf_graceful_shutdown_check) check whether to setup timer
for shutdown or proceed directly to final shutdown.
(ospf_terminate) moved here from ospf_route.c, call
ospf_finish for each instance.
(ospf_finish) renamed to ospf_finish_final and made static.
(ospf_finish) new function, exported wrapper around
ospf_graceful_shutdown_check.
(ospf_finish_final) complete shutdown of an instance.
Add missing TIMER_OFF's of two timer threads.
(ospf_area_free) opaque self lsa timer should be turned off.
2005-10-29 14:50:09 +02:00
|
|
|
{
|
|
|
|
ospf->stub_router_shutdown_time = OSPF_STUB_ROUTER_UNCONFIGURED;
|
2022-06-03 16:28:11 +02:00
|
|
|
THREAD_OFF(ospf->t_deferred_shutdown);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2005-10-29 Paul Jakma <paul.jakma@sun.com>
* (general) RFC3137 stub-router support
* ospfd.h: Add OSPF_OUTPUT_COST_INFINITE define.
(struct ospf_master) Add a OSPF_MASTER_SHUTDOWN flag for
options, to allow shutdown to distinguish between complete
shutdown and shutdown of a subset of ospf instances.
(struct ospf)
Add stub_router_{startup,shutdown_}time, configuration of startup
and shutdown time for stub-router.
Add t_graceful_shutdown struct thread, timer for graceful
shutdown, if needed.
(struct ospf_area) Add stub_router_state - run time state of
stub-router for an area. Add flags for ADMIN, IS and WAS
states.
Add t_stub_router, timer thread to resend router-lsa for an
area.
* ospf_lsa.c: (ospf_link_cost) new simple function to spit out
either the given lnks cost or infinite cost if stub-router is
in effect.
(lsa_link_{ptop,broadcast,virtuallink,ptomp}_set) use
previous function for transit-links.
(ospf_stub_router_timer) timer thread for end of startup stub
router. Change state as required for the area and setup
re-origination of router-lsa.
(ospf_stub_router_check) Check/do whether stub-router should be
enabled, and whether it requires timer to be setup.
(ospf_router_lsa_new) call previous function at top.
(ospf_router_lsa_originate) no external callers, made static.
* ospf_lsa.h: (ospf_router_lsa_originate) removed.
* ospf_main.c: (sigint) make static.
remove call to exit, as ospf_terminate now deals with
exiting.
* ospf_route.c: (ospf_terminate) removed, now in ospfd.c.
* ospf_vty.c: (show_ip_ospf_area) print out state of
stub-router, if active.
(show_ip_ospf) print out configuration of stub-router
support, and details of graceful-shutdown if the timer is
active.
((no)?ospf_max_metric_router_lsa_{admin,startup,shutdown}) new
commands to (de-)?configure stub-router support.
(config_write_stub_router) write out config of stub-router.
(ospf_config_write) call previous.
(ospf_vty_init) install the new stub-router commands.
* ospfd.c: various functions made static.
(ospf_new) Set defaults for stub-router. Graceful shutdown
is made to default on, just to be adventerous.
(ospf_graceful_shutdown_finish) new function, final part of
shutdown.
(ospf_graceful_shutdown_timer) timer thread wrapper for
graceful-shutdown.
(ospf_graceful_shutdown_check) check whether to setup timer
for shutdown or proceed directly to final shutdown.
(ospf_terminate) moved here from ospf_route.c, call
ospf_finish for each instance.
(ospf_finish) renamed to ospf_finish_final and made static.
(ospf_finish) new function, exported wrapper around
ospf_graceful_shutdown_check.
(ospf_finish_final) complete shutdown of an instance.
Add missing TIMER_OFF's of two timer threads.
(ospf_area_free) opaque self lsa timer should be turned off.
2005-10-29 14:50:09 +02:00
|
|
|
ospf_finish_final(ospf);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2005-10-29 Paul Jakma <paul.jakma@sun.com>
* (general) RFC3137 stub-router support
* ospfd.h: Add OSPF_OUTPUT_COST_INFINITE define.
(struct ospf_master) Add a OSPF_MASTER_SHUTDOWN flag for
options, to allow shutdown to distinguish between complete
shutdown and shutdown of a subset of ospf instances.
(struct ospf)
Add stub_router_{startup,shutdown_}time, configuration of startup
and shutdown time for stub-router.
Add t_graceful_shutdown struct thread, timer for graceful
shutdown, if needed.
(struct ospf_area) Add stub_router_state - run time state of
stub-router for an area. Add flags for ADMIN, IS and WAS
states.
Add t_stub_router, timer thread to resend router-lsa for an
area.
* ospf_lsa.c: (ospf_link_cost) new simple function to spit out
either the given lnks cost or infinite cost if stub-router is
in effect.
(lsa_link_{ptop,broadcast,virtuallink,ptomp}_set) use
previous function for transit-links.
(ospf_stub_router_timer) timer thread for end of startup stub
router. Change state as required for the area and setup
re-origination of router-lsa.
(ospf_stub_router_check) Check/do whether stub-router should be
enabled, and whether it requires timer to be setup.
(ospf_router_lsa_new) call previous function at top.
(ospf_router_lsa_originate) no external callers, made static.
* ospf_lsa.h: (ospf_router_lsa_originate) removed.
* ospf_main.c: (sigint) make static.
remove call to exit, as ospf_terminate now deals with
exiting.
* ospf_route.c: (ospf_terminate) removed, now in ospfd.c.
* ospf_vty.c: (show_ip_ospf_area) print out state of
stub-router, if active.
(show_ip_ospf) print out configuration of stub-router
support, and details of graceful-shutdown if the timer is
active.
((no)?ospf_max_metric_router_lsa_{admin,startup,shutdown}) new
commands to (de-)?configure stub-router support.
(config_write_stub_router) write out config of stub-router.
(ospf_config_write) call previous.
(ospf_vty_init) install the new stub-router commands.
* ospfd.c: various functions made static.
(ospf_new) Set defaults for stub-router. Graceful shutdown
is made to default on, just to be adventerous.
(ospf_graceful_shutdown_finish) new function, final part of
shutdown.
(ospf_graceful_shutdown_timer) timer thread wrapper for
graceful-shutdown.
(ospf_graceful_shutdown_check) check whether to setup timer
for shutdown or proceed directly to final shutdown.
(ospf_terminate) moved here from ospf_route.c, call
ospf_finish for each instance.
(ospf_finish) renamed to ospf_finish_final and made static.
(ospf_finish) new function, exported wrapper around
ospf_graceful_shutdown_check.
(ospf_finish_final) complete shutdown of an instance.
Add missing TIMER_OFF's of two timer threads.
(ospf_area_free) opaque self lsa timer should be turned off.
2005-10-29 14:50:09 +02:00
|
|
|
/* *ospf is now invalid */
|
|
|
|
|
|
|
|
/* ospfd being shut-down? If so, was this the last ospf instance? */
|
|
|
|
if (CHECK_FLAG(om->options, OSPF_MASTER_SHUTDOWN)
|
|
|
|
&& (listcount(om->ospf) == 0)) {
|
2021-10-20 14:00:02 +02:00
|
|
|
frr_fini();
|
2017-07-17 14:03:14 +02:00
|
|
|
exit(0);
|
|
|
|
}
|
|
|
|
|
2005-10-29 Paul Jakma <paul.jakma@sun.com>
* (general) RFC3137 stub-router support
* ospfd.h: Add OSPF_OUTPUT_COST_INFINITE define.
(struct ospf_master) Add a OSPF_MASTER_SHUTDOWN flag for
options, to allow shutdown to distinguish between complete
shutdown and shutdown of a subset of ospf instances.
(struct ospf)
Add stub_router_{startup,shutdown_}time, configuration of startup
and shutdown time for stub-router.
Add t_graceful_shutdown struct thread, timer for graceful
shutdown, if needed.
(struct ospf_area) Add stub_router_state - run time state of
stub-router for an area. Add flags for ADMIN, IS and WAS
states.
Add t_stub_router, timer thread to resend router-lsa for an
area.
* ospf_lsa.c: (ospf_link_cost) new simple function to spit out
either the given lnks cost or infinite cost if stub-router is
in effect.
(lsa_link_{ptop,broadcast,virtuallink,ptomp}_set) use
previous function for transit-links.
(ospf_stub_router_timer) timer thread for end of startup stub
router. Change state as required for the area and setup
re-origination of router-lsa.
(ospf_stub_router_check) Check/do whether stub-router should be
enabled, and whether it requires timer to be setup.
(ospf_router_lsa_new) call previous function at top.
(ospf_router_lsa_originate) no external callers, made static.
* ospf_lsa.h: (ospf_router_lsa_originate) removed.
* ospf_main.c: (sigint) make static.
remove call to exit, as ospf_terminate now deals with
exiting.
* ospf_route.c: (ospf_terminate) removed, now in ospfd.c.
* ospf_vty.c: (show_ip_ospf_area) print out state of
stub-router, if active.
(show_ip_ospf) print out configuration of stub-router
support, and details of graceful-shutdown if the timer is
active.
((no)?ospf_max_metric_router_lsa_{admin,startup,shutdown}) new
commands to (de-)?configure stub-router support.
(config_write_stub_router) write out config of stub-router.
(ospf_config_write) call previous.
(ospf_vty_init) install the new stub-router commands.
* ospfd.c: various functions made static.
(ospf_new) Set defaults for stub-router. Graceful shutdown
is made to default on, just to be adventerous.
(ospf_graceful_shutdown_finish) new function, final part of
shutdown.
(ospf_graceful_shutdown_timer) timer thread wrapper for
graceful-shutdown.
(ospf_graceful_shutdown_check) check whether to setup timer
for shutdown or proceed directly to final shutdown.
(ospf_terminate) moved here from ospf_route.c, call
ospf_finish for each instance.
(ospf_finish) renamed to ospf_finish_final and made static.
(ospf_finish) new function, exported wrapper around
ospf_graceful_shutdown_check.
(ospf_finish_final) complete shutdown of an instance.
Add missing TIMER_OFF's of two timer threads.
(ospf_area_free) opaque self lsa timer should be turned off.
2005-10-29 14:50:09 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Timer thread for G-R */
|
2022-02-23 01:04:25 +01:00
|
|
|
static void ospf_deferred_shutdown_timer(struct thread *t)
|
2005-10-29 Paul Jakma <paul.jakma@sun.com>
* (general) RFC3137 stub-router support
* ospfd.h: Add OSPF_OUTPUT_COST_INFINITE define.
(struct ospf_master) Add a OSPF_MASTER_SHUTDOWN flag for
options, to allow shutdown to distinguish between complete
shutdown and shutdown of a subset of ospf instances.
(struct ospf)
Add stub_router_{startup,shutdown_}time, configuration of startup
and shutdown time for stub-router.
Add t_graceful_shutdown struct thread, timer for graceful
shutdown, if needed.
(struct ospf_area) Add stub_router_state - run time state of
stub-router for an area. Add flags for ADMIN, IS and WAS
states.
Add t_stub_router, timer thread to resend router-lsa for an
area.
* ospf_lsa.c: (ospf_link_cost) new simple function to spit out
either the given lnks cost or infinite cost if stub-router is
in effect.
(lsa_link_{ptop,broadcast,virtuallink,ptomp}_set) use
previous function for transit-links.
(ospf_stub_router_timer) timer thread for end of startup stub
router. Change state as required for the area and setup
re-origination of router-lsa.
(ospf_stub_router_check) Check/do whether stub-router should be
enabled, and whether it requires timer to be setup.
(ospf_router_lsa_new) call previous function at top.
(ospf_router_lsa_originate) no external callers, made static.
* ospf_lsa.h: (ospf_router_lsa_originate) removed.
* ospf_main.c: (sigint) make static.
remove call to exit, as ospf_terminate now deals with
exiting.
* ospf_route.c: (ospf_terminate) removed, now in ospfd.c.
* ospf_vty.c: (show_ip_ospf_area) print out state of
stub-router, if active.
(show_ip_ospf) print out configuration of stub-router
support, and details of graceful-shutdown if the timer is
active.
((no)?ospf_max_metric_router_lsa_{admin,startup,shutdown}) new
commands to (de-)?configure stub-router support.
(config_write_stub_router) write out config of stub-router.
(ospf_config_write) call previous.
(ospf_vty_init) install the new stub-router commands.
* ospfd.c: various functions made static.
(ospf_new) Set defaults for stub-router. Graceful shutdown
is made to default on, just to be adventerous.
(ospf_graceful_shutdown_finish) new function, final part of
shutdown.
(ospf_graceful_shutdown_timer) timer thread wrapper for
graceful-shutdown.
(ospf_graceful_shutdown_check) check whether to setup timer
for shutdown or proceed directly to final shutdown.
(ospf_terminate) moved here from ospf_route.c, call
ospf_finish for each instance.
(ospf_finish) renamed to ospf_finish_final and made static.
(ospf_finish) new function, exported wrapper around
ospf_graceful_shutdown_check.
(ospf_finish_final) complete shutdown of an instance.
Add missing TIMER_OFF's of two timer threads.
(ospf_area_free) opaque self lsa timer should be turned off.
2005-10-29 14:50:09 +02:00
|
|
|
{
|
|
|
|
struct ospf *ospf = THREAD_ARG(t);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2005-11-26 14:31:11 +01:00
|
|
|
ospf_deferred_shutdown_finish(ospf);
|
2005-10-29 Paul Jakma <paul.jakma@sun.com>
* (general) RFC3137 stub-router support
* ospfd.h: Add OSPF_OUTPUT_COST_INFINITE define.
(struct ospf_master) Add a OSPF_MASTER_SHUTDOWN flag for
options, to allow shutdown to distinguish between complete
shutdown and shutdown of a subset of ospf instances.
(struct ospf)
Add stub_router_{startup,shutdown_}time, configuration of startup
and shutdown time for stub-router.
Add t_graceful_shutdown struct thread, timer for graceful
shutdown, if needed.
(struct ospf_area) Add stub_router_state - run time state of
stub-router for an area. Add flags for ADMIN, IS and WAS
states.
Add t_stub_router, timer thread to resend router-lsa for an
area.
* ospf_lsa.c: (ospf_link_cost) new simple function to spit out
either the given lnks cost or infinite cost if stub-router is
in effect.
(lsa_link_{ptop,broadcast,virtuallink,ptomp}_set) use
previous function for transit-links.
(ospf_stub_router_timer) timer thread for end of startup stub
router. Change state as required for the area and setup
re-origination of router-lsa.
(ospf_stub_router_check) Check/do whether stub-router should be
enabled, and whether it requires timer to be setup.
(ospf_router_lsa_new) call previous function at top.
(ospf_router_lsa_originate) no external callers, made static.
* ospf_lsa.h: (ospf_router_lsa_originate) removed.
* ospf_main.c: (sigint) make static.
remove call to exit, as ospf_terminate now deals with
exiting.
* ospf_route.c: (ospf_terminate) removed, now in ospfd.c.
* ospf_vty.c: (show_ip_ospf_area) print out state of
stub-router, if active.
(show_ip_ospf) print out configuration of stub-router
support, and details of graceful-shutdown if the timer is
active.
((no)?ospf_max_metric_router_lsa_{admin,startup,shutdown}) new
commands to (de-)?configure stub-router support.
(config_write_stub_router) write out config of stub-router.
(ospf_config_write) call previous.
(ospf_vty_init) install the new stub-router commands.
* ospfd.c: various functions made static.
(ospf_new) Set defaults for stub-router. Graceful shutdown
is made to default on, just to be adventerous.
(ospf_graceful_shutdown_finish) new function, final part of
shutdown.
(ospf_graceful_shutdown_timer) timer thread wrapper for
graceful-shutdown.
(ospf_graceful_shutdown_check) check whether to setup timer
for shutdown or proceed directly to final shutdown.
(ospf_terminate) moved here from ospf_route.c, call
ospf_finish for each instance.
(ospf_finish) renamed to ospf_finish_final and made static.
(ospf_finish) new function, exported wrapper around
ospf_graceful_shutdown_check.
(ospf_finish_final) complete shutdown of an instance.
Add missing TIMER_OFF's of two timer threads.
(ospf_area_free) opaque self lsa timer should be turned off.
2005-10-29 14:50:09 +02:00
|
|
|
}
|
|
|
|
|
2005-11-26 14:31:11 +01:00
|
|
|
/* Check whether deferred-shutdown must be scheduled, otherwise call
|
2005-10-29 Paul Jakma <paul.jakma@sun.com>
* (general) RFC3137 stub-router support
* ospfd.h: Add OSPF_OUTPUT_COST_INFINITE define.
(struct ospf_master) Add a OSPF_MASTER_SHUTDOWN flag for
options, to allow shutdown to distinguish between complete
shutdown and shutdown of a subset of ospf instances.
(struct ospf)
Add stub_router_{startup,shutdown_}time, configuration of startup
and shutdown time for stub-router.
Add t_graceful_shutdown struct thread, timer for graceful
shutdown, if needed.
(struct ospf_area) Add stub_router_state - run time state of
stub-router for an area. Add flags for ADMIN, IS and WAS
states.
Add t_stub_router, timer thread to resend router-lsa for an
area.
* ospf_lsa.c: (ospf_link_cost) new simple function to spit out
either the given lnks cost or infinite cost if stub-router is
in effect.
(lsa_link_{ptop,broadcast,virtuallink,ptomp}_set) use
previous function for transit-links.
(ospf_stub_router_timer) timer thread for end of startup stub
router. Change state as required for the area and setup
re-origination of router-lsa.
(ospf_stub_router_check) Check/do whether stub-router should be
enabled, and whether it requires timer to be setup.
(ospf_router_lsa_new) call previous function at top.
(ospf_router_lsa_originate) no external callers, made static.
* ospf_lsa.h: (ospf_router_lsa_originate) removed.
* ospf_main.c: (sigint) make static.
remove call to exit, as ospf_terminate now deals with
exiting.
* ospf_route.c: (ospf_terminate) removed, now in ospfd.c.
* ospf_vty.c: (show_ip_ospf_area) print out state of
stub-router, if active.
(show_ip_ospf) print out configuration of stub-router
support, and details of graceful-shutdown if the timer is
active.
((no)?ospf_max_metric_router_lsa_{admin,startup,shutdown}) new
commands to (de-)?configure stub-router support.
(config_write_stub_router) write out config of stub-router.
(ospf_config_write) call previous.
(ospf_vty_init) install the new stub-router commands.
* ospfd.c: various functions made static.
(ospf_new) Set defaults for stub-router. Graceful shutdown
is made to default on, just to be adventerous.
(ospf_graceful_shutdown_finish) new function, final part of
shutdown.
(ospf_graceful_shutdown_timer) timer thread wrapper for
graceful-shutdown.
(ospf_graceful_shutdown_check) check whether to setup timer
for shutdown or proceed directly to final shutdown.
(ospf_terminate) moved here from ospf_route.c, call
ospf_finish for each instance.
(ospf_finish) renamed to ospf_finish_final and made static.
(ospf_finish) new function, exported wrapper around
ospf_graceful_shutdown_check.
(ospf_finish_final) complete shutdown of an instance.
Add missing TIMER_OFF's of two timer threads.
(ospf_area_free) opaque self lsa timer should be turned off.
2005-10-29 14:50:09 +02:00
|
|
|
* down directly into second-half of instance shutdown.
|
|
|
|
*/
|
2005-11-26 14:31:11 +01:00
|
|
|
static void ospf_deferred_shutdown_check(struct ospf *ospf)
|
2005-10-29 Paul Jakma <paul.jakma@sun.com>
* (general) RFC3137 stub-router support
* ospfd.h: Add OSPF_OUTPUT_COST_INFINITE define.
(struct ospf_master) Add a OSPF_MASTER_SHUTDOWN flag for
options, to allow shutdown to distinguish between complete
shutdown and shutdown of a subset of ospf instances.
(struct ospf)
Add stub_router_{startup,shutdown_}time, configuration of startup
and shutdown time for stub-router.
Add t_graceful_shutdown struct thread, timer for graceful
shutdown, if needed.
(struct ospf_area) Add stub_router_state - run time state of
stub-router for an area. Add flags for ADMIN, IS and WAS
states.
Add t_stub_router, timer thread to resend router-lsa for an
area.
* ospf_lsa.c: (ospf_link_cost) new simple function to spit out
either the given lnks cost or infinite cost if stub-router is
in effect.
(lsa_link_{ptop,broadcast,virtuallink,ptomp}_set) use
previous function for transit-links.
(ospf_stub_router_timer) timer thread for end of startup stub
router. Change state as required for the area and setup
re-origination of router-lsa.
(ospf_stub_router_check) Check/do whether stub-router should be
enabled, and whether it requires timer to be setup.
(ospf_router_lsa_new) call previous function at top.
(ospf_router_lsa_originate) no external callers, made static.
* ospf_lsa.h: (ospf_router_lsa_originate) removed.
* ospf_main.c: (sigint) make static.
remove call to exit, as ospf_terminate now deals with
exiting.
* ospf_route.c: (ospf_terminate) removed, now in ospfd.c.
* ospf_vty.c: (show_ip_ospf_area) print out state of
stub-router, if active.
(show_ip_ospf) print out configuration of stub-router
support, and details of graceful-shutdown if the timer is
active.
((no)?ospf_max_metric_router_lsa_{admin,startup,shutdown}) new
commands to (de-)?configure stub-router support.
(config_write_stub_router) write out config of stub-router.
(ospf_config_write) call previous.
(ospf_vty_init) install the new stub-router commands.
* ospfd.c: various functions made static.
(ospf_new) Set defaults for stub-router. Graceful shutdown
is made to default on, just to be adventerous.
(ospf_graceful_shutdown_finish) new function, final part of
shutdown.
(ospf_graceful_shutdown_timer) timer thread wrapper for
graceful-shutdown.
(ospf_graceful_shutdown_check) check whether to setup timer
for shutdown or proceed directly to final shutdown.
(ospf_terminate) moved here from ospf_route.c, call
ospf_finish for each instance.
(ospf_finish) renamed to ospf_finish_final and made static.
(ospf_finish) new function, exported wrapper around
ospf_graceful_shutdown_check.
(ospf_finish_final) complete shutdown of an instance.
Add missing TIMER_OFF's of two timer threads.
(ospf_area_free) opaque self lsa timer should be turned off.
2005-10-29 14:50:09 +02:00
|
|
|
{
|
|
|
|
unsigned long timeout;
|
|
|
|
struct listnode *ln;
|
|
|
|
struct ospf_area *area;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2005-11-26 14:31:11 +01:00
|
|
|
/* deferred shutdown already running? */
|
|
|
|
if (ospf->t_deferred_shutdown)
|
2005-10-29 Paul Jakma <paul.jakma@sun.com>
* (general) RFC3137 stub-router support
* ospfd.h: Add OSPF_OUTPUT_COST_INFINITE define.
(struct ospf_master) Add a OSPF_MASTER_SHUTDOWN flag for
options, to allow shutdown to distinguish between complete
shutdown and shutdown of a subset of ospf instances.
(struct ospf)
Add stub_router_{startup,shutdown_}time, configuration of startup
and shutdown time for stub-router.
Add t_graceful_shutdown struct thread, timer for graceful
shutdown, if needed.
(struct ospf_area) Add stub_router_state - run time state of
stub-router for an area. Add flags for ADMIN, IS and WAS
states.
Add t_stub_router, timer thread to resend router-lsa for an
area.
* ospf_lsa.c: (ospf_link_cost) new simple function to spit out
either the given lnks cost or infinite cost if stub-router is
in effect.
(lsa_link_{ptop,broadcast,virtuallink,ptomp}_set) use
previous function for transit-links.
(ospf_stub_router_timer) timer thread for end of startup stub
router. Change state as required for the area and setup
re-origination of router-lsa.
(ospf_stub_router_check) Check/do whether stub-router should be
enabled, and whether it requires timer to be setup.
(ospf_router_lsa_new) call previous function at top.
(ospf_router_lsa_originate) no external callers, made static.
* ospf_lsa.h: (ospf_router_lsa_originate) removed.
* ospf_main.c: (sigint) make static.
remove call to exit, as ospf_terminate now deals with
exiting.
* ospf_route.c: (ospf_terminate) removed, now in ospfd.c.
* ospf_vty.c: (show_ip_ospf_area) print out state of
stub-router, if active.
(show_ip_ospf) print out configuration of stub-router
support, and details of graceful-shutdown if the timer is
active.
((no)?ospf_max_metric_router_lsa_{admin,startup,shutdown}) new
commands to (de-)?configure stub-router support.
(config_write_stub_router) write out config of stub-router.
(ospf_config_write) call previous.
(ospf_vty_init) install the new stub-router commands.
* ospfd.c: various functions made static.
(ospf_new) Set defaults for stub-router. Graceful shutdown
is made to default on, just to be adventerous.
(ospf_graceful_shutdown_finish) new function, final part of
shutdown.
(ospf_graceful_shutdown_timer) timer thread wrapper for
graceful-shutdown.
(ospf_graceful_shutdown_check) check whether to setup timer
for shutdown or proceed directly to final shutdown.
(ospf_terminate) moved here from ospf_route.c, call
ospf_finish for each instance.
(ospf_finish) renamed to ospf_finish_final and made static.
(ospf_finish) new function, exported wrapper around
ospf_graceful_shutdown_check.
(ospf_finish_final) complete shutdown of an instance.
Add missing TIMER_OFF's of two timer threads.
(ospf_area_free) opaque self lsa timer should be turned off.
2005-10-29 14:50:09 +02:00
|
|
|
return;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2005-10-29 Paul Jakma <paul.jakma@sun.com>
* (general) RFC3137 stub-router support
* ospfd.h: Add OSPF_OUTPUT_COST_INFINITE define.
(struct ospf_master) Add a OSPF_MASTER_SHUTDOWN flag for
options, to allow shutdown to distinguish between complete
shutdown and shutdown of a subset of ospf instances.
(struct ospf)
Add stub_router_{startup,shutdown_}time, configuration of startup
and shutdown time for stub-router.
Add t_graceful_shutdown struct thread, timer for graceful
shutdown, if needed.
(struct ospf_area) Add stub_router_state - run time state of
stub-router for an area. Add flags for ADMIN, IS and WAS
states.
Add t_stub_router, timer thread to resend router-lsa for an
area.
* ospf_lsa.c: (ospf_link_cost) new simple function to spit out
either the given lnks cost or infinite cost if stub-router is
in effect.
(lsa_link_{ptop,broadcast,virtuallink,ptomp}_set) use
previous function for transit-links.
(ospf_stub_router_timer) timer thread for end of startup stub
router. Change state as required for the area and setup
re-origination of router-lsa.
(ospf_stub_router_check) Check/do whether stub-router should be
enabled, and whether it requires timer to be setup.
(ospf_router_lsa_new) call previous function at top.
(ospf_router_lsa_originate) no external callers, made static.
* ospf_lsa.h: (ospf_router_lsa_originate) removed.
* ospf_main.c: (sigint) make static.
remove call to exit, as ospf_terminate now deals with
exiting.
* ospf_route.c: (ospf_terminate) removed, now in ospfd.c.
* ospf_vty.c: (show_ip_ospf_area) print out state of
stub-router, if active.
(show_ip_ospf) print out configuration of stub-router
support, and details of graceful-shutdown if the timer is
active.
((no)?ospf_max_metric_router_lsa_{admin,startup,shutdown}) new
commands to (de-)?configure stub-router support.
(config_write_stub_router) write out config of stub-router.
(ospf_config_write) call previous.
(ospf_vty_init) install the new stub-router commands.
* ospfd.c: various functions made static.
(ospf_new) Set defaults for stub-router. Graceful shutdown
is made to default on, just to be adventerous.
(ospf_graceful_shutdown_finish) new function, final part of
shutdown.
(ospf_graceful_shutdown_timer) timer thread wrapper for
graceful-shutdown.
(ospf_graceful_shutdown_check) check whether to setup timer
for shutdown or proceed directly to final shutdown.
(ospf_terminate) moved here from ospf_route.c, call
ospf_finish for each instance.
(ospf_finish) renamed to ospf_finish_final and made static.
(ospf_finish) new function, exported wrapper around
ospf_graceful_shutdown_check.
(ospf_finish_final) complete shutdown of an instance.
Add missing TIMER_OFF's of two timer threads.
(ospf_area_free) opaque self lsa timer should be turned off.
2005-10-29 14:50:09 +02:00
|
|
|
/* Should we try push out max-metric LSAs? */
|
|
|
|
if (ospf->stub_router_shutdown_time != OSPF_STUB_ROUTER_UNCONFIGURED) {
|
|
|
|
for (ALL_LIST_ELEMENTS_RO(ospf->areas, ln, area)) {
|
|
|
|
SET_FLAG(area->stub_router_state,
|
|
|
|
OSPF_AREA_ADMIN_STUB_ROUTED);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2005-10-29 Paul Jakma <paul.jakma@sun.com>
* (general) RFC3137 stub-router support
* ospfd.h: Add OSPF_OUTPUT_COST_INFINITE define.
(struct ospf_master) Add a OSPF_MASTER_SHUTDOWN flag for
options, to allow shutdown to distinguish between complete
shutdown and shutdown of a subset of ospf instances.
(struct ospf)
Add stub_router_{startup,shutdown_}time, configuration of startup
and shutdown time for stub-router.
Add t_graceful_shutdown struct thread, timer for graceful
shutdown, if needed.
(struct ospf_area) Add stub_router_state - run time state of
stub-router for an area. Add flags for ADMIN, IS and WAS
states.
Add t_stub_router, timer thread to resend router-lsa for an
area.
* ospf_lsa.c: (ospf_link_cost) new simple function to spit out
either the given lnks cost or infinite cost if stub-router is
in effect.
(lsa_link_{ptop,broadcast,virtuallink,ptomp}_set) use
previous function for transit-links.
(ospf_stub_router_timer) timer thread for end of startup stub
router. Change state as required for the area and setup
re-origination of router-lsa.
(ospf_stub_router_check) Check/do whether stub-router should be
enabled, and whether it requires timer to be setup.
(ospf_router_lsa_new) call previous function at top.
(ospf_router_lsa_originate) no external callers, made static.
* ospf_lsa.h: (ospf_router_lsa_originate) removed.
* ospf_main.c: (sigint) make static.
remove call to exit, as ospf_terminate now deals with
exiting.
* ospf_route.c: (ospf_terminate) removed, now in ospfd.c.
* ospf_vty.c: (show_ip_ospf_area) print out state of
stub-router, if active.
(show_ip_ospf) print out configuration of stub-router
support, and details of graceful-shutdown if the timer is
active.
((no)?ospf_max_metric_router_lsa_{admin,startup,shutdown}) new
commands to (de-)?configure stub-router support.
(config_write_stub_router) write out config of stub-router.
(ospf_config_write) call previous.
(ospf_vty_init) install the new stub-router commands.
* ospfd.c: various functions made static.
(ospf_new) Set defaults for stub-router. Graceful shutdown
is made to default on, just to be adventerous.
(ospf_graceful_shutdown_finish) new function, final part of
shutdown.
(ospf_graceful_shutdown_timer) timer thread wrapper for
graceful-shutdown.
(ospf_graceful_shutdown_check) check whether to setup timer
for shutdown or proceed directly to final shutdown.
(ospf_terminate) moved here from ospf_route.c, call
ospf_finish for each instance.
(ospf_finish) renamed to ospf_finish_final and made static.
(ospf_finish) new function, exported wrapper around
ospf_graceful_shutdown_check.
(ospf_finish_final) complete shutdown of an instance.
Add missing TIMER_OFF's of two timer threads.
(ospf_area_free) opaque self lsa timer should be turned off.
2005-10-29 14:50:09 +02:00
|
|
|
if (!CHECK_FLAG(area->stub_router_state,
|
|
|
|
OSPF_AREA_IS_STUB_ROUTED))
|
2010-01-24 23:42:13 +01:00
|
|
|
ospf_router_lsa_update_area(area);
|
2005-10-29 Paul Jakma <paul.jakma@sun.com>
* (general) RFC3137 stub-router support
* ospfd.h: Add OSPF_OUTPUT_COST_INFINITE define.
(struct ospf_master) Add a OSPF_MASTER_SHUTDOWN flag for
options, to allow shutdown to distinguish between complete
shutdown and shutdown of a subset of ospf instances.
(struct ospf)
Add stub_router_{startup,shutdown_}time, configuration of startup
and shutdown time for stub-router.
Add t_graceful_shutdown struct thread, timer for graceful
shutdown, if needed.
(struct ospf_area) Add stub_router_state - run time state of
stub-router for an area. Add flags for ADMIN, IS and WAS
states.
Add t_stub_router, timer thread to resend router-lsa for an
area.
* ospf_lsa.c: (ospf_link_cost) new simple function to spit out
either the given lnks cost or infinite cost if stub-router is
in effect.
(lsa_link_{ptop,broadcast,virtuallink,ptomp}_set) use
previous function for transit-links.
(ospf_stub_router_timer) timer thread for end of startup stub
router. Change state as required for the area and setup
re-origination of router-lsa.
(ospf_stub_router_check) Check/do whether stub-router should be
enabled, and whether it requires timer to be setup.
(ospf_router_lsa_new) call previous function at top.
(ospf_router_lsa_originate) no external callers, made static.
* ospf_lsa.h: (ospf_router_lsa_originate) removed.
* ospf_main.c: (sigint) make static.
remove call to exit, as ospf_terminate now deals with
exiting.
* ospf_route.c: (ospf_terminate) removed, now in ospfd.c.
* ospf_vty.c: (show_ip_ospf_area) print out state of
stub-router, if active.
(show_ip_ospf) print out configuration of stub-router
support, and details of graceful-shutdown if the timer is
active.
((no)?ospf_max_metric_router_lsa_{admin,startup,shutdown}) new
commands to (de-)?configure stub-router support.
(config_write_stub_router) write out config of stub-router.
(ospf_config_write) call previous.
(ospf_vty_init) install the new stub-router commands.
* ospfd.c: various functions made static.
(ospf_new) Set defaults for stub-router. Graceful shutdown
is made to default on, just to be adventerous.
(ospf_graceful_shutdown_finish) new function, final part of
shutdown.
(ospf_graceful_shutdown_timer) timer thread wrapper for
graceful-shutdown.
(ospf_graceful_shutdown_check) check whether to setup timer
for shutdown or proceed directly to final shutdown.
(ospf_terminate) moved here from ospf_route.c, call
ospf_finish for each instance.
(ospf_finish) renamed to ospf_finish_final and made static.
(ospf_finish) new function, exported wrapper around
ospf_graceful_shutdown_check.
(ospf_finish_final) complete shutdown of an instance.
Add missing TIMER_OFF's of two timer threads.
(ospf_area_free) opaque self lsa timer should be turned off.
2005-10-29 14:50:09 +02:00
|
|
|
}
|
|
|
|
timeout = ospf->stub_router_shutdown_time;
|
|
|
|
} else {
|
2005-11-26 14:31:11 +01:00
|
|
|
/* No timer needed */
|
|
|
|
ospf_deferred_shutdown_finish(ospf);
|
|
|
|
return;
|
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2005-11-26 14:31:11 +01:00
|
|
|
OSPF_TIMER_ON(ospf->t_deferred_shutdown, ospf_deferred_shutdown_timer,
|
2005-10-29 Paul Jakma <paul.jakma@sun.com>
* (general) RFC3137 stub-router support
* ospfd.h: Add OSPF_OUTPUT_COST_INFINITE define.
(struct ospf_master) Add a OSPF_MASTER_SHUTDOWN flag for
options, to allow shutdown to distinguish between complete
shutdown and shutdown of a subset of ospf instances.
(struct ospf)
Add stub_router_{startup,shutdown_}time, configuration of startup
and shutdown time for stub-router.
Add t_graceful_shutdown struct thread, timer for graceful
shutdown, if needed.
(struct ospf_area) Add stub_router_state - run time state of
stub-router for an area. Add flags for ADMIN, IS and WAS
states.
Add t_stub_router, timer thread to resend router-lsa for an
area.
* ospf_lsa.c: (ospf_link_cost) new simple function to spit out
either the given lnks cost or infinite cost if stub-router is
in effect.
(lsa_link_{ptop,broadcast,virtuallink,ptomp}_set) use
previous function for transit-links.
(ospf_stub_router_timer) timer thread for end of startup stub
router. Change state as required for the area and setup
re-origination of router-lsa.
(ospf_stub_router_check) Check/do whether stub-router should be
enabled, and whether it requires timer to be setup.
(ospf_router_lsa_new) call previous function at top.
(ospf_router_lsa_originate) no external callers, made static.
* ospf_lsa.h: (ospf_router_lsa_originate) removed.
* ospf_main.c: (sigint) make static.
remove call to exit, as ospf_terminate now deals with
exiting.
* ospf_route.c: (ospf_terminate) removed, now in ospfd.c.
* ospf_vty.c: (show_ip_ospf_area) print out state of
stub-router, if active.
(show_ip_ospf) print out configuration of stub-router
support, and details of graceful-shutdown if the timer is
active.
((no)?ospf_max_metric_router_lsa_{admin,startup,shutdown}) new
commands to (de-)?configure stub-router support.
(config_write_stub_router) write out config of stub-router.
(ospf_config_write) call previous.
(ospf_vty_init) install the new stub-router commands.
* ospfd.c: various functions made static.
(ospf_new) Set defaults for stub-router. Graceful shutdown
is made to default on, just to be adventerous.
(ospf_graceful_shutdown_finish) new function, final part of
shutdown.
(ospf_graceful_shutdown_timer) timer thread wrapper for
graceful-shutdown.
(ospf_graceful_shutdown_check) check whether to setup timer
for shutdown or proceed directly to final shutdown.
(ospf_terminate) moved here from ospf_route.c, call
ospf_finish for each instance.
(ospf_finish) renamed to ospf_finish_final and made static.
(ospf_finish) new function, exported wrapper around
ospf_graceful_shutdown_check.
(ospf_finish_final) complete shutdown of an instance.
Add missing TIMER_OFF's of two timer threads.
(ospf_area_free) opaque self lsa timer should be turned off.
2005-10-29 14:50:09 +02:00
|
|
|
timeout);
|
|
|
|
return;
|
|
|
|
}
|
2014-06-04 06:53:35 +02:00
|
|
|
|
2005-10-29 Paul Jakma <paul.jakma@sun.com>
* (general) RFC3137 stub-router support
* ospfd.h: Add OSPF_OUTPUT_COST_INFINITE define.
(struct ospf_master) Add a OSPF_MASTER_SHUTDOWN flag for
options, to allow shutdown to distinguish between complete
shutdown and shutdown of a subset of ospf instances.
(struct ospf)
Add stub_router_{startup,shutdown_}time, configuration of startup
and shutdown time for stub-router.
Add t_graceful_shutdown struct thread, timer for graceful
shutdown, if needed.
(struct ospf_area) Add stub_router_state - run time state of
stub-router for an area. Add flags for ADMIN, IS and WAS
states.
Add t_stub_router, timer thread to resend router-lsa for an
area.
* ospf_lsa.c: (ospf_link_cost) new simple function to spit out
either the given lnks cost or infinite cost if stub-router is
in effect.
(lsa_link_{ptop,broadcast,virtuallink,ptomp}_set) use
previous function for transit-links.
(ospf_stub_router_timer) timer thread for end of startup stub
router. Change state as required for the area and setup
re-origination of router-lsa.
(ospf_stub_router_check) Check/do whether stub-router should be
enabled, and whether it requires timer to be setup.
(ospf_router_lsa_new) call previous function at top.
(ospf_router_lsa_originate) no external callers, made static.
* ospf_lsa.h: (ospf_router_lsa_originate) removed.
* ospf_main.c: (sigint) make static.
remove call to exit, as ospf_terminate now deals with
exiting.
* ospf_route.c: (ospf_terminate) removed, now in ospfd.c.
* ospf_vty.c: (show_ip_ospf_area) print out state of
stub-router, if active.
(show_ip_ospf) print out configuration of stub-router
support, and details of graceful-shutdown if the timer is
active.
((no)?ospf_max_metric_router_lsa_{admin,startup,shutdown}) new
commands to (de-)?configure stub-router support.
(config_write_stub_router) write out config of stub-router.
(ospf_config_write) call previous.
(ospf_vty_init) install the new stub-router commands.
* ospfd.c: various functions made static.
(ospf_new) Set defaults for stub-router. Graceful shutdown
is made to default on, just to be adventerous.
(ospf_graceful_shutdown_finish) new function, final part of
shutdown.
(ospf_graceful_shutdown_timer) timer thread wrapper for
graceful-shutdown.
(ospf_graceful_shutdown_check) check whether to setup timer
for shutdown or proceed directly to final shutdown.
(ospf_terminate) moved here from ospf_route.c, call
ospf_finish for each instance.
(ospf_finish) renamed to ospf_finish_final and made static.
(ospf_finish) new function, exported wrapper around
ospf_graceful_shutdown_check.
(ospf_finish_final) complete shutdown of an instance.
Add missing TIMER_OFF's of two timer threads.
(ospf_area_free) opaque self lsa timer should be turned off.
2005-10-29 14:50:09 +02:00
|
|
|
/* Shut down the entire process */
|
|
|
|
void ospf_terminate(void)
|
|
|
|
{
|
|
|
|
struct ospf *ospf;
|
|
|
|
struct listnode *node, *nnode;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2005-10-29 Paul Jakma <paul.jakma@sun.com>
* (general) RFC3137 stub-router support
* ospfd.h: Add OSPF_OUTPUT_COST_INFINITE define.
(struct ospf_master) Add a OSPF_MASTER_SHUTDOWN flag for
options, to allow shutdown to distinguish between complete
shutdown and shutdown of a subset of ospf instances.
(struct ospf)
Add stub_router_{startup,shutdown_}time, configuration of startup
and shutdown time for stub-router.
Add t_graceful_shutdown struct thread, timer for graceful
shutdown, if needed.
(struct ospf_area) Add stub_router_state - run time state of
stub-router for an area. Add flags for ADMIN, IS and WAS
states.
Add t_stub_router, timer thread to resend router-lsa for an
area.
* ospf_lsa.c: (ospf_link_cost) new simple function to spit out
either the given lnks cost or infinite cost if stub-router is
in effect.
(lsa_link_{ptop,broadcast,virtuallink,ptomp}_set) use
previous function for transit-links.
(ospf_stub_router_timer) timer thread for end of startup stub
router. Change state as required for the area and setup
re-origination of router-lsa.
(ospf_stub_router_check) Check/do whether stub-router should be
enabled, and whether it requires timer to be setup.
(ospf_router_lsa_new) call previous function at top.
(ospf_router_lsa_originate) no external callers, made static.
* ospf_lsa.h: (ospf_router_lsa_originate) removed.
* ospf_main.c: (sigint) make static.
remove call to exit, as ospf_terminate now deals with
exiting.
* ospf_route.c: (ospf_terminate) removed, now in ospfd.c.
* ospf_vty.c: (show_ip_ospf_area) print out state of
stub-router, if active.
(show_ip_ospf) print out configuration of stub-router
support, and details of graceful-shutdown if the timer is
active.
((no)?ospf_max_metric_router_lsa_{admin,startup,shutdown}) new
commands to (de-)?configure stub-router support.
(config_write_stub_router) write out config of stub-router.
(ospf_config_write) call previous.
(ospf_vty_init) install the new stub-router commands.
* ospfd.c: various functions made static.
(ospf_new) Set defaults for stub-router. Graceful shutdown
is made to default on, just to be adventerous.
(ospf_graceful_shutdown_finish) new function, final part of
shutdown.
(ospf_graceful_shutdown_timer) timer thread wrapper for
graceful-shutdown.
(ospf_graceful_shutdown_check) check whether to setup timer
for shutdown or proceed directly to final shutdown.
(ospf_terminate) moved here from ospf_route.c, call
ospf_finish for each instance.
(ospf_finish) renamed to ospf_finish_final and made static.
(ospf_finish) new function, exported wrapper around
ospf_graceful_shutdown_check.
(ospf_finish_final) complete shutdown of an instance.
Add missing TIMER_OFF's of two timer threads.
(ospf_area_free) opaque self lsa timer should be turned off.
2005-10-29 14:50:09 +02:00
|
|
|
/* shutdown already in progress */
|
|
|
|
if (CHECK_FLAG(om->options, OSPF_MASTER_SHUTDOWN))
|
|
|
|
return;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2005-10-29 Paul Jakma <paul.jakma@sun.com>
* (general) RFC3137 stub-router support
* ospfd.h: Add OSPF_OUTPUT_COST_INFINITE define.
(struct ospf_master) Add a OSPF_MASTER_SHUTDOWN flag for
options, to allow shutdown to distinguish between complete
shutdown and shutdown of a subset of ospf instances.
(struct ospf)
Add stub_router_{startup,shutdown_}time, configuration of startup
and shutdown time for stub-router.
Add t_graceful_shutdown struct thread, timer for graceful
shutdown, if needed.
(struct ospf_area) Add stub_router_state - run time state of
stub-router for an area. Add flags for ADMIN, IS and WAS
states.
Add t_stub_router, timer thread to resend router-lsa for an
area.
* ospf_lsa.c: (ospf_link_cost) new simple function to spit out
either the given lnks cost or infinite cost if stub-router is
in effect.
(lsa_link_{ptop,broadcast,virtuallink,ptomp}_set) use
previous function for transit-links.
(ospf_stub_router_timer) timer thread for end of startup stub
router. Change state as required for the area and setup
re-origination of router-lsa.
(ospf_stub_router_check) Check/do whether stub-router should be
enabled, and whether it requires timer to be setup.
(ospf_router_lsa_new) call previous function at top.
(ospf_router_lsa_originate) no external callers, made static.
* ospf_lsa.h: (ospf_router_lsa_originate) removed.
* ospf_main.c: (sigint) make static.
remove call to exit, as ospf_terminate now deals with
exiting.
* ospf_route.c: (ospf_terminate) removed, now in ospfd.c.
* ospf_vty.c: (show_ip_ospf_area) print out state of
stub-router, if active.
(show_ip_ospf) print out configuration of stub-router
support, and details of graceful-shutdown if the timer is
active.
((no)?ospf_max_metric_router_lsa_{admin,startup,shutdown}) new
commands to (de-)?configure stub-router support.
(config_write_stub_router) write out config of stub-router.
(ospf_config_write) call previous.
(ospf_vty_init) install the new stub-router commands.
* ospfd.c: various functions made static.
(ospf_new) Set defaults for stub-router. Graceful shutdown
is made to default on, just to be adventerous.
(ospf_graceful_shutdown_finish) new function, final part of
shutdown.
(ospf_graceful_shutdown_timer) timer thread wrapper for
graceful-shutdown.
(ospf_graceful_shutdown_check) check whether to setup timer
for shutdown or proceed directly to final shutdown.
(ospf_terminate) moved here from ospf_route.c, call
ospf_finish for each instance.
(ospf_finish) renamed to ospf_finish_final and made static.
(ospf_finish) new function, exported wrapper around
ospf_graceful_shutdown_check.
(ospf_finish_final) complete shutdown of an instance.
Add missing TIMER_OFF's of two timer threads.
(ospf_area_free) opaque self lsa timer should be turned off.
2005-10-29 14:50:09 +02:00
|
|
|
SET_FLAG(om->options, OSPF_MASTER_SHUTDOWN);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2020-06-11 17:16:02 +02:00
|
|
|
/* Skip some steps if OSPF not actually running */
|
2007-02-27 14:55:46 +01:00
|
|
|
if (listcount(om->ospf) == 0)
|
2020-06-11 17:16:02 +02:00
|
|
|
goto done;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2005-10-29 Paul Jakma <paul.jakma@sun.com>
* (general) RFC3137 stub-router support
* ospfd.h: Add OSPF_OUTPUT_COST_INFINITE define.
(struct ospf_master) Add a OSPF_MASTER_SHUTDOWN flag for
options, to allow shutdown to distinguish between complete
shutdown and shutdown of a subset of ospf instances.
(struct ospf)
Add stub_router_{startup,shutdown_}time, configuration of startup
and shutdown time for stub-router.
Add t_graceful_shutdown struct thread, timer for graceful
shutdown, if needed.
(struct ospf_area) Add stub_router_state - run time state of
stub-router for an area. Add flags for ADMIN, IS and WAS
states.
Add t_stub_router, timer thread to resend router-lsa for an
area.
* ospf_lsa.c: (ospf_link_cost) new simple function to spit out
either the given lnks cost or infinite cost if stub-router is
in effect.
(lsa_link_{ptop,broadcast,virtuallink,ptomp}_set) use
previous function for transit-links.
(ospf_stub_router_timer) timer thread for end of startup stub
router. Change state as required for the area and setup
re-origination of router-lsa.
(ospf_stub_router_check) Check/do whether stub-router should be
enabled, and whether it requires timer to be setup.
(ospf_router_lsa_new) call previous function at top.
(ospf_router_lsa_originate) no external callers, made static.
* ospf_lsa.h: (ospf_router_lsa_originate) removed.
* ospf_main.c: (sigint) make static.
remove call to exit, as ospf_terminate now deals with
exiting.
* ospf_route.c: (ospf_terminate) removed, now in ospfd.c.
* ospf_vty.c: (show_ip_ospf_area) print out state of
stub-router, if active.
(show_ip_ospf) print out configuration of stub-router
support, and details of graceful-shutdown if the timer is
active.
((no)?ospf_max_metric_router_lsa_{admin,startup,shutdown}) new
commands to (de-)?configure stub-router support.
(config_write_stub_router) write out config of stub-router.
(ospf_config_write) call previous.
(ospf_vty_init) install the new stub-router commands.
* ospfd.c: various functions made static.
(ospf_new) Set defaults for stub-router. Graceful shutdown
is made to default on, just to be adventerous.
(ospf_graceful_shutdown_finish) new function, final part of
shutdown.
(ospf_graceful_shutdown_timer) timer thread wrapper for
graceful-shutdown.
(ospf_graceful_shutdown_check) check whether to setup timer
for shutdown or proceed directly to final shutdown.
(ospf_terminate) moved here from ospf_route.c, call
ospf_finish for each instance.
(ospf_finish) renamed to ospf_finish_final and made static.
(ospf_finish) new function, exported wrapper around
ospf_graceful_shutdown_check.
(ospf_finish_final) complete shutdown of an instance.
Add missing TIMER_OFF's of two timer threads.
(ospf_area_free) opaque self lsa timer should be turned off.
2005-10-29 14:50:09 +02:00
|
|
|
for (ALL_LIST_ELEMENTS(om->ospf, node, nnode, ospf))
|
|
|
|
ospf_finish(ospf);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2021-05-31 15:27:51 +02:00
|
|
|
/* Cleanup GR */
|
|
|
|
ospf_gr_helper_stop();
|
|
|
|
|
2018-01-25 01:41:07 +01:00
|
|
|
/* Cleanup route maps */
|
|
|
|
route_map_finish();
|
|
|
|
|
|
|
|
/* reverse prefix_list_init */
|
|
|
|
prefix_list_add_hook(NULL);
|
|
|
|
prefix_list_delete_hook(NULL);
|
|
|
|
prefix_list_reset();
|
|
|
|
|
|
|
|
/* Cleanup vrf info */
|
|
|
|
ospf_vrf_terminate();
|
|
|
|
|
2005-10-29 Paul Jakma <paul.jakma@sun.com>
* (general) RFC3137 stub-router support
* ospfd.h: Add OSPF_OUTPUT_COST_INFINITE define.
(struct ospf_master) Add a OSPF_MASTER_SHUTDOWN flag for
options, to allow shutdown to distinguish between complete
shutdown and shutdown of a subset of ospf instances.
(struct ospf)
Add stub_router_{startup,shutdown_}time, configuration of startup
and shutdown time for stub-router.
Add t_graceful_shutdown struct thread, timer for graceful
shutdown, if needed.
(struct ospf_area) Add stub_router_state - run time state of
stub-router for an area. Add flags for ADMIN, IS and WAS
states.
Add t_stub_router, timer thread to resend router-lsa for an
area.
* ospf_lsa.c: (ospf_link_cost) new simple function to spit out
either the given lnks cost or infinite cost if stub-router is
in effect.
(lsa_link_{ptop,broadcast,virtuallink,ptomp}_set) use
previous function for transit-links.
(ospf_stub_router_timer) timer thread for end of startup stub
router. Change state as required for the area and setup
re-origination of router-lsa.
(ospf_stub_router_check) Check/do whether stub-router should be
enabled, and whether it requires timer to be setup.
(ospf_router_lsa_new) call previous function at top.
(ospf_router_lsa_originate) no external callers, made static.
* ospf_lsa.h: (ospf_router_lsa_originate) removed.
* ospf_main.c: (sigint) make static.
remove call to exit, as ospf_terminate now deals with
exiting.
* ospf_route.c: (ospf_terminate) removed, now in ospfd.c.
* ospf_vty.c: (show_ip_ospf_area) print out state of
stub-router, if active.
(show_ip_ospf) print out configuration of stub-router
support, and details of graceful-shutdown if the timer is
active.
((no)?ospf_max_metric_router_lsa_{admin,startup,shutdown}) new
commands to (de-)?configure stub-router support.
(config_write_stub_router) write out config of stub-router.
(ospf_config_write) call previous.
(ospf_vty_init) install the new stub-router commands.
* ospfd.c: various functions made static.
(ospf_new) Set defaults for stub-router. Graceful shutdown
is made to default on, just to be adventerous.
(ospf_graceful_shutdown_finish) new function, final part of
shutdown.
(ospf_graceful_shutdown_timer) timer thread wrapper for
graceful-shutdown.
(ospf_graceful_shutdown_check) check whether to setup timer
for shutdown or proceed directly to final shutdown.
(ospf_terminate) moved here from ospf_route.c, call
ospf_finish for each instance.
(ospf_finish) renamed to ospf_finish_final and made static.
(ospf_finish) new function, exported wrapper around
ospf_graceful_shutdown_check.
(ospf_finish_final) complete shutdown of an instance.
Add missing TIMER_OFF's of two timer threads.
(ospf_area_free) opaque self lsa timer should be turned off.
2005-10-29 14:50:09 +02:00
|
|
|
/* Deliberately go back up, hopefully to thread scheduler, as
|
|
|
|
* One or more ospf_finish()'s may have deferred shutdown to a timer
|
|
|
|
* thread
|
|
|
|
*/
|
2017-06-30 16:33:09 +02:00
|
|
|
zclient_stop(zclient);
|
|
|
|
zclient_free(zclient);
|
2017-09-12 04:05:16 +02:00
|
|
|
|
2020-06-11 17:16:02 +02:00
|
|
|
done:
|
2017-09-12 04:05:16 +02:00
|
|
|
frr_fini();
|
2005-10-29 Paul Jakma <paul.jakma@sun.com>
* (general) RFC3137 stub-router support
* ospfd.h: Add OSPF_OUTPUT_COST_INFINITE define.
(struct ospf_master) Add a OSPF_MASTER_SHUTDOWN flag for
options, to allow shutdown to distinguish between complete
shutdown and shutdown of a subset of ospf instances.
(struct ospf)
Add stub_router_{startup,shutdown_}time, configuration of startup
and shutdown time for stub-router.
Add t_graceful_shutdown struct thread, timer for graceful
shutdown, if needed.
(struct ospf_area) Add stub_router_state - run time state of
stub-router for an area. Add flags for ADMIN, IS and WAS
states.
Add t_stub_router, timer thread to resend router-lsa for an
area.
* ospf_lsa.c: (ospf_link_cost) new simple function to spit out
either the given lnks cost or infinite cost if stub-router is
in effect.
(lsa_link_{ptop,broadcast,virtuallink,ptomp}_set) use
previous function for transit-links.
(ospf_stub_router_timer) timer thread for end of startup stub
router. Change state as required for the area and setup
re-origination of router-lsa.
(ospf_stub_router_check) Check/do whether stub-router should be
enabled, and whether it requires timer to be setup.
(ospf_router_lsa_new) call previous function at top.
(ospf_router_lsa_originate) no external callers, made static.
* ospf_lsa.h: (ospf_router_lsa_originate) removed.
* ospf_main.c: (sigint) make static.
remove call to exit, as ospf_terminate now deals with
exiting.
* ospf_route.c: (ospf_terminate) removed, now in ospfd.c.
* ospf_vty.c: (show_ip_ospf_area) print out state of
stub-router, if active.
(show_ip_ospf) print out configuration of stub-router
support, and details of graceful-shutdown if the timer is
active.
((no)?ospf_max_metric_router_lsa_{admin,startup,shutdown}) new
commands to (de-)?configure stub-router support.
(config_write_stub_router) write out config of stub-router.
(ospf_config_write) call previous.
(ospf_vty_init) install the new stub-router commands.
* ospfd.c: various functions made static.
(ospf_new) Set defaults for stub-router. Graceful shutdown
is made to default on, just to be adventerous.
(ospf_graceful_shutdown_finish) new function, final part of
shutdown.
(ospf_graceful_shutdown_timer) timer thread wrapper for
graceful-shutdown.
(ospf_graceful_shutdown_check) check whether to setup timer
for shutdown or proceed directly to final shutdown.
(ospf_terminate) moved here from ospf_route.c, call
ospf_finish for each instance.
(ospf_finish) renamed to ospf_finish_final and made static.
(ospf_finish) new function, exported wrapper around
ospf_graceful_shutdown_check.
(ospf_finish_final) complete shutdown of an instance.
Add missing TIMER_OFF's of two timer threads.
(ospf_area_free) opaque self lsa timer should be turned off.
2005-10-29 14:50:09 +02:00
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
void ospf_finish(struct ospf *ospf)
|
2005-10-29 Paul Jakma <paul.jakma@sun.com>
* (general) RFC3137 stub-router support
* ospfd.h: Add OSPF_OUTPUT_COST_INFINITE define.
(struct ospf_master) Add a OSPF_MASTER_SHUTDOWN flag for
options, to allow shutdown to distinguish between complete
shutdown and shutdown of a subset of ospf instances.
(struct ospf)
Add stub_router_{startup,shutdown_}time, configuration of startup
and shutdown time for stub-router.
Add t_graceful_shutdown struct thread, timer for graceful
shutdown, if needed.
(struct ospf_area) Add stub_router_state - run time state of
stub-router for an area. Add flags for ADMIN, IS and WAS
states.
Add t_stub_router, timer thread to resend router-lsa for an
area.
* ospf_lsa.c: (ospf_link_cost) new simple function to spit out
either the given lnks cost or infinite cost if stub-router is
in effect.
(lsa_link_{ptop,broadcast,virtuallink,ptomp}_set) use
previous function for transit-links.
(ospf_stub_router_timer) timer thread for end of startup stub
router. Change state as required for the area and setup
re-origination of router-lsa.
(ospf_stub_router_check) Check/do whether stub-router should be
enabled, and whether it requires timer to be setup.
(ospf_router_lsa_new) call previous function at top.
(ospf_router_lsa_originate) no external callers, made static.
* ospf_lsa.h: (ospf_router_lsa_originate) removed.
* ospf_main.c: (sigint) make static.
remove call to exit, as ospf_terminate now deals with
exiting.
* ospf_route.c: (ospf_terminate) removed, now in ospfd.c.
* ospf_vty.c: (show_ip_ospf_area) print out state of
stub-router, if active.
(show_ip_ospf) print out configuration of stub-router
support, and details of graceful-shutdown if the timer is
active.
((no)?ospf_max_metric_router_lsa_{admin,startup,shutdown}) new
commands to (de-)?configure stub-router support.
(config_write_stub_router) write out config of stub-router.
(ospf_config_write) call previous.
(ospf_vty_init) install the new stub-router commands.
* ospfd.c: various functions made static.
(ospf_new) Set defaults for stub-router. Graceful shutdown
is made to default on, just to be adventerous.
(ospf_graceful_shutdown_finish) new function, final part of
shutdown.
(ospf_graceful_shutdown_timer) timer thread wrapper for
graceful-shutdown.
(ospf_graceful_shutdown_check) check whether to setup timer
for shutdown or proceed directly to final shutdown.
(ospf_terminate) moved here from ospf_route.c, call
ospf_finish for each instance.
(ospf_finish) renamed to ospf_finish_final and made static.
(ospf_finish) new function, exported wrapper around
ospf_graceful_shutdown_check.
(ospf_finish_final) complete shutdown of an instance.
Add missing TIMER_OFF's of two timer threads.
(ospf_area_free) opaque self lsa timer should be turned off.
2005-10-29 14:50:09 +02:00
|
|
|
{
|
2005-11-26 14:31:11 +01:00
|
|
|
/* let deferred shutdown decide */
|
|
|
|
ospf_deferred_shutdown_check(ospf);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2005-11-26 14:31:11 +01:00
|
|
|
/* if ospf_deferred_shutdown returns, then ospf_finish_final is
|
2005-10-29 Paul Jakma <paul.jakma@sun.com>
* (general) RFC3137 stub-router support
* ospfd.h: Add OSPF_OUTPUT_COST_INFINITE define.
(struct ospf_master) Add a OSPF_MASTER_SHUTDOWN flag for
options, to allow shutdown to distinguish between complete
shutdown and shutdown of a subset of ospf instances.
(struct ospf)
Add stub_router_{startup,shutdown_}time, configuration of startup
and shutdown time for stub-router.
Add t_graceful_shutdown struct thread, timer for graceful
shutdown, if needed.
(struct ospf_area) Add stub_router_state - run time state of
stub-router for an area. Add flags for ADMIN, IS and WAS
states.
Add t_stub_router, timer thread to resend router-lsa for an
area.
* ospf_lsa.c: (ospf_link_cost) new simple function to spit out
either the given lnks cost or infinite cost if stub-router is
in effect.
(lsa_link_{ptop,broadcast,virtuallink,ptomp}_set) use
previous function for transit-links.
(ospf_stub_router_timer) timer thread for end of startup stub
router. Change state as required for the area and setup
re-origination of router-lsa.
(ospf_stub_router_check) Check/do whether stub-router should be
enabled, and whether it requires timer to be setup.
(ospf_router_lsa_new) call previous function at top.
(ospf_router_lsa_originate) no external callers, made static.
* ospf_lsa.h: (ospf_router_lsa_originate) removed.
* ospf_main.c: (sigint) make static.
remove call to exit, as ospf_terminate now deals with
exiting.
* ospf_route.c: (ospf_terminate) removed, now in ospfd.c.
* ospf_vty.c: (show_ip_ospf_area) print out state of
stub-router, if active.
(show_ip_ospf) print out configuration of stub-router
support, and details of graceful-shutdown if the timer is
active.
((no)?ospf_max_metric_router_lsa_{admin,startup,shutdown}) new
commands to (de-)?configure stub-router support.
(config_write_stub_router) write out config of stub-router.
(ospf_config_write) call previous.
(ospf_vty_init) install the new stub-router commands.
* ospfd.c: various functions made static.
(ospf_new) Set defaults for stub-router. Graceful shutdown
is made to default on, just to be adventerous.
(ospf_graceful_shutdown_finish) new function, final part of
shutdown.
(ospf_graceful_shutdown_timer) timer thread wrapper for
graceful-shutdown.
(ospf_graceful_shutdown_check) check whether to setup timer
for shutdown or proceed directly to final shutdown.
(ospf_terminate) moved here from ospf_route.c, call
ospf_finish for each instance.
(ospf_finish) renamed to ospf_finish_final and made static.
(ospf_finish) new function, exported wrapper around
ospf_graceful_shutdown_check.
(ospf_finish_final) complete shutdown of an instance.
Add missing TIMER_OFF's of two timer threads.
(ospf_area_free) opaque self lsa timer should be turned off.
2005-10-29 14:50:09 +02:00
|
|
|
* deferred to expiry of G-S timer thread. Return back up, hopefully
|
|
|
|
* to thread scheduler.
|
|
|
|
*/
|
2005-11-26 14:31:11 +01:00
|
|
|
return;
|
2005-10-29 Paul Jakma <paul.jakma@sun.com>
* (general) RFC3137 stub-router support
* ospfd.h: Add OSPF_OUTPUT_COST_INFINITE define.
(struct ospf_master) Add a OSPF_MASTER_SHUTDOWN flag for
options, to allow shutdown to distinguish between complete
shutdown and shutdown of a subset of ospf instances.
(struct ospf)
Add stub_router_{startup,shutdown_}time, configuration of startup
and shutdown time for stub-router.
Add t_graceful_shutdown struct thread, timer for graceful
shutdown, if needed.
(struct ospf_area) Add stub_router_state - run time state of
stub-router for an area. Add flags for ADMIN, IS and WAS
states.
Add t_stub_router, timer thread to resend router-lsa for an
area.
* ospf_lsa.c: (ospf_link_cost) new simple function to spit out
either the given lnks cost or infinite cost if stub-router is
in effect.
(lsa_link_{ptop,broadcast,virtuallink,ptomp}_set) use
previous function for transit-links.
(ospf_stub_router_timer) timer thread for end of startup stub
router. Change state as required for the area and setup
re-origination of router-lsa.
(ospf_stub_router_check) Check/do whether stub-router should be
enabled, and whether it requires timer to be setup.
(ospf_router_lsa_new) call previous function at top.
(ospf_router_lsa_originate) no external callers, made static.
* ospf_lsa.h: (ospf_router_lsa_originate) removed.
* ospf_main.c: (sigint) make static.
remove call to exit, as ospf_terminate now deals with
exiting.
* ospf_route.c: (ospf_terminate) removed, now in ospfd.c.
* ospf_vty.c: (show_ip_ospf_area) print out state of
stub-router, if active.
(show_ip_ospf) print out configuration of stub-router
support, and details of graceful-shutdown if the timer is
active.
((no)?ospf_max_metric_router_lsa_{admin,startup,shutdown}) new
commands to (de-)?configure stub-router support.
(config_write_stub_router) write out config of stub-router.
(ospf_config_write) call previous.
(ospf_vty_init) install the new stub-router commands.
* ospfd.c: various functions made static.
(ospf_new) Set defaults for stub-router. Graceful shutdown
is made to default on, just to be adventerous.
(ospf_graceful_shutdown_finish) new function, final part of
shutdown.
(ospf_graceful_shutdown_timer) timer thread wrapper for
graceful-shutdown.
(ospf_graceful_shutdown_check) check whether to setup timer
for shutdown or proceed directly to final shutdown.
(ospf_terminate) moved here from ospf_route.c, call
ospf_finish for each instance.
(ospf_finish) renamed to ospf_finish_final and made static.
(ospf_finish) new function, exported wrapper around
ospf_graceful_shutdown_check.
(ospf_finish_final) complete shutdown of an instance.
Add missing TIMER_OFF's of two timer threads.
(ospf_area_free) opaque self lsa timer should be turned off.
2005-10-29 14:50:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Final cleanup of ospf instance */
|
|
|
|
static void ospf_finish_final(struct ospf *ospf)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
2021-06-02 04:51:49 +02:00
|
|
|
struct vrf *vrf = vrf_lookup_by_id(ospf->vrf_id);
|
2002-12-13 21:15:29 +01:00
|
|
|
struct route_node *rn;
|
|
|
|
struct ospf_nbr_nbma *nbr_nbma;
|
2003-03-25 06:07:42 +01:00
|
|
|
struct ospf_lsa *lsa;
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
struct ospf_interface *oi;
|
|
|
|
struct ospf_area *area;
|
|
|
|
struct ospf_vl_data *vl_data;
|
|
|
|
struct listnode *node, *nnode;
|
2021-05-07 17:10:01 +02:00
|
|
|
struct ospf_redist *red;
|
2015-05-20 03:29:14 +02:00
|
|
|
int i;
|
Multi-Instance OSPF Summary
——————————————-------------
- etc/init.d/quagga is modified to support creating separate ospf daemon
process for each instance. Each individual instance is monitored by
watchquagga just like any protocol daemons.(requires initd-mi.patch).
- Vtysh is modified to able to connect to multiple daemons of the same
protocol (supported for OSPF only for now).
- ospfd is modified to remember the Instance-ID that its invoked with. For
the entire life of the process it caters to any command request that
matches that instance-ID (unless its a non instance specific command).
Routes/messages to zebra are tagged with instance-ID.
- zebra route/redistribute mechanisms are modified to work with
[protocol type + instance-id]
- bgpd now has ability to have multiple instance specific redistribution
for a protocol (OSPF only supported/tested for now).
- zlog ability to display instance-id besides the protocol/daemon name.
- Changes in other daemons are to because of the needed integration with
some of the modified APIs/routines. (Didn’t prefer replicating too many
separate instance specific APIs.)
- config/show/debug commands are modified to take instance-id argument
as appropriate.
Guidelines to start using multi-instance ospf
---------------------------------------------
The patch is backward compatible, i.e for any previous way of single ospf
deamon(router ospf <cr>) will continue to work as is, including all the
show commands etc.
To enable multiple instances, do the following:
1. service quagga stop
2. Modify /etc/quagga/daemons to add instance-ids of each desired
instance in the following format:
ospfd=“yes"
ospfd_instances="1,2,3"
assuming you want to enable 3 instances with those instance ids.
3. Create corresponding ospfd config files as ospfd-1.conf, ospfd-2.conf
and ospfd-3.conf.
4. service quagga start/restart
5. Verify that the deamons are started as expected. You should see
ospfd started with -n <instance-id> option.
ps –ef | grep quagga
With that /var/run/quagga/ should have ospfd-<instance-id>.pid and
ospfd-<instance-id>/vty to each instance.
6. vtysh to work with instances as you would with any other deamons.
7. Overall most quagga semantics are the same working with the instance
deamon, like it is for any other daemon.
NOTE:
To safeguard against errors leading to too many processes getting invoked,
a hard limit on number of instance-ids is in place, currently its 5.
Allowed instance-id range is <1-65535>
Once daemons are up, show running from vtysh should show the instance-id
of each daemon as 'router ospf <instance-id>’ (without needing explicit
configuration)
Instance-id can not be changed via vtysh, other router ospf configuration
is allowed as before.
Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
2015-05-20 03:03:42 +02:00
|
|
|
|
|
|
|
QOBJ_UNREG(ospf);
|
|
|
|
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
ospf_opaque_type11_lsa_term(ospf);
|
2009-08-07 13:48:15 +02:00
|
|
|
|
2018-02-03 19:30:33 +01:00
|
|
|
ospf_opaque_finish();
|
|
|
|
|
2021-05-31 15:27:51 +02:00
|
|
|
if (!ospf->gr_info.prepare_in_progress)
|
|
|
|
ospf_flush_self_originated_lsas_now(ospf);
|
2009-08-07 13:48:15 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Unregister redistribution */
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
for (i = 0; i < ZEBRA_ROUTE_MAX; i++) {
|
|
|
|
struct list *red_list;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
red_list = ospf->redist[i];
|
|
|
|
if (!red_list)
|
|
|
|
continue;
|
|
|
|
|
2019-02-27 21:08:29 +01:00
|
|
|
for (ALL_LIST_ELEMENTS(red_list, node, nnode, red)) {
|
2002-12-13 21:15:29 +01:00
|
|
|
ospf_redistribute_unset(ospf, i, red->instance);
|
2019-02-27 21:08:29 +01:00
|
|
|
ospf_redist_del(ospf, i, red->instance);
|
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
2021-05-07 17:10:01 +02:00
|
|
|
red = ospf_redist_lookup(ospf, DEFAULT_ROUTE, 0);
|
|
|
|
if (red) {
|
|
|
|
ospf_routemap_unset(red);
|
|
|
|
ospf_redist_del(ospf, DEFAULT_ROUTE, 0);
|
|
|
|
ospf_redistribute_default_set(ospf, DEFAULT_ORIGINATE_NONE, 0, 0);
|
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
for (ALL_LIST_ELEMENTS(ospf->areas, node, nnode, area))
|
|
|
|
ospf_remove_vls_through_area(ospf, area);
|
|
|
|
|
|
|
|
for (ALL_LIST_ELEMENTS(ospf->vlinks, node, nnode, vl_data))
|
|
|
|
ospf_vl_delete(ospf, vl_data);
|
|
|
|
|
2018-10-02 11:39:51 +02:00
|
|
|
list_delete(&ospf->vlinks);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2020-07-22 19:31:14 +02:00
|
|
|
/* shutdown LDP-Sync */
|
|
|
|
if (ospf->vrf_id == VRF_DEFAULT)
|
|
|
|
ospf_ldp_sync_gbl_exit(ospf, true);
|
|
|
|
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
/* Reset interface. */
|
|
|
|
for (ALL_LIST_ELEMENTS(ospf->oiflist, node, nnode, oi))
|
2002-12-13 21:15:29 +01:00
|
|
|
ospf_if_free(oi);
|
2018-10-02 11:39:51 +02:00
|
|
|
list_delete(&ospf->oiflist);
|
2019-07-12 04:36:06 +02:00
|
|
|
ospf->oi_running = 0;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2017-08-25 22:51:12 +02:00
|
|
|
/* De-Register VRF */
|
|
|
|
ospf_zebra_vrf_deregister(ospf);
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Clear static neighbors */
|
|
|
|
for (rn = route_top(ospf->nbr_nbma); rn; rn = route_next(rn))
|
2012-12-04 19:46:37 +01:00
|
|
|
if ((nbr_nbma = rn->info)) {
|
2022-06-03 16:28:11 +02:00
|
|
|
THREAD_OFF(nbr_nbma->t_poll);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
if (nbr_nbma->nbr) {
|
2012-12-04 19:46:37 +01:00
|
|
|
nbr_nbma->nbr->nbr_nbma = NULL;
|
2002-12-13 21:15:29 +01:00
|
|
|
nbr_nbma->nbr = NULL;
|
2017-07-17 14:03:14 +02:00
|
|
|
}
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
if (nbr_nbma->oi) {
|
|
|
|
listnode_delete(nbr_nbma->oi->nbr_nbma,
|
|
|
|
nbr_nbma);
|
|
|
|
nbr_nbma->oi = NULL;
|
2017-07-17 14:03:14 +02:00
|
|
|
}
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
XFREE(MTYPE_OSPF_NEIGHBOR_STATIC, nbr_nbma);
|
2017-07-17 14:03:14 +02:00
|
|
|
}
|
|
|
|
|
2012-12-04 19:46:37 +01:00
|
|
|
route_table_finish(ospf->nbr_nbma);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Clear networks and Areas. */
|
2009-08-27 17:51:42 +02:00
|
|
|
for (rn = route_top(ospf->networks); rn; rn = route_next(rn)) {
|
2002-12-13 21:15:29 +01:00
|
|
|
struct ospf_network *network;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2012-12-04 19:46:37 +01:00
|
|
|
if ((network = rn->info) != NULL) {
|
|
|
|
ospf_network_free(ospf, network);
|
|
|
|
rn->info = NULL;
|
|
|
|
route_unlock_node(rn);
|
2017-07-17 14:03:14 +02:00
|
|
|
}
|
2012-12-04 19:46:37 +01:00
|
|
|
}
|
2017-07-13 22:33:29 +02:00
|
|
|
route_table_finish(ospf->networks);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
for (ALL_LIST_ELEMENTS(ospf->areas, node, nnode, area)) {
|
|
|
|
listnode_delete(ospf->areas, area);
|
|
|
|
ospf_area_free(area);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Cancel all timers. */
|
2022-06-03 16:28:11 +02:00
|
|
|
THREAD_OFF(ospf->t_read);
|
|
|
|
THREAD_OFF(ospf->t_write);
|
|
|
|
THREAD_OFF(ospf->t_spf_calc);
|
|
|
|
THREAD_OFF(ospf->t_ase_calc);
|
2022-09-12 16:27:20 +02:00
|
|
|
THREAD_OFF(ospf->t_orr_calc);
|
2022-06-03 16:28:11 +02:00
|
|
|
THREAD_OFF(ospf->t_maxage);
|
|
|
|
THREAD_OFF(ospf->t_maxage_walker);
|
|
|
|
THREAD_OFF(ospf->t_abr_task);
|
|
|
|
THREAD_OFF(ospf->t_asbr_check);
|
|
|
|
THREAD_OFF(ospf->t_asbr_nssa_redist_update);
|
|
|
|
THREAD_OFF(ospf->t_distribute_update);
|
|
|
|
THREAD_OFF(ospf->t_lsa_refresher);
|
|
|
|
THREAD_OFF(ospf->t_opaque_lsa_self);
|
|
|
|
THREAD_OFF(ospf->t_sr_update);
|
|
|
|
THREAD_OFF(ospf->t_default_routemap_timer);
|
|
|
|
THREAD_OFF(ospf->t_external_aggr);
|
|
|
|
THREAD_OFF(ospf->gr_info.t_grace_period);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2003-03-25 06:07:42 +01:00
|
|
|
LSDB_LOOP (OPAQUE_AS_LSDB(ospf), rn, lsa)
|
2018-01-17 19:28:17 +01:00
|
|
|
ospf_discard_from_db(ospf, ospf->lsdb, lsa);
|
2003-03-25 06:07:42 +01:00
|
|
|
LSDB_LOOP (EXTERNAL_LSDB(ospf), rn, lsa)
|
2018-01-17 19:28:17 +01:00
|
|
|
ospf_discard_from_db(ospf, ospf->lsdb, lsa);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
ospf_lsdb_delete_all(ospf->lsdb);
|
Multi-Instance OSPF Summary
——————————————-------------
- etc/init.d/quagga is modified to support creating separate ospf daemon
process for each instance. Each individual instance is monitored by
watchquagga just like any protocol daemons.(requires initd-mi.patch).
- Vtysh is modified to able to connect to multiple daemons of the same
protocol (supported for OSPF only for now).
- ospfd is modified to remember the Instance-ID that its invoked with. For
the entire life of the process it caters to any command request that
matches that instance-ID (unless its a non instance specific command).
Routes/messages to zebra are tagged with instance-ID.
- zebra route/redistribute mechanisms are modified to work with
[protocol type + instance-id]
- bgpd now has ability to have multiple instance specific redistribution
for a protocol (OSPF only supported/tested for now).
- zlog ability to display instance-id besides the protocol/daemon name.
- Changes in other daemons are to because of the needed integration with
some of the modified APIs/routines. (Didn’t prefer replicating too many
separate instance specific APIs.)
- config/show/debug commands are modified to take instance-id argument
as appropriate.
Guidelines to start using multi-instance ospf
---------------------------------------------
The patch is backward compatible, i.e for any previous way of single ospf
deamon(router ospf <cr>) will continue to work as is, including all the
show commands etc.
To enable multiple instances, do the following:
1. service quagga stop
2. Modify /etc/quagga/daemons to add instance-ids of each desired
instance in the following format:
ospfd=“yes"
ospfd_instances="1,2,3"
assuming you want to enable 3 instances with those instance ids.
3. Create corresponding ospfd config files as ospfd-1.conf, ospfd-2.conf
and ospfd-3.conf.
4. service quagga start/restart
5. Verify that the deamons are started as expected. You should see
ospfd started with -n <instance-id> option.
ps –ef | grep quagga
With that /var/run/quagga/ should have ospfd-<instance-id>.pid and
ospfd-<instance-id>/vty to each instance.
6. vtysh to work with instances as you would with any other deamons.
7. Overall most quagga semantics are the same working with the instance
deamon, like it is for any other daemon.
NOTE:
To safeguard against errors leading to too many processes getting invoked,
a hard limit on number of instance-ids is in place, currently its 5.
Allowed instance-id range is <1-65535>
Once daemons are up, show running from vtysh should show the instance-id
of each daemon as 'router ospf <instance-id>’ (without needing explicit
configuration)
Instance-id can not be changed via vtysh, other router ospf configuration
is allowed as before.
Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
2015-05-20 03:03:42 +02:00
|
|
|
ospf_lsdb_free(ospf->lsdb);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
Multi-Instance OSPF Summary
——————————————-------------
- etc/init.d/quagga is modified to support creating separate ospf daemon
process for each instance. Each individual instance is monitored by
watchquagga just like any protocol daemons.(requires initd-mi.patch).
- Vtysh is modified to able to connect to multiple daemons of the same
protocol (supported for OSPF only for now).
- ospfd is modified to remember the Instance-ID that its invoked with. For
the entire life of the process it caters to any command request that
matches that instance-ID (unless its a non instance specific command).
Routes/messages to zebra are tagged with instance-ID.
- zebra route/redistribute mechanisms are modified to work with
[protocol type + instance-id]
- bgpd now has ability to have multiple instance specific redistribution
for a protocol (OSPF only supported/tested for now).
- zlog ability to display instance-id besides the protocol/daemon name.
- Changes in other daemons are to because of the needed integration with
some of the modified APIs/routines. (Didn’t prefer replicating too many
separate instance specific APIs.)
- config/show/debug commands are modified to take instance-id argument
as appropriate.
Guidelines to start using multi-instance ospf
---------------------------------------------
The patch is backward compatible, i.e for any previous way of single ospf
deamon(router ospf <cr>) will continue to work as is, including all the
show commands etc.
To enable multiple instances, do the following:
1. service quagga stop
2. Modify /etc/quagga/daemons to add instance-ids of each desired
instance in the following format:
ospfd=“yes"
ospfd_instances="1,2,3"
assuming you want to enable 3 instances with those instance ids.
3. Create corresponding ospfd config files as ospfd-1.conf, ospfd-2.conf
and ospfd-3.conf.
4. service quagga start/restart
5. Verify that the deamons are started as expected. You should see
ospfd started with -n <instance-id> option.
ps –ef | grep quagga
With that /var/run/quagga/ should have ospfd-<instance-id>.pid and
ospfd-<instance-id>/vty to each instance.
6. vtysh to work with instances as you would with any other deamons.
7. Overall most quagga semantics are the same working with the instance
deamon, like it is for any other daemon.
NOTE:
To safeguard against errors leading to too many processes getting invoked,
a hard limit on number of instance-ids is in place, currently its 5.
Allowed instance-id range is <1-65535>
Once daemons are up, show running from vtysh should show the instance-id
of each daemon as 'router ospf <instance-id>’ (without needing explicit
configuration)
Instance-id can not be changed via vtysh, other router ospf configuration
is allowed as before.
Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
2015-05-20 03:03:42 +02:00
|
|
|
for (rn = route_top(ospf->maxage_lsa); rn; rn = route_next(rn)) {
|
|
|
|
if ((lsa = rn->info) != NULL) {
|
|
|
|
ospf_lsa_unlock(&lsa);
|
|
|
|
rn->info = NULL;
|
2021-05-31 15:27:51 +02:00
|
|
|
route_unlock_node(rn);
|
2017-07-17 14:03:14 +02:00
|
|
|
}
|
|
|
|
}
|
2012-12-04 19:46:37 +01:00
|
|
|
route_table_finish(ospf->maxage_lsa);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
if (ospf->old_table)
|
|
|
|
ospf_route_table_free(ospf->old_table);
|
|
|
|
if (ospf->new_table) {
|
2021-05-31 15:27:51 +02:00
|
|
|
if (!ospf->gr_info.prepare_in_progress)
|
|
|
|
ospf_route_delete(ospf, ospf->new_table);
|
2002-12-13 21:15:29 +01:00
|
|
|
ospf_route_table_free(ospf->new_table);
|
2017-07-17 14:03:14 +02:00
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
if (ospf->old_rtrs)
|
|
|
|
ospf_rtrs_free(ospf->old_rtrs);
|
|
|
|
if (ospf->new_rtrs)
|
|
|
|
ospf_rtrs_free(ospf->new_rtrs);
|
Multi-Instance OSPF Summary
——————————————-------------
- etc/init.d/quagga is modified to support creating separate ospf daemon
process for each instance. Each individual instance is monitored by
watchquagga just like any protocol daemons.(requires initd-mi.patch).
- Vtysh is modified to able to connect to multiple daemons of the same
protocol (supported for OSPF only for now).
- ospfd is modified to remember the Instance-ID that its invoked with. For
the entire life of the process it caters to any command request that
matches that instance-ID (unless its a non instance specific command).
Routes/messages to zebra are tagged with instance-ID.
- zebra route/redistribute mechanisms are modified to work with
[protocol type + instance-id]
- bgpd now has ability to have multiple instance specific redistribution
for a protocol (OSPF only supported/tested for now).
- zlog ability to display instance-id besides the protocol/daemon name.
- Changes in other daemons are to because of the needed integration with
some of the modified APIs/routines. (Didn’t prefer replicating too many
separate instance specific APIs.)
- config/show/debug commands are modified to take instance-id argument
as appropriate.
Guidelines to start using multi-instance ospf
---------------------------------------------
The patch is backward compatible, i.e for any previous way of single ospf
deamon(router ospf <cr>) will continue to work as is, including all the
show commands etc.
To enable multiple instances, do the following:
1. service quagga stop
2. Modify /etc/quagga/daemons to add instance-ids of each desired
instance in the following format:
ospfd=“yes"
ospfd_instances="1,2,3"
assuming you want to enable 3 instances with those instance ids.
3. Create corresponding ospfd config files as ospfd-1.conf, ospfd-2.conf
and ospfd-3.conf.
4. service quagga start/restart
5. Verify that the deamons are started as expected. You should see
ospfd started with -n <instance-id> option.
ps –ef | grep quagga
With that /var/run/quagga/ should have ospfd-<instance-id>.pid and
ospfd-<instance-id>/vty to each instance.
6. vtysh to work with instances as you would with any other deamons.
7. Overall most quagga semantics are the same working with the instance
deamon, like it is for any other daemon.
NOTE:
To safeguard against errors leading to too many processes getting invoked,
a hard limit on number of instance-ids is in place, currently its 5.
Allowed instance-id range is <1-65535>
Once daemons are up, show running from vtysh should show the instance-id
of each daemon as 'router ospf <instance-id>’ (without needing explicit
configuration)
Instance-id can not be changed via vtysh, other router ospf configuration
is allowed as before.
Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
2015-05-20 03:03:42 +02:00
|
|
|
if (ospf->new_external_route) {
|
2021-05-31 15:27:51 +02:00
|
|
|
if (!ospf->gr_info.prepare_in_progress)
|
|
|
|
ospf_route_delete(ospf, ospf->new_external_route);
|
2002-12-13 21:15:29 +01:00
|
|
|
ospf_route_table_free(ospf->new_external_route);
|
Multi-Instance OSPF Summary
——————————————-------------
- etc/init.d/quagga is modified to support creating separate ospf daemon
process for each instance. Each individual instance is monitored by
watchquagga just like any protocol daemons.(requires initd-mi.patch).
- Vtysh is modified to able to connect to multiple daemons of the same
protocol (supported for OSPF only for now).
- ospfd is modified to remember the Instance-ID that its invoked with. For
the entire life of the process it caters to any command request that
matches that instance-ID (unless its a non instance specific command).
Routes/messages to zebra are tagged with instance-ID.
- zebra route/redistribute mechanisms are modified to work with
[protocol type + instance-id]
- bgpd now has ability to have multiple instance specific redistribution
for a protocol (OSPF only supported/tested for now).
- zlog ability to display instance-id besides the protocol/daemon name.
- Changes in other daemons are to because of the needed integration with
some of the modified APIs/routines. (Didn’t prefer replicating too many
separate instance specific APIs.)
- config/show/debug commands are modified to take instance-id argument
as appropriate.
Guidelines to start using multi-instance ospf
---------------------------------------------
The patch is backward compatible, i.e for any previous way of single ospf
deamon(router ospf <cr>) will continue to work as is, including all the
show commands etc.
To enable multiple instances, do the following:
1. service quagga stop
2. Modify /etc/quagga/daemons to add instance-ids of each desired
instance in the following format:
ospfd=“yes"
ospfd_instances="1,2,3"
assuming you want to enable 3 instances with those instance ids.
3. Create corresponding ospfd config files as ospfd-1.conf, ospfd-2.conf
and ospfd-3.conf.
4. service quagga start/restart
5. Verify that the deamons are started as expected. You should see
ospfd started with -n <instance-id> option.
ps –ef | grep quagga
With that /var/run/quagga/ should have ospfd-<instance-id>.pid and
ospfd-<instance-id>/vty to each instance.
6. vtysh to work with instances as you would with any other deamons.
7. Overall most quagga semantics are the same working with the instance
deamon, like it is for any other daemon.
NOTE:
To safeguard against errors leading to too many processes getting invoked,
a hard limit on number of instance-ids is in place, currently its 5.
Allowed instance-id range is <1-65535>
Once daemons are up, show running from vtysh should show the instance-id
of each daemon as 'router ospf <instance-id>’ (without needing explicit
configuration)
Instance-id can not be changed via vtysh, other router ospf configuration
is allowed as before.
Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
2015-05-20 03:03:42 +02:00
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
if (ospf->old_external_route) {
|
2021-05-31 15:27:51 +02:00
|
|
|
if (!ospf->gr_info.prepare_in_progress)
|
|
|
|
ospf_route_delete(ospf, ospf->old_external_route);
|
2002-12-13 21:15:29 +01:00
|
|
|
ospf_route_table_free(ospf->old_external_route);
|
Multi-Instance OSPF Summary
——————————————-------------
- etc/init.d/quagga is modified to support creating separate ospf daemon
process for each instance. Each individual instance is monitored by
watchquagga just like any protocol daemons.(requires initd-mi.patch).
- Vtysh is modified to able to connect to multiple daemons of the same
protocol (supported for OSPF only for now).
- ospfd is modified to remember the Instance-ID that its invoked with. For
the entire life of the process it caters to any command request that
matches that instance-ID (unless its a non instance specific command).
Routes/messages to zebra are tagged with instance-ID.
- zebra route/redistribute mechanisms are modified to work with
[protocol type + instance-id]
- bgpd now has ability to have multiple instance specific redistribution
for a protocol (OSPF only supported/tested for now).
- zlog ability to display instance-id besides the protocol/daemon name.
- Changes in other daemons are to because of the needed integration with
some of the modified APIs/routines. (Didn’t prefer replicating too many
separate instance specific APIs.)
- config/show/debug commands are modified to take instance-id argument
as appropriate.
Guidelines to start using multi-instance ospf
---------------------------------------------
The patch is backward compatible, i.e for any previous way of single ospf
deamon(router ospf <cr>) will continue to work as is, including all the
show commands etc.
To enable multiple instances, do the following:
1. service quagga stop
2. Modify /etc/quagga/daemons to add instance-ids of each desired
instance in the following format:
ospfd=“yes"
ospfd_instances="1,2,3"
assuming you want to enable 3 instances with those instance ids.
3. Create corresponding ospfd config files as ospfd-1.conf, ospfd-2.conf
and ospfd-3.conf.
4. service quagga start/restart
5. Verify that the deamons are started as expected. You should see
ospfd started with -n <instance-id> option.
ps –ef | grep quagga
With that /var/run/quagga/ should have ospfd-<instance-id>.pid and
ospfd-<instance-id>/vty to each instance.
6. vtysh to work with instances as you would with any other deamons.
7. Overall most quagga semantics are the same working with the instance
deamon, like it is for any other daemon.
NOTE:
To safeguard against errors leading to too many processes getting invoked,
a hard limit on number of instance-ids is in place, currently its 5.
Allowed instance-id range is <1-65535>
Once daemons are up, show running from vtysh should show the instance-id
of each daemon as 'router ospf <instance-id>’ (without needing explicit
configuration)
Instance-id can not be changed via vtysh, other router ospf configuration
is allowed as before.
Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
2015-05-20 03:03:42 +02:00
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
if (ospf->external_lsas) {
|
|
|
|
ospf_ase_external_lsas_finish(ospf->external_lsas);
|
Multi-Instance OSPF Summary
——————————————-------------
- etc/init.d/quagga is modified to support creating separate ospf daemon
process for each instance. Each individual instance is monitored by
watchquagga just like any protocol daemons.(requires initd-mi.patch).
- Vtysh is modified to able to connect to multiple daemons of the same
protocol (supported for OSPF only for now).
- ospfd is modified to remember the Instance-ID that its invoked with. For
the entire life of the process it caters to any command request that
matches that instance-ID (unless its a non instance specific command).
Routes/messages to zebra are tagged with instance-ID.
- zebra route/redistribute mechanisms are modified to work with
[protocol type + instance-id]
- bgpd now has ability to have multiple instance specific redistribution
for a protocol (OSPF only supported/tested for now).
- zlog ability to display instance-id besides the protocol/daemon name.
- Changes in other daemons are to because of the needed integration with
some of the modified APIs/routines. (Didn’t prefer replicating too many
separate instance specific APIs.)
- config/show/debug commands are modified to take instance-id argument
as appropriate.
Guidelines to start using multi-instance ospf
---------------------------------------------
The patch is backward compatible, i.e for any previous way of single ospf
deamon(router ospf <cr>) will continue to work as is, including all the
show commands etc.
To enable multiple instances, do the following:
1. service quagga stop
2. Modify /etc/quagga/daemons to add instance-ids of each desired
instance in the following format:
ospfd=“yes"
ospfd_instances="1,2,3"
assuming you want to enable 3 instances with those instance ids.
3. Create corresponding ospfd config files as ospfd-1.conf, ospfd-2.conf
and ospfd-3.conf.
4. service quagga start/restart
5. Verify that the deamons are started as expected. You should see
ospfd started with -n <instance-id> option.
ps –ef | grep quagga
With that /var/run/quagga/ should have ospfd-<instance-id>.pid and
ospfd-<instance-id>/vty to each instance.
6. vtysh to work with instances as you would with any other deamons.
7. Overall most quagga semantics are the same working with the instance
deamon, like it is for any other daemon.
NOTE:
To safeguard against errors leading to too many processes getting invoked,
a hard limit on number of instance-ids is in place, currently its 5.
Allowed instance-id range is <1-65535>
Once daemons are up, show running from vtysh should show the instance-id
of each daemon as 'router ospf <instance-id>’ (without needing explicit
configuration)
Instance-id can not be changed via vtysh, other router ospf configuration
is allowed as before.
Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
2015-05-20 03:03:42 +02:00
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2003-03-25 06:07:42 +01:00
|
|
|
for (i = ZEBRA_ROUTE_SYSTEM; i <= ZEBRA_ROUTE_MAX; i++) {
|
Multi-Instance OSPF Summary
——————————————-------------
- etc/init.d/quagga is modified to support creating separate ospf daemon
process for each instance. Each individual instance is monitored by
watchquagga just like any protocol daemons.(requires initd-mi.patch).
- Vtysh is modified to able to connect to multiple daemons of the same
protocol (supported for OSPF only for now).
- ospfd is modified to remember the Instance-ID that its invoked with. For
the entire life of the process it caters to any command request that
matches that instance-ID (unless its a non instance specific command).
Routes/messages to zebra are tagged with instance-ID.
- zebra route/redistribute mechanisms are modified to work with
[protocol type + instance-id]
- bgpd now has ability to have multiple instance specific redistribution
for a protocol (OSPF only supported/tested for now).
- zlog ability to display instance-id besides the protocol/daemon name.
- Changes in other daemons are to because of the needed integration with
some of the modified APIs/routines. (Didn’t prefer replicating too many
separate instance specific APIs.)
- config/show/debug commands are modified to take instance-id argument
as appropriate.
Guidelines to start using multi-instance ospf
---------------------------------------------
The patch is backward compatible, i.e for any previous way of single ospf
deamon(router ospf <cr>) will continue to work as is, including all the
show commands etc.
To enable multiple instances, do the following:
1. service quagga stop
2. Modify /etc/quagga/daemons to add instance-ids of each desired
instance in the following format:
ospfd=“yes"
ospfd_instances="1,2,3"
assuming you want to enable 3 instances with those instance ids.
3. Create corresponding ospfd config files as ospfd-1.conf, ospfd-2.conf
and ospfd-3.conf.
4. service quagga start/restart
5. Verify that the deamons are started as expected. You should see
ospfd started with -n <instance-id> option.
ps –ef | grep quagga
With that /var/run/quagga/ should have ospfd-<instance-id>.pid and
ospfd-<instance-id>/vty to each instance.
6. vtysh to work with instances as you would with any other deamons.
7. Overall most quagga semantics are the same working with the instance
deamon, like it is for any other daemon.
NOTE:
To safeguard against errors leading to too many processes getting invoked,
a hard limit on number of instance-ids is in place, currently its 5.
Allowed instance-id range is <1-65535>
Once daemons are up, show running from vtysh should show the instance-id
of each daemon as 'router ospf <instance-id>’ (without needing explicit
configuration)
Instance-id can not be changed via vtysh, other router ospf configuration
is allowed as before.
Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
2015-05-20 03:03:42 +02:00
|
|
|
struct list *ext_list;
|
2003-03-25 06:07:42 +01:00
|
|
|
struct ospf_external *ext;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2017-11-21 02:21:03 +01:00
|
|
|
ext_list = ospf->external[i];
|
Multi-Instance OSPF Summary
——————————————-------------
- etc/init.d/quagga is modified to support creating separate ospf daemon
process for each instance. Each individual instance is monitored by
watchquagga just like any protocol daemons.(requires initd-mi.patch).
- Vtysh is modified to able to connect to multiple daemons of the same
protocol (supported for OSPF only for now).
- ospfd is modified to remember the Instance-ID that its invoked with. For
the entire life of the process it caters to any command request that
matches that instance-ID (unless its a non instance specific command).
Routes/messages to zebra are tagged with instance-ID.
- zebra route/redistribute mechanisms are modified to work with
[protocol type + instance-id]
- bgpd now has ability to have multiple instance specific redistribution
for a protocol (OSPF only supported/tested for now).
- zlog ability to display instance-id besides the protocol/daemon name.
- Changes in other daemons are to because of the needed integration with
some of the modified APIs/routines. (Didn’t prefer replicating too many
separate instance specific APIs.)
- config/show/debug commands are modified to take instance-id argument
as appropriate.
Guidelines to start using multi-instance ospf
---------------------------------------------
The patch is backward compatible, i.e for any previous way of single ospf
deamon(router ospf <cr>) will continue to work as is, including all the
show commands etc.
To enable multiple instances, do the following:
1. service quagga stop
2. Modify /etc/quagga/daemons to add instance-ids of each desired
instance in the following format:
ospfd=“yes"
ospfd_instances="1,2,3"
assuming you want to enable 3 instances with those instance ids.
3. Create corresponding ospfd config files as ospfd-1.conf, ospfd-2.conf
and ospfd-3.conf.
4. service quagga start/restart
5. Verify that the deamons are started as expected. You should see
ospfd started with -n <instance-id> option.
ps –ef | grep quagga
With that /var/run/quagga/ should have ospfd-<instance-id>.pid and
ospfd-<instance-id>/vty to each instance.
6. vtysh to work with instances as you would with any other deamons.
7. Overall most quagga semantics are the same working with the instance
deamon, like it is for any other daemon.
NOTE:
To safeguard against errors leading to too many processes getting invoked,
a hard limit on number of instance-ids is in place, currently its 5.
Allowed instance-id range is <1-65535>
Once daemons are up, show running from vtysh should show the instance-id
of each daemon as 'router ospf <instance-id>’ (without needing explicit
configuration)
Instance-id can not be changed via vtysh, other router ospf configuration
is allowed as before.
Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
2015-05-20 03:03:42 +02:00
|
|
|
if (!ext_list)
|
|
|
|
continue;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2019-07-03 01:06:22 +02:00
|
|
|
for (ALL_LIST_ELEMENTS(ext_list, node, nnode, ext)) {
|
Multi-Instance OSPF Summary
——————————————-------------
- etc/init.d/quagga is modified to support creating separate ospf daemon
process for each instance. Each individual instance is monitored by
watchquagga just like any protocol daemons.(requires initd-mi.patch).
- Vtysh is modified to able to connect to multiple daemons of the same
protocol (supported for OSPF only for now).
- ospfd is modified to remember the Instance-ID that its invoked with. For
the entire life of the process it caters to any command request that
matches that instance-ID (unless its a non instance specific command).
Routes/messages to zebra are tagged with instance-ID.
- zebra route/redistribute mechanisms are modified to work with
[protocol type + instance-id]
- bgpd now has ability to have multiple instance specific redistribution
for a protocol (OSPF only supported/tested for now).
- zlog ability to display instance-id besides the protocol/daemon name.
- Changes in other daemons are to because of the needed integration with
some of the modified APIs/routines. (Didn’t prefer replicating too many
separate instance specific APIs.)
- config/show/debug commands are modified to take instance-id argument
as appropriate.
Guidelines to start using multi-instance ospf
---------------------------------------------
The patch is backward compatible, i.e for any previous way of single ospf
deamon(router ospf <cr>) will continue to work as is, including all the
show commands etc.
To enable multiple instances, do the following:
1. service quagga stop
2. Modify /etc/quagga/daemons to add instance-ids of each desired
instance in the following format:
ospfd=“yes"
ospfd_instances="1,2,3"
assuming you want to enable 3 instances with those instance ids.
3. Create corresponding ospfd config files as ospfd-1.conf, ospfd-2.conf
and ospfd-3.conf.
4. service quagga start/restart
5. Verify that the deamons are started as expected. You should see
ospfd started with -n <instance-id> option.
ps –ef | grep quagga
With that /var/run/quagga/ should have ospfd-<instance-id>.pid and
ospfd-<instance-id>/vty to each instance.
6. vtysh to work with instances as you would with any other deamons.
7. Overall most quagga semantics are the same working with the instance
deamon, like it is for any other daemon.
NOTE:
To safeguard against errors leading to too many processes getting invoked,
a hard limit on number of instance-ids is in place, currently its 5.
Allowed instance-id range is <1-65535>
Once daemons are up, show running from vtysh should show the instance-id
of each daemon as 'router ospf <instance-id>’ (without needing explicit
configuration)
Instance-id can not be changed via vtysh, other router ospf configuration
is allowed as before.
Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
2015-05-20 03:03:42 +02:00
|
|
|
if (ext->external_info)
|
2002-12-13 21:15:29 +01:00
|
|
|
for (rn = route_top(ext->external_info); rn;
|
|
|
|
rn = route_next(rn)) {
|
2009-08-07 13:48:15 +02:00
|
|
|
if (rn->info == NULL)
|
Multi-Instance OSPF Summary
——————————————-------------
- etc/init.d/quagga is modified to support creating separate ospf daemon
process for each instance. Each individual instance is monitored by
watchquagga just like any protocol daemons.(requires initd-mi.patch).
- Vtysh is modified to able to connect to multiple daemons of the same
protocol (supported for OSPF only for now).
- ospfd is modified to remember the Instance-ID that its invoked with. For
the entire life of the process it caters to any command request that
matches that instance-ID (unless its a non instance specific command).
Routes/messages to zebra are tagged with instance-ID.
- zebra route/redistribute mechanisms are modified to work with
[protocol type + instance-id]
- bgpd now has ability to have multiple instance specific redistribution
for a protocol (OSPF only supported/tested for now).
- zlog ability to display instance-id besides the protocol/daemon name.
- Changes in other daemons are to because of the needed integration with
some of the modified APIs/routines. (Didn’t prefer replicating too many
separate instance specific APIs.)
- config/show/debug commands are modified to take instance-id argument
as appropriate.
Guidelines to start using multi-instance ospf
---------------------------------------------
The patch is backward compatible, i.e for any previous way of single ospf
deamon(router ospf <cr>) will continue to work as is, including all the
show commands etc.
To enable multiple instances, do the following:
1. service quagga stop
2. Modify /etc/quagga/daemons to add instance-ids of each desired
instance in the following format:
ospfd=“yes"
ospfd_instances="1,2,3"
assuming you want to enable 3 instances with those instance ids.
3. Create corresponding ospfd config files as ospfd-1.conf, ospfd-2.conf
and ospfd-3.conf.
4. service quagga start/restart
5. Verify that the deamons are started as expected. You should see
ospfd started with -n <instance-id> option.
ps –ef | grep quagga
With that /var/run/quagga/ should have ospfd-<instance-id>.pid and
ospfd-<instance-id>/vty to each instance.
6. vtysh to work with instances as you would with any other deamons.
7. Overall most quagga semantics are the same working with the instance
deamon, like it is for any other daemon.
NOTE:
To safeguard against errors leading to too many processes getting invoked,
a hard limit on number of instance-ids is in place, currently its 5.
Allowed instance-id range is <1-65535>
Once daemons are up, show running from vtysh should show the instance-id
of each daemon as 'router ospf <instance-id>’ (without needing explicit
configuration)
Instance-id can not be changed via vtysh, other router ospf configuration
is allowed as before.
Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
2015-05-20 03:03:42 +02:00
|
|
|
continue;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
XFREE(MTYPE_OSPF_EXTERNAL_INFO,
|
2003-03-25 06:07:42 +01:00
|
|
|
rn->info);
|
2002-12-13 21:15:29 +01:00
|
|
|
rn->info = NULL;
|
2012-12-04 19:46:37 +01:00
|
|
|
route_unlock_node(rn);
|
2017-07-17 14:03:14 +02:00
|
|
|
}
|
2019-02-27 21:08:29 +01:00
|
|
|
|
|
|
|
ospf_external_del(ospf, i, ext->instance);
|
2017-07-17 14:03:14 +02:00
|
|
|
}
|
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
|
Multi-Instance OSPF Summary
——————————————-------------
- etc/init.d/quagga is modified to support creating separate ospf daemon
process for each instance. Each individual instance is monitored by
watchquagga just like any protocol daemons.(requires initd-mi.patch).
- Vtysh is modified to able to connect to multiple daemons of the same
protocol (supported for OSPF only for now).
- ospfd is modified to remember the Instance-ID that its invoked with. For
the entire life of the process it caters to any command request that
matches that instance-ID (unless its a non instance specific command).
Routes/messages to zebra are tagged with instance-ID.
- zebra route/redistribute mechanisms are modified to work with
[protocol type + instance-id]
- bgpd now has ability to have multiple instance specific redistribution
for a protocol (OSPF only supported/tested for now).
- zlog ability to display instance-id besides the protocol/daemon name.
- Changes in other daemons are to because of the needed integration with
some of the modified APIs/routines. (Didn’t prefer replicating too many
separate instance specific APIs.)
- config/show/debug commands are modified to take instance-id argument
as appropriate.
Guidelines to start using multi-instance ospf
---------------------------------------------
The patch is backward compatible, i.e for any previous way of single ospf
deamon(router ospf <cr>) will continue to work as is, including all the
show commands etc.
To enable multiple instances, do the following:
1. service quagga stop
2. Modify /etc/quagga/daemons to add instance-ids of each desired
instance in the following format:
ospfd=“yes"
ospfd_instances="1,2,3"
assuming you want to enable 3 instances with those instance ids.
3. Create corresponding ospfd config files as ospfd-1.conf, ospfd-2.conf
and ospfd-3.conf.
4. service quagga start/restart
5. Verify that the deamons are started as expected. You should see
ospfd started with -n <instance-id> option.
ps –ef | grep quagga
With that /var/run/quagga/ should have ospfd-<instance-id>.pid and
ospfd-<instance-id>/vty to each instance.
6. vtysh to work with instances as you would with any other deamons.
7. Overall most quagga semantics are the same working with the instance
deamon, like it is for any other daemon.
NOTE:
To safeguard against errors leading to too many processes getting invoked,
a hard limit on number of instance-ids is in place, currently its 5.
Allowed instance-id range is <1-65535>
Once daemons are up, show running from vtysh should show the instance-id
of each daemon as 'router ospf <instance-id>’ (without needing explicit
configuration)
Instance-id can not be changed via vtysh, other router ospf configuration
is allowed as before.
Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
2015-05-20 03:03:42 +02:00
|
|
|
ospf_distance_reset(ospf);
|
|
|
|
route_table_finish(ospf->distance_table);
|
|
|
|
|
2020-08-15 10:27:40 +02:00
|
|
|
/* Release extrenal Aggregator table */
|
|
|
|
for (rn = route_top(ospf->rt_aggr_tbl); rn; rn = route_next(rn)) {
|
|
|
|
struct ospf_external_aggr_rt *aggr;
|
|
|
|
|
|
|
|
aggr = rn->info;
|
|
|
|
|
|
|
|
if (aggr) {
|
|
|
|
ospf_external_aggregator_free(aggr);
|
|
|
|
rn->info = NULL;
|
|
|
|
route_unlock_node(rn);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
route_table_finish(ospf->rt_aggr_tbl);
|
|
|
|
|
|
|
|
|
2022-11-22 10:59:40 +01:00
|
|
|
ospf_free_refresh_queue(ospf);
|
|
|
|
|
2019-07-12 04:36:06 +02:00
|
|
|
list_delete(&ospf->areas);
|
|
|
|
list_delete(&ospf->oi_write_q);
|
|
|
|
|
2020-08-21 19:03:05 +02:00
|
|
|
/* Reset GR helper data structers */
|
2021-05-31 15:27:51 +02:00
|
|
|
ospf_gr_helper_instance_stop(ospf);
|
2020-08-21 19:03:05 +02:00
|
|
|
|
2019-07-12 04:36:06 +02:00
|
|
|
close(ospf->fd);
|
|
|
|
stream_free(ospf->ibuf);
|
|
|
|
ospf->fd = -1;
|
2021-02-11 11:05:12 +01:00
|
|
|
ospf->max_multipath = MULTIPATH_NUM;
|
2003-04-04 04:44:16 +02:00
|
|
|
ospf_delete(ospf);
|
Multi-Instance OSPF Summary
——————————————-------------
- etc/init.d/quagga is modified to support creating separate ospf daemon
process for each instance. Each individual instance is monitored by
watchquagga just like any protocol daemons.(requires initd-mi.patch).
- Vtysh is modified to able to connect to multiple daemons of the same
protocol (supported for OSPF only for now).
- ospfd is modified to remember the Instance-ID that its invoked with. For
the entire life of the process it caters to any command request that
matches that instance-ID (unless its a non instance specific command).
Routes/messages to zebra are tagged with instance-ID.
- zebra route/redistribute mechanisms are modified to work with
[protocol type + instance-id]
- bgpd now has ability to have multiple instance specific redistribution
for a protocol (OSPF only supported/tested for now).
- zlog ability to display instance-id besides the protocol/daemon name.
- Changes in other daemons are to because of the needed integration with
some of the modified APIs/routines. (Didn’t prefer replicating too many
separate instance specific APIs.)
- config/show/debug commands are modified to take instance-id argument
as appropriate.
Guidelines to start using multi-instance ospf
---------------------------------------------
The patch is backward compatible, i.e for any previous way of single ospf
deamon(router ospf <cr>) will continue to work as is, including all the
show commands etc.
To enable multiple instances, do the following:
1. service quagga stop
2. Modify /etc/quagga/daemons to add instance-ids of each desired
instance in the following format:
ospfd=“yes"
ospfd_instances="1,2,3"
assuming you want to enable 3 instances with those instance ids.
3. Create corresponding ospfd config files as ospfd-1.conf, ospfd-2.conf
and ospfd-3.conf.
4. service quagga start/restart
5. Verify that the deamons are started as expected. You should see
ospfd started with -n <instance-id> option.
ps –ef | grep quagga
With that /var/run/quagga/ should have ospfd-<instance-id>.pid and
ospfd-<instance-id>/vty to each instance.
6. vtysh to work with instances as you would with any other deamons.
7. Overall most quagga semantics are the same working with the instance
deamon, like it is for any other daemon.
NOTE:
To safeguard against errors leading to too many processes getting invoked,
a hard limit on number of instance-ids is in place, currently its 5.
Allowed instance-id range is <1-65535>
Once daemons are up, show running from vtysh should show the instance-id
of each daemon as 'router ospf <instance-id>’ (without needing explicit
configuration)
Instance-id can not be changed via vtysh, other router ospf configuration
is allowed as before.
Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
2015-05-20 03:03:42 +02:00
|
|
|
|
2021-06-02 04:51:49 +02:00
|
|
|
if (vrf)
|
|
|
|
ospf_vrf_unlink(ospf, vrf);
|
2017-08-25 22:51:12 +02:00
|
|
|
|
*: rework renaming the default VRF
Currently, it is possible to rename the default VRF either by passing
`-o` option to zebra or by creating a file in `/var/run/netns` and
binding it to `/proc/self/ns/net`.
In both cases, only zebra knows about the rename and other daemons learn
about it only after they connect to zebra. This is a problem, because
daemons may read their config before they connect to zebra. To handle
this rename after the config is read, we have some special code in every
single daemon, which is not very bad but not desirable in my opinion.
But things are getting worse when we need to handle this in northbound
layer as we have to manually rewrite the config nodes. This approach is
already hacky, but still works as every daemon handles its own NB
structures. But it is completely incompatible with the central
management daemon architecture we are aiming for, as mgmtd doesn't even
have a connection with zebra to learn from it. And it shouldn't have it,
because operational state changes should never affect configuration.
To solve the problem and simplify the code, I propose to expand the `-o`
option to all daemons. By using the startup option, we let daemons know
about the rename before they read their configs so we don't need any
special code to deal with it. There's an easy way to pass the option to
all daemons by using `frr_global_options` variable.
Unfortunately, the second way of renaming by creating a file in
`/var/run/netns` is incompatible with the new mgmtd architecture.
Theoretically, we could force daemons to read their configs only after
they connect to zebra, but it means adding even more code to handle a
very specific use-case. And anyway this won't work for mgmtd as it
doesn't have a connection with zebra. So I had to remove this option.
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-12-03 23:22:55 +01:00
|
|
|
XFREE(MTYPE_OSPF_TOP, ospf->name);
|
Multi-Instance OSPF Summary
——————————————-------------
- etc/init.d/quagga is modified to support creating separate ospf daemon
process for each instance. Each individual instance is monitored by
watchquagga just like any protocol daemons.(requires initd-mi.patch).
- Vtysh is modified to able to connect to multiple daemons of the same
protocol (supported for OSPF only for now).
- ospfd is modified to remember the Instance-ID that its invoked with. For
the entire life of the process it caters to any command request that
matches that instance-ID (unless its a non instance specific command).
Routes/messages to zebra are tagged with instance-ID.
- zebra route/redistribute mechanisms are modified to work with
[protocol type + instance-id]
- bgpd now has ability to have multiple instance specific redistribution
for a protocol (OSPF only supported/tested for now).
- zlog ability to display instance-id besides the protocol/daemon name.
- Changes in other daemons are to because of the needed integration with
some of the modified APIs/routines. (Didn’t prefer replicating too many
separate instance specific APIs.)
- config/show/debug commands are modified to take instance-id argument
as appropriate.
Guidelines to start using multi-instance ospf
---------------------------------------------
The patch is backward compatible, i.e for any previous way of single ospf
deamon(router ospf <cr>) will continue to work as is, including all the
show commands etc.
To enable multiple instances, do the following:
1. service quagga stop
2. Modify /etc/quagga/daemons to add instance-ids of each desired
instance in the following format:
ospfd=“yes"
ospfd_instances="1,2,3"
assuming you want to enable 3 instances with those instance ids.
3. Create corresponding ospfd config files as ospfd-1.conf, ospfd-2.conf
and ospfd-3.conf.
4. service quagga start/restart
5. Verify that the deamons are started as expected. You should see
ospfd started with -n <instance-id> option.
ps –ef | grep quagga
With that /var/run/quagga/ should have ospfd-<instance-id>.pid and
ospfd-<instance-id>/vty to each instance.
6. vtysh to work with instances as you would with any other deamons.
7. Overall most quagga semantics are the same working with the instance
deamon, like it is for any other daemon.
NOTE:
To safeguard against errors leading to too many processes getting invoked,
a hard limit on number of instance-ids is in place, currently its 5.
Allowed instance-id range is <1-65535>
Once daemons are up, show running from vtysh should show the instance-id
of each daemon as 'router ospf <instance-id>’ (without needing explicit
configuration)
Instance-id can not be changed via vtysh, other router ospf configuration
is allowed as before.
Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
2015-05-20 03:03:42 +02:00
|
|
|
XFREE(MTYPE_OSPF_TOP, ospf);
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
2014-06-04 06:53:35 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* allocate new OSPF Area object */
|
2020-08-05 10:44:21 +02:00
|
|
|
struct ospf_area *ospf_area_new(struct ospf *ospf, struct in_addr area_id)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
|
|
|
struct ospf_area *new;
|
|
|
|
|
|
|
|
/* Allocate new config_network. */
|
|
|
|
new = XCALLOC(MTYPE_OSPF_AREA, sizeof(struct ospf_area));
|
|
|
|
|
2003-03-25 06:07:42 +01:00
|
|
|
new->ospf = ospf;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
new->area_id = area_id;
|
2017-05-19 20:38:02 +02:00
|
|
|
new->area_id_fmt = OSPF_AREA_ID_FMT_DOTTEDQUAD;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
new->external_routing = OSPF_AREA_DEFAULT;
|
|
|
|
new->default_cost = 1;
|
|
|
|
new->auth_type = OSPF_AUTH_NULL;
|
|
|
|
|
|
|
|
/* New LSDB init. */
|
|
|
|
new->lsdb = ospf_lsdb_new();
|
|
|
|
|
|
|
|
/* Self-originated LSAs initialize. */
|
|
|
|
new->router_lsa_self = NULL;
|
|
|
|
|
|
|
|
ospf_opaque_type10_lsa_init(new);
|
|
|
|
|
2003-03-25 06:07:42 +01:00
|
|
|
new->oiflist = list_new();
|
2002-12-13 21:15:29 +01:00
|
|
|
new->ranges = route_table_init();
|
|
|
|
|
|
|
|
if (area_id.s_addr == OSPF_AREA_BACKBONE)
|
2003-03-25 06:07:42 +01:00
|
|
|
ospf->backbone = new;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
return new;
|
|
|
|
}
|
|
|
|
|
2020-12-23 14:20:22 +01:00
|
|
|
void ospf_area_lsdb_discard_delete(struct ospf_area *area)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
2003-03-25 06:07:42 +01:00
|
|
|
struct route_node *rn;
|
|
|
|
struct ospf_lsa *lsa;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2003-03-25 06:07:42 +01:00
|
|
|
LSDB_LOOP (ROUTER_LSDB(area), rn, lsa)
|
2018-01-17 19:28:17 +01:00
|
|
|
ospf_discard_from_db(area->ospf, area->lsdb, lsa);
|
2003-03-25 06:07:42 +01:00
|
|
|
LSDB_LOOP (NETWORK_LSDB(area), rn, lsa)
|
2018-01-17 19:28:17 +01:00
|
|
|
ospf_discard_from_db(area->ospf, area->lsdb, lsa);
|
2003-03-25 06:07:42 +01:00
|
|
|
LSDB_LOOP (SUMMARY_LSDB(area), rn, lsa)
|
2018-01-17 19:28:17 +01:00
|
|
|
ospf_discard_from_db(area->ospf, area->lsdb, lsa);
|
2003-03-25 06:07:42 +01:00
|
|
|
LSDB_LOOP (ASBR_SUMMARY_LSDB(area), rn, lsa)
|
2018-01-17 19:28:17 +01:00
|
|
|
ospf_discard_from_db(area->ospf, area->lsdb, lsa);
|
2003-03-25 06:07:42 +01:00
|
|
|
|
|
|
|
LSDB_LOOP (NSSA_LSDB(area), rn, lsa)
|
2018-01-17 19:28:17 +01:00
|
|
|
ospf_discard_from_db(area->ospf, area->lsdb, lsa);
|
2003-03-25 06:07:42 +01:00
|
|
|
LSDB_LOOP (OPAQUE_AREA_LSDB(area), rn, lsa)
|
2018-01-17 19:28:17 +01:00
|
|
|
ospf_discard_from_db(area->ospf, area->lsdb, lsa);
|
2003-03-25 06:07:42 +01:00
|
|
|
LSDB_LOOP (OPAQUE_LINK_LSDB(area), rn, lsa)
|
2018-01-17 19:28:17 +01:00
|
|
|
ospf_discard_from_db(area->ospf, area->lsdb, lsa);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2003-03-25 06:07:42 +01:00
|
|
|
ospf_lsdb_delete_all(area->lsdb);
|
2020-12-23 14:20:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void ospf_area_free(struct ospf_area *area)
|
|
|
|
{
|
|
|
|
ospf_opaque_type10_lsa_term(area);
|
|
|
|
|
|
|
|
/* Free LSDBs. */
|
|
|
|
ospf_area_lsdb_discard_delete(area);
|
|
|
|
|
2003-03-25 06:07:42 +01:00
|
|
|
ospf_lsdb_free(area->lsdb);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
ospf_lsa_unlock(&area->router_lsa_self);
|
|
|
|
|
|
|
|
route_table_finish(area->ranges);
|
2018-10-02 11:39:51 +02:00
|
|
|
list_delete(&area->oiflist);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
if (EXPORT_NAME(area))
|
|
|
|
free(EXPORT_NAME(area));
|
|
|
|
|
|
|
|
if (IMPORT_NAME(area))
|
|
|
|
free(IMPORT_NAME(area));
|
|
|
|
|
|
|
|
/* Cancel timer. */
|
2022-06-03 16:28:11 +02:00
|
|
|
THREAD_OFF(area->t_stub_router);
|
|
|
|
THREAD_OFF(area->t_opaque_lsa_self);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
if (OSPF_IS_AREA_BACKBONE(area))
|
|
|
|
area->ospf->backbone = NULL;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
XFREE(MTYPE_OSPF_AREA, area);
|
|
|
|
}
|
|
|
|
|
2003-03-25 06:07:42 +01:00
|
|
|
void ospf_area_check_free(struct ospf *ospf, struct in_addr area_id)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
|
|
|
struct ospf_area *area;
|
|
|
|
|
2003-03-25 06:07:42 +01:00
|
|
|
area = ospf_area_lookup_by_area_id(ospf, area_id);
|
2002-12-13 21:15:29 +01:00
|
|
|
if (area && listcount(area->oiflist) == 0 && area->ranges->top == NULL
|
2018-10-25 09:02:24 +02:00
|
|
|
&& !ospf_vl_count(ospf, area)
|
2002-12-13 21:15:29 +01:00
|
|
|
&& area->shortcut_configured == OSPF_SHORTCUT_DEFAULT
|
|
|
|
&& area->external_routing == OSPF_AREA_DEFAULT
|
|
|
|
&& area->no_summary == 0 && area->default_cost == 1
|
|
|
|
&& EXPORT_NAME(area) == NULL && IMPORT_NAME(area) == NULL
|
|
|
|
&& area->auth_type == OSPF_AUTH_NULL) {
|
2003-03-25 06:07:42 +01:00
|
|
|
listnode_delete(ospf->areas, area);
|
2002-12-13 21:15:29 +01:00
|
|
|
ospf_area_free(area);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-05-19 20:38:02 +02:00
|
|
|
struct ospf_area *ospf_area_get(struct ospf *ospf, struct in_addr area_id)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
|
|
|
struct ospf_area *area;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2003-03-25 06:07:42 +01:00
|
|
|
area = ospf_area_lookup_by_area_id(ospf, area_id);
|
2002-12-13 21:15:29 +01:00
|
|
|
if (!area) {
|
2003-03-25 06:07:42 +01:00
|
|
|
area = ospf_area_new(ospf, area_id);
|
|
|
|
listnode_add_sort(ospf->areas, area);
|
|
|
|
ospf_check_abr_status(ospf);
|
2012-12-03 20:17:24 +01:00
|
|
|
if (ospf->stub_router_admin_set
|
|
|
|
== OSPF_STUB_ROUTER_ADMINISTRATIVE_SET) {
|
|
|
|
SET_FLAG(area->stub_router_state,
|
|
|
|
OSPF_AREA_ADMIN_STUB_ROUTED);
|
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return area;
|
|
|
|
}
|
|
|
|
|
2003-03-25 06:07:42 +01:00
|
|
|
struct ospf_area *ospf_area_lookup_by_area_id(struct ospf *ospf,
|
|
|
|
struct in_addr area_id)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
|
|
|
struct ospf_area *area;
|
2004-09-23 21:18:23 +02:00
|
|
|
struct listnode *node;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
for (ALL_LIST_ELEMENTS_RO(ospf->areas, node, area))
|
|
|
|
if (IPV4_ADDR_SAME(&area->area_id, &area_id))
|
|
|
|
return area;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ospf_area_add_if(struct ospf_area *area, struct ospf_interface *oi)
|
|
|
|
{
|
|
|
|
listnode_add(area->oiflist, oi);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ospf_area_del_if(struct ospf_area *area, struct ospf_interface *oi)
|
|
|
|
{
|
|
|
|
listnode_delete(area->oiflist, oi);
|
|
|
|
}
|
|
|
|
|
2009-08-27 17:51:42 +02:00
|
|
|
|
2020-08-05 10:44:21 +02:00
|
|
|
struct ospf_interface *add_ospf_interface(struct connected *co,
|
|
|
|
struct ospf_area *area)
|
2009-08-07 13:48:15 +02:00
|
|
|
{
|
|
|
|
struct ospf_interface *oi;
|
|
|
|
|
|
|
|
oi = ospf_if_new(area->ospf, co->ifp, co->address);
|
|
|
|
oi->connected = co;
|
|
|
|
|
2009-08-27 17:51:42 +02:00
|
|
|
oi->area = area;
|
2009-08-07 13:48:15 +02:00
|
|
|
|
|
|
|
oi->params = ospf_lookup_if_params(co->ifp, oi->address->u.prefix4);
|
|
|
|
oi->output_cost = ospf_if_get_output_cost(oi);
|
|
|
|
|
|
|
|
/* Relate ospf interface to ospf instance. */
|
2009-08-27 17:51:42 +02:00
|
|
|
oi->ospf = area->ospf;
|
2009-08-07 13:48:15 +02:00
|
|
|
|
|
|
|
/* update network type as interface flag */
|
|
|
|
/* If network type is specified previously,
|
|
|
|
skip network type setting. */
|
|
|
|
oi->type = IF_DEF_PARAMS(co->ifp)->type;
|
2021-02-17 01:51:52 +01:00
|
|
|
oi->ptp_dmvpn = IF_DEF_PARAMS(co->ifp)->ptp_dmvpn;
|
2009-08-07 13:48:15 +02:00
|
|
|
|
|
|
|
/* Add pseudo neighbor. */
|
|
|
|
ospf_nbr_self_reset(oi, oi->ospf->router_id);
|
|
|
|
|
2009-08-27 17:51:42 +02:00
|
|
|
ospf_area_add_if(oi->area, oi);
|
|
|
|
|
2020-07-22 19:31:14 +02:00
|
|
|
/* if LDP-IGP Sync is configured globally inherit config */
|
|
|
|
ospf_ldp_sync_if_init(oi);
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
/*
|
2022-02-14 18:53:16 +01:00
|
|
|
* if router_id is not configured, don't bring up
|
2009-08-27 17:51:42 +02:00
|
|
|
* interfaces.
|
|
|
|
* ospf_router_id_update() will call ospf_if_update
|
|
|
|
* whenever r-id is configured instead.
|
2017-07-17 14:03:14 +02:00
|
|
|
*/
|
2020-02-06 07:49:02 +01:00
|
|
|
if ((area->ospf->router_id.s_addr != INADDR_ANY)
|
|
|
|
&& if_is_operative(co->ifp))
|
2009-08-27 17:51:42 +02:00
|
|
|
ospf_if_up(oi);
|
2020-08-05 10:44:21 +02:00
|
|
|
|
|
|
|
return oi;
|
2009-08-07 13:48:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static void update_redistributed(struct ospf *ospf, int add_to_ospf)
|
|
|
|
{
|
|
|
|
struct route_node *rn;
|
|
|
|
struct external_info *ei;
|
|
|
|
struct ospf_external *ext;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2017-11-21 02:21:03 +01:00
|
|
|
if (ospf_is_type_redistributed(ospf, ZEBRA_ROUTE_CONNECT, 0)) {
|
|
|
|
ext = ospf_external_lookup(ospf, ZEBRA_ROUTE_CONNECT, 0);
|
|
|
|
if ((ext) && EXTERNAL_INFO(ext)) {
|
2009-08-07 13:48:15 +02:00
|
|
|
for (rn = route_top(EXTERNAL_INFO(ext)); rn;
|
|
|
|
rn = route_next(rn)) {
|
2017-11-21 02:21:03 +01:00
|
|
|
ei = rn->info;
|
|
|
|
if (ei == NULL)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (add_to_ospf) {
|
|
|
|
if (ospf_external_info_find_lsa(ospf,
|
|
|
|
&ei->p))
|
2021-08-10 18:24:47 +02:00
|
|
|
if (!ospf_redistribute_check(
|
|
|
|
ospf, ei, NULL))
|
2017-11-21 02:21:03 +01:00
|
|
|
ospf_external_lsa_flush(
|
|
|
|
ospf, ei->type,
|
|
|
|
&ei->p,
|
|
|
|
ei->ifindex /*, ei->nexthop */);
|
|
|
|
} else {
|
|
|
|
if (!ospf_external_info_find_lsa(
|
|
|
|
ospf, &ei->p))
|
2021-08-10 18:24:47 +02:00
|
|
|
if (ospf_redistribute_check(
|
|
|
|
ospf, ei, NULL))
|
2017-11-21 02:21:03 +01:00
|
|
|
ospf_external_lsa_originate(
|
|
|
|
ospf, ei);
|
2009-08-07 13:48:15 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2017-11-21 02:21:03 +01:00
|
|
|
}
|
2009-08-07 13:48:15 +02:00
|
|
|
}
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Config network statement related functions. */
|
2017-05-19 20:38:02 +02:00
|
|
|
static struct ospf_network *ospf_network_new(struct in_addr area_id)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
|
|
|
struct ospf_network *new;
|
|
|
|
new = XCALLOC(MTYPE_OSPF_NETWORK, sizeof(struct ospf_network));
|
|
|
|
|
|
|
|
new->area_id = area_id;
|
2017-05-19 20:38:02 +02:00
|
|
|
new->area_id_fmt = OSPF_AREA_ID_FMT_DOTTEDQUAD;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
return new;
|
|
|
|
}
|
|
|
|
|
2003-03-25 06:07:42 +01:00
|
|
|
static void ospf_network_free(struct ospf *ospf, struct ospf_network *network)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
2003-03-25 06:07:42 +01:00
|
|
|
ospf_area_check_free(ospf, network->area_id);
|
|
|
|
ospf_schedule_abr_task(ospf);
|
2002-12-13 21:15:29 +01:00
|
|
|
XFREE(MTYPE_OSPF_NETWORK, network);
|
|
|
|
}
|
|
|
|
|
|
|
|
int ospf_network_set(struct ospf *ospf, struct prefix_ipv4 *p,
|
2017-05-19 20:38:02 +02:00
|
|
|
struct in_addr area_id, int df)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
|
|
|
struct ospf_network *network;
|
|
|
|
struct ospf_area *area;
|
|
|
|
struct route_node *rn;
|
|
|
|
|
|
|
|
rn = route_node_get(ospf->networks, (struct prefix *)p);
|
|
|
|
if (rn->info) {
|
2018-01-08 22:16:18 +01:00
|
|
|
network = rn->info;
|
2002-12-13 21:15:29 +01:00
|
|
|
route_unlock_node(rn);
|
2018-01-08 22:16:18 +01:00
|
|
|
|
|
|
|
if (IPV4_ADDR_SAME(&area_id, &network->area_id)) {
|
|
|
|
return 1;
|
|
|
|
} else {
|
|
|
|
/* There is already same network statement. */
|
|
|
|
return 0;
|
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
2017-05-19 20:38:02 +02:00
|
|
|
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);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
/* Run network config now. */
|
2008-09-02 20:06:31 +02:00
|
|
|
ospf_network_run((struct prefix *)p, area);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
/* Update connected redistribute. */
|
2009-08-07 13:48:15 +02:00
|
|
|
update_redistributed(ospf, 1); /* interfaces possibly added */
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2003-03-25 06:07:42 +01:00
|
|
|
ospf_area_check_free(ospf, area_id);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
int ospf_network_unset(struct ospf *ospf, struct prefix_ipv4 *p,
|
|
|
|
struct in_addr area_id)
|
|
|
|
{
|
|
|
|
struct route_node *rn;
|
|
|
|
struct ospf_network *network;
|
2008-09-02 20:06:31 +02:00
|
|
|
struct listnode *node, *nnode;
|
|
|
|
struct ospf_interface *oi;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
rn = route_node_lookup(ospf->networks, (struct prefix *)p);
|
|
|
|
if (rn == NULL)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
network = rn->info;
|
2009-06-04 01:44:21 +02:00
|
|
|
route_unlock_node(rn);
|
2002-12-13 21:15:29 +01:00
|
|
|
if (!IPV4_ADDR_SAME(&area_id, &network->area_id))
|
|
|
|
return 0;
|
|
|
|
|
2003-03-25 06:07:42 +01:00
|
|
|
ospf_network_free(ospf, rn->info);
|
2002-12-13 21:15:29 +01:00
|
|
|
rn->info = NULL;
|
2009-06-04 01:44:21 +02:00
|
|
|
route_unlock_node(rn); /* initial reference */
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2017-08-01 20:47:02 +02:00
|
|
|
/* Find interfaces that are not configured already. */
|
2008-09-02 20:06:31 +02:00
|
|
|
for (ALL_LIST_ELEMENTS(ospf->oiflist, node, nnode, oi)) {
|
2017-08-01 20:47:02 +02:00
|
|
|
|
|
|
|
if (oi->type == OSPF_IFTYPE_VIRTUALLINK)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
ospf_network_run_subnet(ospf, oi->connected, NULL, NULL);
|
2008-09-02 20:06:31 +02:00
|
|
|
}
|
2009-08-07 13:48:15 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Update connected redistribute. */
|
2009-08-07 13:48:15 +02:00
|
|
|
update_redistributed(ospf, 0); /* interfaces possibly removed */
|
|
|
|
ospf_area_check_free(ospf, area_id);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2009-08-07 13:48:15 +02:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2009-08-27 17:51:42 +02:00
|
|
|
/* Ensure there's an OSPF instance, as "ip ospf area" enabled OSPF means
|
|
|
|
* there might not be any 'router ospf' config.
|
|
|
|
*
|
|
|
|
* Otherwise, doesn't do anything different to ospf_if_update for now
|
|
|
|
*/
|
2017-08-25 22:51:12 +02:00
|
|
|
void ospf_interface_area_set(struct ospf *ospf, struct interface *ifp)
|
2009-08-07 13:48:15 +02:00
|
|
|
{
|
2017-08-25 22:51:12 +02:00
|
|
|
if (!ospf)
|
|
|
|
return;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2009-08-27 17:51:42 +02:00
|
|
|
ospf_if_update(ospf, ifp);
|
|
|
|
/* if_update does a update_redistributed */
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2009-08-27 17:51:42 +02:00
|
|
|
return;
|
2009-08-07 13:48:15 +02:00
|
|
|
}
|
|
|
|
|
2017-08-25 22:51:12 +02:00
|
|
|
void ospf_interface_area_unset(struct ospf *ospf, struct interface *ifp)
|
2009-08-07 13:48:15 +02:00
|
|
|
{
|
2009-08-27 17:51:42 +02:00
|
|
|
struct route_node *rn_oi;
|
2009-08-07 13:48:15 +02:00
|
|
|
|
|
|
|
if (!ospf)
|
2009-08-27 17:51:42 +02:00
|
|
|
return; /* Ospf not ready yet */
|
2009-08-07 13:48:15 +02:00
|
|
|
|
2009-08-27 17:51:42 +02:00
|
|
|
/* Find interfaces that may need to be removed. */
|
|
|
|
for (rn_oi = route_top(IF_OIFS(ifp)); rn_oi;
|
|
|
|
rn_oi = route_next(rn_oi)) {
|
2017-08-25 22:51:12 +02:00
|
|
|
struct ospf_interface *oi = NULL;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2009-08-27 17:51:42 +02:00
|
|
|
if ((oi = rn_oi->info) == NULL)
|
|
|
|
continue;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2009-08-07 13:48:15 +02:00
|
|
|
if (oi->type == OSPF_IFTYPE_VIRTUALLINK)
|
2009-08-27 17:51:42 +02:00
|
|
|
continue;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2009-08-27 17:51:42 +02:00
|
|
|
ospf_network_run_subnet(ospf, oi->connected, NULL, NULL);
|
2009-08-07 13:48:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Update connected redistribute. */
|
|
|
|
update_redistributed(ospf, 0); /* interfaces possibly removed */
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
2003-01-25 07:47:41 +01:00
|
|
|
/* Check whether interface matches given network
|
|
|
|
* returns: 1, true. 0, false
|
|
|
|
*/
|
2009-12-03 17:07:00 +01:00
|
|
|
static int ospf_network_match_iface(const struct connected *co,
|
|
|
|
const struct prefix *net)
|
2003-01-25 07:47:41 +01:00
|
|
|
{
|
[PtP over ethernet] New peer flag allows much more addressing flexibility
2006-12-12 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
* if.h: (struct connected) Add new ZEBRA_IFA_PEER flag indicating
whether a peer address has been configured. Comment now shows
the new interpretation of the destination addr: if ZEBRA_IFA_PEER
is set, then it must contain the destination address, otherwise
it may contain the broadcast address or be NULL.
(CONNECTED_DEST_HOST,CONNECTED_POINTOPOINT_HOST) Remove obsolete
macros that were specific to IPv4 and not fully general.
(CONNECTED_PEER) New macro to check ZEBRA_IFA_PEER flag.
(CONNECTED_PREFIX) New macro giving the prefix to insert into
the RIB: if CONNECTED_PEER, then use the destination (peer) address,
else use the address field.
(CONNECTED_ID) New macro to come up with an identifying address
for the struct connected.
* if.c: (if_lookup_address, connected_lookup_address) Streamline
logic with new CONNECTED_PREFIX macro.
* prefix.h: (PREFIX_COPY_IPV4, PREFIX_COPY_IPV6) New macros
for better performance than the general prefix_copy function.
* zclient.c: (zebra_interface_address_read) For non-null destination
addresses, set prefixlen to equal the address prefixlen. This
is needed to get the new CONNECTED_PREFIX macro to work properly.
* connected.c: (connected_up_ipv4, connected_down_ipv4,
connected_up_ipv6, connected_down_ipv6) Simplify logic using the
new CONNECTED_PREFIX macro.
(connected_add_ipv4) Set prefixlen in destination addresses (required
by the CONNECTED_PREFIX macro). Use CONNECTED_PEER macro instead
of testing for IFF_POINTOPOINT. Delete invalid warning message.
Warn about cases where the ZEBRA_IFA_PEER is set but no
destination address has been supplied (and turn off the flag).
(connected_add_ipv6) Add new flags argument so callers may set
the ZEBRA_IFA_PEER flag. If peer/broadcast address satisfies
IN6_IS_ADDR_UNSPECIFIED, then reject it with a warning.
Set prefixlen in destination address so CONNECTED_PREFIX will work.
* connected.h: (connected_add_ipv6) Add new flags argument so
callers may set the ZEBRA_IFA_PEER flag.
* interface.c: (connected_dump_vty) Use CONNECTED_PEER macro
to decide whether the destination address is a peer or broadcast
address (instead of checking IFF_BROADCAST and IFF_POINTOPOINT).
* if_ioctl.c: (if_getaddrs) Instead of setting a peer address
only when the IFF_POINTOPOINT is set, we now accept a peer
address whenever it is available and not the same as the local
address. Otherwise (no peer address assigned), we check
for a broadcast address (regardless of the IFF_BROADCAST flag).
And must now pass a flags value of ZEBRA_IFA_PEER to
connected_add_ipv4 when a peer address is assigned.
The same new logic is used with the IPv6 code as well (and we
pass the new flags argument to connected_add_ipv6).
(if_get_addr) Do not bother to check IFF_POINTOPOINT: just
issue the SIOCGIFDSTADDR ioctl and see if we get back
a peer address not matching the local address (and set
the ZEBRA_IFA_PEER in that case). If there's no peer address,
try to grab SIOCGIFBRDADDR regardless of whether IFF_BROADCAST is set.
* if_ioctl_solaris.c: (if_get_addr) Just try the SIOCGLIFDSTADDR ioctl
without bothering to check the IFF_POINTOPOINT flag. And if
no peer address was found, just try the SIOCGLIFBRDADDR ioctl
without checking the IFF_BROADCAST flag. Call connected_add_ipv4
and connected_add_ipv6 with appropriate flags.
* if_proc.c: (ifaddr_proc_ipv6) Must pass new flags argument to
connected_add_ipv6.
* kernel_socket.c: (ifam_read) Must pass new flags argument to
connected_add_ipv6.
* rt_netlink.c: (netlink_interface_addr) Copy logic from iproute2
to determine local and possible peer address (so there's no longer
a test for IFF_POINTOPOINT). Set ZEBRA_IFA_PEER flag appropriately.
Pass new flags argument to connected_add_ipv6.
(netlink_address) Test !CONNECTED_PEER instead of if_is_broadcast
to determine whether the connected destination address is a
broadcast address.
* bgp_nexthop.c: (bgp_connected_add, bgp_connected_delete)
Simplify logic by using new CONNECTED_PREFIX macro.
* ospf_interface.c: (ospf_if_is_configured, ospf_if_lookup_by_prefix,
ospf_if_lookup_recv_if) Simplify logic using new CONNECTED_PREFIX
macro.
* ospf_lsa.c: (lsa_link_ptop_set) Using the new CONNECTED_PREFIX
macro, both options collapse into the same code.
* ospf_snmp.c: (ospf_snmp_if_update) Simplify logic using new
CONNECTED_ID macro.
(ospf_snmp_is_if_have_addr) Simplify logic using new CONNECTED_PREFIX
macro.
* ospf_vty.c: (show_ip_ospf_interface_sub) Use new CONNECTED_PEER macro
instead of testing the IFF_POINTOPOINT flag.
* ospfd.c: (ospf_network_match_iface) Use new CONNECTED_PEER macro
instead of testing with if_is_pointopoint. And add commented-out
code to implement alternative (in my opinion) more elegant behavior
that has no special-case treatment for PtP addresses.
(ospf_network_run) Use new CONNECTED_ID macro to simplify logic.
* rip_interface.c: (rip_interface_multicast_set) Use new CONNECTED_ID
macro to simplify logic.
(rip_request_interface_send) Fix minor bug: ipv4_broadcast_addr does
not give a useful result if prefixlen is 32 (we require a peer
address in such cases).
* ripd.c: (rip_update_interface) Fix same bug as above.
2006-12-12 20:18:21 +01:00
|
|
|
/* new approach: more elegant and conceptually clean */
|
2017-06-28 20:53:27 +02:00
|
|
|
return prefix_match_network_statement(net, CONNECTED_PREFIX(co));
|
2003-01-25 07:47:41 +01:00
|
|
|
}
|
|
|
|
|
2009-08-27 17:51:42 +02:00
|
|
|
static void ospf_update_interface_area(struct connected *co,
|
|
|
|
struct ospf_area *area)
|
|
|
|
{
|
|
|
|
struct ospf_interface *oi = ospf_if_table_lookup(co->ifp, co->address);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2009-08-27 17:51:42 +02:00
|
|
|
/* nothing to be done case */
|
|
|
|
if (oi && oi->area == area) {
|
|
|
|
return;
|
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2009-08-27 17:51:42 +02:00
|
|
|
if (oi)
|
|
|
|
ospf_if_free(oi);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2009-08-27 17:51:42 +02:00
|
|
|
add_ospf_interface(co, area);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Run OSPF for the given subnet, taking into account the following
|
|
|
|
* possible sources of area configuration, in the given order of preference:
|
|
|
|
*
|
|
|
|
* - Whether there is interface+address specific area configuration
|
|
|
|
* - Whether there is a default area for the interface
|
|
|
|
* - Whether there is an area given as a parameter.
|
|
|
|
* - If no specific network prefix/area is supplied, whether there's
|
|
|
|
* a matching network configured.
|
|
|
|
*/
|
|
|
|
static void ospf_network_run_subnet(struct ospf *ospf, struct connected *co,
|
|
|
|
struct prefix *p,
|
|
|
|
struct ospf_area *given_area)
|
|
|
|
{
|
|
|
|
struct ospf_interface *oi;
|
|
|
|
struct ospf_if_params *params;
|
|
|
|
struct ospf_area *area = NULL;
|
|
|
|
struct route_node *rn;
|
|
|
|
int configed = 0;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2009-08-27 17:51:42 +02:00
|
|
|
if (CHECK_FLAG(co->flags, ZEBRA_IFA_SECONDARY))
|
|
|
|
return;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2009-08-27 17:51:42 +02:00
|
|
|
if (co->address->family != AF_INET)
|
|
|
|
return;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2009-08-27 17:51:42 +02:00
|
|
|
/* Try determine the appropriate area for this interface + address
|
|
|
|
* Start by checking interface config
|
|
|
|
*/
|
|
|
|
params = ospf_lookup_if_params(co->ifp, co->address->u.prefix4);
|
|
|
|
if (params && OSPF_IF_PARAM_CONFIGURED(params, if_area))
|
|
|
|
area = ospf_area_get(ospf, params->if_area);
|
|
|
|
else {
|
|
|
|
params = IF_DEF_PARAMS(co->ifp);
|
|
|
|
if (OSPF_IF_PARAM_CONFIGURED(params, if_area))
|
|
|
|
area = ospf_area_get(ospf, params->if_area);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If we've found an interface and/or addr specific area, then we're
|
|
|
|
* done
|
|
|
|
*/
|
|
|
|
if (area) {
|
|
|
|
ospf_update_interface_area(co, area);
|
2008-09-02 20:06:31 +02:00
|
|
|
return;
|
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
/* Otherwise, only remaining possibility is a matching network statement
|
|
|
|
*/
|
2017-07-17 14:03:14 +02:00
|
|
|
if (p) {
|
2002-12-13 21:15:29 +01:00
|
|
|
assert(given_area != NULL);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Which either was supplied as a parameter.. (e.g. cause a new
|
2008-09-02 20:06:31 +02:00
|
|
|
* network/area was just added)..
|
2017-07-17 14:03:14 +02:00
|
|
|
*/
|
2008-09-02 20:06:31 +02:00
|
|
|
if (p->family == co->address->family
|
2009-08-27 17:51:42 +02:00
|
|
|
&& ospf_network_match_iface(co, p))
|
|
|
|
ospf_update_interface_area(co, given_area);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
return;
|
2017-07-17 14:03:14 +02:00
|
|
|
}
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Else we have to search the existing network/area config to see
|
|
|
|
* if any match..
|
|
|
|
*/
|
|
|
|
for (rn = route_top(ospf->networks); rn; rn = route_next(rn))
|
|
|
|
if (rn->info != NULL && ospf_network_match_iface(co, &rn->p)) {
|
2004-09-23 21:18:23 +02:00
|
|
|
struct ospf_network *network =
|
|
|
|
(struct ospf_network *)rn->info;
|
2006-07-26 11:37:26 +02:00
|
|
|
area = ospf_area_get(ospf, network->area_id);
|
|
|
|
ospf_update_interface_area(co, area);
|
2002-12-13 21:15:29 +01:00
|
|
|
configed = 1;
|
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* If the subnet isn't in any area, deconfigure */
|
|
|
|
if (!configed && (oi = ospf_if_table_lookup(co->ifp, co->address)))
|
|
|
|
ospf_if_free(oi);
|
|
|
|
}
|
|
|
|
|
2008-09-02 20:06:31 +02:00
|
|
|
static void ospf_network_run_interface(struct ospf *ospf, struct interface *ifp,
|
2009-08-27 17:51:42 +02:00
|
|
|
struct prefix *p,
|
2008-09-02 20:06:31 +02:00
|
|
|
struct ospf_area *given_area)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
2008-09-02 20:06:31 +02:00
|
|
|
struct listnode *cnode;
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
struct connected *co;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2008-09-02 20:06:31 +02:00
|
|
|
if (memcmp(ifp->name, "VLINK", 5) == 0)
|
|
|
|
return;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2009-08-27 17:51:42 +02:00
|
|
|
/* Network prefix without area is nonsensical */
|
2017-07-17 14:03:14 +02:00
|
|
|
if (p)
|
2009-08-27 17:51:42 +02:00
|
|
|
assert(given_area != NULL);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2009-08-27 17:51:42 +02:00
|
|
|
/* if interface prefix is match specified prefix,
|
|
|
|
then create socket and join multicast group. */
|
|
|
|
for (ALL_LIST_ELEMENTS_RO(ifp->connected, cnode, co))
|
|
|
|
ospf_network_run_subnet(ospf, co, p, given_area);
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
2003-03-25 06:07:42 +01:00
|
|
|
static void ospf_network_run(struct prefix *p, struct ospf_area *area)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
2017-10-03 03:06:01 +02:00
|
|
|
struct vrf *vrf = vrf_lookup_by_id(area->ospf->vrf_id);
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
struct interface *ifp;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Schedule Router ID Update. */
|
2020-02-06 07:49:02 +01:00
|
|
|
if (area->ospf->router_id.s_addr == INADDR_ANY)
|
2002-12-13 21:15:29 +01:00
|
|
|
ospf_router_id_update(area->ospf);
|
|
|
|
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
/* Get target interface. */
|
2017-10-06 20:25:58 +02:00
|
|
|
FOR_ALL_INTERFACES (vrf, ifp)
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
ospf_network_run_interface(area->ospf, ifp, p, area);
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void ospf_ls_upd_queue_empty(struct ospf_interface *oi)
|
2017-07-17 14:03:14 +02:00
|
|
|
{
|
2002-12-13 21:15:29 +01:00
|
|
|
struct route_node *rn;
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
struct listnode *node, *nnode;
|
2004-09-23 21:18:23 +02:00
|
|
|
struct list *lst;
|
2002-12-13 21:15:29 +01:00
|
|
|
struct ospf_lsa *lsa;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* empty ls update queue */
|
2009-08-27 17:51:42 +02:00
|
|
|
for (rn = route_top(oi->ls_upd_queue); rn; rn = route_next(rn))
|
|
|
|
if ((lst = (struct list *)rn->info)) {
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
for (ALL_LIST_ELEMENTS(lst, node, nnode, lsa))
|
2006-07-26 11:37:26 +02:00
|
|
|
ospf_lsa_unlock(&lsa); /* oi->ls_upd_queue */
|
2018-10-02 11:39:51 +02:00
|
|
|
list_delete(&lst);
|
2002-12-13 21:15:29 +01:00
|
|
|
rn->info = NULL;
|
2017-07-17 14:03:14 +02:00
|
|
|
}
|
|
|
|
|
2009-08-07 13:48:15 +02:00
|
|
|
/* remove update event */
|
2022-06-03 16:31:04 +02:00
|
|
|
THREAD_OFF(oi->t_ls_upd_event);
|
2017-07-17 14:03:14 +02:00
|
|
|
}
|
2014-06-04 06:53:35 +02:00
|
|
|
|
2009-05-15 19:47:45 +02:00
|
|
|
void ospf_if_update(struct ospf *ospf, struct interface *ifp)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
2017-09-07 17:08:09 +02:00
|
|
|
|
2015-05-20 03:03:54 +02:00
|
|
|
if (!ospf)
|
2017-09-07 17:08:09 +02:00
|
|
|
return;
|
2017-08-25 22:51:12 +02:00
|
|
|
|
|
|
|
if (IS_DEBUG_OSPF_EVENT)
|
|
|
|
zlog_debug(
|
2021-10-22 00:17:40 +02:00
|
|
|
"%s: interface %s vrf %s(%u) ospf vrf %s vrf_id %u router_id %pI4",
|
|
|
|
__func__, ifp->name, ifp->vrf->name, ifp->vrf->vrf_id,
|
2017-08-25 22:51:12 +02:00
|
|
|
ospf_vrf_id_to_name(ospf->vrf_id), ospf->vrf_id,
|
2020-10-21 19:56:26 +02:00
|
|
|
&ospf->router_id);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* OSPF must be ready. */
|
2009-08-27 17:51:42 +02:00
|
|
|
if (!ospf_is_ready(ospf))
|
2017-07-17 14:03:14 +02:00
|
|
|
return;
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
ospf_network_run_interface(ospf, ifp, NULL, NULL);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Update connected redistribute. */
|
|
|
|
update_redistributed(ospf, 1);
|
2019-09-19 04:26:55 +02:00
|
|
|
|
2017-06-21 01:56:50 +02:00
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
void ospf_remove_vls_through_area(struct ospf *ospf, struct ospf_area *area)
|
|
|
|
{
|
2004-09-23 21:18:23 +02:00
|
|
|
struct listnode *node, *nnode;
|
2002-12-13 21:15:29 +01:00
|
|
|
struct ospf_vl_data *vl_data;
|
|
|
|
|
|
|
|
for (ALL_LIST_ELEMENTS(ospf->vlinks, node, nnode, vl_data))
|
|
|
|
if (IPV4_ADDR_SAME(&vl_data->vl_area_id, &area->area_id))
|
|
|
|
ospf_vl_delete(ospf, vl_data);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-06-21 01:56:50 +02:00
|
|
|
static const struct message ospf_area_type_msg[] = {
|
|
|
|
{OSPF_AREA_DEFAULT, "Default"},
|
2002-12-13 21:15:29 +01:00
|
|
|
{OSPF_AREA_STUB, "Stub"},
|
|
|
|
{OSPF_AREA_NSSA, "NSSA"},
|
2017-06-21 01:56:50 +02:00
|
|
|
{0}};
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
static void ospf_area_type_set(struct ospf_area *area, int type)
|
2017-07-17 14:03:14 +02:00
|
|
|
{
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
struct listnode *node;
|
|
|
|
struct ospf_interface *oi;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
if (area->external_routing == type) {
|
|
|
|
if (IS_DEBUG_OSPF_EVENT)
|
2020-10-21 19:56:26 +02:00
|
|
|
zlog_debug("Area[%pI4]: Types are the same, ignored.",
|
|
|
|
&area->area_id);
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
return;
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
area->external_routing = type;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2010-01-24 23:42:13 +01:00
|
|
|
if (IS_DEBUG_OSPF_EVENT)
|
2020-10-21 19:56:26 +02:00
|
|
|
zlog_debug("Area[%pI4]: Configured as %s",
|
|
|
|
&area->area_id,
|
2017-06-21 01:56:50 +02:00
|
|
|
lookup_msg(ospf_area_type_msg, type, NULL));
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
switch (area->external_routing) {
|
|
|
|
case OSPF_AREA_DEFAULT:
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
for (ALL_LIST_ELEMENTS_RO(area->oiflist, node, oi))
|
|
|
|
if (oi->nbr_self != NULL) {
|
|
|
|
UNSET_FLAG(oi->nbr_self->options,
|
|
|
|
OSPF_OPTION_NP);
|
|
|
|
SET_FLAG(oi->nbr_self->options, OSPF_OPTION_E);
|
2017-07-17 14:03:14 +02:00
|
|
|
}
|
|
|
|
break;
|
2002-12-13 21:15:29 +01:00
|
|
|
case OSPF_AREA_STUB:
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
for (ALL_LIST_ELEMENTS_RO(area->oiflist, node, oi))
|
|
|
|
if (oi->nbr_self != NULL) {
|
2002-12-13 21:15:29 +01:00
|
|
|
if (IS_DEBUG_OSPF_EVENT)
|
2004-12-08 20:06:51 +01:00
|
|
|
zlog_debug(
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
"setting options on %s accordingly",
|
|
|
|
IF_NAME(oi));
|
|
|
|
UNSET_FLAG(oi->nbr_self->options,
|
|
|
|
OSPF_OPTION_NP);
|
|
|
|
UNSET_FLAG(oi->nbr_self->options,
|
|
|
|
OSPF_OPTION_E);
|
2002-12-13 21:15:29 +01:00
|
|
|
if (IS_DEBUG_OSPF_EVENT)
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
zlog_debug("options set on %s: %x",
|
|
|
|
IF_NAME(oi), OPTIONS(oi));
|
2017-07-17 14:03:14 +02:00
|
|
|
}
|
|
|
|
break;
|
2002-12-13 21:15:29 +01:00
|
|
|
case OSPF_AREA_NSSA:
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
for (ALL_LIST_ELEMENTS_RO(area->oiflist, node, oi))
|
|
|
|
if (oi->nbr_self != NULL) {
|
2004-12-08 20:06:51 +01:00
|
|
|
zlog_debug(
|
2010-01-24 23:42:13 +01:00
|
|
|
"setting nssa options on %s accordingly",
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
IF_NAME(oi));
|
|
|
|
UNSET_FLAG(oi->nbr_self->options,
|
|
|
|
OSPF_OPTION_E);
|
|
|
|
SET_FLAG(oi->nbr_self->options, OSPF_OPTION_NP);
|
|
|
|
zlog_debug("options set on %s: %x", IF_NAME(oi),
|
|
|
|
OPTIONS(oi));
|
2017-07-17 14:03:14 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2010-01-24 23:42:13 +01:00
|
|
|
ospf_router_lsa_update_area(area);
|
2003-03-25 06:07:42 +01:00
|
|
|
ospf_schedule_abr_task(area->ospf);
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
2003-03-25 06:07:42 +01:00
|
|
|
int ospf_area_shortcut_set(struct ospf *ospf, struct ospf_area *area, int mode)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
|
|
|
if (area->shortcut_configured == mode)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
area->shortcut_configured = mode;
|
2010-01-24 23:42:13 +01:00
|
|
|
ospf_router_lsa_update_area(area);
|
2003-03-25 06:07:42 +01:00
|
|
|
ospf_schedule_abr_task(ospf);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2003-03-25 06:07:42 +01:00
|
|
|
ospf_area_check_free(ospf, area->area_id);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2003-03-25 06:07:42 +01:00
|
|
|
int ospf_area_shortcut_unset(struct ospf *ospf, struct ospf_area *area)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
|
|
|
area->shortcut_configured = OSPF_SHORTCUT_DEFAULT;
|
2010-01-24 23:42:13 +01:00
|
|
|
ospf_router_lsa_update_area(area);
|
2003-03-25 06:07:42 +01:00
|
|
|
ospf_area_check_free(ospf, area->area_id);
|
|
|
|
ospf_schedule_abr_task(ospf);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int ospf_area_vlink_count(struct ospf *ospf, struct ospf_area *area)
|
|
|
|
{
|
|
|
|
struct ospf_vl_data *vl;
|
2004-09-23 21:18:23 +02:00
|
|
|
struct listnode *node;
|
2002-12-13 21:15:29 +01:00
|
|
|
int count = 0;
|
|
|
|
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
for (ALL_LIST_ELEMENTS_RO(ospf->vlinks, node, vl))
|
|
|
|
if (IPV4_ADDR_SAME(&vl->vl_area_id, &area->area_id))
|
|
|
|
count++;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
return count;
|
|
|
|
}
|
|
|
|
|
2017-05-19 20:38:02 +02:00
|
|
|
int ospf_area_display_format_set(struct ospf *ospf, struct ospf_area *area,
|
|
|
|
int df)
|
|
|
|
{
|
|
|
|
area->area_id_fmt = df;
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
int ospf_area_stub_set(struct ospf *ospf, struct in_addr area_id)
|
|
|
|
{
|
|
|
|
struct ospf_area *area;
|
|
|
|
|
2017-05-19 20:38:02 +02:00
|
|
|
area = ospf_area_get(ospf, area_id);
|
2002-12-13 21:15:29 +01:00
|
|
|
if (ospf_area_vlink_count(ospf, area))
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
if (area->external_routing != OSPF_AREA_STUB)
|
|
|
|
ospf_area_type_set(area, OSPF_AREA_STUB);
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
int ospf_area_stub_unset(struct ospf *ospf, struct in_addr area_id)
|
|
|
|
{
|
|
|
|
struct ospf_area *area;
|
|
|
|
|
2003-03-25 06:07:42 +01:00
|
|
|
area = ospf_area_lookup_by_area_id(ospf, area_id);
|
2002-12-13 21:15:29 +01:00
|
|
|
if (area == NULL)
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
if (area->external_routing == OSPF_AREA_STUB)
|
|
|
|
ospf_area_type_set(area, OSPF_AREA_DEFAULT);
|
|
|
|
|
2003-03-25 06:07:42 +01:00
|
|
|
ospf_area_check_free(ospf, area_id);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
int ospf_area_no_summary_set(struct ospf *ospf, struct in_addr area_id)
|
|
|
|
{
|
|
|
|
struct ospf_area *area;
|
|
|
|
|
2017-05-19 20:38:02 +02:00
|
|
|
area = ospf_area_get(ospf, area_id);
|
2002-12-13 21:15:29 +01:00
|
|
|
area->no_summary = 1;
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
int ospf_area_no_summary_unset(struct ospf *ospf, struct in_addr area_id)
|
|
|
|
{
|
|
|
|
struct ospf_area *area;
|
|
|
|
|
2003-03-25 06:07:42 +01:00
|
|
|
area = ospf_area_lookup_by_area_id(ospf, area_id);
|
2002-12-13 21:15:29 +01:00
|
|
|
if (area == NULL)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
area->no_summary = 0;
|
2003-03-25 06:07:42 +01:00
|
|
|
ospf_area_check_free(ospf, area_id);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2017-10-07 22:26:13 +02:00
|
|
|
int ospf_area_nssa_no_summary_set(struct ospf *ospf, struct in_addr area_id)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
|
|
|
struct ospf_area *area;
|
|
|
|
|
2017-05-19 20:38:02 +02:00
|
|
|
area = ospf_area_get(ospf, area_id);
|
2002-12-13 21:15:29 +01:00
|
|
|
if (ospf_area_vlink_count(ospf, area))
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
if (area->external_routing != OSPF_AREA_NSSA) {
|
|
|
|
ospf_area_type_set(area, OSPF_AREA_NSSA);
|
|
|
|
ospf->anyNSSA++;
|
2017-10-07 22:26:13 +02:00
|
|
|
area->NSSATranslatorRole = OSPF_NSSA_ROLE_CANDIDATE;
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
2017-10-07 22:26:13 +02:00
|
|
|
ospf_area_no_summary_set(ospf, area_id);
|
2003-06-22 10:35:18 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2017-10-07 22:26:13 +02:00
|
|
|
int ospf_area_nssa_set(struct ospf *ospf, struct in_addr area_id)
|
|
|
|
{
|
|
|
|
struct ospf_area *area;
|
|
|
|
|
|
|
|
area = ospf_area_get(ospf, area_id);
|
|
|
|
if (ospf_area_vlink_count(ospf, area))
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
if (area->external_routing != OSPF_AREA_NSSA) {
|
|
|
|
ospf_area_type_set(area, OSPF_AREA_NSSA);
|
|
|
|
ospf->anyNSSA++;
|
|
|
|
|
|
|
|
/* set NSSA area defaults */
|
|
|
|
area->no_summary = 0;
|
2020-11-02 15:28:52 +01:00
|
|
|
area->suppress_fa = 0;
|
2017-10-07 22:26:13 +02:00
|
|
|
area->NSSATranslatorRole = OSPF_NSSA_ROLE_CANDIDATE;
|
|
|
|
area->NSSATranslatorState = OSPF_NSSA_TRANSLATE_DISABLED;
|
|
|
|
area->NSSATranslatorStabilityInterval =
|
|
|
|
OSPF_NSSA_TRANS_STABLE_DEFAULT;
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
int ospf_area_nssa_unset(struct ospf *ospf, struct in_addr area_id, int argc)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
|
|
|
struct ospf_area *area;
|
|
|
|
|
2003-03-25 06:07:42 +01:00
|
|
|
area = ospf_area_lookup_by_area_id(ospf, area_id);
|
2002-12-13 21:15:29 +01:00
|
|
|
if (area == NULL)
|
|
|
|
return 0;
|
|
|
|
|
2017-10-07 22:26:13 +02:00
|
|
|
/* argc < 5 -> 'no area x nssa' */
|
|
|
|
if (argc < 5 && area->external_routing == OSPF_AREA_NSSA) {
|
2002-12-13 21:15:29 +01:00
|
|
|
ospf->anyNSSA--;
|
2017-10-07 22:26:13 +02:00
|
|
|
/* set NSSA area defaults */
|
|
|
|
area->no_summary = 0;
|
2020-11-02 15:28:52 +01:00
|
|
|
area->suppress_fa = 0;
|
2017-10-07 22:26:13 +02:00
|
|
|
area->NSSATranslatorRole = OSPF_NSSA_ROLE_CANDIDATE;
|
|
|
|
area->NSSATranslatorState = OSPF_NSSA_TRANSLATE_DISABLED;
|
|
|
|
area->NSSATranslatorStabilityInterval =
|
|
|
|
OSPF_NSSA_TRANS_STABLE_DEFAULT;
|
2002-12-13 21:15:29 +01:00
|
|
|
ospf_area_type_set(area, OSPF_AREA_DEFAULT);
|
2017-10-07 22:26:13 +02:00
|
|
|
} else {
|
2020-11-20 22:53:20 +01:00
|
|
|
ospf_area_nssa_translator_role_set(ospf, area_id,
|
|
|
|
OSPF_NSSA_ROLE_CANDIDATE);
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
2003-03-25 06:07:42 +01:00
|
|
|
ospf_area_check_free(ospf, area_id);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2020-11-02 15:28:52 +01:00
|
|
|
int ospf_area_nssa_suppress_fa_set(struct ospf *ospf, struct in_addr area_id)
|
|
|
|
{
|
|
|
|
struct ospf_area *area;
|
|
|
|
|
|
|
|
area = ospf_area_lookup_by_area_id(ospf, area_id);
|
|
|
|
if (area == NULL)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
area->suppress_fa = 1;
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
int ospf_area_nssa_suppress_fa_unset(struct ospf *ospf, struct in_addr area_id)
|
|
|
|
{
|
|
|
|
struct ospf_area *area;
|
|
|
|
|
|
|
|
area = ospf_area_lookup_by_area_id(ospf, area_id);
|
|
|
|
if (area == NULL)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
area->suppress_fa = 0;
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
int ospf_area_nssa_translator_role_set(struct ospf *ospf,
|
|
|
|
struct in_addr area_id, int role)
|
|
|
|
{
|
|
|
|
struct ospf_area *area;
|
|
|
|
|
2003-03-25 06:07:42 +01:00
|
|
|
area = ospf_area_lookup_by_area_id(ospf, area_id);
|
2002-12-13 21:15:29 +01:00
|
|
|
if (area == NULL)
|
|
|
|
return 0;
|
|
|
|
|
2020-11-20 22:53:20 +01:00
|
|
|
if (role != area->NSSATranslatorRole) {
|
|
|
|
if ((area->NSSATranslatorRole == OSPF_NSSA_ROLE_ALWAYS)
|
|
|
|
|| (role == OSPF_NSSA_ROLE_ALWAYS)) {
|
|
|
|
/* RFC 3101 3.1
|
|
|
|
* if new role is OSPF_NSSA_ROLE_ALWAYS we need to set
|
|
|
|
* Nt bit, if the role was OSPF_NSSA_ROLE_ALWAYS we need
|
|
|
|
* to clear Nt bit
|
|
|
|
*/
|
|
|
|
area->NSSATranslatorRole = role;
|
|
|
|
ospf_router_lsa_update_area(area);
|
|
|
|
} else
|
|
|
|
area->NSSATranslatorRole = role;
|
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2003-03-25 06:07:42 +01:00
|
|
|
int ospf_area_export_list_set(struct ospf *ospf, struct ospf_area *area,
|
2004-10-11 13:00:30 +02:00
|
|
|
const char *list_name)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
|
|
|
struct access_list *list;
|
|
|
|
list = access_list_lookup(AFI_IP, list_name);
|
|
|
|
|
|
|
|
EXPORT_LIST(area) = list;
|
|
|
|
|
|
|
|
if (EXPORT_NAME(area))
|
|
|
|
free(EXPORT_NAME(area));
|
|
|
|
|
|
|
|
EXPORT_NAME(area) = strdup(list_name);
|
2003-03-25 06:07:42 +01:00
|
|
|
ospf_schedule_abr_task(ospf);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2003-03-25 06:07:42 +01:00
|
|
|
int ospf_area_export_list_unset(struct ospf *ospf, struct ospf_area *area)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
|
|
|
|
|
|
|
EXPORT_LIST(area) = 0;
|
|
|
|
|
|
|
|
if (EXPORT_NAME(area))
|
|
|
|
free(EXPORT_NAME(area));
|
|
|
|
|
|
|
|
EXPORT_NAME(area) = NULL;
|
|
|
|
|
2003-03-25 06:07:42 +01:00
|
|
|
ospf_area_check_free(ospf, area->area_id);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2003-03-25 06:07:42 +01:00
|
|
|
ospf_schedule_abr_task(ospf);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2004-10-11 13:00:30 +02:00
|
|
|
int ospf_area_import_list_set(struct ospf *ospf, struct ospf_area *area,
|
|
|
|
const char *name)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
|
|
|
struct access_list *list;
|
|
|
|
list = access_list_lookup(AFI_IP, name);
|
|
|
|
|
|
|
|
IMPORT_LIST(area) = list;
|
|
|
|
|
|
|
|
if (IMPORT_NAME(area))
|
|
|
|
free(IMPORT_NAME(area));
|
|
|
|
|
|
|
|
IMPORT_NAME(area) = strdup(name);
|
2003-03-25 06:07:42 +01:00
|
|
|
ospf_schedule_abr_task(ospf);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2003-03-25 06:07:42 +01:00
|
|
|
int ospf_area_import_list_unset(struct ospf *ospf, struct ospf_area *area)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
|
|
|
IMPORT_LIST(area) = 0;
|
|
|
|
|
|
|
|
if (IMPORT_NAME(area))
|
|
|
|
free(IMPORT_NAME(area));
|
|
|
|
|
|
|
|
IMPORT_NAME(area) = NULL;
|
2003-03-25 06:07:42 +01:00
|
|
|
ospf_area_check_free(ospf, area->area_id);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2003-03-25 06:07:42 +01:00
|
|
|
ospf_schedule_abr_task(ospf);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
int ospf_timers_refresh_set(struct ospf *ospf, int interval)
|
|
|
|
{
|
|
|
|
int time_left;
|
|
|
|
|
|
|
|
if (ospf->lsa_refresh_interval == interval)
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
time_left = ospf->lsa_refresh_interval
|
2017-01-18 01:30:43 +01:00
|
|
|
- (monotime(NULL) - ospf->lsa_refresher_started);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
if (time_left > interval) {
|
2022-06-03 16:28:11 +02:00
|
|
|
THREAD_OFF(ospf->t_lsa_refresher);
|
2017-05-05 23:22:25 +02:00
|
|
|
thread_add_timer(master, ospf_lsa_refresh_walker, ospf,
|
|
|
|
interval, &ospf->t_lsa_refresher);
|
2017-07-17 14:03:14 +02:00
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
ospf->lsa_refresh_interval = interval;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
int ospf_timers_refresh_unset(struct ospf *ospf)
|
|
|
|
{
|
|
|
|
int time_left;
|
|
|
|
|
|
|
|
time_left = ospf->lsa_refresh_interval
|
2017-01-18 01:30:43 +01:00
|
|
|
- (monotime(NULL) - ospf->lsa_refresher_started);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
if (time_left > OSPF_LSA_REFRESH_INTERVAL_DEFAULT) {
|
2022-06-03 16:28:11 +02:00
|
|
|
THREAD_OFF(ospf->t_lsa_refresher);
|
2017-05-05 23:22:25 +02:00
|
|
|
ospf->t_lsa_refresher = NULL;
|
|
|
|
thread_add_timer(master, ospf_lsa_refresh_walker, ospf,
|
|
|
|
OSPF_LSA_REFRESH_INTERVAL_DEFAULT,
|
|
|
|
&ospf->t_lsa_refresher);
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
ospf->lsa_refresh_interval = OSPF_LSA_REFRESH_INTERVAL_DEFAULT;
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2014-06-04 06:53:35 +02:00
|
|
|
|
2005-05-06 23:37:42 +02:00
|
|
|
static struct ospf_nbr_nbma *ospf_nbr_nbma_new(void)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
|
|
|
struct ospf_nbr_nbma *nbr_nbma;
|
|
|
|
|
2008-08-18 23:13:29 +02:00
|
|
|
nbr_nbma = XCALLOC(MTYPE_OSPF_NEIGHBOR_STATIC,
|
2002-12-13 21:15:29 +01:00
|
|
|
sizeof(struct ospf_nbr_nbma));
|
|
|
|
|
|
|
|
nbr_nbma->priority = OSPF_NEIGHBOR_PRIORITY_DEFAULT;
|
|
|
|
nbr_nbma->v_poll = OSPF_POLL_INTERVAL_DEFAULT;
|
|
|
|
|
|
|
|
return nbr_nbma;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void ospf_nbr_nbma_free(struct ospf_nbr_nbma *nbr_nbma)
|
|
|
|
{
|
|
|
|
XFREE(MTYPE_OSPF_NEIGHBOR_STATIC, nbr_nbma);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void ospf_nbr_nbma_delete(struct ospf *ospf,
|
|
|
|
struct ospf_nbr_nbma *nbr_nbma)
|
|
|
|
{
|
|
|
|
struct route_node *rn;
|
|
|
|
struct prefix_ipv4 p;
|
|
|
|
|
|
|
|
p.family = AF_INET;
|
|
|
|
p.prefix = nbr_nbma->addr;
|
|
|
|
p.prefixlen = IPV4_MAX_BITLEN;
|
|
|
|
|
|
|
|
rn = route_node_lookup(ospf->nbr_nbma, (struct prefix *)&p);
|
|
|
|
if (rn) {
|
|
|
|
ospf_nbr_nbma_free(rn->info);
|
|
|
|
rn->info = NULL;
|
|
|
|
route_unlock_node(rn);
|
|
|
|
route_unlock_node(rn);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void ospf_nbr_nbma_down(struct ospf_nbr_nbma *nbr_nbma)
|
|
|
|
{
|
2022-06-03 16:28:11 +02:00
|
|
|
THREAD_OFF(nbr_nbma->t_poll);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
if (nbr_nbma->nbr) {
|
|
|
|
nbr_nbma->nbr->nbr_nbma = NULL;
|
|
|
|
OSPF_NSM_EVENT_EXECUTE(nbr_nbma->nbr, NSM_KillNbr);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (nbr_nbma->oi)
|
|
|
|
listnode_delete(nbr_nbma->oi->nbr_nbma, nbr_nbma);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void ospf_nbr_nbma_add(struct ospf_nbr_nbma *nbr_nbma,
|
|
|
|
struct ospf_interface *oi)
|
|
|
|
{
|
|
|
|
struct ospf_neighbor *nbr;
|
|
|
|
struct route_node *rn;
|
|
|
|
struct prefix p;
|
|
|
|
|
|
|
|
if (oi->type != OSPF_IFTYPE_NBMA)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (nbr_nbma->nbr != NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (IPV4_ADDR_SAME(&oi->nbr_self->address.u.prefix4, &nbr_nbma->addr))
|
|
|
|
return;
|
|
|
|
|
|
|
|
nbr_nbma->oi = oi;
|
|
|
|
listnode_add(oi->nbr_nbma, nbr_nbma);
|
|
|
|
|
|
|
|
/* Get neighbor information from table. */
|
|
|
|
p.family = AF_INET;
|
|
|
|
p.prefixlen = IPV4_MAX_BITLEN;
|
|
|
|
p.u.prefix4 = nbr_nbma->addr;
|
|
|
|
|
2020-04-08 07:57:15 +02:00
|
|
|
rn = route_node_get(oi->nbrs, &p);
|
2002-12-13 21:15:29 +01:00
|
|
|
if (rn->info) {
|
|
|
|
nbr = rn->info;
|
|
|
|
nbr->nbr_nbma = nbr_nbma;
|
|
|
|
nbr_nbma->nbr = nbr;
|
|
|
|
|
|
|
|
route_unlock_node(rn);
|
2017-07-17 14:03:14 +02:00
|
|
|
} else {
|
2002-12-13 21:15:29 +01:00
|
|
|
nbr = rn->info = ospf_nbr_new(oi);
|
|
|
|
nbr->state = NSM_Down;
|
|
|
|
nbr->src = nbr_nbma->addr;
|
|
|
|
nbr->nbr_nbma = nbr_nbma;
|
|
|
|
nbr->priority = nbr_nbma->priority;
|
|
|
|
nbr->address = p;
|
|
|
|
|
|
|
|
nbr_nbma->nbr = nbr;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2021-03-03 21:22:47 +01:00
|
|
|
/* Configure BFD if interface has it. */
|
|
|
|
ospf_neighbor_bfd_apply(nbr);
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
OSPF_NSM_EVENT_EXECUTE(nbr, NSM_Start);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-03-25 06:07:42 +01:00
|
|
|
void ospf_nbr_nbma_if_update(struct ospf *ospf, struct ospf_interface *oi)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
|
|
|
struct ospf_nbr_nbma *nbr_nbma;
|
|
|
|
struct route_node *rn;
|
|
|
|
struct prefix_ipv4 p;
|
|
|
|
|
|
|
|
if (oi->type != OSPF_IFTYPE_NBMA)
|
|
|
|
return;
|
|
|
|
|
2003-03-25 06:07:42 +01:00
|
|
|
for (rn = route_top(ospf->nbr_nbma); rn; rn = route_next(rn))
|
2002-12-13 21:15:29 +01:00
|
|
|
if ((nbr_nbma = rn->info))
|
|
|
|
if (nbr_nbma->oi == NULL && nbr_nbma->nbr == NULL) {
|
|
|
|
p.family = AF_INET;
|
|
|
|
p.prefix = nbr_nbma->addr;
|
|
|
|
p.prefixlen = IPV4_MAX_BITLEN;
|
|
|
|
|
|
|
|
if (prefix_match(oi->address,
|
|
|
|
(struct prefix *)&p))
|
|
|
|
ospf_nbr_nbma_add(nbr_nbma, oi);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
struct ospf_nbr_nbma *ospf_nbr_nbma_lookup(struct ospf *ospf,
|
|
|
|
struct in_addr nbr_addr)
|
|
|
|
{
|
|
|
|
struct route_node *rn;
|
|
|
|
struct prefix_ipv4 p;
|
|
|
|
|
|
|
|
p.family = AF_INET;
|
|
|
|
p.prefix = nbr_addr;
|
|
|
|
p.prefixlen = IPV4_MAX_BITLEN;
|
|
|
|
|
|
|
|
rn = route_node_lookup(ospf->nbr_nbma, (struct prefix *)&p);
|
|
|
|
if (rn) {
|
|
|
|
route_unlock_node(rn);
|
|
|
|
return rn->info;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
int ospf_nbr_nbma_set(struct ospf *ospf, struct in_addr nbr_addr)
|
|
|
|
{
|
|
|
|
struct ospf_nbr_nbma *nbr_nbma;
|
|
|
|
struct ospf_interface *oi;
|
|
|
|
struct prefix_ipv4 p;
|
|
|
|
struct route_node *rn;
|
2004-09-23 21:18:23 +02:00
|
|
|
struct listnode *node;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
nbr_nbma = ospf_nbr_nbma_lookup(ospf, nbr_addr);
|
|
|
|
if (nbr_nbma)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
nbr_nbma = ospf_nbr_nbma_new();
|
|
|
|
nbr_nbma->addr = nbr_addr;
|
|
|
|
|
|
|
|
p.family = AF_INET;
|
|
|
|
p.prefix = nbr_addr;
|
|
|
|
p.prefixlen = IPV4_MAX_BITLEN;
|
|
|
|
|
|
|
|
rn = route_node_get(ospf->nbr_nbma, (struct prefix *)&p);
|
2010-03-08 13:58:14 +01:00
|
|
|
if (rn->info)
|
|
|
|
route_unlock_node(rn);
|
2002-12-13 21:15:29 +01:00
|
|
|
rn->info = nbr_nbma;
|
|
|
|
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
for (ALL_LIST_ELEMENTS_RO(ospf->oiflist, node, oi)) {
|
2002-12-13 21:15:29 +01:00
|
|
|
if (oi->type == OSPF_IFTYPE_NBMA)
|
|
|
|
if (prefix_match(oi->address, (struct prefix *)&p)) {
|
|
|
|
ospf_nbr_nbma_add(nbr_nbma, oi);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
int ospf_nbr_nbma_unset(struct ospf *ospf, struct in_addr nbr_addr)
|
|
|
|
{
|
|
|
|
struct ospf_nbr_nbma *nbr_nbma;
|
|
|
|
|
|
|
|
nbr_nbma = ospf_nbr_nbma_lookup(ospf, nbr_addr);
|
|
|
|
if (nbr_nbma == NULL)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
ospf_nbr_nbma_down(nbr_nbma);
|
|
|
|
ospf_nbr_nbma_delete(ospf, nbr_nbma);
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
int ospf_nbr_nbma_priority_set(struct ospf *ospf, struct in_addr nbr_addr,
|
2018-03-27 21:13:34 +02:00
|
|
|
uint8_t priority)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
|
|
|
struct ospf_nbr_nbma *nbr_nbma;
|
|
|
|
|
|
|
|
nbr_nbma = ospf_nbr_nbma_lookup(ospf, nbr_addr);
|
|
|
|
if (nbr_nbma == NULL)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
if (nbr_nbma->priority != priority)
|
|
|
|
nbr_nbma->priority = priority;
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
int ospf_nbr_nbma_priority_unset(struct ospf *ospf, struct in_addr nbr_addr)
|
|
|
|
{
|
|
|
|
struct ospf_nbr_nbma *nbr_nbma;
|
|
|
|
|
|
|
|
nbr_nbma = ospf_nbr_nbma_lookup(ospf, nbr_addr);
|
|
|
|
if (nbr_nbma == NULL)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
if (nbr_nbma != OSPF_NEIGHBOR_PRIORITY_DEFAULT)
|
|
|
|
nbr_nbma->priority = OSPF_NEIGHBOR_PRIORITY_DEFAULT;
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
int ospf_nbr_nbma_poll_interval_set(struct ospf *ospf, struct in_addr nbr_addr,
|
2004-10-11 13:00:30 +02:00
|
|
|
unsigned int interval)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
|
|
|
struct ospf_nbr_nbma *nbr_nbma;
|
|
|
|
|
|
|
|
nbr_nbma = ospf_nbr_nbma_lookup(ospf, nbr_addr);
|
|
|
|
if (nbr_nbma == NULL)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
if (nbr_nbma->v_poll != interval) {
|
|
|
|
nbr_nbma->v_poll = interval;
|
|
|
|
if (nbr_nbma->oi && ospf_if_is_up(nbr_nbma->oi)) {
|
2022-06-03 16:28:11 +02:00
|
|
|
THREAD_OFF(nbr_nbma->t_poll);
|
2002-12-13 21:15:29 +01:00
|
|
|
OSPF_POLL_TIMER_ON(nbr_nbma->t_poll, ospf_poll_timer,
|
|
|
|
nbr_nbma->v_poll);
|
2017-07-17 14:03:14 +02:00
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
int ospf_nbr_nbma_poll_interval_unset(struct ospf *ospf, struct in_addr addr)
|
|
|
|
{
|
|
|
|
struct ospf_nbr_nbma *nbr_nbma;
|
|
|
|
|
|
|
|
nbr_nbma = ospf_nbr_nbma_lookup(ospf, addr);
|
|
|
|
if (nbr_nbma == NULL)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
if (nbr_nbma->v_poll != OSPF_POLL_INTERVAL_DEFAULT)
|
|
|
|
nbr_nbma->v_poll = OSPF_POLL_INTERVAL_DEFAULT;
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2016-11-13 08:02:23 +01:00
|
|
|
void ospf_master_init(struct thread_master *master)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
2022-05-11 12:16:44 +02:00
|
|
|
memset(&ospf_master, 0, sizeof(ospf_master));
|
2003-04-04 04:44:16 +02:00
|
|
|
|
|
|
|
om = &ospf_master;
|
|
|
|
om->ospf = list_new();
|
2016-11-13 08:02:23 +01:00
|
|
|
om->master = master;
|
2003-04-04 04:44:16 +02:00
|
|
|
}
|
2017-08-25 22:51:12 +02:00
|
|
|
|
|
|
|
/* Link OSPF instance to VRF. */
|
|
|
|
void ospf_vrf_link(struct ospf *ospf, struct vrf *vrf)
|
|
|
|
{
|
|
|
|
ospf->vrf_id = vrf->vrf_id;
|
|
|
|
if (vrf->info != (void *)ospf)
|
|
|
|
vrf->info = (void *)ospf;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Unlink OSPF instance from VRF. */
|
|
|
|
void ospf_vrf_unlink(struct ospf *ospf, struct vrf *vrf)
|
|
|
|
{
|
|
|
|
if (vrf->info == (void *)ospf)
|
|
|
|
vrf->info = NULL;
|
|
|
|
ospf->vrf_id = VRF_UNKNOWN;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* This is hook function for vrf create called as part of vrf_init */
|
|
|
|
static int ospf_vrf_new(struct vrf *vrf)
|
|
|
|
{
|
|
|
|
if (IS_DEBUG_OSPF_EVENT)
|
2020-03-05 19:17:54 +01:00
|
|
|
zlog_debug("%s: VRF Created: %s(%u)", __func__, vrf->name,
|
|
|
|
vrf->vrf_id);
|
2017-08-25 22:51:12 +02:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* This is hook function for vrf delete call as part of vrf_init */
|
|
|
|
static int ospf_vrf_delete(struct vrf *vrf)
|
|
|
|
{
|
|
|
|
if (IS_DEBUG_OSPF_EVENT)
|
2020-03-05 19:17:54 +01:00
|
|
|
zlog_debug("%s: VRF Deletion: %s(%u)", __func__, vrf->name,
|
|
|
|
vrf->vrf_id);
|
2017-08-25 22:51:12 +02:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2021-05-05 16:25:15 +02:00
|
|
|
static void ospf_set_redist_vrf_bitmaps(struct ospf *ospf, bool set)
|
2018-02-28 09:01:13 +01:00
|
|
|
{
|
|
|
|
int type;
|
|
|
|
struct list *red_list;
|
|
|
|
|
|
|
|
for (type = 0; type < ZEBRA_ROUTE_MAX; type++) {
|
|
|
|
red_list = ospf->redist[type];
|
|
|
|
if (!red_list)
|
|
|
|
continue;
|
|
|
|
if (IS_DEBUG_OSPF_EVENT)
|
|
|
|
zlog_debug(
|
|
|
|
"%s: setting redist vrf %d bitmap for type %d",
|
|
|
|
__func__, ospf->vrf_id, type);
|
2021-05-05 16:25:15 +02:00
|
|
|
if (set)
|
|
|
|
vrf_bitmap_set(zclient->redist[AFI_IP][type],
|
|
|
|
ospf->vrf_id);
|
|
|
|
else
|
|
|
|
vrf_bitmap_unset(zclient->redist[AFI_IP][type],
|
|
|
|
ospf->vrf_id);
|
2018-02-28 09:01:13 +01:00
|
|
|
}
|
2021-05-18 00:23:35 +02:00
|
|
|
|
|
|
|
red_list = ospf->redist[DEFAULT_ROUTE];
|
|
|
|
if (red_list) {
|
|
|
|
if (set)
|
|
|
|
vrf_bitmap_set(zclient->default_information[AFI_IP],
|
|
|
|
ospf->vrf_id);
|
|
|
|
else
|
|
|
|
vrf_bitmap_unset(zclient->default_information[AFI_IP],
|
|
|
|
ospf->vrf_id);
|
|
|
|
}
|
2018-02-28 09:01:13 +01:00
|
|
|
}
|
|
|
|
|
2017-08-25 22:51:12 +02:00
|
|
|
/* Enable OSPF VRF instance */
|
|
|
|
static int ospf_vrf_enable(struct vrf *vrf)
|
|
|
|
{
|
|
|
|
struct ospf *ospf = NULL;
|
2018-01-22 16:06:58 +01:00
|
|
|
vrf_id_t old_vrf_id;
|
2018-01-29 16:56:11 +01:00
|
|
|
int ret = 0;
|
2017-08-25 22:51:12 +02:00
|
|
|
|
|
|
|
if (IS_DEBUG_OSPF_EVENT)
|
2020-03-06 15:23:22 +01:00
|
|
|
zlog_debug("%s: VRF %s id %u enabled", __func__, vrf->name,
|
|
|
|
vrf->vrf_id);
|
2017-08-25 22:51:12 +02:00
|
|
|
|
|
|
|
ospf = ospf_lookup_by_name(vrf->name);
|
|
|
|
if (ospf) {
|
|
|
|
old_vrf_id = ospf->vrf_id;
|
|
|
|
/* We have instance configured, link to VRF and make it "up". */
|
|
|
|
ospf_vrf_link(ospf, vrf);
|
|
|
|
if (IS_DEBUG_OSPF_EVENT)
|
2017-12-18 12:07:22 +01:00
|
|
|
zlog_debug(
|
|
|
|
"%s: ospf linked to vrf %s vrf_id %u (old id %u)",
|
2020-03-06 15:23:22 +01:00
|
|
|
__func__, vrf->name, ospf->vrf_id, old_vrf_id);
|
2017-08-25 22:51:12 +02:00
|
|
|
|
|
|
|
if (old_vrf_id != ospf->vrf_id) {
|
2021-05-05 16:25:15 +02:00
|
|
|
ospf_set_redist_vrf_bitmaps(ospf, true);
|
2018-02-28 09:01:13 +01:00
|
|
|
|
2021-05-05 16:25:15 +02:00
|
|
|
/* start zebra redist to us for new vrf */
|
|
|
|
ospf_zebra_vrf_register(ospf);
|
2018-06-19 22:41:28 +02:00
|
|
|
|
2021-05-05 16:25:15 +02:00
|
|
|
ret = ospf_sock_init(ospf);
|
2018-01-29 16:56:11 +01:00
|
|
|
if (ret < 0 || ospf->fd <= 0)
|
|
|
|
return 0;
|
|
|
|
thread_add_read(master, ospf_read, ospf, ospf->fd,
|
|
|
|
&ospf->t_read);
|
2017-08-25 22:51:12 +02:00
|
|
|
ospf->oi_running = 1;
|
|
|
|
ospf_router_id_update(ospf);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Disable OSPF VRF instance */
|
|
|
|
static int ospf_vrf_disable(struct vrf *vrf)
|
|
|
|
{
|
|
|
|
struct ospf *ospf = NULL;
|
|
|
|
vrf_id_t old_vrf_id = VRF_UNKNOWN;
|
|
|
|
|
|
|
|
if (vrf->vrf_id == VRF_DEFAULT)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
if (IS_DEBUG_OSPF_EVENT)
|
2020-03-05 19:17:54 +01:00
|
|
|
zlog_debug("%s: VRF %s id %d disabled.", __func__, vrf->name,
|
|
|
|
vrf->vrf_id);
|
2017-08-25 22:51:12 +02:00
|
|
|
|
|
|
|
ospf = ospf_lookup_by_name(vrf->name);
|
|
|
|
if (ospf) {
|
|
|
|
old_vrf_id = ospf->vrf_id;
|
|
|
|
|
2021-05-05 16:25:15 +02:00
|
|
|
ospf_zebra_vrf_deregister(ospf);
|
|
|
|
|
|
|
|
ospf_set_redist_vrf_bitmaps(ospf, false);
|
|
|
|
|
2017-08-25 22:51:12 +02:00
|
|
|
/* We have instance configured, unlink
|
|
|
|
* from VRF and make it "down".
|
|
|
|
*/
|
|
|
|
ospf_vrf_unlink(ospf, vrf);
|
|
|
|
ospf->oi_running = 0;
|
|
|
|
if (IS_DEBUG_OSPF_EVENT)
|
2020-03-05 19:17:54 +01:00
|
|
|
zlog_debug("%s: ospf old_vrf_id %d unlinked", __func__,
|
|
|
|
old_vrf_id);
|
2022-06-03 16:31:04 +02:00
|
|
|
THREAD_OFF(ospf->t_read);
|
2018-01-29 16:56:11 +01:00
|
|
|
close(ospf->fd);
|
|
|
|
ospf->fd = -1;
|
2017-08-25 22:51:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Note: This is a callback, the VRF will be deleted by the caller. */
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ospf_vrf_init(void)
|
|
|
|
{
|
|
|
|
vrf_init(ospf_vrf_new, ospf_vrf_enable, ospf_vrf_disable,
|
*: rework renaming the default VRF
Currently, it is possible to rename the default VRF either by passing
`-o` option to zebra or by creating a file in `/var/run/netns` and
binding it to `/proc/self/ns/net`.
In both cases, only zebra knows about the rename and other daemons learn
about it only after they connect to zebra. This is a problem, because
daemons may read their config before they connect to zebra. To handle
this rename after the config is read, we have some special code in every
single daemon, which is not very bad but not desirable in my opinion.
But things are getting worse when we need to handle this in northbound
layer as we have to manually rewrite the config nodes. This approach is
already hacky, but still works as every daemon handles its own NB
structures. But it is completely incompatible with the central
management daemon architecture we are aiming for, as mgmtd doesn't even
have a connection with zebra to learn from it. And it shouldn't have it,
because operational state changes should never affect configuration.
To solve the problem and simplify the code, I propose to expand the `-o`
option to all daemons. By using the startup option, we let daemons know
about the rename before they read their configs so we don't need any
special code to deal with it. There's an easy way to pass the option to
all daemons by using `frr_global_options` variable.
Unfortunately, the second way of renaming by creating a file in
`/var/run/netns` is incompatible with the new mgmtd architecture.
Theoretically, we could force daemons to read their configs only after
they connect to zebra, but it means adding even more code to handle a
very specific use-case. And anyway this won't work for mgmtd as it
doesn't have a connection with zebra. So I had to remove this option.
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-12-03 23:22:55 +01:00
|
|
|
ospf_vrf_delete);
|
2017-08-25 22:51:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void ospf_vrf_terminate(void)
|
|
|
|
{
|
|
|
|
vrf_terminate();
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *ospf_vrf_id_to_name(vrf_id_t vrf_id)
|
|
|
|
{
|
|
|
|
struct vrf *vrf = vrf_lookup_by_id(vrf_id);
|
|
|
|
|
|
|
|
return vrf ? vrf->name : "NIL";
|
|
|
|
}
|
2019-11-12 20:17:14 +01:00
|
|
|
|
|
|
|
const char *ospf_get_name(const struct ospf *ospf)
|
|
|
|
{
|
|
|
|
if (ospf->name)
|
|
|
|
return ospf->name;
|
|
|
|
else
|
|
|
|
return VRF_DEFAULT_NAME;
|
|
|
|
}
|