2023-02-08 13:17:09 +01:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2002-12-13 21:15:29 +01:00
|
|
|
/*
|
|
|
|
* OSPF Interface functions.
|
|
|
|
* Copyright (C) 1999, 2000 Toshiaki Takada
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <zebra.h>
|
|
|
|
|
2023-03-07 20:22:48 +01:00
|
|
|
#include "frrevent.h"
|
2002-12-13 21:15:29 +01:00
|
|
|
#include "linklist.h"
|
|
|
|
#include "prefix.h"
|
|
|
|
#include "if.h"
|
|
|
|
#include "table.h"
|
|
|
|
#include "memory.h"
|
|
|
|
#include "command.h"
|
|
|
|
#include "stream.h"
|
|
|
|
#include "log.h"
|
2023-01-19 16:16:11 +01:00
|
|
|
#include "network.h"
|
2015-07-26 01:13:58 +02:00
|
|
|
#include "zclient.h"
|
2015-07-22 21:35:37 +02:00
|
|
|
#include "bfd.h"
|
2020-07-22 19:31:14 +02:00
|
|
|
#include "ldp_sync.h"
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2003-03-25 06:07:42 +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_spf.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_packet.h"
|
|
|
|
#include "ospfd/ospf_abr.h"
|
|
|
|
#include "ospfd/ospf_network.h"
|
|
|
|
#include "ospfd/ospf_dump.h"
|
2020-07-22 19:31:14 +02:00
|
|
|
#include "ospfd/ospf_ldp_sync.h"
|
2021-05-24 19:45:29 +02:00
|
|
|
#include "ospfd/ospf_route.h"
|
2021-06-17 15:26:36 +02:00
|
|
|
#include "ospfd/ospf_te.h"
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2016-12-07 13:25:38 +01:00
|
|
|
DEFINE_QOBJ_TYPE(ospf_interface);
|
2016-06-12 17:32:23 +02:00
|
|
|
DEFINE_HOOK(ospf_vl_add, (struct ospf_vl_data * vd), (vd));
|
|
|
|
DEFINE_HOOK(ospf_vl_delete, (struct ospf_vl_data * vd), (vd));
|
2019-09-19 04:26:55 +02:00
|
|
|
DEFINE_HOOK(ospf_if_update, (struct interface * ifp), (ifp));
|
2019-09-19 15:40:57 +02:00
|
|
|
DEFINE_HOOK(ospf_if_delete, (struct interface * ifp), (ifp));
|
2014-06-04 06:53:35 +02:00
|
|
|
|
2018-01-20 03:17:53 +01:00
|
|
|
int ospf_interface_neighbor_count(struct ospf_interface *oi)
|
|
|
|
{
|
|
|
|
int count = 0;
|
|
|
|
struct route_node *rn;
|
|
|
|
struct ospf_neighbor *nbr = NULL;
|
|
|
|
|
|
|
|
for (rn = route_top(oi->nbrs); rn; rn = route_next(rn)) {
|
|
|
|
nbr = rn->info;
|
2022-08-11 00:14:23 +02:00
|
|
|
if (!nbr)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
/* Do not show myself. */
|
|
|
|
if (nbr == oi->nbr_self)
|
|
|
|
continue;
|
|
|
|
/* Down state is not shown. */
|
|
|
|
if (nbr->state == NSM_Down)
|
|
|
|
continue;
|
|
|
|
count++;
|
2018-01-20 03:17:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return count;
|
|
|
|
}
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
int ospf_if_get_output_cost(struct ospf_interface *oi)
|
|
|
|
{
|
|
|
|
/* If all else fails, use default OSPF cost */
|
2018-03-27 21:13:34 +02:00
|
|
|
uint32_t cost;
|
|
|
|
uint32_t bw, refbw;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2020-07-22 19:31:14 +02:00
|
|
|
/* if LDP-IGP Sync is running on interface set cost so interface
|
|
|
|
* is used only as last resort
|
|
|
|
*/
|
|
|
|
if (ldp_sync_if_is_enabled(IF_DEF_PARAMS(oi->ifp)->ldp_sync_info))
|
|
|
|
return (LDP_OSPF_LSINFINITY);
|
|
|
|
|
2017-06-14 22:30:08 +02:00
|
|
|
/* ifp speed and bw can be 0 in some platforms, use ospf default bw
|
|
|
|
if bw is configured under interface it would be used.
|
|
|
|
*/
|
2017-06-12 18:53:21 +02:00
|
|
|
if (!oi->ifp->bandwidth && oi->ifp->speed)
|
|
|
|
bw = oi->ifp->speed;
|
|
|
|
else
|
2017-06-12 22:17:28 +02:00
|
|
|
bw = oi->ifp->bandwidth ? oi->ifp->bandwidth
|
|
|
|
: OSPF_DEFAULT_BANDWIDTH;
|
2003-03-25 06:07:42 +01:00
|
|
|
refbw = oi->ospf->ref_bandwidth;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2022-04-19 14:12:43 +02:00
|
|
|
/* A specified ip ospf cost overrides a calculated one. */
|
2002-12-13 21:15:29 +01:00
|
|
|
if (OSPF_IF_PARAM_CONFIGURED(IF_DEF_PARAMS(oi->ifp), output_cost_cmd)
|
|
|
|
|| OSPF_IF_PARAM_CONFIGURED(oi->params, output_cost_cmd))
|
|
|
|
cost = OSPF_IF_PARAM(oi, output_cost_cmd);
|
|
|
|
/* See if a cost can be calculated from the zebra processes
|
|
|
|
interface bandwidth field. */
|
|
|
|
else {
|
2018-03-27 21:13:34 +02:00
|
|
|
cost = (uint32_t)((double)refbw / (double)bw + (double)0.5);
|
2002-12-13 21:15:29 +01:00
|
|
|
if (cost < 1)
|
|
|
|
cost = 1;
|
|
|
|
else if (cost > 65535)
|
|
|
|
cost = 65535;
|
2023-05-09 19:10:35 +02:00
|
|
|
|
|
|
|
if (if_is_loopback(oi->ifp))
|
|
|
|
cost = 0;
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
return cost;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ospf_if_recalculate_output_cost(struct interface *ifp)
|
|
|
|
{
|
2018-03-27 21:13:34 +02:00
|
|
|
uint32_t newcost;
|
2002-12-13 21:15:29 +01:00
|
|
|
struct route_node *rn;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
for (rn = route_top(IF_OIFS(ifp)); rn; rn = route_next(rn)) {
|
|
|
|
struct ospf_interface *oi;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
if ((oi = rn->info) == NULL)
|
|
|
|
continue;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
newcost = ospf_if_get_output_cost(oi);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Is actual output cost changed? */
|
|
|
|
if (oi->output_cost != newcost) {
|
|
|
|
oi->output_cost = newcost;
|
2010-01-24 23:42:13 +01:00
|
|
|
ospf_router_lsa_update_area(oi->area);
|
2017-07-17 14:03:14 +02:00
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-03-29 19:03:49 +02:00
|
|
|
/* Simulate down/up on the interface. This is needed, for example, when
|
|
|
|
the MTU changes. */
|
|
|
|
void ospf_if_reset(struct interface *ifp)
|
|
|
|
{
|
|
|
|
struct route_node *rn;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2005-03-29 19:03:49 +02:00
|
|
|
for (rn = route_top(IF_OIFS(ifp)); rn; rn = route_next(rn)) {
|
|
|
|
struct ospf_interface *oi;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2005-03-29 19:03:49 +02:00
|
|
|
if ((oi = rn->info) == NULL)
|
|
|
|
continue;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2005-03-29 19:03:49 +02:00
|
|
|
ospf_if_down(oi);
|
|
|
|
ospf_if_up(oi);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
void ospf_if_reset_variables(struct ospf_interface *oi)
|
|
|
|
{
|
|
|
|
/* Set default values. */
|
|
|
|
/* don't clear this flag. oi->flag = OSPF_IF_DISABLE; */
|
|
|
|
|
|
|
|
if (oi->vl_data)
|
|
|
|
oi->type = OSPF_IFTYPE_VIRTUALLINK;
|
|
|
|
else
|
|
|
|
/* preserve network-type */
|
|
|
|
if (oi->type != OSPF_IFTYPE_NBMA)
|
|
|
|
oi->type = OSPF_IFTYPE_BROADCAST;
|
|
|
|
|
|
|
|
oi->state = ISM_Down;
|
|
|
|
|
|
|
|
oi->crypt_seqnum = 0;
|
|
|
|
|
|
|
|
/* This must be short, (less than RxmtInterval)
|
|
|
|
- RFC 2328 Section 13.5 para 3. Set to 1 second to avoid Acks being
|
|
|
|
held back for too long - MAG */
|
|
|
|
oi->v_ls_ack = 1;
|
|
|
|
}
|
|
|
|
|
2003-10-15 23:14:20 +02:00
|
|
|
/* lookup oi for specified prefix/ifp */
|
|
|
|
struct ospf_interface *ospf_if_table_lookup(struct interface *ifp,
|
|
|
|
struct prefix *prefix)
|
|
|
|
{
|
|
|
|
struct prefix p;
|
2003-10-15 23:40:57 +02:00
|
|
|
struct route_node *rn;
|
2005-05-19 01:29:57 +02:00
|
|
|
struct ospf_interface *rninfo = NULL;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2003-10-15 23:14:20 +02:00
|
|
|
p = *prefix;
|
2021-07-01 16:42:03 +02:00
|
|
|
p.prefixlen = IPV4_MAX_BITLEN;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2003-10-15 23:14:20 +02:00
|
|
|
/* route_node_get implicitely locks */
|
2005-10-21 Paul Jakma <paul.jakma@sun.com>
* (general) OSPF fast, sub-second hello and 1s dead-interval
support. A warning fix. Millisec support for ospf_timer_dump.
Change auto-cost ref-bandwidth to add a comment to write out
of config, rather than printing annoying messages to vty on
startup.
* ospf_dump.c: (ospf_timer_dump) Print out milliseconds too.
Callers typically specify a length of 9, so most see
millisecs unless they specify the additional length.
* ospf_interface.h: (struct ospf_interface) new interface param,
fast_hello.
* ospf_interface.c: (ospf_if_table_lookup) add brackets,
gcc warning fix.
(ospf_new_if_params) Initialise fast_hello param.
(ospf_free_if_params) Check whether fast_hello is configured.
(ospf_if_new_hook) set fast_hello to default.
* ospf_ism.h: Wrap OSPF_ISM_TIMER_ON inside do {} while (0) to
prevent funny side-effects from its if statement when this
macro is used conditionally by other macros.
(OSPF_ISM_TIMER_MSEC_ON) new macro, set in milliseconds.
(OSPF_HELLO_TIMER_ON) new macro to set hello timer according
to whether fast_hello is set.
* ospf_ism.c: Update all setting of the hello timer to use
either OSPF_ISM_TIMER_MSEC_ON or OSPF_HELLO_TIMER_ON. The
former is used when hello is to be sent immediately.
* ospf_nsm.c: ditto
* ospf_packet.c: (ospf_hello) hello-interval is not checked
for mismatch if fast_hello is set.
(ospf_read) Annoying nit, fix "no ospf_interface" to be debug
rather than a warning, as it can be perfectly normal to
receive packets when logical subnets are used.
(ospf_make_hello) Set hello-interval to 0 if fast-hellos are
configured.
* ospf_vty.c: (ospf_auto_cost_reference_bandwidth) annoying
nit, don't vty_out if this command is given, it gets tired
quick.
(show_ip_ospf_interface_sub) Print the hello-interval
according to whether fast-hello is set or not.
Print the extra 5 millisec characters from (ospf_timer_dump)
if fast-hello is configured.
(ospf_vty_dead_interval_set) new function, common to all
forms of dead-interval command, to set dead-interval and
fast-hello correctly. If a dead-interval is given, unset
fast-hello, else if a hello-multiplier is set, set
dead-interval to 1 and fast-hello to given multiplier.
(ip_ospf_dead_interval_addr_cmd) use
ospf_vty_dead_interval_set().
(ip_ospf_dead_interval_minimal_addr_cmd) ditto.
(no_ip_ospf_dead_interval) Unset fast-hello.
(no_ip_ospf_hello_interval) Bug-fix, unset of hello-interval
should set it to OSPF_HELLO_INTERVAL_DEFAULT, not
OSPF_ROUTER_DEAD_INTERVAL_DEFAULT.
(config_write_interface) Write out fast-hello.
(ospf_config_write) Write a comment about
"auto-cost reference-bandwidth" having to be equal on all
routers. Hopefully just as noticeable as old practice of
writing to vty, but less annoying.
(ospf_vty_if_init) install the two new dead-interval
commands.
* ospfd.h: Add defines for OSPF_ROUTER_DEAD_INTERVAL_MINIMAL
and OSPF_FAST_HELLO_DEFAULT.
2005-10-21 02:45:17 +02:00
|
|
|
if ((rn = route_node_lookup(IF_OIFS(ifp), &p))) {
|
2005-05-19 01:29:57 +02:00
|
|
|
rninfo = (struct ospf_interface *)rn->info;
|
|
|
|
route_unlock_node(rn);
|
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2003-11-11 00:56:29 +01:00
|
|
|
return rninfo;
|
2003-10-15 23:14:20 +02:00
|
|
|
}
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
static void ospf_add_to_if(struct interface *ifp, struct ospf_interface *oi)
|
|
|
|
{
|
|
|
|
struct route_node *rn;
|
|
|
|
struct prefix p;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
p = *oi->address;
|
2021-07-01 16:42:03 +02:00
|
|
|
p.prefixlen = IPV4_MAX_BITLEN;
|
2017-08-23 19:29:27 +02:00
|
|
|
apply_mask(&p);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
rn = route_node_get(IF_OIFS(ifp), &p);
|
2003-02-19 00:25:44 +01:00
|
|
|
/* rn->info should either be NULL or equal to this oi
|
|
|
|
* as route_node_get may return an existing node
|
|
|
|
*/
|
2003-10-15 23:14:20 +02:00
|
|
|
assert(!rn->info || rn->info == oi);
|
2002-12-13 21:15:29 +01:00
|
|
|
rn->info = oi;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void ospf_delete_from_if(struct interface *ifp,
|
|
|
|
struct ospf_interface *oi)
|
|
|
|
{
|
|
|
|
struct route_node *rn;
|
|
|
|
struct prefix p;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
p = *oi->address;
|
2021-07-01 16:42:03 +02:00
|
|
|
p.prefixlen = IPV4_MAX_BITLEN;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
rn = route_node_lookup(IF_OIFS(oi->ifp), &p);
|
|
|
|
assert(rn);
|
|
|
|
assert(rn->info);
|
|
|
|
rn->info = NULL;
|
|
|
|
route_unlock_node(rn);
|
|
|
|
route_unlock_node(rn);
|
|
|
|
}
|
|
|
|
|
2003-03-25 06:07:42 +01:00
|
|
|
struct ospf_interface *ospf_if_new(struct ospf *ospf, struct interface *ifp,
|
|
|
|
struct prefix *p)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
|
|
|
struct ospf_interface *oi;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2019-08-30 22:14:38 +02:00
|
|
|
oi = ospf_if_table_lookup(ifp, p);
|
|
|
|
if (oi)
|
2003-10-15 23:14:20 +02:00
|
|
|
return oi;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2019-08-30 22:14:38 +02:00
|
|
|
oi = XCALLOC(MTYPE_OSPF_IF, sizeof(struct ospf_interface));
|
|
|
|
|
|
|
|
oi->obuf = ospf_fifo_new();
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Set zebra interface pointer. */
|
|
|
|
oi->ifp = ifp;
|
|
|
|
oi->address = p;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
ospf_add_to_if(ifp, oi);
|
2003-03-25 06:07:42 +01:00
|
|
|
listnode_add(ospf->oiflist, oi);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Initialize neighbor list. */
|
|
|
|
oi->nbrs = route_table_init();
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Initialize static neighbor list. */
|
|
|
|
oi->nbr_nbma = list_new();
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Initialize Link State Acknowledgment list. */
|
|
|
|
oi->ls_ack = list_new();
|
|
|
|
oi->ls_ack_direct.ls_ack = list_new();
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Set default values. */
|
|
|
|
ospf_if_reset_variables(oi);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2016-04-21 23:22:33 +02:00
|
|
|
/* Set pseudo neighbor to Null */
|
|
|
|
oi->nbr_self = NULL;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
oi->ls_upd_queue = route_table_init();
|
|
|
|
oi->t_ls_upd_event = NULL;
|
|
|
|
oi->t_ls_ack_direct = NULL;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2023-01-19 16:16:11 +01:00
|
|
|
oi->crypt_seqnum = frr_sequence32_next();
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
ospf_opaque_type9_lsa_init(oi);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2003-03-25 06:07:42 +01:00
|
|
|
oi->ospf = ospf;
|
2018-05-01 16:36:53 +02:00
|
|
|
|
2016-12-07 13:25:38 +01:00
|
|
|
QOBJ_REG(oi, ospf_interface);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2023-06-29 19:51:18 +02:00
|
|
|
/* If first oi, check per-intf write socket */
|
|
|
|
if (ospf->oi_running && ospf->intf_socket_enabled)
|
|
|
|
ospf_ifp_sock_init(ifp);
|
|
|
|
|
2017-08-25 22:51:12 +02:00
|
|
|
if (IS_DEBUG_OSPF_EVENT)
|
|
|
|
zlog_debug("%s: ospf interface %s vrf %s id %u created",
|
2020-03-05 19:17:54 +01:00
|
|
|
__func__, ifp->name, ospf_get_name(ospf),
|
|
|
|
ospf->vrf_id);
|
2017-08-25 22:51:12 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
return oi;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Restore an interface to its pre UP state
|
|
|
|
Used from ism_interface_down only */
|
|
|
|
void ospf_if_cleanup(struct ospf_interface *oi)
|
|
|
|
{
|
|
|
|
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;
|
2002-12-13 21:15:29 +01:00
|
|
|
struct ospf_neighbor *nbr;
|
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_nbr_nbma *nbr_nbma;
|
|
|
|
struct ospf_lsa *lsa;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2006-01-11 02:08:19 +01:00
|
|
|
/* oi->nbrs and oi->nbr_nbma should be deleted on InterfaceDown event */
|
2002-12-13 21:15:29 +01:00
|
|
|
/* delete all static neighbors attached to this interface */
|
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(oi->nbr_nbma, node, nnode, nbr_nbma)) {
|
2022-12-25 16:26:52 +01:00
|
|
|
EVENT_OFF(nbr_nbma->t_poll);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
if (nbr_nbma->nbr) {
|
|
|
|
nbr_nbma->nbr->nbr_nbma = NULL;
|
|
|
|
nbr_nbma->nbr = NULL;
|
2017-07-17 14:03:14 +02:00
|
|
|
}
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
nbr_nbma->oi = NULL;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
listnode_delete(oi->nbr_nbma, nbr_nbma);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* send Neighbor event KillNbr to all associated neighbors. */
|
2022-08-11 00:14:23 +02:00
|
|
|
for (rn = route_top(oi->nbrs); rn; rn = route_next(rn)) {
|
2002-12-13 21:15:29 +01:00
|
|
|
if ((nbr = rn->info) != NULL)
|
|
|
|
if (nbr != oi->nbr_self)
|
|
|
|
OSPF_NSM_EVENT_EXECUTE(nbr, NSM_KillNbr);
|
2022-08-11 00:14:23 +02:00
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Cleanup Link State Acknowlegdment list. */
|
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(oi->ls_ack, node, nnode, lsa))
|
2006-07-26 11:37:26 +02:00
|
|
|
ospf_lsa_unlock(&lsa); /* oi->ls_ack */
|
2002-12-13 21:15:29 +01:00
|
|
|
list_delete_all_node(oi->ls_ack);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
oi->crypt_seqnum = 0;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Empty link state update queue */
|
|
|
|
ospf_ls_upd_queue_empty(oi);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2006-01-11 02:08:19 +01:00
|
|
|
/* Reset pseudo neighbor. */
|
2016-07-20 04:17:38 +02:00
|
|
|
ospf_nbr_self_reset(oi, oi->ospf->router_id);
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void ospf_if_free(struct ospf_interface *oi)
|
|
|
|
{
|
2023-06-29 19:51:18 +02:00
|
|
|
struct interface *ifp = oi->ifp;
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
ospf_if_down(oi);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2019-08-30 22:14:38 +02:00
|
|
|
ospf_fifo_free(oi->obuf);
|
2018-05-01 16:36:53 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
assert(oi->state == ISM_Down);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2023-11-27 14:13:03 +01:00
|
|
|
ospf_opaque_type9_lsa_if_cleanup(oi);
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
ospf_opaque_type9_lsa_term(oi);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2016-12-07 13:25:38 +01:00
|
|
|
QOBJ_UNREG(oi);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Free Pseudo Neighbour */
|
|
|
|
ospf_nbr_delete(oi->nbr_self);
|
|
|
|
|
|
|
|
route_table_finish(oi->nbrs);
|
|
|
|
route_table_finish(oi->ls_upd_queue);
|
|
|
|
|
|
|
|
/* Free any lists that should be freed */
|
2018-10-02 11:39:51 +02:00
|
|
|
list_delete(&oi->nbr_nbma);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2018-10-02 11:39:51 +02:00
|
|
|
list_delete(&oi->ls_ack);
|
|
|
|
list_delete(&oi->ls_ack_direct.ls_ack);
|
2016-12-07 13:25:38 +01:00
|
|
|
|
2017-08-25 22:51:12 +02:00
|
|
|
if (IS_DEBUG_OSPF_EVENT)
|
|
|
|
zlog_debug("%s: ospf interface %s vrf %s id %u deleted",
|
2021-10-22 00:17:40 +02:00
|
|
|
__func__, oi->ifp->name, oi->ifp->vrf->name,
|
|
|
|
oi->ifp->vrf->vrf_id);
|
2017-08-25 22:51:12 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
ospf_delete_from_if(oi->ifp, oi);
|
|
|
|
|
2003-03-25 06:07:42 +01:00
|
|
|
listnode_delete(oi->ospf->oiflist, oi);
|
2002-12-13 21:15:29 +01:00
|
|
|
listnode_delete(oi->area->oiflist, oi);
|
|
|
|
|
2022-12-10 15:08:37 +01:00
|
|
|
event_cancel_event(master, oi);
|
2010-04-15 12:39:05 +02:00
|
|
|
|
2023-06-29 19:51:18 +02:00
|
|
|
/* If last oi, close per-interface socket */
|
|
|
|
if (ospf_oi_count(ifp) == 0)
|
|
|
|
ospf_ifp_sock_close(ifp);
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
memset(oi, 0, sizeof(*oi));
|
|
|
|
XFREE(MTYPE_OSPF_IF, oi);
|
|
|
|
}
|
|
|
|
|
|
|
|
int ospf_if_is_up(struct ospf_interface *oi)
|
|
|
|
{
|
|
|
|
return if_is_up(oi->ifp);
|
|
|
|
}
|
|
|
|
|
2012-07-07 17:06:11 +02:00
|
|
|
/* Lookup OSPF interface by router LSA posistion */
|
|
|
|
struct ospf_interface *ospf_if_lookup_by_lsa_pos(struct ospf_area *area,
|
|
|
|
int lsa_pos)
|
|
|
|
{
|
|
|
|
struct listnode *node;
|
|
|
|
struct ospf_interface *oi;
|
|
|
|
|
|
|
|
for (ALL_LIST_ELEMENTS_RO(area->oiflist, node, oi)) {
|
|
|
|
if (lsa_pos >= oi->lsa_pos_beg && lsa_pos < oi->lsa_pos_end)
|
|
|
|
return oi;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2003-03-25 06:07:42 +01:00
|
|
|
struct ospf_interface *ospf_if_lookup_by_local_addr(struct ospf *ospf,
|
|
|
|
struct interface *ifp,
|
|
|
|
struct in_addr address)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
2004-09-23 21:18:23 +02:00
|
|
|
struct listnode *node;
|
2002-12-13 21:15:29 +01:00
|
|
|
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
|
|
|
for (ALL_LIST_ELEMENTS_RO(ospf->oiflist, node, oi))
|
|
|
|
if (oi->type != OSPF_IFTYPE_VIRTUALLINK) {
|
2002-12-13 21:15:29 +01:00
|
|
|
if (ifp && oi->ifp != ifp)
|
|
|
|
continue;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
if (IPV4_ADDR_SAME(&address, &oi->address->u.prefix4))
|
|
|
|
return oi;
|
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2003-03-25 06:07:42 +01:00
|
|
|
struct ospf_interface *ospf_if_lookup_by_prefix(struct ospf *ospf,
|
|
|
|
struct prefix_ipv4 *p)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
2004-09-23 21:18:23 +02:00
|
|
|
struct listnode *node;
|
2002-12-13 21:15:29 +01:00
|
|
|
struct ospf_interface *oi;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Check each Interface. */
|
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)) {
|
|
|
|
if (oi->type != OSPF_IFTYPE_VIRTUALLINK) {
|
[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
|
|
|
struct prefix ptmp;
|
2017-07-17 14:03:14 +02: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
|
|
|
prefix_copy(&ptmp, CONNECTED_PREFIX(oi->connected));
|
2003-03-25 06:07:42 +01:00
|
|
|
apply_mask(&ptmp);
|
|
|
|
if (prefix_same(&ptmp, (struct prefix *)p))
|
|
|
|
return oi;
|
2017-07-17 14:03:14 +02:00
|
|
|
}
|
2003-03-25 06:07:42 +01:00
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2009-07-27 12:42:30 +02:00
|
|
|
/* determine receiving interface by ifp and source address */
|
|
|
|
struct ospf_interface *ospf_if_lookup_recv_if(struct ospf *ospf,
|
|
|
|
struct in_addr src,
|
|
|
|
struct interface *ifp)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
2009-07-27 12:42:30 +02:00
|
|
|
struct route_node *rn;
|
2002-12-13 21:15:29 +01:00
|
|
|
struct prefix_ipv4 addr;
|
2022-10-12 22:05:23 +02:00
|
|
|
struct ospf_interface *oi, *match, *unnumbered_match;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
addr.family = AF_INET;
|
|
|
|
addr.prefix = src;
|
|
|
|
addr.prefixlen = IPV4_MAX_BITLEN;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2022-10-12 22:05:23 +02:00
|
|
|
match = unnumbered_match = NULL;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2009-07-27 12:42:30 +02:00
|
|
|
for (rn = route_top(IF_OIFS(ifp)); rn; rn = route_next(rn)) {
|
|
|
|
oi = rn->info;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2009-07-27 12:42:30 +02:00
|
|
|
if (!oi) /* oi can be NULL for PtP aliases */
|
|
|
|
continue;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
if (oi->type == OSPF_IFTYPE_VIRTUALLINK)
|
|
|
|
continue;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2021-11-16 16:01:03 +01:00
|
|
|
if (if_is_loopback(oi->ifp))
|
2006-03-30 16:20:00 +02:00
|
|
|
continue;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2015-05-20 02:58:13 +02:00
|
|
|
if (CHECK_FLAG(oi->connected->flags, ZEBRA_IFA_UNNUMBERED))
|
2022-10-12 22:05:23 +02:00
|
|
|
unnumbered_match = oi;
|
2015-05-20 02:58:13 +02:00
|
|
|
else if (prefix_match(CONNECTED_PREFIX(oi->connected),
|
|
|
|
(struct prefix *)&addr)) {
|
2017-07-22 14:52:33 +02:00
|
|
|
if ((match == NULL) || (match->address->prefixlen
|
|
|
|
< oi->address->prefixlen))
|
[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
|
|
|
match = oi;
|
2017-07-17 14:03:14 +02:00
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
2022-10-12 22:05:23 +02:00
|
|
|
if (match)
|
|
|
|
return match;
|
|
|
|
|
|
|
|
return unnumbered_match;
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
2014-06-04 06:53:35 +02:00
|
|
|
|
2022-08-11 03:56:40 +02:00
|
|
|
void ospf_interface_fifo_flush(struct ospf_interface *oi)
|
|
|
|
{
|
|
|
|
struct ospf *ospf = oi->ospf;
|
|
|
|
|
|
|
|
ospf_fifo_flush(oi->obuf);
|
|
|
|
|
|
|
|
if (oi->on_write_q) {
|
|
|
|
listnode_delete(ospf->oi_write_q, oi);
|
|
|
|
if (list_isempty(ospf->oi_write_q))
|
2022-12-25 16:26:52 +01:00
|
|
|
EVENT_OFF(ospf->t_write);
|
2022-08-11 03:56:40 +02:00
|
|
|
oi->on_write_q = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-10-23 20:59:29 +02:00
|
|
|
static void ospf_if_reset_stats(struct ospf_interface *oi)
|
|
|
|
{
|
|
|
|
oi->hello_in = oi->hello_out = 0;
|
|
|
|
oi->db_desc_in = oi->db_desc_out = 0;
|
|
|
|
oi->ls_req_in = oi->ls_req_out = 0;
|
|
|
|
oi->ls_upd_in = oi->ls_upd_out = 0;
|
|
|
|
oi->ls_ack_in = oi->ls_ack_out = 0;
|
|
|
|
}
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
void ospf_if_stream_unset(struct ospf_interface *oi)
|
|
|
|
{
|
2019-08-30 22:14:38 +02:00
|
|
|
/* flush the interface packet queue */
|
2022-08-11 03:56:40 +02:00
|
|
|
ospf_interface_fifo_flush(oi);
|
2019-08-30 22:14:38 +02:00
|
|
|
/*reset protocol stats */
|
|
|
|
ospf_if_reset_stats(oi);
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
2003-03-25 06:07:42 +01:00
|
|
|
|
2014-06-04 06:53:35 +02:00
|
|
|
|
2005-05-06 23:37:42 +02:00
|
|
|
static struct ospf_if_params *ospf_new_if_params(void)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
|
|
|
struct ospf_if_params *oip;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2008-08-18 23:13:29 +02:00
|
|
|
oip = XCALLOC(MTYPE_OSPF_IF_PARAMS, sizeof(struct ospf_if_params));
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
UNSET_IF_PARAM(oip, output_cost_cmd);
|
|
|
|
UNSET_IF_PARAM(oip, transmit_delay);
|
|
|
|
UNSET_IF_PARAM(oip, retransmit_interval);
|
|
|
|
UNSET_IF_PARAM(oip, passive_interface);
|
|
|
|
UNSET_IF_PARAM(oip, v_hello);
|
2005-10-21 Paul Jakma <paul.jakma@sun.com>
* (general) OSPF fast, sub-second hello and 1s dead-interval
support. A warning fix. Millisec support for ospf_timer_dump.
Change auto-cost ref-bandwidth to add a comment to write out
of config, rather than printing annoying messages to vty on
startup.
* ospf_dump.c: (ospf_timer_dump) Print out milliseconds too.
Callers typically specify a length of 9, so most see
millisecs unless they specify the additional length.
* ospf_interface.h: (struct ospf_interface) new interface param,
fast_hello.
* ospf_interface.c: (ospf_if_table_lookup) add brackets,
gcc warning fix.
(ospf_new_if_params) Initialise fast_hello param.
(ospf_free_if_params) Check whether fast_hello is configured.
(ospf_if_new_hook) set fast_hello to default.
* ospf_ism.h: Wrap OSPF_ISM_TIMER_ON inside do {} while (0) to
prevent funny side-effects from its if statement when this
macro is used conditionally by other macros.
(OSPF_ISM_TIMER_MSEC_ON) new macro, set in milliseconds.
(OSPF_HELLO_TIMER_ON) new macro to set hello timer according
to whether fast_hello is set.
* ospf_ism.c: Update all setting of the hello timer to use
either OSPF_ISM_TIMER_MSEC_ON or OSPF_HELLO_TIMER_ON. The
former is used when hello is to be sent immediately.
* ospf_nsm.c: ditto
* ospf_packet.c: (ospf_hello) hello-interval is not checked
for mismatch if fast_hello is set.
(ospf_read) Annoying nit, fix "no ospf_interface" to be debug
rather than a warning, as it can be perfectly normal to
receive packets when logical subnets are used.
(ospf_make_hello) Set hello-interval to 0 if fast-hellos are
configured.
* ospf_vty.c: (ospf_auto_cost_reference_bandwidth) annoying
nit, don't vty_out if this command is given, it gets tired
quick.
(show_ip_ospf_interface_sub) Print the hello-interval
according to whether fast-hello is set or not.
Print the extra 5 millisec characters from (ospf_timer_dump)
if fast-hello is configured.
(ospf_vty_dead_interval_set) new function, common to all
forms of dead-interval command, to set dead-interval and
fast-hello correctly. If a dead-interval is given, unset
fast-hello, else if a hello-multiplier is set, set
dead-interval to 1 and fast-hello to given multiplier.
(ip_ospf_dead_interval_addr_cmd) use
ospf_vty_dead_interval_set().
(ip_ospf_dead_interval_minimal_addr_cmd) ditto.
(no_ip_ospf_dead_interval) Unset fast-hello.
(no_ip_ospf_hello_interval) Bug-fix, unset of hello-interval
should set it to OSPF_HELLO_INTERVAL_DEFAULT, not
OSPF_ROUTER_DEAD_INTERVAL_DEFAULT.
(config_write_interface) Write out fast-hello.
(ospf_config_write) Write a comment about
"auto-cost reference-bandwidth" having to be equal on all
routers. Hopefully just as noticeable as old practice of
writing to vty, but less annoying.
(ospf_vty_if_init) install the two new dead-interval
commands.
* ospfd.h: Add defines for OSPF_ROUTER_DEAD_INTERVAL_MINIMAL
and OSPF_FAST_HELLO_DEFAULT.
2005-10-21 02:45:17 +02:00
|
|
|
UNSET_IF_PARAM(oip, fast_hello);
|
2023-03-03 17:09:20 +01:00
|
|
|
UNSET_IF_PARAM(oip, v_gr_hello_delay);
|
2002-12-13 21:15:29 +01:00
|
|
|
UNSET_IF_PARAM(oip, v_wait);
|
|
|
|
UNSET_IF_PARAM(oip, priority);
|
|
|
|
UNSET_IF_PARAM(oip, type);
|
|
|
|
UNSET_IF_PARAM(oip, auth_simple);
|
|
|
|
UNSET_IF_PARAM(oip, auth_crypt);
|
|
|
|
UNSET_IF_PARAM(oip, auth_type);
|
2020-10-13 21:53:02 +02:00
|
|
|
UNSET_IF_PARAM(oip, if_area);
|
2023-06-08 22:49:34 +02:00
|
|
|
UNSET_IF_PARAM(oip, opaque_capable);
|
2023-09-12 13:39:44 +02:00
|
|
|
UNSET_IF_PARAM(oip, keychain_name);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2003-06-04 04:23:15 +02:00
|
|
|
oip->auth_crypt = list_new();
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2009-10-13 17:13:13 +02:00
|
|
|
oip->network_lsa_seqnum = htonl(OSPF_INITIAL_SEQUENCE_NUMBER);
|
2020-09-19 09:29:25 +02:00
|
|
|
oip->is_v_wait_set = false;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2021-02-17 01:51:52 +01:00
|
|
|
oip->ptp_dmvpn = 0;
|
2023-05-18 16:43:52 +02:00
|
|
|
oip->p2mp_delay_reflood = OSPF_P2MP_DELAY_REFLOOD_DEFAULT;
|
2023-06-08 22:49:34 +02:00
|
|
|
oip->opaque_capable = OSPF_OPAQUE_CAPABLE_DEFAULT;
|
2021-02-17 01:51:52 +01:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
return oip;
|
|
|
|
}
|
|
|
|
|
2021-03-03 21:22:47 +01:00
|
|
|
static void ospf_del_if_params(struct interface *ifp,
|
|
|
|
struct ospf_if_params *oip)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
2018-10-02 11:39:51 +02:00
|
|
|
list_delete(&oip->auth_crypt);
|
2023-09-12 13:39:44 +02:00
|
|
|
XFREE(MTYPE_OSPF_IF_PARAMS, oip->keychain_name);
|
2021-03-03 21:22:47 +01:00
|
|
|
ospf_interface_disable_bfd(ifp, oip);
|
2020-07-22 19:31:14 +02:00
|
|
|
ldp_sync_info_free(&(oip->ldp_sync_info));
|
2002-12-13 21:15:29 +01:00
|
|
|
XFREE(MTYPE_OSPF_IF_PARAMS, oip);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ospf_free_if_params(struct interface *ifp, struct in_addr addr)
|
|
|
|
{
|
|
|
|
struct ospf_if_params *oip;
|
|
|
|
struct prefix_ipv4 p;
|
|
|
|
struct route_node *rn;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2004-08-31 19:28:41 +02:00
|
|
|
p.family = AF_INET;
|
2021-07-01 16:42:03 +02:00
|
|
|
p.prefixlen = IPV4_MAX_BITLEN;
|
2002-12-13 21:15:29 +01:00
|
|
|
p.prefix = addr;
|
|
|
|
rn = route_node_lookup(IF_OIFS_PARAMS(ifp), (struct prefix *)&p);
|
|
|
|
if (!rn || !rn->info)
|
|
|
|
return;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
oip = rn->info;
|
|
|
|
route_unlock_node(rn);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2023-06-08 22:49:34 +02:00
|
|
|
if (!OSPF_IF_PARAM_CONFIGURED(oip, output_cost_cmd) &&
|
|
|
|
!OSPF_IF_PARAM_CONFIGURED(oip, transmit_delay) &&
|
|
|
|
!OSPF_IF_PARAM_CONFIGURED(oip, retransmit_interval) &&
|
|
|
|
!OSPF_IF_PARAM_CONFIGURED(oip, passive_interface) &&
|
|
|
|
!OSPF_IF_PARAM_CONFIGURED(oip, v_hello) &&
|
|
|
|
!OSPF_IF_PARAM_CONFIGURED(oip, fast_hello) &&
|
|
|
|
!OSPF_IF_PARAM_CONFIGURED(oip, v_wait) &&
|
|
|
|
!OSPF_IF_PARAM_CONFIGURED(oip, priority) &&
|
|
|
|
!OSPF_IF_PARAM_CONFIGURED(oip, type) &&
|
|
|
|
!OSPF_IF_PARAM_CONFIGURED(oip, auth_simple) &&
|
|
|
|
!OSPF_IF_PARAM_CONFIGURED(oip, auth_type) &&
|
|
|
|
!OSPF_IF_PARAM_CONFIGURED(oip, if_area) &&
|
|
|
|
!OSPF_IF_PARAM_CONFIGURED(oip, opaque_capable) &&
|
2023-07-17 19:47:16 +02:00
|
|
|
!OSPF_IF_PARAM_CONFIGURED(oip, prefix_suppression) &&
|
2023-09-12 13:39:44 +02:00
|
|
|
!OSPF_IF_PARAM_CONFIGURED(oip, keychain_name) &&
|
2023-06-08 22:49:34 +02:00
|
|
|
listcount(oip->auth_crypt) == 0) {
|
2021-03-03 21:22:47 +01:00
|
|
|
ospf_del_if_params(ifp, oip);
|
2002-12-13 21:15:29 +01:00
|
|
|
rn->info = NULL;
|
|
|
|
route_unlock_node(rn);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
struct ospf_if_params *ospf_lookup_if_params(struct interface *ifp,
|
|
|
|
struct in_addr addr)
|
|
|
|
{
|
|
|
|
struct prefix_ipv4 p;
|
|
|
|
struct route_node *rn;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2004-08-31 19:28:41 +02:00
|
|
|
p.family = AF_INET;
|
2021-07-01 16:42:03 +02:00
|
|
|
p.prefixlen = IPV4_MAX_BITLEN;
|
2002-12-13 21:15:29 +01:00
|
|
|
p.prefix = addr;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
rn = route_node_lookup(IF_OIFS_PARAMS(ifp), (struct prefix *)&p);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
if (rn) {
|
|
|
|
route_unlock_node(rn);
|
|
|
|
return rn->info;
|
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct ospf_if_params *ospf_get_if_params(struct interface *ifp,
|
|
|
|
struct in_addr addr)
|
|
|
|
{
|
|
|
|
struct prefix_ipv4 p;
|
|
|
|
struct route_node *rn;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
p.family = AF_INET;
|
2021-07-01 16:42:03 +02:00
|
|
|
p.prefixlen = IPV4_MAX_BITLEN;
|
2002-12-13 21:15:29 +01:00
|
|
|
p.prefix = addr;
|
2017-08-23 19:29:27 +02:00
|
|
|
apply_mask_ipv4(&p);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
rn = route_node_get(IF_OIFS_PARAMS(ifp), (struct prefix *)&p);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
if (rn->info == NULL)
|
|
|
|
rn->info = ospf_new_if_params();
|
|
|
|
else
|
|
|
|
route_unlock_node(rn);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
return rn->info;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ospf_if_update_params(struct interface *ifp, struct in_addr addr)
|
|
|
|
{
|
|
|
|
struct route_node *rn;
|
|
|
|
struct ospf_interface *oi;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
for (rn = route_top(IF_OIFS(ifp)); rn; rn = route_next(rn)) {
|
|
|
|
if ((oi = rn->info) == NULL)
|
|
|
|
continue;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
if (IPV4_ADDR_SAME(&oi->address->u.prefix4, &addr))
|
|
|
|
oi->params = ospf_lookup_if_params(
|
|
|
|
ifp, oi->address->u.prefix4);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int ospf_if_new_hook(struct interface *ifp)
|
|
|
|
{
|
|
|
|
int rc = 0;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2008-08-18 23:13:29 +02:00
|
|
|
ifp->info = XCALLOC(MTYPE_OSPF_IF_INFO, sizeof(struct ospf_if_info));
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2023-03-29 22:58:25 +02:00
|
|
|
IF_OSPF_IF_INFO(ifp)->oii_fd = -1;
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
IF_OIFS(ifp) = route_table_init();
|
|
|
|
IF_OIFS_PARAMS(ifp) = route_table_init();
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
IF_DEF_PARAMS(ifp) = ospf_new_if_params();
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
SET_IF_PARAM(IF_DEF_PARAMS(ifp), transmit_delay);
|
|
|
|
IF_DEF_PARAMS(ifp)->transmit_delay = OSPF_TRANSMIT_DELAY_DEFAULT;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
SET_IF_PARAM(IF_DEF_PARAMS(ifp), retransmit_interval);
|
|
|
|
IF_DEF_PARAMS(ifp)->retransmit_interval =
|
|
|
|
OSPF_RETRANSMIT_INTERVAL_DEFAULT;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
SET_IF_PARAM(IF_DEF_PARAMS(ifp), priority);
|
|
|
|
IF_DEF_PARAMS(ifp)->priority = OSPF_ROUTER_PRIORITY_DEFAULT;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2005-09-29 15:52:57 +02:00
|
|
|
IF_DEF_PARAMS(ifp)->mtu_ignore = OSPF_MTU_IGNORE_DEFAULT;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
SET_IF_PARAM(IF_DEF_PARAMS(ifp), v_hello);
|
|
|
|
IF_DEF_PARAMS(ifp)->v_hello = OSPF_HELLO_INTERVAL_DEFAULT;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2005-10-21 Paul Jakma <paul.jakma@sun.com>
* (general) OSPF fast, sub-second hello and 1s dead-interval
support. A warning fix. Millisec support for ospf_timer_dump.
Change auto-cost ref-bandwidth to add a comment to write out
of config, rather than printing annoying messages to vty on
startup.
* ospf_dump.c: (ospf_timer_dump) Print out milliseconds too.
Callers typically specify a length of 9, so most see
millisecs unless they specify the additional length.
* ospf_interface.h: (struct ospf_interface) new interface param,
fast_hello.
* ospf_interface.c: (ospf_if_table_lookup) add brackets,
gcc warning fix.
(ospf_new_if_params) Initialise fast_hello param.
(ospf_free_if_params) Check whether fast_hello is configured.
(ospf_if_new_hook) set fast_hello to default.
* ospf_ism.h: Wrap OSPF_ISM_TIMER_ON inside do {} while (0) to
prevent funny side-effects from its if statement when this
macro is used conditionally by other macros.
(OSPF_ISM_TIMER_MSEC_ON) new macro, set in milliseconds.
(OSPF_HELLO_TIMER_ON) new macro to set hello timer according
to whether fast_hello is set.
* ospf_ism.c: Update all setting of the hello timer to use
either OSPF_ISM_TIMER_MSEC_ON or OSPF_HELLO_TIMER_ON. The
former is used when hello is to be sent immediately.
* ospf_nsm.c: ditto
* ospf_packet.c: (ospf_hello) hello-interval is not checked
for mismatch if fast_hello is set.
(ospf_read) Annoying nit, fix "no ospf_interface" to be debug
rather than a warning, as it can be perfectly normal to
receive packets when logical subnets are used.
(ospf_make_hello) Set hello-interval to 0 if fast-hellos are
configured.
* ospf_vty.c: (ospf_auto_cost_reference_bandwidth) annoying
nit, don't vty_out if this command is given, it gets tired
quick.
(show_ip_ospf_interface_sub) Print the hello-interval
according to whether fast-hello is set or not.
Print the extra 5 millisec characters from (ospf_timer_dump)
if fast-hello is configured.
(ospf_vty_dead_interval_set) new function, common to all
forms of dead-interval command, to set dead-interval and
fast-hello correctly. If a dead-interval is given, unset
fast-hello, else if a hello-multiplier is set, set
dead-interval to 1 and fast-hello to given multiplier.
(ip_ospf_dead_interval_addr_cmd) use
ospf_vty_dead_interval_set().
(ip_ospf_dead_interval_minimal_addr_cmd) ditto.
(no_ip_ospf_dead_interval) Unset fast-hello.
(no_ip_ospf_hello_interval) Bug-fix, unset of hello-interval
should set it to OSPF_HELLO_INTERVAL_DEFAULT, not
OSPF_ROUTER_DEAD_INTERVAL_DEFAULT.
(config_write_interface) Write out fast-hello.
(ospf_config_write) Write a comment about
"auto-cost reference-bandwidth" having to be equal on all
routers. Hopefully just as noticeable as old practice of
writing to vty, but less annoying.
(ospf_vty_if_init) install the two new dead-interval
commands.
* ospfd.h: Add defines for OSPF_ROUTER_DEAD_INTERVAL_MINIMAL
and OSPF_FAST_HELLO_DEFAULT.
2005-10-21 02:45:17 +02:00
|
|
|
SET_IF_PARAM(IF_DEF_PARAMS(ifp), fast_hello);
|
|
|
|
IF_DEF_PARAMS(ifp)->fast_hello = OSPF_FAST_HELLO_DEFAULT;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2023-03-03 17:09:20 +01:00
|
|
|
SET_IF_PARAM(IF_DEF_PARAMS(ifp), v_gr_hello_delay);
|
|
|
|
IF_DEF_PARAMS(ifp)->v_gr_hello_delay = OSPF_HELLO_DELAY_DEFAULT;
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
SET_IF_PARAM(IF_DEF_PARAMS(ifp), v_wait);
|
|
|
|
IF_DEF_PARAMS(ifp)->v_wait = OSPF_ROUTER_DEAD_INTERVAL_DEFAULT;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
SET_IF_PARAM(IF_DEF_PARAMS(ifp), auth_simple);
|
|
|
|
memset(IF_DEF_PARAMS(ifp)->auth_simple, 0, OSPF_AUTH_SIMPLE_SIZE);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
SET_IF_PARAM(IF_DEF_PARAMS(ifp), auth_type);
|
|
|
|
IF_DEF_PARAMS(ifp)->auth_type = OSPF_AUTH_NOTSET;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2023-06-08 22:49:34 +02:00
|
|
|
SET_IF_PARAM(IF_DEF_PARAMS(ifp), opaque_capable);
|
|
|
|
IF_DEF_PARAMS(ifp)->opaque_capable = OSPF_OPAQUE_CAPABLE_DEFAULT;
|
|
|
|
|
2023-07-17 19:47:16 +02:00
|
|
|
IF_DEF_PARAMS(ifp)->prefix_suppression = OSPF_PREFIX_SUPPRESSION_DEFAULT;
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
rc = ospf_opaque_new_if(ifp);
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int ospf_if_delete_hook(struct interface *ifp)
|
|
|
|
{
|
|
|
|
int rc = 0;
|
2004-02-17 21:07:30 +01:00
|
|
|
struct route_node *rn;
|
2023-03-29 22:58:25 +02:00
|
|
|
struct ospf_if_info *oii;
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
rc = ospf_opaque_del_if(ifp);
|
2004-02-17 21:07:30 +01:00
|
|
|
|
2021-04-09 15:54:23 +02:00
|
|
|
/*
|
|
|
|
* This function must be called before `route_table_finish` due to
|
|
|
|
* BFD integration need to iterate over the interface neighbors to
|
|
|
|
* remove all registrations.
|
|
|
|
*/
|
|
|
|
ospf_del_if_params(ifp, IF_DEF_PARAMS(ifp));
|
|
|
|
|
2004-02-17 21:07:30 +01:00
|
|
|
for (rn = route_top(IF_OIFS_PARAMS(ifp)); rn; rn = route_next(rn))
|
|
|
|
if (rn->info)
|
2021-03-03 21:22:47 +01:00
|
|
|
ospf_del_if_params(ifp, rn->info);
|
2021-11-11 19:25:35 +01:00
|
|
|
|
|
|
|
route_table_finish(IF_OIFS(ifp));
|
2002-12-13 21:15:29 +01:00
|
|
|
route_table_finish(IF_OIFS_PARAMS(ifp));
|
2004-02-17 21:07:30 +01:00
|
|
|
|
2023-03-29 22:58:25 +02:00
|
|
|
/* Close per-interface socket */
|
|
|
|
oii = ifp->info;
|
|
|
|
if (oii && oii->oii_fd > 0) {
|
|
|
|
close(oii->oii_fd);
|
|
|
|
oii->oii_fd = -1;
|
|
|
|
}
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
XFREE(MTYPE_OSPF_IF_INFO, ifp->info);
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
int ospf_if_is_enable(struct ospf_interface *oi)
|
|
|
|
{
|
2021-11-16 16:01:03 +01:00
|
|
|
if (!(if_is_loopback(oi->ifp)))
|
2002-12-13 21:15:29 +01:00
|
|
|
if (if_is_up(oi->ifp))
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2005-02-08 16:37:30 +01:00
|
|
|
void ospf_if_set_multicast(struct ospf_interface *oi)
|
|
|
|
{
|
|
|
|
if ((oi->state > ISM_Loopback) && (oi->type != OSPF_IFTYPE_LOOPBACK)
|
|
|
|
&& (oi->type != OSPF_IFTYPE_VIRTUALLINK)
|
2007-04-21 22:46:31 +02:00
|
|
|
&& (OSPF_IF_PASSIVE_STATUS(oi) == OSPF_IF_ACTIVE)) {
|
2005-02-08 16:37:30 +01:00
|
|
|
/* The interface should belong to the OSPF-all-routers group. */
|
2006-06-15 20:40:49 +02:00
|
|
|
if (!OI_MEMBER_CHECK(oi, MEMBER_ALLROUTERS)
|
2005-02-08 16:37:30 +01:00
|
|
|
&& (ospf_if_add_allspfrouters(oi->ospf, oi->address,
|
|
|
|
oi->ifp->ifindex)
|
|
|
|
>= 0))
|
2006-06-15 20:40:49 +02:00
|
|
|
/* Set the flag only if the system call to join
|
|
|
|
* succeeded. */
|
|
|
|
OI_MEMBER_JOINED(oi, MEMBER_ALLROUTERS);
|
2005-02-08 16:37:30 +01:00
|
|
|
} else {
|
|
|
|
/* The interface should NOT belong to the OSPF-all-routers
|
|
|
|
* group. */
|
2006-06-15 20:40:49 +02:00
|
|
|
if (OI_MEMBER_CHECK(oi, MEMBER_ALLROUTERS)) {
|
|
|
|
/* Only actually drop if this is the last reference */
|
|
|
|
if (OI_MEMBER_COUNT(oi, MEMBER_ALLROUTERS) == 1)
|
|
|
|
ospf_if_drop_allspfrouters(oi->ospf,
|
|
|
|
oi->address,
|
|
|
|
oi->ifp->ifindex);
|
2005-02-08 16:37:30 +01:00
|
|
|
/* Unset the flag regardless of whether the system call
|
|
|
|
to leave
|
|
|
|
the group succeeded, since it's much safer to assume
|
|
|
|
that
|
|
|
|
we are not a member. */
|
2006-06-15 20:40:49 +02:00
|
|
|
OI_MEMBER_LEFT(oi, MEMBER_ALLROUTERS);
|
2017-07-17 14:03:14 +02:00
|
|
|
}
|
2005-02-08 16:37:30 +01:00
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2005-02-08 16:37:30 +01:00
|
|
|
if (((oi->type == OSPF_IFTYPE_BROADCAST)
|
|
|
|
|| (oi->type == OSPF_IFTYPE_POINTOPOINT))
|
|
|
|
&& ((oi->state == ISM_DR) || (oi->state == ISM_Backup))
|
2007-04-21 22:46:31 +02:00
|
|
|
&& (OSPF_IF_PASSIVE_STATUS(oi) == OSPF_IF_ACTIVE)) {
|
2005-02-08 16:37:30 +01:00
|
|
|
/* The interface should belong to the OSPF-designated-routers
|
|
|
|
* group. */
|
2006-06-15 20:40:49 +02:00
|
|
|
if (!OI_MEMBER_CHECK(oi, MEMBER_DROUTERS)
|
2005-02-08 16:37:30 +01:00
|
|
|
&& (ospf_if_add_alldrouters(oi->ospf, oi->address,
|
|
|
|
oi->ifp->ifindex)
|
|
|
|
>= 0))
|
|
|
|
/* Set the flag only if the system call to join
|
|
|
|
* succeeded. */
|
2006-06-15 20:40:49 +02:00
|
|
|
OI_MEMBER_JOINED(oi, MEMBER_DROUTERS);
|
2005-02-08 16:37:30 +01:00
|
|
|
} else {
|
|
|
|
/* The interface should NOT belong to the
|
|
|
|
* OSPF-designated-routers group */
|
2006-06-15 20:40:49 +02:00
|
|
|
if (OI_MEMBER_CHECK(oi, MEMBER_DROUTERS)) {
|
|
|
|
/* drop only if last reference */
|
|
|
|
if (OI_MEMBER_COUNT(oi, MEMBER_DROUTERS) == 1)
|
|
|
|
ospf_if_drop_alldrouters(oi->ospf, oi->address,
|
|
|
|
oi->ifp->ifindex);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2005-02-08 16:37:30 +01:00
|
|
|
/* Unset the flag regardless of whether the system call
|
|
|
|
to leave
|
|
|
|
the group succeeded, since it's much safer to assume
|
|
|
|
that
|
|
|
|
we are not a member. */
|
2006-06-15 20:40:49 +02:00
|
|
|
OI_MEMBER_LEFT(oi, MEMBER_DROUTERS);
|
2005-02-08 16:37:30 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
int ospf_if_up(struct ospf_interface *oi)
|
|
|
|
{
|
|
|
|
if (oi == NULL)
|
|
|
|
return 0;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
if (oi->type == OSPF_IFTYPE_LOOPBACK)
|
|
|
|
OSPF_ISM_EVENT_SCHEDULE(oi, ISM_LoopInd);
|
|
|
|
else {
|
|
|
|
OSPF_ISM_EVENT_SCHEDULE(oi, ISM_InterfaceUp);
|
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
int ospf_if_down(struct ospf_interface *oi)
|
|
|
|
{
|
2020-08-22 19:49:30 +02:00
|
|
|
struct ospf *ospf;
|
2021-05-24 19:45:29 +02:00
|
|
|
struct route_node *rn;
|
|
|
|
struct ospf_route *or;
|
|
|
|
struct listnode *nh;
|
|
|
|
struct ospf_path *op;
|
2020-08-22 19:49:30 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
if (oi == NULL)
|
|
|
|
return 0;
|
|
|
|
|
2020-08-22 19:49:30 +02:00
|
|
|
ospf = oi->ospf;
|
|
|
|
|
|
|
|
/* Cease the HELPER role for all the neighbours
|
|
|
|
* of this interface.
|
|
|
|
*/
|
|
|
|
if (ospf->is_helper_supported) {
|
|
|
|
struct route_node *rn = NULL;
|
|
|
|
|
|
|
|
if (ospf_interface_neighbor_count(oi)) {
|
|
|
|
for (rn = route_top(oi->nbrs); rn;
|
|
|
|
rn = route_next(rn)) {
|
|
|
|
struct ospf_neighbor *nbr = NULL;
|
|
|
|
|
|
|
|
if (!rn->info)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
nbr = rn->info;
|
|
|
|
|
|
|
|
if (OSPF_GR_IS_ACTIVE_HELPER(nbr))
|
|
|
|
ospf_gr_helper_exit(
|
|
|
|
nbr, OSPF_GR_HELPER_TOPO_CHG);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
OSPF_ISM_EVENT_EXECUTE(oi, ISM_InterfaceDown);
|
2012-07-07 17:06:11 +02:00
|
|
|
/* delete position in router LSA */
|
|
|
|
oi->lsa_pos_beg = 0;
|
|
|
|
oi->lsa_pos_end = 0;
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Shutdown packet reception and sending */
|
|
|
|
ospf_if_stream_unset(oi);
|
|
|
|
|
2022-02-02 10:19:09 +01:00
|
|
|
if (!ospf->new_table)
|
|
|
|
return 1;
|
2021-05-24 19:45:29 +02:00
|
|
|
for (rn = route_top(ospf->new_table); rn; rn = route_next(rn)) {
|
|
|
|
or = rn->info;
|
|
|
|
|
|
|
|
if (!or)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
for (nh = listhead(or->paths); nh;
|
|
|
|
nh = listnextnode_unchecked(nh)) {
|
|
|
|
op = listgetdata(nh);
|
|
|
|
if (op->ifindex == oi->ifp->ifindex) {
|
|
|
|
or->changed = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2014-06-04 06:53:35 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Virtual Link related functions. */
|
|
|
|
|
|
|
|
struct ospf_vl_data *ospf_vl_data_new(struct ospf_area *area,
|
|
|
|
struct in_addr vl_peer)
|
|
|
|
{
|
|
|
|
struct ospf_vl_data *vl_data;
|
|
|
|
|
2008-08-18 23:13:29 +02:00
|
|
|
vl_data = XCALLOC(MTYPE_OSPF_VL_DATA, sizeof(struct ospf_vl_data));
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
vl_data->vl_peer.s_addr = vl_peer.s_addr;
|
|
|
|
vl_data->vl_area_id = area->area_id;
|
2017-05-19 20:38:02 +02:00
|
|
|
vl_data->vl_area_id_fmt = area->area_id_fmt;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
return vl_data;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ospf_vl_data_free(struct ospf_vl_data *vl_data)
|
|
|
|
{
|
|
|
|
XFREE(MTYPE_OSPF_VL_DATA, vl_data);
|
|
|
|
}
|
|
|
|
|
2018-03-27 21:13:34 +02:00
|
|
|
unsigned int vlink_count = 0;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2003-03-25 06:07:42 +01:00
|
|
|
struct ospf_interface *ospf_vl_new(struct ospf *ospf,
|
|
|
|
struct ospf_vl_data *vl_data)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
|
|
|
struct ospf_interface *voi;
|
|
|
|
struct interface *vi;
|
2023-11-21 14:08:29 +01:00
|
|
|
char ifname[IFNAMSIZ];
|
2002-12-13 21:15:29 +01:00
|
|
|
struct ospf_area *area;
|
|
|
|
struct in_addr area_id;
|
|
|
|
struct connected *co;
|
|
|
|
struct prefix_ipv4 *p;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
if (IS_DEBUG_OSPF_EVENT)
|
2022-08-22 19:30:35 +02:00
|
|
|
zlog_debug("%s: (%s): Start", __func__, ospf_get_name(ospf));
|
2002-12-13 21:15:29 +01:00
|
|
|
if (vlink_count == OSPF_VL_MAX_COUNT) {
|
|
|
|
if (IS_DEBUG_OSPF_EVENT)
|
2004-12-08 18:45:02 +01:00
|
|
|
zlog_debug(
|
2022-08-22 19:30:35 +02:00
|
|
|
"%s: Alarm: cannot create more than OSPF_MAX_VL_COUNT virtual links",
|
|
|
|
__func__);
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
return NULL;
|
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
if (IS_DEBUG_OSPF_EVENT)
|
2022-08-22 19:30:35 +02:00
|
|
|
zlog_debug("%s: creating pseudo zebra interface vrf id %u",
|
|
|
|
__func__, ospf->vrf_id);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2018-06-18 17:49:58 +02:00
|
|
|
snprintf(ifname, sizeof(ifname), "VLINK%u", vlink_count);
|
2021-10-13 14:06:38 +02:00
|
|
|
vi = if_get_by_name(ifname, ospf->vrf_id, ospf->name);
|
2015-05-20 03:29:16 +02:00
|
|
|
/*
|
2021-10-13 14:06:38 +02:00
|
|
|
* if_get_by_name sets ZEBRA_INTERFACE_LINKDETECTION
|
2015-05-20 03:29:16 +02:00
|
|
|
* virtual links don't need this.
|
|
|
|
*/
|
|
|
|
UNSET_FLAG(vi->status, ZEBRA_INTERFACE_LINKDETECTION);
|
2002-12-13 21:15:29 +01:00
|
|
|
co = connected_new();
|
|
|
|
co->ifp = vi;
|
2023-11-22 19:05:41 +01:00
|
|
|
if_connected_add_tail(vi->connected, co);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
p = prefix_ipv4_new();
|
|
|
|
p->family = AF_INET;
|
2020-02-06 07:49:02 +01:00
|
|
|
p->prefix.s_addr = INADDR_ANY;
|
2002-12-13 21:15:29 +01:00
|
|
|
p->prefixlen = 0;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
co->address = (struct prefix *)p;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2003-03-25 06:07:42 +01:00
|
|
|
voi = ospf_if_new(ospf, vi, co->address);
|
2002-12-13 21:15:29 +01:00
|
|
|
if (voi == NULL) {
|
|
|
|
if (IS_DEBUG_OSPF_EVENT)
|
2004-12-08 18:45:02 +01:00
|
|
|
zlog_debug(
|
2022-08-22 19:30:35 +02:00
|
|
|
"%s: Alarm: OSPF int structure is not created",
|
|
|
|
__func__);
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
voi->connected = co;
|
|
|
|
voi->vl_data = vl_data;
|
|
|
|
voi->ifp->mtu = OSPF_VL_MTU;
|
|
|
|
voi->type = OSPF_IFTYPE_VIRTUALLINK;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2003-08-01 02:24:13 +02:00
|
|
|
vlink_count++;
|
2002-12-13 21:15:29 +01:00
|
|
|
if (IS_DEBUG_OSPF_EVENT)
|
2022-08-22 19:30:35 +02:00
|
|
|
zlog_debug("%s: Created name: %s set if->name to %s", __func__,
|
|
|
|
ifname, vi->name);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2020-02-06 07:49:02 +01:00
|
|
|
area_id.s_addr = INADDR_ANY;
|
2017-05-19 20:38:02 +02:00
|
|
|
area = ospf_area_get(ospf, area_id);
|
2002-12-13 21:15:29 +01:00
|
|
|
voi->area = area;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
if (IS_DEBUG_OSPF_EVENT)
|
2022-08-22 19:30:35 +02:00
|
|
|
zlog_debug("%s: set associated area to the backbone", __func__);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2016-04-21 23:22:33 +02:00
|
|
|
/* Add pseudo neighbor. */
|
2016-07-20 04:17:38 +02:00
|
|
|
ospf_nbr_self_reset(voi, voi->ospf->router_id);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
ospf_area_add_if(voi->area, voi);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
if (IS_DEBUG_OSPF_EVENT)
|
2022-08-22 19:30:35 +02:00
|
|
|
zlog_debug("%s: Stop", __func__);
|
2002-12-13 21:15:29 +01:00
|
|
|
return voi;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void ospf_vl_if_delete(struct ospf_vl_data *vl_data)
|
|
|
|
{
|
2019-12-18 15:23:38 +01:00
|
|
|
struct interface *ifp = vl_data->vl_oi->ifp;
|
2021-11-05 23:22:07 +01:00
|
|
|
struct vrf *vrf = ifp->vrf;
|
2019-12-18 15:23:38 +01:00
|
|
|
|
2020-02-06 07:49:02 +01:00
|
|
|
vl_data->vl_oi->address->u.prefix4.s_addr = INADDR_ANY;
|
2002-12-13 21:15:29 +01:00
|
|
|
vl_data->vl_oi->address->prefixlen = 0;
|
|
|
|
ospf_if_free(vl_data->vl_oi);
|
2019-12-18 15:23:38 +01:00
|
|
|
if_delete(&ifp);
|
2021-11-05 23:22:07 +01:00
|
|
|
if (!vrf_is_enabled(vrf))
|
|
|
|
vrf_delete(vrf);
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
2018-10-25 09:02:24 +02:00
|
|
|
/* for a defined area, count the number of configured vl
|
|
|
|
*/
|
|
|
|
int ospf_vl_count(struct ospf *ospf, struct ospf_area *area)
|
|
|
|
{
|
|
|
|
int count = 0;
|
|
|
|
struct ospf_vl_data *vl_data;
|
|
|
|
struct listnode *node;
|
|
|
|
|
|
|
|
for (ALL_LIST_ELEMENTS_RO(ospf->vlinks, node, vl_data)) {
|
|
|
|
if (area
|
|
|
|
&& !IPV4_ADDR_SAME(&vl_data->vl_area_id, &area->area_id))
|
|
|
|
continue;
|
|
|
|
count++;
|
|
|
|
}
|
|
|
|
return count;
|
|
|
|
}
|
|
|
|
|
[ospfd] Fix SPF of virtual-links
2006-04-24 Paul Jakma <paul.jakma@sun.com>
* (general) More Virtual-link fixes, again with much help in
testing / debug from Juergen Kammer. Primarily in SPF.
* ospf_spf.h: Add guard. ospf_interface.h will include this
header.
* ospf_interface.h: Modify ospf_vl_lookup definition to take
struct ospf as argument, so as to allow for NULL area
argument.
(struct ospf_vl_data) Remove out_oi, instead add a struct
vertex_nexthop, to use as initial nexthop for backbone paths
through a vlink.
* ospf_interface.c: (ospf_vl_lookup) Modified to allow
NULL area to be passed to indicate "any" (first) area.
Add extra debug.
(ospf_vl_set_params) vl_oi -> nexthop. Add extra debug.
(ospf_vl_up_check) Fix debug, inet_ntoa returns a static
buffer..
* ospf_route.c: (ospf_intra_add_router) Vlinks dont go through
backbone, don't bother checking.
* ospf_spf.c: (static struct list vertex_list) Record vertices
that will need to be freed.
(cmp) Order network before router vertices, as required,
wasn't implemented.
(vertex_nexthop_free) Mild additional robustness check.
(vertex_parent_free) Take void argument, as this function
is passed as list deconstructor for vertex parent list.
(ospf_vertex_new) More debug. Set deconstructor for parent
list. Track allocated vertices on the vertex_list.
(ospf_vertex_free) Get rid of the tricky recursive cleanup of
vertices. Now frees only the given vertex.
(ospf_vertex_add_parent) Fix assert.
(ospf_nexthop_calculation) Fix calculation of nexthop for
VLink vertices, lookup the vl_data and use its previously
recorded nexthop information.
(ospf_spf_calculate) Vertices are freed simply by deleting
vertex_list nodes and letting ospf_vertex_free as deconstructor
work per-node.
(ospf_spf_calculate_timer) Trivial optimisation, leave
backbone SPF calculation till last to reduce SPF churn on
VLink updates.
* ospf_vty.c: (ospf_find_vl_data) update call to ospf_vl_lookup
(no_ospf_area_vlink_cmd) ditto.
(show_ip_ospf_interface_sub) For Vlinks, the peer address is
more interesting than the output interface.
2006-05-04 09:32:57 +02:00
|
|
|
/* Look up vl_data for given peer, optionally qualified to be in the
|
|
|
|
* specified area. NULL area returns first found..
|
|
|
|
*/
|
|
|
|
struct ospf_vl_data *ospf_vl_lookup(struct ospf *ospf, struct ospf_area *area,
|
|
|
|
struct in_addr vl_peer)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
|
|
|
struct ospf_vl_data *vl_data;
|
2004-09-23 21:18:23 +02:00
|
|
|
struct listnode *node;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
[ospfd] Fix SPF of virtual-links
2006-04-24 Paul Jakma <paul.jakma@sun.com>
* (general) More Virtual-link fixes, again with much help in
testing / debug from Juergen Kammer. Primarily in SPF.
* ospf_spf.h: Add guard. ospf_interface.h will include this
header.
* ospf_interface.h: Modify ospf_vl_lookup definition to take
struct ospf as argument, so as to allow for NULL area
argument.
(struct ospf_vl_data) Remove out_oi, instead add a struct
vertex_nexthop, to use as initial nexthop for backbone paths
through a vlink.
* ospf_interface.c: (ospf_vl_lookup) Modified to allow
NULL area to be passed to indicate "any" (first) area.
Add extra debug.
(ospf_vl_set_params) vl_oi -> nexthop. Add extra debug.
(ospf_vl_up_check) Fix debug, inet_ntoa returns a static
buffer..
* ospf_route.c: (ospf_intra_add_router) Vlinks dont go through
backbone, don't bother checking.
* ospf_spf.c: (static struct list vertex_list) Record vertices
that will need to be freed.
(cmp) Order network before router vertices, as required,
wasn't implemented.
(vertex_nexthop_free) Mild additional robustness check.
(vertex_parent_free) Take void argument, as this function
is passed as list deconstructor for vertex parent list.
(ospf_vertex_new) More debug. Set deconstructor for parent
list. Track allocated vertices on the vertex_list.
(ospf_vertex_free) Get rid of the tricky recursive cleanup of
vertices. Now frees only the given vertex.
(ospf_vertex_add_parent) Fix assert.
(ospf_nexthop_calculation) Fix calculation of nexthop for
VLink vertices, lookup the vl_data and use its previously
recorded nexthop information.
(ospf_spf_calculate) Vertices are freed simply by deleting
vertex_list nodes and letting ospf_vertex_free as deconstructor
work per-node.
(ospf_spf_calculate_timer) Trivial optimisation, leave
backbone SPF calculation till last to reduce SPF churn on
VLink updates.
* ospf_vty.c: (ospf_find_vl_data) update call to ospf_vl_lookup
(no_ospf_area_vlink_cmd) ditto.
(show_ip_ospf_interface_sub) For Vlinks, the peer address is
more interesting than the output interface.
2006-05-04 09:32:57 +02:00
|
|
|
if (IS_DEBUG_OSPF_EVENT) {
|
2020-10-21 19:56:26 +02:00
|
|
|
zlog_debug("%s: Looking for %pI4", __func__, &vl_peer);
|
[ospfd] Fix SPF of virtual-links
2006-04-24 Paul Jakma <paul.jakma@sun.com>
* (general) More Virtual-link fixes, again with much help in
testing / debug from Juergen Kammer. Primarily in SPF.
* ospf_spf.h: Add guard. ospf_interface.h will include this
header.
* ospf_interface.h: Modify ospf_vl_lookup definition to take
struct ospf as argument, so as to allow for NULL area
argument.
(struct ospf_vl_data) Remove out_oi, instead add a struct
vertex_nexthop, to use as initial nexthop for backbone paths
through a vlink.
* ospf_interface.c: (ospf_vl_lookup) Modified to allow
NULL area to be passed to indicate "any" (first) area.
Add extra debug.
(ospf_vl_set_params) vl_oi -> nexthop. Add extra debug.
(ospf_vl_up_check) Fix debug, inet_ntoa returns a static
buffer..
* ospf_route.c: (ospf_intra_add_router) Vlinks dont go through
backbone, don't bother checking.
* ospf_spf.c: (static struct list vertex_list) Record vertices
that will need to be freed.
(cmp) Order network before router vertices, as required,
wasn't implemented.
(vertex_nexthop_free) Mild additional robustness check.
(vertex_parent_free) Take void argument, as this function
is passed as list deconstructor for vertex parent list.
(ospf_vertex_new) More debug. Set deconstructor for parent
list. Track allocated vertices on the vertex_list.
(ospf_vertex_free) Get rid of the tricky recursive cleanup of
vertices. Now frees only the given vertex.
(ospf_vertex_add_parent) Fix assert.
(ospf_nexthop_calculation) Fix calculation of nexthop for
VLink vertices, lookup the vl_data and use its previously
recorded nexthop information.
(ospf_spf_calculate) Vertices are freed simply by deleting
vertex_list nodes and letting ospf_vertex_free as deconstructor
work per-node.
(ospf_spf_calculate_timer) Trivial optimisation, leave
backbone SPF calculation till last to reduce SPF churn on
VLink updates.
* ospf_vty.c: (ospf_find_vl_data) update call to ospf_vl_lookup
(no_ospf_area_vlink_cmd) ditto.
(show_ip_ospf_interface_sub) For Vlinks, the peer address is
more interesting than the output interface.
2006-05-04 09:32:57 +02:00
|
|
|
if (area)
|
2020-10-21 19:56:26 +02:00
|
|
|
zlog_debug("%s: in area %pI4", __func__,
|
|
|
|
&area->area_id);
|
[ospfd] Fix SPF of virtual-links
2006-04-24 Paul Jakma <paul.jakma@sun.com>
* (general) More Virtual-link fixes, again with much help in
testing / debug from Juergen Kammer. Primarily in SPF.
* ospf_spf.h: Add guard. ospf_interface.h will include this
header.
* ospf_interface.h: Modify ospf_vl_lookup definition to take
struct ospf as argument, so as to allow for NULL area
argument.
(struct ospf_vl_data) Remove out_oi, instead add a struct
vertex_nexthop, to use as initial nexthop for backbone paths
through a vlink.
* ospf_interface.c: (ospf_vl_lookup) Modified to allow
NULL area to be passed to indicate "any" (first) area.
Add extra debug.
(ospf_vl_set_params) vl_oi -> nexthop. Add extra debug.
(ospf_vl_up_check) Fix debug, inet_ntoa returns a static
buffer..
* ospf_route.c: (ospf_intra_add_router) Vlinks dont go through
backbone, don't bother checking.
* ospf_spf.c: (static struct list vertex_list) Record vertices
that will need to be freed.
(cmp) Order network before router vertices, as required,
wasn't implemented.
(vertex_nexthop_free) Mild additional robustness check.
(vertex_parent_free) Take void argument, as this function
is passed as list deconstructor for vertex parent list.
(ospf_vertex_new) More debug. Set deconstructor for parent
list. Track allocated vertices on the vertex_list.
(ospf_vertex_free) Get rid of the tricky recursive cleanup of
vertices. Now frees only the given vertex.
(ospf_vertex_add_parent) Fix assert.
(ospf_nexthop_calculation) Fix calculation of nexthop for
VLink vertices, lookup the vl_data and use its previously
recorded nexthop information.
(ospf_spf_calculate) Vertices are freed simply by deleting
vertex_list nodes and letting ospf_vertex_free as deconstructor
work per-node.
(ospf_spf_calculate_timer) Trivial optimisation, leave
backbone SPF calculation till last to reduce SPF churn on
VLink updates.
* ospf_vty.c: (ospf_find_vl_data) update call to ospf_vl_lookup
(no_ospf_area_vlink_cmd) ditto.
(show_ip_ospf_interface_sub) For Vlinks, the peer address is
more interesting than the output interface.
2006-05-04 09:32:57 +02:00
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
[ospfd] Fix SPF of virtual-links
2006-04-24 Paul Jakma <paul.jakma@sun.com>
* (general) More Virtual-link fixes, again with much help in
testing / debug from Juergen Kammer. Primarily in SPF.
* ospf_spf.h: Add guard. ospf_interface.h will include this
header.
* ospf_interface.h: Modify ospf_vl_lookup definition to take
struct ospf as argument, so as to allow for NULL area
argument.
(struct ospf_vl_data) Remove out_oi, instead add a struct
vertex_nexthop, to use as initial nexthop for backbone paths
through a vlink.
* ospf_interface.c: (ospf_vl_lookup) Modified to allow
NULL area to be passed to indicate "any" (first) area.
Add extra debug.
(ospf_vl_set_params) vl_oi -> nexthop. Add extra debug.
(ospf_vl_up_check) Fix debug, inet_ntoa returns a static
buffer..
* ospf_route.c: (ospf_intra_add_router) Vlinks dont go through
backbone, don't bother checking.
* ospf_spf.c: (static struct list vertex_list) Record vertices
that will need to be freed.
(cmp) Order network before router vertices, as required,
wasn't implemented.
(vertex_nexthop_free) Mild additional robustness check.
(vertex_parent_free) Take void argument, as this function
is passed as list deconstructor for vertex parent list.
(ospf_vertex_new) More debug. Set deconstructor for parent
list. Track allocated vertices on the vertex_list.
(ospf_vertex_free) Get rid of the tricky recursive cleanup of
vertices. Now frees only the given vertex.
(ospf_vertex_add_parent) Fix assert.
(ospf_nexthop_calculation) Fix calculation of nexthop for
VLink vertices, lookup the vl_data and use its previously
recorded nexthop information.
(ospf_spf_calculate) Vertices are freed simply by deleting
vertex_list nodes and letting ospf_vertex_free as deconstructor
work per-node.
(ospf_spf_calculate_timer) Trivial optimisation, leave
backbone SPF calculation till last to reduce SPF churn on
VLink updates.
* ospf_vty.c: (ospf_find_vl_data) update call to ospf_vl_lookup
(no_ospf_area_vlink_cmd) ditto.
(show_ip_ospf_interface_sub) For Vlinks, the peer address is
more interesting than the output interface.
2006-05-04 09:32:57 +02:00
|
|
|
for (ALL_LIST_ELEMENTS_RO(ospf->vlinks, node, vl_data)) {
|
|
|
|
if (IS_DEBUG_OSPF_EVENT)
|
2020-10-21 19:56:26 +02:00
|
|
|
zlog_debug("%s: VL %s, peer %pI4", __func__,
|
[ospfd] Fix SPF of virtual-links
2006-04-24 Paul Jakma <paul.jakma@sun.com>
* (general) More Virtual-link fixes, again with much help in
testing / debug from Juergen Kammer. Primarily in SPF.
* ospf_spf.h: Add guard. ospf_interface.h will include this
header.
* ospf_interface.h: Modify ospf_vl_lookup definition to take
struct ospf as argument, so as to allow for NULL area
argument.
(struct ospf_vl_data) Remove out_oi, instead add a struct
vertex_nexthop, to use as initial nexthop for backbone paths
through a vlink.
* ospf_interface.c: (ospf_vl_lookup) Modified to allow
NULL area to be passed to indicate "any" (first) area.
Add extra debug.
(ospf_vl_set_params) vl_oi -> nexthop. Add extra debug.
(ospf_vl_up_check) Fix debug, inet_ntoa returns a static
buffer..
* ospf_route.c: (ospf_intra_add_router) Vlinks dont go through
backbone, don't bother checking.
* ospf_spf.c: (static struct list vertex_list) Record vertices
that will need to be freed.
(cmp) Order network before router vertices, as required,
wasn't implemented.
(vertex_nexthop_free) Mild additional robustness check.
(vertex_parent_free) Take void argument, as this function
is passed as list deconstructor for vertex parent list.
(ospf_vertex_new) More debug. Set deconstructor for parent
list. Track allocated vertices on the vertex_list.
(ospf_vertex_free) Get rid of the tricky recursive cleanup of
vertices. Now frees only the given vertex.
(ospf_vertex_add_parent) Fix assert.
(ospf_nexthop_calculation) Fix calculation of nexthop for
VLink vertices, lookup the vl_data and use its previously
recorded nexthop information.
(ospf_spf_calculate) Vertices are freed simply by deleting
vertex_list nodes and letting ospf_vertex_free as deconstructor
work per-node.
(ospf_spf_calculate_timer) Trivial optimisation, leave
backbone SPF calculation till last to reduce SPF churn on
VLink updates.
* ospf_vty.c: (ospf_find_vl_data) update call to ospf_vl_lookup
(no_ospf_area_vlink_cmd) ditto.
(show_ip_ospf_interface_sub) For Vlinks, the peer address is
more interesting than the output interface.
2006-05-04 09:32:57 +02:00
|
|
|
vl_data->vl_oi->ifp->name,
|
2020-10-21 19:56:26 +02:00
|
|
|
&vl_data->vl_peer);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
[ospfd] Fix SPF of virtual-links
2006-04-24 Paul Jakma <paul.jakma@sun.com>
* (general) More Virtual-link fixes, again with much help in
testing / debug from Juergen Kammer. Primarily in SPF.
* ospf_spf.h: Add guard. ospf_interface.h will include this
header.
* ospf_interface.h: Modify ospf_vl_lookup definition to take
struct ospf as argument, so as to allow for NULL area
argument.
(struct ospf_vl_data) Remove out_oi, instead add a struct
vertex_nexthop, to use as initial nexthop for backbone paths
through a vlink.
* ospf_interface.c: (ospf_vl_lookup) Modified to allow
NULL area to be passed to indicate "any" (first) area.
Add extra debug.
(ospf_vl_set_params) vl_oi -> nexthop. Add extra debug.
(ospf_vl_up_check) Fix debug, inet_ntoa returns a static
buffer..
* ospf_route.c: (ospf_intra_add_router) Vlinks dont go through
backbone, don't bother checking.
* ospf_spf.c: (static struct list vertex_list) Record vertices
that will need to be freed.
(cmp) Order network before router vertices, as required,
wasn't implemented.
(vertex_nexthop_free) Mild additional robustness check.
(vertex_parent_free) Take void argument, as this function
is passed as list deconstructor for vertex parent list.
(ospf_vertex_new) More debug. Set deconstructor for parent
list. Track allocated vertices on the vertex_list.
(ospf_vertex_free) Get rid of the tricky recursive cleanup of
vertices. Now frees only the given vertex.
(ospf_vertex_add_parent) Fix assert.
(ospf_nexthop_calculation) Fix calculation of nexthop for
VLink vertices, lookup the vl_data and use its previously
recorded nexthop information.
(ospf_spf_calculate) Vertices are freed simply by deleting
vertex_list nodes and letting ospf_vertex_free as deconstructor
work per-node.
(ospf_spf_calculate_timer) Trivial optimisation, leave
backbone SPF calculation till last to reduce SPF churn on
VLink updates.
* ospf_vty.c: (ospf_find_vl_data) update call to ospf_vl_lookup
(no_ospf_area_vlink_cmd) ditto.
(show_ip_ospf_interface_sub) For Vlinks, the peer address is
more interesting than the output interface.
2006-05-04 09:32:57 +02:00
|
|
|
if (area
|
|
|
|
&& !IPV4_ADDR_SAME(&vl_data->vl_area_id, &area->area_id))
|
|
|
|
continue;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
[ospfd] Fix SPF of virtual-links
2006-04-24 Paul Jakma <paul.jakma@sun.com>
* (general) More Virtual-link fixes, again with much help in
testing / debug from Juergen Kammer. Primarily in SPF.
* ospf_spf.h: Add guard. ospf_interface.h will include this
header.
* ospf_interface.h: Modify ospf_vl_lookup definition to take
struct ospf as argument, so as to allow for NULL area
argument.
(struct ospf_vl_data) Remove out_oi, instead add a struct
vertex_nexthop, to use as initial nexthop for backbone paths
through a vlink.
* ospf_interface.c: (ospf_vl_lookup) Modified to allow
NULL area to be passed to indicate "any" (first) area.
Add extra debug.
(ospf_vl_set_params) vl_oi -> nexthop. Add extra debug.
(ospf_vl_up_check) Fix debug, inet_ntoa returns a static
buffer..
* ospf_route.c: (ospf_intra_add_router) Vlinks dont go through
backbone, don't bother checking.
* ospf_spf.c: (static struct list vertex_list) Record vertices
that will need to be freed.
(cmp) Order network before router vertices, as required,
wasn't implemented.
(vertex_nexthop_free) Mild additional robustness check.
(vertex_parent_free) Take void argument, as this function
is passed as list deconstructor for vertex parent list.
(ospf_vertex_new) More debug. Set deconstructor for parent
list. Track allocated vertices on the vertex_list.
(ospf_vertex_free) Get rid of the tricky recursive cleanup of
vertices. Now frees only the given vertex.
(ospf_vertex_add_parent) Fix assert.
(ospf_nexthop_calculation) Fix calculation of nexthop for
VLink vertices, lookup the vl_data and use its previously
recorded nexthop information.
(ospf_spf_calculate) Vertices are freed simply by deleting
vertex_list nodes and letting ospf_vertex_free as deconstructor
work per-node.
(ospf_spf_calculate_timer) Trivial optimisation, leave
backbone SPF calculation till last to reduce SPF churn on
VLink updates.
* ospf_vty.c: (ospf_find_vl_data) update call to ospf_vl_lookup
(no_ospf_area_vlink_cmd) ditto.
(show_ip_ospf_interface_sub) For Vlinks, the peer address is
more interesting than the output interface.
2006-05-04 09:32:57 +02:00
|
|
|
if (IPV4_ADDR_SAME(&vl_data->vl_peer, &vl_peer))
|
|
|
|
return vl_data;
|
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void ospf_vl_shutdown(struct ospf_vl_data *vl_data)
|
|
|
|
{
|
|
|
|
struct ospf_interface *oi;
|
|
|
|
|
|
|
|
if ((oi = vl_data->vl_oi) == NULL)
|
|
|
|
return;
|
|
|
|
|
2020-02-06 07:49:02 +01:00
|
|
|
oi->address->u.prefix4.s_addr = INADDR_ANY;
|
2002-12-13 21:15:29 +01:00
|
|
|
oi->address->prefixlen = 0;
|
|
|
|
|
|
|
|
UNSET_FLAG(oi->ifp->flags, IFF_UP);
|
|
|
|
/* OSPF_ISM_EVENT_SCHEDULE (oi, ISM_InterfaceDown); */
|
|
|
|
OSPF_ISM_EVENT_EXECUTE(oi, ISM_InterfaceDown);
|
|
|
|
}
|
|
|
|
|
2003-03-25 06:07:42 +01:00
|
|
|
void ospf_vl_add(struct ospf *ospf, struct ospf_vl_data *vl_data)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
2003-03-25 06:07:42 +01:00
|
|
|
listnode_add(ospf->vlinks, vl_data);
|
2016-06-12 17:32:23 +02:00
|
|
|
hook_call(ospf_vl_add, vl_data);
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
2003-03-25 06:07:42 +01:00
|
|
|
void ospf_vl_delete(struct ospf *ospf, struct ospf_vl_data *vl_data)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
|
|
|
ospf_vl_shutdown(vl_data);
|
|
|
|
ospf_vl_if_delete(vl_data);
|
|
|
|
|
2016-06-12 17:32:23 +02:00
|
|
|
hook_call(ospf_vl_delete, vl_data);
|
2003-03-25 06:07:42 +01:00
|
|
|
listnode_delete(ospf->vlinks, vl_data);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
ospf_vl_data_free(vl_data);
|
|
|
|
}
|
|
|
|
|
2020-08-07 14:13:07 +02:00
|
|
|
static int ospf_vl_set_params(struct ospf_area *area,
|
|
|
|
struct ospf_vl_data *vl_data, struct vertex *v)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
|
|
|
int changed = 0;
|
|
|
|
struct ospf_interface *voi;
|
2004-09-23 21:18:23 +02:00
|
|
|
struct listnode *node;
|
2005-10-18 Paul Jakma <paul.jakma@sun.com>
* (general) SPF memory management cleanup and fix for rare
double-free bug.
* ospf_spf.h: (struct vertex_parent) New struct to hold parent
specific data, eg the backlink and the parent vertex pointer,
and point to the appropriate general struct vertex_nexthop.
(struct vertex_nexthop) remove parent vertex pointer, so
this struct can be shared across vertices.
(struct vertex) rename list child to list children. Remove
list of nexthops, replace with list of vertex_parents.
* ospf_spf.c: (update_stat) trivial, remove cast from void *.
(vertex_nexthop_new) remove init of parent - field is gone
from struct vertex_nexthop.
(ospf_canonical_nexthops_free) Remove the canonical
vertex_nexthop memory objects. These are the vertex_nexthops
attached to the first level of router vertices from the root.
(vertex_parent_new) new function, create a vertex_parent.
(vertex_parent_free) ditto, but free it.
(ospf_vertex_new) Update to match changes to struct vertex.
(ospf_vertex_free) Recursively free a struct vertex and its
children. The parent list is used as a reference count.
vertex_nexthops must be free seperately, if required.
(ospf_vertex_dump) update to match struct vertex changes.
Print out backlink of parents too.
(ospf_vertex_add_parent) ditto.
(ospf_lsa_has_link) update comment.
(ospf_nexthop_add_unique) removed, not needed anymore.
(ospf_nexthop_merge) ditto.
(ospf_spf_consider_nexthop) renamed to ospf_spf_add_parent.
Simplified to just create vertex_parent and add it.
(ospf_spf_flush_parents) new function, flush out the parent
list.
(ospf_nexthop_calculation) Take the relevant route_lsa_link
as an argument, which simplifies things and removes the need
for the hack in ospf_nexthop_add_unique - ospf_spf_next
already knew exactly which link the cost calculated was for.
Update to match struct vertex changes too.
(ospf_spf_next) Don't create a vertex for W unnecessarily, if
it's there's a vertex already created for W, use it, and
hence there's no need to free it either.
Update some manipulation/comparisons of distance to match.
Flush the parent list if a lower cost path is found.
(ospf_spf_route_free) unused, removed.
(ospf_spf_dump) match the struct vertex changes, and dump the
ifname if possible.
(ospf_spf_calculate) At end of SPF, free the canonical nexthops
and call ospf_vertex_free on the root vertex to free the
entire tree.
* ospf_interface.c: (ospf_vl_set_params) match struct vertex
changes.
* ospf_route.c: (ospf_intra_route_add) ditto
(ospf_route_copy_nexthops_from_vertex) ditto
* memtypes.c: (memory_list_ospf) Add MTYPE_OSPF_VERTEX_PARENT.
2005-10-18 06:20:33 +02:00
|
|
|
struct vertex_parent *vp = NULL;
|
2015-07-30 01:02:26 +02:00
|
|
|
unsigned int i;
|
2002-12-13 21:15:29 +01:00
|
|
|
struct router_lsa *rl;
|
2020-08-07 14:13:07 +02:00
|
|
|
struct ospf_interface *oi;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
voi = vl_data->vl_oi;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
if (voi->output_cost != v->distance) {
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
voi->output_cost = v->distance;
|
|
|
|
changed = 1;
|
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2005-10-18 Paul Jakma <paul.jakma@sun.com>
* (general) SPF memory management cleanup and fix for rare
double-free bug.
* ospf_spf.h: (struct vertex_parent) New struct to hold parent
specific data, eg the backlink and the parent vertex pointer,
and point to the appropriate general struct vertex_nexthop.
(struct vertex_nexthop) remove parent vertex pointer, so
this struct can be shared across vertices.
(struct vertex) rename list child to list children. Remove
list of nexthops, replace with list of vertex_parents.
* ospf_spf.c: (update_stat) trivial, remove cast from void *.
(vertex_nexthop_new) remove init of parent - field is gone
from struct vertex_nexthop.
(ospf_canonical_nexthops_free) Remove the canonical
vertex_nexthop memory objects. These are the vertex_nexthops
attached to the first level of router vertices from the root.
(vertex_parent_new) new function, create a vertex_parent.
(vertex_parent_free) ditto, but free it.
(ospf_vertex_new) Update to match changes to struct vertex.
(ospf_vertex_free) Recursively free a struct vertex and its
children. The parent list is used as a reference count.
vertex_nexthops must be free seperately, if required.
(ospf_vertex_dump) update to match struct vertex changes.
Print out backlink of parents too.
(ospf_vertex_add_parent) ditto.
(ospf_lsa_has_link) update comment.
(ospf_nexthop_add_unique) removed, not needed anymore.
(ospf_nexthop_merge) ditto.
(ospf_spf_consider_nexthop) renamed to ospf_spf_add_parent.
Simplified to just create vertex_parent and add it.
(ospf_spf_flush_parents) new function, flush out the parent
list.
(ospf_nexthop_calculation) Take the relevant route_lsa_link
as an argument, which simplifies things and removes the need
for the hack in ospf_nexthop_add_unique - ospf_spf_next
already knew exactly which link the cost calculated was for.
Update to match struct vertex changes too.
(ospf_spf_next) Don't create a vertex for W unnecessarily, if
it's there's a vertex already created for W, use it, and
hence there's no need to free it either.
Update some manipulation/comparisons of distance to match.
Flush the parent list if a lower cost path is found.
(ospf_spf_route_free) unused, removed.
(ospf_spf_dump) match the struct vertex changes, and dump the
ifname if possible.
(ospf_spf_calculate) At end of SPF, free the canonical nexthops
and call ospf_vertex_free on the root vertex to free the
entire tree.
* ospf_interface.c: (ospf_vl_set_params) match struct vertex
changes.
* ospf_route.c: (ospf_intra_route_add) ditto
(ospf_route_copy_nexthops_from_vertex) ditto
* memtypes.c: (memory_list_ospf) Add MTYPE_OSPF_VERTEX_PARENT.
2005-10-18 06:20:33 +02:00
|
|
|
for (ALL_LIST_ELEMENTS_RO(v->parents, node, vp)) {
|
2020-08-07 14:13:07 +02:00
|
|
|
vl_data->nexthop.lsa_pos = vp->nexthop->lsa_pos;
|
[ospfd] Fix SPF of virtual-links
2006-04-24 Paul Jakma <paul.jakma@sun.com>
* (general) More Virtual-link fixes, again with much help in
testing / debug from Juergen Kammer. Primarily in SPF.
* ospf_spf.h: Add guard. ospf_interface.h will include this
header.
* ospf_interface.h: Modify ospf_vl_lookup definition to take
struct ospf as argument, so as to allow for NULL area
argument.
(struct ospf_vl_data) Remove out_oi, instead add a struct
vertex_nexthop, to use as initial nexthop for backbone paths
through a vlink.
* ospf_interface.c: (ospf_vl_lookup) Modified to allow
NULL area to be passed to indicate "any" (first) area.
Add extra debug.
(ospf_vl_set_params) vl_oi -> nexthop. Add extra debug.
(ospf_vl_up_check) Fix debug, inet_ntoa returns a static
buffer..
* ospf_route.c: (ospf_intra_add_router) Vlinks dont go through
backbone, don't bother checking.
* ospf_spf.c: (static struct list vertex_list) Record vertices
that will need to be freed.
(cmp) Order network before router vertices, as required,
wasn't implemented.
(vertex_nexthop_free) Mild additional robustness check.
(vertex_parent_free) Take void argument, as this function
is passed as list deconstructor for vertex parent list.
(ospf_vertex_new) More debug. Set deconstructor for parent
list. Track allocated vertices on the vertex_list.
(ospf_vertex_free) Get rid of the tricky recursive cleanup of
vertices. Now frees only the given vertex.
(ospf_vertex_add_parent) Fix assert.
(ospf_nexthop_calculation) Fix calculation of nexthop for
VLink vertices, lookup the vl_data and use its previously
recorded nexthop information.
(ospf_spf_calculate) Vertices are freed simply by deleting
vertex_list nodes and letting ospf_vertex_free as deconstructor
work per-node.
(ospf_spf_calculate_timer) Trivial optimisation, leave
backbone SPF calculation till last to reduce SPF churn on
VLink updates.
* ospf_vty.c: (ospf_find_vl_data) update call to ospf_vl_lookup
(no_ospf_area_vlink_cmd) ditto.
(show_ip_ospf_interface_sub) For Vlinks, the peer address is
more interesting than the output interface.
2006-05-04 09:32:57 +02:00
|
|
|
vl_data->nexthop.router = vp->nexthop->router;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2020-08-07 14:13:07 +02:00
|
|
|
/*
|
|
|
|
* Only deal with interface data when the local
|
|
|
|
* (calculating) node is the SPF root node
|
|
|
|
*/
|
|
|
|
if (!area->spf_dry_run) {
|
|
|
|
oi = ospf_if_lookup_by_lsa_pos(
|
|
|
|
area, vl_data->nexthop.lsa_pos);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2020-08-07 14:13:07 +02:00
|
|
|
if (!IPV4_ADDR_SAME(&voi->address->u.prefix4,
|
|
|
|
&oi->address->u.prefix4))
|
|
|
|
changed = 1;
|
|
|
|
|
|
|
|
voi->address->u.prefix4 = oi->address->u.prefix4;
|
|
|
|
voi->address->prefixlen = oi->address->prefixlen;
|
|
|
|
}
|
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
|
|
|
break; /* We take the first interface. */
|
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
rl = (struct router_lsa *)v->lsa;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2004-04-08 09:43:45 +02:00
|
|
|
/* use SPF determined backlink index in struct vertex
|
|
|
|
* for virtual link destination address
|
|
|
|
*/
|
2005-10-18 Paul Jakma <paul.jakma@sun.com>
* (general) SPF memory management cleanup and fix for rare
double-free bug.
* ospf_spf.h: (struct vertex_parent) New struct to hold parent
specific data, eg the backlink and the parent vertex pointer,
and point to the appropriate general struct vertex_nexthop.
(struct vertex_nexthop) remove parent vertex pointer, so
this struct can be shared across vertices.
(struct vertex) rename list child to list children. Remove
list of nexthops, replace with list of vertex_parents.
* ospf_spf.c: (update_stat) trivial, remove cast from void *.
(vertex_nexthop_new) remove init of parent - field is gone
from struct vertex_nexthop.
(ospf_canonical_nexthops_free) Remove the canonical
vertex_nexthop memory objects. These are the vertex_nexthops
attached to the first level of router vertices from the root.
(vertex_parent_new) new function, create a vertex_parent.
(vertex_parent_free) ditto, but free it.
(ospf_vertex_new) Update to match changes to struct vertex.
(ospf_vertex_free) Recursively free a struct vertex and its
children. The parent list is used as a reference count.
vertex_nexthops must be free seperately, if required.
(ospf_vertex_dump) update to match struct vertex changes.
Print out backlink of parents too.
(ospf_vertex_add_parent) ditto.
(ospf_lsa_has_link) update comment.
(ospf_nexthop_add_unique) removed, not needed anymore.
(ospf_nexthop_merge) ditto.
(ospf_spf_consider_nexthop) renamed to ospf_spf_add_parent.
Simplified to just create vertex_parent and add it.
(ospf_spf_flush_parents) new function, flush out the parent
list.
(ospf_nexthop_calculation) Take the relevant route_lsa_link
as an argument, which simplifies things and removes the need
for the hack in ospf_nexthop_add_unique - ospf_spf_next
already knew exactly which link the cost calculated was for.
Update to match struct vertex changes too.
(ospf_spf_next) Don't create a vertex for W unnecessarily, if
it's there's a vertex already created for W, use it, and
hence there's no need to free it either.
Update some manipulation/comparisons of distance to match.
Flush the parent list if a lower cost path is found.
(ospf_spf_route_free) unused, removed.
(ospf_spf_dump) match the struct vertex changes, and dump the
ifname if possible.
(ospf_spf_calculate) At end of SPF, free the canonical nexthops
and call ospf_vertex_free on the root vertex to free the
entire tree.
* ospf_interface.c: (ospf_vl_set_params) match struct vertex
changes.
* ospf_route.c: (ospf_intra_route_add) ditto
(ospf_route_copy_nexthops_from_vertex) ditto
* memtypes.c: (memory_list_ospf) Add MTYPE_OSPF_VERTEX_PARENT.
2005-10-18 06:20:33 +02:00
|
|
|
if (vp && vp->backlink >= 0) {
|
2004-04-08 09:43:45 +02:00
|
|
|
if (!IPV4_ADDR_SAME(&vl_data->peer_addr,
|
2005-10-18 Paul Jakma <paul.jakma@sun.com>
* (general) SPF memory management cleanup and fix for rare
double-free bug.
* ospf_spf.h: (struct vertex_parent) New struct to hold parent
specific data, eg the backlink and the parent vertex pointer,
and point to the appropriate general struct vertex_nexthop.
(struct vertex_nexthop) remove parent vertex pointer, so
this struct can be shared across vertices.
(struct vertex) rename list child to list children. Remove
list of nexthops, replace with list of vertex_parents.
* ospf_spf.c: (update_stat) trivial, remove cast from void *.
(vertex_nexthop_new) remove init of parent - field is gone
from struct vertex_nexthop.
(ospf_canonical_nexthops_free) Remove the canonical
vertex_nexthop memory objects. These are the vertex_nexthops
attached to the first level of router vertices from the root.
(vertex_parent_new) new function, create a vertex_parent.
(vertex_parent_free) ditto, but free it.
(ospf_vertex_new) Update to match changes to struct vertex.
(ospf_vertex_free) Recursively free a struct vertex and its
children. The parent list is used as a reference count.
vertex_nexthops must be free seperately, if required.
(ospf_vertex_dump) update to match struct vertex changes.
Print out backlink of parents too.
(ospf_vertex_add_parent) ditto.
(ospf_lsa_has_link) update comment.
(ospf_nexthop_add_unique) removed, not needed anymore.
(ospf_nexthop_merge) ditto.
(ospf_spf_consider_nexthop) renamed to ospf_spf_add_parent.
Simplified to just create vertex_parent and add it.
(ospf_spf_flush_parents) new function, flush out the parent
list.
(ospf_nexthop_calculation) Take the relevant route_lsa_link
as an argument, which simplifies things and removes the need
for the hack in ospf_nexthop_add_unique - ospf_spf_next
already knew exactly which link the cost calculated was for.
Update to match struct vertex changes too.
(ospf_spf_next) Don't create a vertex for W unnecessarily, if
it's there's a vertex already created for W, use it, and
hence there's no need to free it either.
Update some manipulation/comparisons of distance to match.
Flush the parent list if a lower cost path is found.
(ospf_spf_route_free) unused, removed.
(ospf_spf_dump) match the struct vertex changes, and dump the
ifname if possible.
(ospf_spf_calculate) At end of SPF, free the canonical nexthops
and call ospf_vertex_free on the root vertex to free the
entire tree.
* ospf_interface.c: (ospf_vl_set_params) match struct vertex
changes.
* ospf_route.c: (ospf_intra_route_add) ditto
(ospf_route_copy_nexthops_from_vertex) ditto
* memtypes.c: (memory_list_ospf) Add MTYPE_OSPF_VERTEX_PARENT.
2005-10-18 06:20:33 +02:00
|
|
|
&rl->link[vp->backlink].link_data))
|
2004-04-08 09:43:45 +02:00
|
|
|
changed = 1;
|
2005-10-18 Paul Jakma <paul.jakma@sun.com>
* (general) SPF memory management cleanup and fix for rare
double-free bug.
* ospf_spf.h: (struct vertex_parent) New struct to hold parent
specific data, eg the backlink and the parent vertex pointer,
and point to the appropriate general struct vertex_nexthop.
(struct vertex_nexthop) remove parent vertex pointer, so
this struct can be shared across vertices.
(struct vertex) rename list child to list children. Remove
list of nexthops, replace with list of vertex_parents.
* ospf_spf.c: (update_stat) trivial, remove cast from void *.
(vertex_nexthop_new) remove init of parent - field is gone
from struct vertex_nexthop.
(ospf_canonical_nexthops_free) Remove the canonical
vertex_nexthop memory objects. These are the vertex_nexthops
attached to the first level of router vertices from the root.
(vertex_parent_new) new function, create a vertex_parent.
(vertex_parent_free) ditto, but free it.
(ospf_vertex_new) Update to match changes to struct vertex.
(ospf_vertex_free) Recursively free a struct vertex and its
children. The parent list is used as a reference count.
vertex_nexthops must be free seperately, if required.
(ospf_vertex_dump) update to match struct vertex changes.
Print out backlink of parents too.
(ospf_vertex_add_parent) ditto.
(ospf_lsa_has_link) update comment.
(ospf_nexthop_add_unique) removed, not needed anymore.
(ospf_nexthop_merge) ditto.
(ospf_spf_consider_nexthop) renamed to ospf_spf_add_parent.
Simplified to just create vertex_parent and add it.
(ospf_spf_flush_parents) new function, flush out the parent
list.
(ospf_nexthop_calculation) Take the relevant route_lsa_link
as an argument, which simplifies things and removes the need
for the hack in ospf_nexthop_add_unique - ospf_spf_next
already knew exactly which link the cost calculated was for.
Update to match struct vertex changes too.
(ospf_spf_next) Don't create a vertex for W unnecessarily, if
it's there's a vertex already created for W, use it, and
hence there's no need to free it either.
Update some manipulation/comparisons of distance to match.
Flush the parent list if a lower cost path is found.
(ospf_spf_route_free) unused, removed.
(ospf_spf_dump) match the struct vertex changes, and dump the
ifname if possible.
(ospf_spf_calculate) At end of SPF, free the canonical nexthops
and call ospf_vertex_free on the root vertex to free the
entire tree.
* ospf_interface.c: (ospf_vl_set_params) match struct vertex
changes.
* ospf_route.c: (ospf_intra_route_add) ditto
(ospf_route_copy_nexthops_from_vertex) ditto
* memtypes.c: (memory_list_ospf) Add MTYPE_OSPF_VERTEX_PARENT.
2005-10-18 06:20:33 +02:00
|
|
|
vl_data->peer_addr = rl->link[vp->backlink].link_data;
|
2004-04-08 09:43:45 +02:00
|
|
|
} else {
|
|
|
|
/* This is highly odd, there is no backlink index
|
|
|
|
* there should be due to the ospf_spf_has_link() check
|
|
|
|
* in SPF. Lets warn and try pick a link anyway.
|
|
|
|
*/
|
2018-08-20 20:05:53 +02:00
|
|
|
zlog_info("ospf_vl_set_params: No backlink for %s!",
|
2004-04-08 09:43:45 +02:00
|
|
|
vl_data->vl_oi->ifp->name);
|
|
|
|
for (i = 0; i < ntohs(rl->links); i++) {
|
|
|
|
switch (rl->link[i].type) {
|
|
|
|
case LSA_LINK_TYPE_VIRTUALLINK:
|
|
|
|
if (IS_DEBUG_OSPF_EVENT)
|
2004-12-08 18:45:02 +01:00
|
|
|
zlog_debug(
|
|
|
|
"found back link through VL");
|
2023-10-10 23:15:32 +02:00
|
|
|
fallthrough;
|
2004-04-08 09:43:45 +02:00
|
|
|
case LSA_LINK_TYPE_TRANSIT:
|
|
|
|
case LSA_LINK_TYPE_POINTOPOINT:
|
2004-05-05 19:26:55 +02:00
|
|
|
if (!IPV4_ADDR_SAME(&vl_data->peer_addr,
|
|
|
|
&rl->link[i].link_data))
|
|
|
|
changed = 1;
|
2004-04-08 09:43:45 +02:00
|
|
|
vl_data->peer_addr = rl->link[i].link_data;
|
|
|
|
}
|
2003-06-22 10:17:12 +02:00
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2004-04-08 09:43:45 +02:00
|
|
|
if (IS_DEBUG_OSPF_EVENT)
|
2020-10-21 19:56:26 +02:00
|
|
|
zlog_debug("%s: %s peer address: %pI4, cost: %d,%schanged",
|
2004-04-08 09:43:45 +02:00
|
|
|
__func__, vl_data->vl_oi->ifp->name,
|
2020-10-21 19:56:26 +02:00
|
|
|
&vl_data->peer_addr, voi->output_cost,
|
[ospfd] Fix SPF of virtual-links
2006-04-24 Paul Jakma <paul.jakma@sun.com>
* (general) More Virtual-link fixes, again with much help in
testing / debug from Juergen Kammer. Primarily in SPF.
* ospf_spf.h: Add guard. ospf_interface.h will include this
header.
* ospf_interface.h: Modify ospf_vl_lookup definition to take
struct ospf as argument, so as to allow for NULL area
argument.
(struct ospf_vl_data) Remove out_oi, instead add a struct
vertex_nexthop, to use as initial nexthop for backbone paths
through a vlink.
* ospf_interface.c: (ospf_vl_lookup) Modified to allow
NULL area to be passed to indicate "any" (first) area.
Add extra debug.
(ospf_vl_set_params) vl_oi -> nexthop. Add extra debug.
(ospf_vl_up_check) Fix debug, inet_ntoa returns a static
buffer..
* ospf_route.c: (ospf_intra_add_router) Vlinks dont go through
backbone, don't bother checking.
* ospf_spf.c: (static struct list vertex_list) Record vertices
that will need to be freed.
(cmp) Order network before router vertices, as required,
wasn't implemented.
(vertex_nexthop_free) Mild additional robustness check.
(vertex_parent_free) Take void argument, as this function
is passed as list deconstructor for vertex parent list.
(ospf_vertex_new) More debug. Set deconstructor for parent
list. Track allocated vertices on the vertex_list.
(ospf_vertex_free) Get rid of the tricky recursive cleanup of
vertices. Now frees only the given vertex.
(ospf_vertex_add_parent) Fix assert.
(ospf_nexthop_calculation) Fix calculation of nexthop for
VLink vertices, lookup the vl_data and use its previously
recorded nexthop information.
(ospf_spf_calculate) Vertices are freed simply by deleting
vertex_list nodes and letting ospf_vertex_free as deconstructor
work per-node.
(ospf_spf_calculate_timer) Trivial optimisation, leave
backbone SPF calculation till last to reduce SPF churn on
VLink updates.
* ospf_vty.c: (ospf_find_vl_data) update call to ospf_vl_lookup
(no_ospf_area_vlink_cmd) ditto.
(show_ip_ospf_interface_sub) For Vlinks, the peer address is
more interesting than the output interface.
2006-05-04 09:32:57 +02:00
|
|
|
(changed ? " " : " un"));
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2003-06-22 10:17:12 +02:00
|
|
|
return changed;
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-03-25 06:07:42 +01:00
|
|
|
void ospf_vl_up_check(struct ospf_area *area, struct in_addr rid,
|
2002-12-13 21:15:29 +01:00
|
|
|
struct vertex *v)
|
|
|
|
{
|
2003-03-25 06:07:42 +01:00
|
|
|
struct ospf *ospf = area->ospf;
|
2004-09-23 21:18:23 +02:00
|
|
|
struct listnode *node;
|
2002-12-13 21:15:29 +01:00
|
|
|
struct ospf_vl_data *vl_data;
|
|
|
|
struct ospf_interface *oi;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
if (IS_DEBUG_OSPF_EVENT) {
|
2022-08-22 19:30:35 +02:00
|
|
|
zlog_debug("%s: Start", __func__);
|
|
|
|
zlog_debug("%s: Router ID is %pI4 Area is %pI4", __func__, &rid,
|
2020-10-21 19:56:26 +02:00
|
|
|
&area->area_id);
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
for (ALL_LIST_ELEMENTS_RO(ospf->vlinks, node, vl_data)) {
|
|
|
|
if (IS_DEBUG_OSPF_EVENT) {
|
2020-10-21 19:56:26 +02:00
|
|
|
zlog_debug("%s: considering VL, %s in area %pI4",
|
[ospfd] Fix SPF of virtual-links
2006-04-24 Paul Jakma <paul.jakma@sun.com>
* (general) More Virtual-link fixes, again with much help in
testing / debug from Juergen Kammer. Primarily in SPF.
* ospf_spf.h: Add guard. ospf_interface.h will include this
header.
* ospf_interface.h: Modify ospf_vl_lookup definition to take
struct ospf as argument, so as to allow for NULL area
argument.
(struct ospf_vl_data) Remove out_oi, instead add a struct
vertex_nexthop, to use as initial nexthop for backbone paths
through a vlink.
* ospf_interface.c: (ospf_vl_lookup) Modified to allow
NULL area to be passed to indicate "any" (first) area.
Add extra debug.
(ospf_vl_set_params) vl_oi -> nexthop. Add extra debug.
(ospf_vl_up_check) Fix debug, inet_ntoa returns a static
buffer..
* ospf_route.c: (ospf_intra_add_router) Vlinks dont go through
backbone, don't bother checking.
* ospf_spf.c: (static struct list vertex_list) Record vertices
that will need to be freed.
(cmp) Order network before router vertices, as required,
wasn't implemented.
(vertex_nexthop_free) Mild additional robustness check.
(vertex_parent_free) Take void argument, as this function
is passed as list deconstructor for vertex parent list.
(ospf_vertex_new) More debug. Set deconstructor for parent
list. Track allocated vertices on the vertex_list.
(ospf_vertex_free) Get rid of the tricky recursive cleanup of
vertices. Now frees only the given vertex.
(ospf_vertex_add_parent) Fix assert.
(ospf_nexthop_calculation) Fix calculation of nexthop for
VLink vertices, lookup the vl_data and use its previously
recorded nexthop information.
(ospf_spf_calculate) Vertices are freed simply by deleting
vertex_list nodes and letting ospf_vertex_free as deconstructor
work per-node.
(ospf_spf_calculate_timer) Trivial optimisation, leave
backbone SPF calculation till last to reduce SPF churn on
VLink updates.
* ospf_vty.c: (ospf_find_vl_data) update call to ospf_vl_lookup
(no_ospf_area_vlink_cmd) ditto.
(show_ip_ospf_interface_sub) For Vlinks, the peer address is
more interesting than the output interface.
2006-05-04 09:32:57 +02:00
|
|
|
__func__, vl_data->vl_oi->ifp->name,
|
2020-10-21 19:56:26 +02:00
|
|
|
&vl_data->vl_area_id);
|
|
|
|
zlog_debug("%s: peer ID: %pI4", __func__,
|
|
|
|
&vl_data->vl_peer);
|
2017-07-17 14:03:14 +02:00
|
|
|
}
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
if (IPV4_ADDR_SAME(&vl_data->vl_peer, &rid)
|
|
|
|
&& IPV4_ADDR_SAME(&vl_data->vl_area_id, &area->area_id)) {
|
|
|
|
oi = vl_data->vl_oi;
|
|
|
|
SET_FLAG(vl_data->flags, OSPF_VL_FLAG_APPROVED);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
if (IS_DEBUG_OSPF_EVENT)
|
2022-08-22 19:30:35 +02:00
|
|
|
zlog_debug("%s: this VL matched", __func__);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
if (oi->state == ISM_Down) {
|
|
|
|
if (IS_DEBUG_OSPF_EVENT)
|
2004-12-08 18:45:02 +01:00
|
|
|
zlog_debug(
|
2022-08-22 19:30:35 +02:00
|
|
|
"%s: VL is down, waking it up",
|
|
|
|
__func__);
|
2002-12-13 21:15:29 +01:00
|
|
|
SET_FLAG(oi->ifp->flags, IFF_UP);
|
2003-06-22 10:17:12 +02:00
|
|
|
OSPF_ISM_EVENT_EXECUTE(oi, ISM_InterfaceUp);
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2020-08-07 14:13:07 +02:00
|
|
|
if (ospf_vl_set_params(area, vl_data, v)) {
|
2003-06-22 10:17:12 +02:00
|
|
|
if (IS_DEBUG_OSPF(ism, ISM_EVENTS))
|
2004-12-08 18:45:02 +01:00
|
|
|
zlog_debug(
|
2022-08-22 19:30:35 +02:00
|
|
|
"%s: VL cost change, scheduling router lsa refresh",
|
|
|
|
__func__);
|
2010-01-24 23:42:13 +01:00
|
|
|
if (ospf->backbone)
|
|
|
|
ospf_router_lsa_update_area(
|
|
|
|
ospf->backbone);
|
2003-06-22 10:17:12 +02:00
|
|
|
else if (IS_DEBUG_OSPF(ism, ISM_EVENTS))
|
2004-12-08 18:45:02 +01:00
|
|
|
zlog_debug(
|
2022-08-22 19:30:35 +02:00
|
|
|
"%s: VL cost change, no backbone!",
|
|
|
|
__func__);
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-03-25 06:07:42 +01:00
|
|
|
void ospf_vl_unapprove(struct ospf *ospf)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
2004-09-23 21:18:23 +02:00
|
|
|
struct listnode *node;
|
2002-12-13 21:15:29 +01:00
|
|
|
struct ospf_vl_data *vl_data;
|
|
|
|
|
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_data))
|
|
|
|
UNSET_FLAG(vl_data->flags, OSPF_VL_FLAG_APPROVED);
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
2003-03-25 06:07:42 +01:00
|
|
|
void ospf_vl_shut_unapproved(struct ospf *ospf)
|
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
|
|
|
struct listnode *node, *nnode;
|
2002-12-13 21:15:29 +01:00
|
|
|
struct ospf_vl_data *vl_data;
|
|
|
|
|
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(ospf->vlinks, node, nnode, vl_data))
|
|
|
|
if (!CHECK_FLAG(vl_data->flags, OSPF_VL_FLAG_APPROVED))
|
|
|
|
ospf_vl_shutdown(vl_data);
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
int ospf_full_virtual_nbrs(struct ospf_area *area)
|
|
|
|
{
|
|
|
|
if (IS_DEBUG_OSPF_EVENT) {
|
2004-12-08 18:45:02 +01:00
|
|
|
zlog_debug(
|
2020-10-21 19:56:26 +02:00
|
|
|
"counting fully adjacent virtual neighbors in area %pI4",
|
|
|
|
&area->area_id);
|
2004-12-08 18:45:02 +01:00
|
|
|
zlog_debug("there are %d of them", area->full_vls);
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
return area->full_vls;
|
|
|
|
}
|
|
|
|
|
|
|
|
int ospf_vls_in_area(struct ospf_area *area)
|
|
|
|
{
|
2004-09-23 21:18:23 +02:00
|
|
|
struct listnode *node;
|
2002-12-13 21:15:29 +01:00
|
|
|
struct ospf_vl_data *vl_data;
|
|
|
|
int c = 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(area->ospf->vlinks, node, vl_data))
|
|
|
|
if (IPV4_ADDR_SAME(&vl_data->vl_area_id, &area->area_id))
|
|
|
|
c++;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
return c;
|
|
|
|
}
|
|
|
|
|
2014-06-04 06:53:35 +02:00
|
|
|
|
2019-01-24 10:12:36 +01:00
|
|
|
struct crypt_key *ospf_crypt_key_new(void)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
2008-08-18 23:13:29 +02:00
|
|
|
return XCALLOC(MTYPE_OSPF_CRYPT_KEY, sizeof(struct crypt_key));
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
2004-09-23 21:18:23 +02:00
|
|
|
void ospf_crypt_key_add(struct list *crypt, struct crypt_key *ck)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
|
|
|
listnode_add(crypt, ck);
|
|
|
|
}
|
|
|
|
|
2018-03-27 21:13:34 +02:00
|
|
|
struct crypt_key *ospf_crypt_key_lookup(struct list *auth_crypt, uint8_t key_id)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
2004-09-23 21:18:23 +02:00
|
|
|
struct listnode *node;
|
2002-12-13 21:15:29 +01:00
|
|
|
struct crypt_key *ck;
|
|
|
|
|
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(auth_crypt, node, ck))
|
|
|
|
if (ck->key_id == key_id)
|
|
|
|
return ck;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2018-03-27 21:13:34 +02:00
|
|
|
int ospf_crypt_key_delete(struct list *auth_crypt, uint8_t key_id)
|
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
|
|
|
struct listnode *node, *nnode;
|
2002-12-13 21:15:29 +01:00
|
|
|
struct crypt_key *ck;
|
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
|
|
|
for (ALL_LIST_ELEMENTS(auth_crypt, node, nnode, ck)) {
|
2002-12-13 21:15:29 +01:00
|
|
|
if (ck->key_id == key_id) {
|
|
|
|
listnode_delete(auth_crypt, ck);
|
2005-09-29 15:52:57 +02:00
|
|
|
XFREE(MTYPE_OSPF_CRYPT_KEY, ck);
|
2002-12-13 21:15:29 +01:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2018-03-27 21:13:34 +02:00
|
|
|
uint8_t ospf_default_iftype(struct interface *ifp)
|
2004-12-15 16:07:19 +01:00
|
|
|
{
|
|
|
|
if (if_is_pointopoint(ifp))
|
|
|
|
return OSPF_IFTYPE_POINTOPOINT;
|
2021-11-16 16:01:03 +01:00
|
|
|
else if (if_is_loopback(ifp))
|
2004-12-15 16:07:19 +01:00
|
|
|
return OSPF_IFTYPE_LOOPBACK;
|
|
|
|
else
|
|
|
|
return OSPF_IFTYPE_BROADCAST;
|
|
|
|
}
|
|
|
|
|
2019-09-19 04:26:55 +02:00
|
|
|
void ospf_if_interface(struct interface *ifp)
|
|
|
|
{
|
|
|
|
hook_call(ospf_if_update, ifp);
|
|
|
|
}
|
|
|
|
|
2021-03-29 13:47:43 +02:00
|
|
|
uint32_t ospf_if_count_area_params(struct interface *ifp)
|
2019-09-18 22:20:04 +02:00
|
|
|
{
|
2020-10-14 00:20:53 +02:00
|
|
|
struct ospf_if_params *params;
|
|
|
|
struct route_node *rn;
|
|
|
|
uint32_t count = 0;
|
2021-03-29 13:47:43 +02:00
|
|
|
|
|
|
|
params = IF_DEF_PARAMS(ifp);
|
|
|
|
if (OSPF_IF_PARAM_CONFIGURED(params, if_area))
|
|
|
|
count++;
|
|
|
|
|
|
|
|
for (rn = route_top(IF_OIFS_PARAMS(ifp)); rn; rn = route_next(rn))
|
|
|
|
if ((params = rn->info)
|
|
|
|
&& OSPF_IF_PARAM_CONFIGURED(params, if_area))
|
|
|
|
count++;
|
|
|
|
|
|
|
|
return count;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int ospf_ifp_create(struct interface *ifp)
|
|
|
|
{
|
|
|
|
struct ospf *ospf = NULL;
|
ospfd: Set Curr_mtu to when we get the mtu
Currently if you start ospfd, bring up neighbors and then issue
a tcpdump on a interface ospf is peering over, this causes the neighbor
relationship to be restarted:
root@spectrum301(mlx-4600c-01):mgmt:~# tcpdump -i vlan402
2020-11-13T21:25:38.059671+00:00 spectrum301 ospfd[29953]: AdjChg: Nbr 202.0.0.3(default) on vlan402:200.0.3.1: Full -> Deleted (KillNbr)
2020-11-13T21:25:38.065520+00:00 spectrum301 ospfd[29953]: ospfTrapNbrStateChange: trap sent: 200.0.3.2 now Deleted/DROther
2020-11-13T21:25:38.065922+00:00 spectrum301 ospfd[29953]: ospfTrapIfStateChange: trap sent: 200.0.3.1 now Down
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on vlan402, link-type EN10MB (Ethernet), capture size 262144 bytes
21:25:38.072330 IP 200.0.3.1 > igmp.mcast.net: igmp v3 report, 1 group record(s)
2020-11-13T21:25:38.080430+00:00 spectrum301 ospfd[29953]: ospfTrapIfStateChange: trap sent: 200.0.3.1 now Point-To-Point
2020-11-13T21:25:38.080654+00:00 spectrum301 ospfd[29953]: SPF Processing Time(usecs): 9734
2020-11-13T21:25:38.080829+00:00 spectrum301 ospfd[29953]: SPF Time: 6422
2020-11-13T21:25:38.080991+00:00 spectrum301 ospfd[29953]: InterArea: 1572
2020-11-13T21:25:38.081152+00:00 spectrum301 ospfd[29953]: Prune: 67
2020-11-13T21:25:38.081329+00:00 spectrum301 ospfd[29953]: RouteInstall: 1396
2020-11-13T21:25:38.081548+00:00 spectrum301 ospfd[29953]: Reason(s) for SPF: N, S, ABR, ASBR
21:25:38.092510 IP 200.0.3.1 > ospf-all.mcast.net: OSPFv2, Hello, length 44
This is happening because the curr_mtu is not being properly stored. It was being set
on interface creation( but we have not actually read in the mtu part of the interface data, so
it is still 0 ).
Modify the code to store the curr_mtu at a point in interface creation *After* we have read
in interface data.
Ticket: CM-32276
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2020-12-01 21:37:03 +01:00
|
|
|
struct ospf_if_info *oii;
|
2019-09-19 04:26:55 +02:00
|
|
|
|
|
|
|
if (IS_DEBUG_OSPF(zebra, ZEBRA_INTERFACE))
|
|
|
|
zlog_debug(
|
2023-05-26 22:43:50 +02:00
|
|
|
"Zebra: interface add %s vrf %s[%u] index %d flags %llx metric %d mtu %d speed %u status 0x%x",
|
2021-10-22 00:17:40 +02:00
|
|
|
ifp->name, ifp->vrf->name, ifp->vrf->vrf_id,
|
|
|
|
ifp->ifindex, (unsigned long long)ifp->flags,
|
2023-05-26 22:43:50 +02:00
|
|
|
ifp->metric, ifp->mtu, ifp->speed, ifp->status);
|
2019-09-19 04:26:55 +02:00
|
|
|
|
|
|
|
assert(ifp->info);
|
|
|
|
|
ospfd: Set Curr_mtu to when we get the mtu
Currently if you start ospfd, bring up neighbors and then issue
a tcpdump on a interface ospf is peering over, this causes the neighbor
relationship to be restarted:
root@spectrum301(mlx-4600c-01):mgmt:~# tcpdump -i vlan402
2020-11-13T21:25:38.059671+00:00 spectrum301 ospfd[29953]: AdjChg: Nbr 202.0.0.3(default) on vlan402:200.0.3.1: Full -> Deleted (KillNbr)
2020-11-13T21:25:38.065520+00:00 spectrum301 ospfd[29953]: ospfTrapNbrStateChange: trap sent: 200.0.3.2 now Deleted/DROther
2020-11-13T21:25:38.065922+00:00 spectrum301 ospfd[29953]: ospfTrapIfStateChange: trap sent: 200.0.3.1 now Down
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on vlan402, link-type EN10MB (Ethernet), capture size 262144 bytes
21:25:38.072330 IP 200.0.3.1 > igmp.mcast.net: igmp v3 report, 1 group record(s)
2020-11-13T21:25:38.080430+00:00 spectrum301 ospfd[29953]: ospfTrapIfStateChange: trap sent: 200.0.3.1 now Point-To-Point
2020-11-13T21:25:38.080654+00:00 spectrum301 ospfd[29953]: SPF Processing Time(usecs): 9734
2020-11-13T21:25:38.080829+00:00 spectrum301 ospfd[29953]: SPF Time: 6422
2020-11-13T21:25:38.080991+00:00 spectrum301 ospfd[29953]: InterArea: 1572
2020-11-13T21:25:38.081152+00:00 spectrum301 ospfd[29953]: Prune: 67
2020-11-13T21:25:38.081329+00:00 spectrum301 ospfd[29953]: RouteInstall: 1396
2020-11-13T21:25:38.081548+00:00 spectrum301 ospfd[29953]: Reason(s) for SPF: N, S, ABR, ASBR
21:25:38.092510 IP 200.0.3.1 > ospf-all.mcast.net: OSPFv2, Hello, length 44
This is happening because the curr_mtu is not being properly stored. It was being set
on interface creation( but we have not actually read in the mtu part of the interface data, so
it is still 0 ).
Modify the code to store the curr_mtu at a point in interface creation *After* we have read
in interface data.
Ticket: CM-32276
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2020-12-01 21:37:03 +01:00
|
|
|
oii = ifp->info;
|
|
|
|
oii->curr_mtu = ifp->mtu;
|
|
|
|
|
2023-05-26 22:43:50 +02:00
|
|
|
/* Change ospf type param based on following
|
|
|
|
* condition:
|
|
|
|
* ospf type params is not set (first creation),
|
|
|
|
* OR ospf param type is changed based on
|
|
|
|
* link event, currently only handle for
|
|
|
|
* loopback interface type, for other ospf interface,
|
|
|
|
* type can be set from user config which needs to be
|
|
|
|
* preserved.
|
|
|
|
*/
|
|
|
|
if (IF_DEF_PARAMS(ifp) &&
|
|
|
|
(!OSPF_IF_PARAM_CONFIGURED(IF_DEF_PARAMS(ifp), type) ||
|
|
|
|
if_is_loopback(ifp))) {
|
2019-09-19 04:26:55 +02:00
|
|
|
SET_IF_PARAM(IF_DEF_PARAMS(ifp), type);
|
|
|
|
IF_DEF_PARAMS(ifp)->type = ospf_default_iftype(ifp);
|
|
|
|
}
|
|
|
|
|
2021-10-22 00:17:40 +02:00
|
|
|
ospf = ifp->vrf->info;
|
2019-09-19 04:26:55 +02:00
|
|
|
if (!ospf)
|
|
|
|
return 0;
|
|
|
|
|
2021-03-29 13:47:43 +02:00
|
|
|
if (ospf_if_count_area_params(ifp) > 0)
|
2020-10-14 00:20:53 +02:00
|
|
|
ospf_interface_area_set(ospf, ifp);
|
|
|
|
|
2019-09-19 04:26:55 +02:00
|
|
|
ospf_if_recalculate_output_cost(ifp);
|
|
|
|
|
|
|
|
ospf_if_update(ospf, ifp);
|
|
|
|
|
2021-06-17 15:26:36 +02:00
|
|
|
if (HAS_LINK_PARAMS(ifp))
|
|
|
|
ospf_mpls_te_update_if(ifp);
|
|
|
|
|
2019-09-19 04:26:55 +02:00
|
|
|
hook_call(ospf_if_update, ifp);
|
|
|
|
|
2019-09-18 22:20:04 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int ospf_ifp_up(struct interface *ifp)
|
|
|
|
{
|
2019-09-19 05:07:44 +02:00
|
|
|
struct ospf_interface *oi;
|
|
|
|
struct route_node *rn;
|
2019-10-24 21:09:18 +02:00
|
|
|
struct ospf_if_info *oii = ifp->info;
|
2023-03-29 22:58:25 +02:00
|
|
|
struct ospf *ospf;
|
|
|
|
|
|
|
|
if (IS_DEBUG_OSPF(zebra, ZEBRA_INTERFACE))
|
|
|
|
zlog_debug("Zebra: Interface[%s] state change to up.",
|
|
|
|
ifp->name);
|
|
|
|
|
|
|
|
/* Open per-intf write socket if configured */
|
|
|
|
ospf = ifp->vrf->info;
|
2023-06-29 19:51:18 +02:00
|
|
|
|
|
|
|
if (ospf && ospf->oi_running && ospf->intf_socket_enabled)
|
2023-03-29 22:58:25 +02:00
|
|
|
ospf_ifp_sock_init(ifp);
|
2019-09-19 05:07:44 +02:00
|
|
|
|
2019-10-24 21:09:18 +02:00
|
|
|
ospf_if_recalculate_output_cost(ifp);
|
2019-09-19 05:07:44 +02:00
|
|
|
|
2019-10-24 21:09:18 +02:00
|
|
|
if (oii && oii->curr_mtu != ifp->mtu) {
|
2019-09-19 05:07:44 +02:00
|
|
|
if (IS_DEBUG_OSPF(zebra, ZEBRA_INTERFACE))
|
|
|
|
zlog_debug(
|
2019-10-24 21:09:18 +02:00
|
|
|
"Zebra: Interface[%s] MTU change %u -> %u.",
|
|
|
|
ifp->name, oii->curr_mtu, ifp->mtu);
|
2019-09-19 05:07:44 +02:00
|
|
|
|
2019-10-24 21:09:18 +02:00
|
|
|
oii->curr_mtu = ifp->mtu;
|
|
|
|
/* Must reset the interface (simulate down/up) when MTU
|
|
|
|
* changes. */
|
|
|
|
ospf_if_reset(ifp);
|
2019-09-19 05:07:44 +02:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (rn = route_top(IF_OIFS(ifp)); rn; rn = route_next(rn)) {
|
|
|
|
if ((oi = rn->info) == NULL)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
ospf_if_up(oi);
|
|
|
|
}
|
|
|
|
|
2021-06-17 15:26:36 +02:00
|
|
|
if (HAS_LINK_PARAMS(ifp))
|
|
|
|
ospf_mpls_te_update_if(ifp);
|
|
|
|
|
2019-09-18 22:20:04 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int ospf_ifp_down(struct interface *ifp)
|
|
|
|
{
|
2019-09-19 05:55:34 +02:00
|
|
|
struct ospf_interface *oi;
|
|
|
|
struct route_node *node;
|
|
|
|
|
|
|
|
if (IS_DEBUG_OSPF(zebra, ZEBRA_INTERFACE))
|
|
|
|
zlog_debug("Zebra: Interface[%s] state change to down.",
|
|
|
|
ifp->name);
|
|
|
|
|
|
|
|
for (node = route_top(IF_OIFS(ifp)); node; node = route_next(node)) {
|
|
|
|
if ((oi = node->info) == NULL)
|
|
|
|
continue;
|
|
|
|
ospf_if_down(oi);
|
|
|
|
}
|
|
|
|
|
2023-03-29 22:58:25 +02:00
|
|
|
/* Close per-interface write socket if configured */
|
|
|
|
ospf_ifp_sock_close(ifp);
|
|
|
|
|
2019-09-18 22:20:04 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int ospf_ifp_destroy(struct interface *ifp)
|
|
|
|
{
|
2020-10-14 00:20:53 +02:00
|
|
|
struct ospf *ospf;
|
2019-09-19 15:40:57 +02:00
|
|
|
struct route_node *rn;
|
|
|
|
|
|
|
|
if (IS_DEBUG_OSPF(zebra, ZEBRA_INTERFACE))
|
|
|
|
zlog_debug(
|
|
|
|
"Zebra: interface delete %s vrf %s[%u] index %d flags %llx metric %d mtu %d",
|
2021-10-22 00:17:40 +02:00
|
|
|
ifp->name, ifp->vrf->name, ifp->vrf->vrf_id,
|
|
|
|
ifp->ifindex, (unsigned long long)ifp->flags,
|
|
|
|
ifp->metric, ifp->mtu);
|
2019-09-19 15:40:57 +02:00
|
|
|
|
|
|
|
hook_call(ospf_if_delete, ifp);
|
|
|
|
|
2021-10-22 00:17:40 +02:00
|
|
|
ospf = ifp->vrf->info;
|
2020-10-14 00:20:53 +02:00
|
|
|
if (ospf) {
|
2021-03-29 13:47:43 +02:00
|
|
|
if (ospf_if_count_area_params(ifp) > 0)
|
2020-10-14 00:20:53 +02:00
|
|
|
ospf_interface_area_unset(ospf, ifp);
|
|
|
|
}
|
|
|
|
|
2019-09-19 15:40:57 +02:00
|
|
|
for (rn = route_top(IF_OIFS(ifp)); rn; rn = route_next(rn))
|
|
|
|
if (rn->info)
|
|
|
|
ospf_if_free((struct ospf_interface *)rn->info);
|
|
|
|
|
2019-09-18 22:20:04 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2021-07-20 12:24:56 +02:00
|
|
|
/* Resetting ospf hello timer */
|
|
|
|
void ospf_reset_hello_timer(struct interface *ifp, struct in_addr addr,
|
|
|
|
bool is_addr)
|
|
|
|
{
|
|
|
|
struct route_node *rn;
|
|
|
|
|
|
|
|
if (is_addr) {
|
|
|
|
struct prefix p;
|
|
|
|
struct ospf_interface *oi = NULL;
|
|
|
|
|
|
|
|
p.u.prefix4 = addr;
|
|
|
|
p.family = AF_INET;
|
2021-08-04 14:47:45 +02:00
|
|
|
p.prefixlen = IPV4_MAX_BITLEN;
|
2021-07-20 12:24:56 +02:00
|
|
|
|
|
|
|
oi = ospf_if_table_lookup(ifp, &p);
|
|
|
|
|
|
|
|
if (oi) {
|
|
|
|
/* Send hello before restart the hello timer
|
|
|
|
* to avoid session flaps in case of bigger
|
|
|
|
* hello interval configurations.
|
|
|
|
*/
|
|
|
|
ospf_hello_send(oi);
|
|
|
|
|
|
|
|
/* Restart hello timer for this interface */
|
2022-12-25 16:26:52 +01:00
|
|
|
EVENT_OFF(oi->t_hello);
|
2021-07-20 12:24:56 +02:00
|
|
|
OSPF_HELLO_TIMER_ON(oi);
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (rn = route_top(IF_OIFS(ifp)); rn; rn = route_next(rn)) {
|
|
|
|
struct ospf_interface *oi = rn->info;
|
|
|
|
|
|
|
|
if (!oi)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
/* If hello interval configured on this oi, don't restart. */
|
|
|
|
if (OSPF_IF_PARAM_CONFIGURED(oi->params, v_hello))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
/* Send hello before restart the hello timer
|
|
|
|
* to avoid session flaps in case of bigger
|
|
|
|
* hello interval configurations.
|
|
|
|
*/
|
|
|
|
ospf_hello_send(oi);
|
|
|
|
|
|
|
|
/* Restart the hello timer. */
|
2022-12-25 16:26:52 +01:00
|
|
|
EVENT_OFF(oi->t_hello);
|
2021-07-20 12:24:56 +02:00
|
|
|
OSPF_HELLO_TIMER_ON(oi);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-24 10:12:36 +01:00
|
|
|
void ospf_if_init(void)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
2023-11-02 21:49:28 +01:00
|
|
|
hook_register_prio(if_real, 0, ospf_ifp_create);
|
|
|
|
hook_register_prio(if_up, 0, ospf_ifp_up);
|
|
|
|
hook_register_prio(if_down, 0, ospf_ifp_down);
|
|
|
|
hook_register_prio(if_unreal, 0, ospf_ifp_destroy);
|
2019-09-18 22:20:04 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Initialize Zebra interface data structure. */
|
2017-08-08 10:50:43 +02:00
|
|
|
hook_register_prio(if_add, 0, ospf_if_new_hook);
|
|
|
|
hook_register_prio(if_del, 0, ospf_if_delete_hook);
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|