2023-02-08 13:17:09 +01:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2002-12-13 21:15:29 +01:00
|
|
|
/*
|
|
|
|
* This is an implementation of rfc2370.
|
|
|
|
* Copyright (C) 2001 KDD R&D Laboratories, Inc.
|
|
|
|
* http://www.kddlabs.co.jp/
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <zebra.h>
|
|
|
|
|
|
|
|
#include "linklist.h"
|
|
|
|
#include "prefix.h"
|
|
|
|
#include "if.h"
|
|
|
|
#include "table.h"
|
|
|
|
#include "memory.h"
|
|
|
|
#include "command.h"
|
|
|
|
#include "vty.h"
|
|
|
|
#include "stream.h"
|
|
|
|
#include "log.h"
|
2022-02-28 16:40:31 +01:00
|
|
|
#include "event.h"
|
2002-12-13 21:15:29 +01:00
|
|
|
#include "hash.h"
|
|
|
|
#include "sockunion.h" /* for inet_aton() */
|
2023-02-18 18:16:18 +01:00
|
|
|
#include "printfrr.h"
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
#include "ospfd/ospfd.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_flood.h"
|
|
|
|
#include "ospfd/ospf_packet.h"
|
|
|
|
#include "ospfd/ospf_spf.h"
|
|
|
|
#include "ospfd/ospf_dump.h"
|
|
|
|
#include "ospfd/ospf_route.h"
|
|
|
|
#include "ospfd/ospf_ase.h"
|
|
|
|
#include "ospfd/ospf_zebra.h"
|
2018-01-18 19:11:11 +01:00
|
|
|
#include "ospfd/ospf_te.h"
|
|
|
|
#include "ospfd/ospf_sr.h"
|
|
|
|
#include "ospfd/ospf_ri.h"
|
|
|
|
#include "ospfd/ospf_ext.h"
|
2018-08-21 01:26:59 +02:00
|
|
|
#include "ospfd/ospf_errors.h"
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2016-01-06 10:37:22 +01:00
|
|
|
DEFINE_MTYPE_STATIC(OSPFD, OSPF_OPAQUE_FUNCTAB, "OSPF opaque function table");
|
|
|
|
DEFINE_MTYPE_STATIC(OSPFD, OPAQUE_INFO_PER_TYPE, "OSPF opaque per-type info");
|
|
|
|
DEFINE_MTYPE_STATIC(OSPFD, OPAQUE_INFO_PER_ID, "OSPF opaque per-ID info");
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/*------------------------------------------------------------------------*
|
2022-04-01 22:27:55 +02:00
|
|
|
* Following are initialize/terminate functions for Opaque-LSAs handling.
|
2002-12-13 21:15:29 +01:00
|
|
|
*------------------------------------------------------------------------*/
|
|
|
|
|
2003-03-17 02:16:55 +01:00
|
|
|
#ifdef SUPPORT_OSPF_API
|
|
|
|
int ospf_apiserver_init(void);
|
|
|
|
void ospf_apiserver_term(void);
|
2004-10-12 08:13:54 +02:00
|
|
|
/* Init apiserver? It's disabled by default. */
|
|
|
|
int ospf_apiserver_enable;
|
2003-03-17 02:16:55 +01:00
|
|
|
#endif /* SUPPORT_OSPF_API */
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
static void ospf_opaque_register_vty(void);
|
|
|
|
static void ospf_opaque_funclist_init(void);
|
|
|
|
static void ospf_opaque_funclist_term(void);
|
2022-01-08 22:57:10 +01:00
|
|
|
static void free_opaque_info_per_type_del(void *val);
|
2002-12-13 21:15:29 +01:00
|
|
|
static void free_opaque_info_per_id(void *val);
|
|
|
|
static int ospf_opaque_lsa_install_hook(struct ospf_lsa *lsa);
|
|
|
|
static int ospf_opaque_lsa_delete_hook(struct ospf_lsa *lsa);
|
|
|
|
|
|
|
|
void ospf_opaque_init(void)
|
|
|
|
{
|
|
|
|
ospf_opaque_register_vty();
|
|
|
|
ospf_opaque_funclist_init();
|
|
|
|
|
|
|
|
if (ospf_mpls_te_init() != 0)
|
|
|
|
exit(1);
|
|
|
|
|
2018-01-18 19:11:11 +01:00
|
|
|
/* Segment Routing init */
|
|
|
|
if (ospf_sr_init() != 0)
|
|
|
|
exit(1);
|
|
|
|
|
2016-04-19 19:21:17 +02:00
|
|
|
if (ospf_router_info_init() != 0)
|
|
|
|
exit(1);
|
|
|
|
|
2018-01-18 19:11:11 +01:00
|
|
|
if (ospf_ext_init() != 0)
|
|
|
|
exit(1);
|
|
|
|
|
2003-03-17 02:16:55 +01:00
|
|
|
#ifdef SUPPORT_OSPF_API
|
2004-10-11 18:27:03 +02:00
|
|
|
if ((ospf_apiserver_enable) && (ospf_apiserver_init() != 0))
|
2003-03-17 02:16:55 +01:00
|
|
|
exit(1);
|
|
|
|
#endif /* SUPPORT_OSPF_API */
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ospf_opaque_term(void)
|
|
|
|
{
|
|
|
|
ospf_mpls_te_term();
|
|
|
|
|
2016-04-19 19:21:17 +02:00
|
|
|
ospf_router_info_term();
|
|
|
|
|
2018-01-18 19:11:11 +01:00
|
|
|
ospf_ext_term();
|
|
|
|
|
|
|
|
ospf_sr_term();
|
|
|
|
|
2003-03-17 02:16:55 +01:00
|
|
|
#ifdef SUPPORT_OSPF_API
|
|
|
|
ospf_apiserver_term();
|
|
|
|
#endif /* SUPPORT_OSPF_API */
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
ospf_opaque_funclist_term();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-02-03 19:30:33 +01:00
|
|
|
void ospf_opaque_finish(void)
|
|
|
|
{
|
2020-11-13 17:35:06 +01:00
|
|
|
ospf_mpls_te_finish();
|
|
|
|
|
2018-02-03 19:30:33 +01:00
|
|
|
ospf_router_info_finish();
|
|
|
|
|
|
|
|
ospf_ext_finish();
|
|
|
|
|
2023-03-18 20:35:34 +01:00
|
|
|
#ifdef SUPPORT_OSPF_API
|
|
|
|
ospf_apiserver_term();
|
|
|
|
#endif
|
|
|
|
|
2018-02-03 19:30:33 +01:00
|
|
|
ospf_sr_finish();
|
|
|
|
}
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
int ospf_opaque_type9_lsa_init(struct ospf_interface *oi)
|
|
|
|
{
|
|
|
|
if (oi->opaque_lsa_self != NULL)
|
2018-10-02 11:39:51 +02:00
|
|
|
list_delete(&oi->opaque_lsa_self);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
oi->opaque_lsa_self = list_new();
|
2022-01-08 22:57:10 +01:00
|
|
|
oi->opaque_lsa_self->del = free_opaque_info_per_type_del;
|
2002-12-13 21:15:29 +01:00
|
|
|
oi->t_opaque_lsa_self = NULL;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ospf_opaque_type9_lsa_term(struct ospf_interface *oi)
|
|
|
|
{
|
2022-06-03 16:28:11 +02:00
|
|
|
THREAD_OFF(oi->t_opaque_lsa_self);
|
2002-12-13 21:15:29 +01:00
|
|
|
if (oi->opaque_lsa_self != NULL)
|
2018-10-02 11:39:51 +02:00
|
|
|
list_delete(&oi->opaque_lsa_self);
|
2002-12-13 21:15:29 +01:00
|
|
|
oi->opaque_lsa_self = NULL;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
int ospf_opaque_type10_lsa_init(struct ospf_area *area)
|
|
|
|
{
|
|
|
|
if (area->opaque_lsa_self != NULL)
|
2018-10-02 11:39:51 +02:00
|
|
|
list_delete(&area->opaque_lsa_self);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
area->opaque_lsa_self = list_new();
|
2022-01-08 22:57:10 +01:00
|
|
|
area->opaque_lsa_self->del = free_opaque_info_per_type_del;
|
2002-12-13 21:15:29 +01:00
|
|
|
area->t_opaque_lsa_self = NULL;
|
|
|
|
|
|
|
|
#ifdef MONITOR_LSDB_CHANGE
|
|
|
|
area->lsdb->new_lsa_hook = ospf_opaque_lsa_install_hook;
|
|
|
|
area->lsdb->del_lsa_hook = ospf_opaque_lsa_delete_hook;
|
|
|
|
#endif /* MONITOR_LSDB_CHANGE */
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ospf_opaque_type10_lsa_term(struct ospf_area *area)
|
|
|
|
{
|
|
|
|
#ifdef MONITOR_LSDB_CHANGE
|
|
|
|
area->lsdb->new_lsa_hook = area->lsdb->del_lsa_hook = NULL;
|
|
|
|
#endif /* MONITOR_LSDB_CHANGE */
|
|
|
|
|
2022-06-03 16:28:11 +02:00
|
|
|
THREAD_OFF(area->t_opaque_lsa_self);
|
2002-12-13 21:15:29 +01:00
|
|
|
if (area->opaque_lsa_self != NULL)
|
2018-10-02 11:39:51 +02:00
|
|
|
list_delete(&area->opaque_lsa_self);
|
2002-12-13 21:15:29 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
int ospf_opaque_type11_lsa_init(struct ospf *top)
|
|
|
|
{
|
|
|
|
if (top->opaque_lsa_self != NULL)
|
2018-10-02 11:39:51 +02:00
|
|
|
list_delete(&top->opaque_lsa_self);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
top->opaque_lsa_self = list_new();
|
2022-01-08 22:57:10 +01:00
|
|
|
top->opaque_lsa_self->del = free_opaque_info_per_type_del;
|
2002-12-13 21:15:29 +01:00
|
|
|
top->t_opaque_lsa_self = NULL;
|
|
|
|
|
|
|
|
#ifdef MONITOR_LSDB_CHANGE
|
|
|
|
top->lsdb->new_lsa_hook = ospf_opaque_lsa_install_hook;
|
|
|
|
top->lsdb->del_lsa_hook = ospf_opaque_lsa_delete_hook;
|
|
|
|
#endif /* MONITOR_LSDB_CHANGE */
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ospf_opaque_type11_lsa_term(struct ospf *top)
|
|
|
|
{
|
|
|
|
#ifdef MONITOR_LSDB_CHANGE
|
|
|
|
top->lsdb->new_lsa_hook = top->lsdb->del_lsa_hook = NULL;
|
|
|
|
#endif /* MONITOR_LSDB_CHANGE */
|
|
|
|
|
2022-06-03 16:28:11 +02:00
|
|
|
THREAD_OFF(top->t_opaque_lsa_self);
|
2002-12-13 21:15:29 +01:00
|
|
|
if (top->opaque_lsa_self != NULL)
|
2018-10-02 11:39:51 +02:00
|
|
|
list_delete(&top->opaque_lsa_self);
|
2002-12-13 21:15:29 +01:00
|
|
|
return;
|
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2018-03-27 21:13:34 +02:00
|
|
|
static const char *ospf_opaque_type_name(uint8_t opaque_type)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
|
|
|
const char *name = "Unknown";
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
switch (opaque_type) {
|
|
|
|
case OPAQUE_TYPE_WILDCARD: /* This is a special assignment! */
|
|
|
|
name = "Wildcard";
|
|
|
|
break;
|
|
|
|
case OPAQUE_TYPE_TRAFFIC_ENGINEERING_LSA:
|
|
|
|
name = "Traffic Engineering LSA";
|
|
|
|
break;
|
|
|
|
case OPAQUE_TYPE_SYCAMORE_OPTICAL_TOPOLOGY_DESC:
|
|
|
|
name = "Sycamore optical topology description";
|
|
|
|
break;
|
|
|
|
case OPAQUE_TYPE_GRACE_LSA:
|
|
|
|
name = "Grace-LSA";
|
|
|
|
break;
|
Update Traffic Engineering Support for OSPFD
NOTE: I am squashing several commits together because they
do not independently compile and we need this ability to
do any type of sane testing on the patches. Since this
series builds together I am doing this. -DBS
This new structure is the basis to get new link parameters for
Traffic Engineering from Zebra/interface layer to OSPFD and ISISD
for the support of Traffic Engineering
* lib/if.[c,h]: link parameters struture and get/set functions
* lib/command.[c,h]: creation of a new link-node
* lib/zclient.[c,h]: modification to the ZBUS message to convey the
link parameters structure
* lib/zebra.h: New ZBUS message
Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
Add support for IEEE 754 format
* lib/stream.[c,h]: Add stream_get{f,d} and stream_put{f,d}) demux and muxers to
safely convert between big-endian IEEE-754 single and double binary
format, as used in IETF RFCs, and C99. Implementation depends on host
using __STDC_IEC_559__, which should be everything we care about. Should
correctly error out otherwise.
* lib/network.[c,h]: Add ntohf and htonf converter
* lib/memtypes.c: Add new memeory type for Traffic Engineering support
Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
Add link parameters support to Zebra
* zebra/interface.c:
- Add new link-params CLI commands
- Add new functions to set/get link parameters for interface
* zebra/redistribute.[c,h]: Add new function to propagate link parameters
to routing daemon (essentially OSPFD and ISISD) for Traffic Engineering.
* zebra/redistribute_null.c: Add new function
zebra_interface_parameters_update()
* zebra/zserv.[c,h]: Add new functions to send link parameters
Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
Add support of new link-params CLI to vtysh
In vtysh_config.c/vtysh_config_parse_line(), it is not possible to continue
to use the ordered version for adding line i.e. config_add_line_uniq() to print
Interface CLI commands as it completely break the new LINK_PARAMS_NODE.
Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
Update Traffic Engineering support for OSPFD
These patches update original code to RFC3630 (OSPF-TE) and add support of
RFC5392 (Inter-AS v2) & RFC7471 (TE metric extensions) and partial support
of RFC6827 (ASON - GMPLS).
* ospfd/ospf_dump.[c,h]: Add new dump functions for Traffic Engineering
* ospfd/ospf_opaque.[c,h]: Add new TLV code points for RFC5392
* ospfd/ospf_packet.c: Update checking of OSPF_OPTION
* ospfd/ospf_vty.[c,h]: Update ospf_str2area_id
* ospfd/ospf_zebra.c: Add new function ospf_interface_link_params() to get
Link Parameters information from the interface to populate Traffic Engineering
metrics
* ospfd/ospfd.[c,h]: Update OSPF_OPTION flags (T -> MT and new DN)
* ospfd/ospf_te.[c,h]: Major modifications to update the code to new
link parameters structure and new RFCs
Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
tmp
2016-04-19 16:21:46 +02:00
|
|
|
case OPAQUE_TYPE_INTER_AS_LSA:
|
|
|
|
name = "Inter-AS TE-v2 LSA";
|
|
|
|
break;
|
2016-04-19 19:21:17 +02:00
|
|
|
case OPAQUE_TYPE_ROUTER_INFORMATION_LSA:
|
|
|
|
name = "Router Information LSA";
|
|
|
|
break;
|
2018-01-18 19:11:11 +01:00
|
|
|
case OPAQUE_TYPE_EXTENDED_PREFIX_LSA:
|
|
|
|
name = "Extended Prefix Opaque LSA";
|
|
|
|
break;
|
|
|
|
case OPAQUE_TYPE_EXTENDED_LINK_LSA:
|
|
|
|
name = "Extended Link Opaque LSA";
|
|
|
|
break;
|
2002-12-13 21:15:29 +01:00
|
|
|
default:
|
|
|
|
if (OPAQUE_TYPE_RANGE_UNASSIGNED(opaque_type))
|
|
|
|
name = "Unassigned";
|
2012-12-04 22:43:42 +01:00
|
|
|
else {
|
2018-03-27 21:13:34 +02:00
|
|
|
uint32_t bigger_range = opaque_type;
|
2012-12-04 22:43:42 +01:00
|
|
|
/*
|
|
|
|
* Get around type-limits warning: comparison is always
|
|
|
|
* true due to limited range of data type
|
|
|
|
*/
|
|
|
|
if (OPAQUE_TYPE_RANGE_RESERVED(bigger_range))
|
|
|
|
name = "Private/Experimental";
|
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
return name;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*------------------------------------------------------------------------*
|
2022-04-01 22:27:55 +02:00
|
|
|
* Following are management functions to store user specified callbacks.
|
2002-12-13 21:15:29 +01:00
|
|
|
*------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
struct opaque_info_per_type; /* Forward declaration. */
|
|
|
|
|
2022-01-08 22:57:10 +01:00
|
|
|
static void free_opaque_info_per_type(struct opaque_info_per_type *oipt,
|
|
|
|
bool cleanup_owner);
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
struct ospf_opaque_functab {
|
2018-03-27 21:13:34 +02:00
|
|
|
uint8_t opaque_type;
|
2002-12-13 21:15:29 +01:00
|
|
|
struct opaque_info_per_type *oipt;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
int (*new_if_hook)(struct interface *ifp);
|
|
|
|
int (*del_if_hook)(struct interface *ifp);
|
|
|
|
void (*ism_change_hook)(struct ospf_interface *oi, int old_status);
|
|
|
|
void (*nsm_change_hook)(struct ospf_neighbor *nbr, int old_status);
|
|
|
|
void (*config_write_router)(struct vty *vty);
|
|
|
|
void (*config_write_if)(struct vty *vty, struct interface *ifp);
|
|
|
|
void (*config_write_debug)(struct vty *vty);
|
2021-10-08 02:06:01 +02:00
|
|
|
void (*show_opaque_info)(struct vty *vty, struct json_object *json,
|
|
|
|
struct ospf_lsa *lsa);
|
2002-12-13 21:15:29 +01:00
|
|
|
int (*lsa_originator)(void *arg);
|
2011-03-22 16:23:55 +01:00
|
|
|
struct ospf_lsa *(*lsa_refresher)(struct ospf_lsa *lsa);
|
2002-12-13 21:15:29 +01:00
|
|
|
int (*new_lsa_hook)(struct ospf_lsa *lsa);
|
|
|
|
int (*del_lsa_hook)(struct ospf_lsa *lsa);
|
|
|
|
};
|
|
|
|
|
2004-09-24 10:01:38 +02:00
|
|
|
/* Handle LSA-9/10/11 altogether. */
|
|
|
|
static struct list *ospf_opaque_wildcard_funclist;
|
|
|
|
static struct list *ospf_opaque_type9_funclist;
|
|
|
|
static struct list *ospf_opaque_type10_funclist;
|
|
|
|
static struct list *ospf_opaque_type11_funclist;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
static void ospf_opaque_del_functab(void *val)
|
|
|
|
{
|
|
|
|
XFREE(MTYPE_OSPF_OPAQUE_FUNCTAB, val);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void ospf_opaque_funclist_init(void)
|
|
|
|
{
|
2004-09-24 10:01:38 +02:00
|
|
|
struct list *funclist;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2003-01-18 01:12:02 +01:00
|
|
|
funclist = ospf_opaque_wildcard_funclist = list_new();
|
|
|
|
funclist->del = ospf_opaque_del_functab;
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
funclist = ospf_opaque_type9_funclist = list_new();
|
|
|
|
funclist->del = ospf_opaque_del_functab;
|
|
|
|
|
|
|
|
funclist = ospf_opaque_type10_funclist = list_new();
|
|
|
|
funclist->del = ospf_opaque_del_functab;
|
|
|
|
|
|
|
|
funclist = ospf_opaque_type11_funclist = list_new();
|
|
|
|
funclist->del = ospf_opaque_del_functab;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void ospf_opaque_funclist_term(void)
|
|
|
|
{
|
2004-09-24 10:01:38 +02:00
|
|
|
struct list *funclist;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2003-01-18 01:12:02 +01:00
|
|
|
funclist = ospf_opaque_wildcard_funclist;
|
2018-10-02 11:39:51 +02:00
|
|
|
list_delete(&funclist);
|
2003-01-18 01:12:02 +01:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
funclist = ospf_opaque_type9_funclist;
|
2018-10-02 11:39:51 +02:00
|
|
|
list_delete(&funclist);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
funclist = ospf_opaque_type10_funclist;
|
2018-10-02 11:39:51 +02:00
|
|
|
list_delete(&funclist);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
funclist = ospf_opaque_type11_funclist;
|
2018-10-02 11:39:51 +02:00
|
|
|
list_delete(&funclist);
|
2002-12-13 21:15:29 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-03-27 21:13:34 +02:00
|
|
|
static struct list *ospf_get_opaque_funclist(uint8_t lsa_type)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
2004-09-24 10:01:38 +02:00
|
|
|
struct list *funclist = NULL;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
switch (lsa_type) {
|
2003-01-18 01:12:02 +01:00
|
|
|
case OPAQUE_TYPE_WILDCARD:
|
|
|
|
/* XXX
|
|
|
|
* This is an ugly trick to handle type-9/10/11 LSA altogether.
|
|
|
|
* Yes, "OPAQUE_TYPE_WILDCARD (value 0)" is not an LSA-type, nor
|
|
|
|
* an officially assigned opaque-type.
|
|
|
|
* Though it is possible that the value might be officially used
|
|
|
|
* in the future, we use it internally as a special label, for
|
|
|
|
* now.
|
|
|
|
*/
|
|
|
|
funclist = ospf_opaque_wildcard_funclist;
|
|
|
|
break;
|
2002-12-13 21:15:29 +01:00
|
|
|
case OSPF_OPAQUE_LINK_LSA:
|
|
|
|
funclist = ospf_opaque_type9_funclist;
|
|
|
|
break;
|
|
|
|
case OSPF_OPAQUE_AREA_LSA:
|
|
|
|
funclist = ospf_opaque_type10_funclist;
|
|
|
|
break;
|
|
|
|
case OSPF_OPAQUE_AS_LSA:
|
|
|
|
funclist = ospf_opaque_type11_funclist;
|
|
|
|
break;
|
|
|
|
default:
|
2022-08-23 18:45:38 +02:00
|
|
|
flog_warn(EC_OSPF_LSA_UNEXPECTED, "%s: Unexpected LSA-type(%u)",
|
|
|
|
__func__, lsa_type);
|
2002-12-13 21:15:29 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
return funclist;
|
|
|
|
}
|
|
|
|
|
2004-09-24 10:01:38 +02:00
|
|
|
/* XXX: such a huge argument list can /not/ be healthy... */
|
2002-12-13 21:15:29 +01:00
|
|
|
int ospf_register_opaque_functab(
|
2018-03-27 21:13:34 +02:00
|
|
|
uint8_t lsa_type, uint8_t opaque_type,
|
2002-12-13 21:15:29 +01:00
|
|
|
int (*new_if_hook)(struct interface *ifp),
|
|
|
|
int (*del_if_hook)(struct interface *ifp),
|
|
|
|
void (*ism_change_hook)(struct ospf_interface *oi, int old_status),
|
|
|
|
void (*nsm_change_hook)(struct ospf_neighbor *nbr, int old_status),
|
|
|
|
void (*config_write_router)(struct vty *vty),
|
|
|
|
void (*config_write_if)(struct vty *vty, struct interface *ifp),
|
|
|
|
void (*config_write_debug)(struct vty *vty),
|
2021-10-08 02:06:01 +02:00
|
|
|
void (*show_opaque_info)(struct vty *vty, struct json_object *json,
|
|
|
|
struct ospf_lsa *lsa),
|
2002-12-13 21:15:29 +01:00
|
|
|
int (*lsa_originator)(void *arg),
|
2011-03-22 16:23:55 +01:00
|
|
|
struct ospf_lsa *(*lsa_refresher)(struct ospf_lsa *lsa),
|
2002-12-13 21:15:29 +01:00
|
|
|
int (*new_lsa_hook)(struct ospf_lsa *lsa),
|
|
|
|
int (*del_lsa_hook)(struct ospf_lsa *lsa))
|
|
|
|
{
|
2004-09-24 10:01:38 +02:00
|
|
|
struct list *funclist;
|
2002-12-13 21:15:29 +01:00
|
|
|
struct ospf_opaque_functab *new;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2018-08-21 01:26:59 +02:00
|
|
|
if ((funclist = ospf_get_opaque_funclist(lsa_type)) == NULL)
|
|
|
|
return -1;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2018-08-21 01:26:59 +02:00
|
|
|
struct listnode *node, *nnode;
|
|
|
|
struct ospf_opaque_functab *functab;
|
|
|
|
|
|
|
|
for (ALL_LIST_ELEMENTS(funclist, node, nnode, functab))
|
|
|
|
if (functab->opaque_type == opaque_type) {
|
|
|
|
flog_warn(
|
2018-09-13 20:56:04 +02:00
|
|
|
EC_OSPF_LSA,
|
2022-08-23 18:45:38 +02:00
|
|
|
"%s: Duplicated entry?: lsa_type(%u), opaque_type(%u)",
|
|
|
|
__func__, lsa_type, opaque_type);
|
2018-08-21 01:26:59 +02:00
|
|
|
return -1;
|
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2018-06-14 14:58:05 +02:00
|
|
|
new = XCALLOC(MTYPE_OSPF_OPAQUE_FUNCTAB,
|
|
|
|
sizeof(struct ospf_opaque_functab));
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
new->opaque_type = opaque_type;
|
|
|
|
new->oipt = NULL;
|
|
|
|
new->new_if_hook = new_if_hook;
|
|
|
|
new->del_if_hook = del_if_hook;
|
|
|
|
new->ism_change_hook = ism_change_hook;
|
|
|
|
new->nsm_change_hook = nsm_change_hook;
|
|
|
|
new->config_write_router = config_write_router;
|
|
|
|
new->config_write_if = config_write_if;
|
|
|
|
new->config_write_debug = config_write_debug;
|
|
|
|
new->show_opaque_info = show_opaque_info;
|
|
|
|
new->lsa_originator = lsa_originator;
|
|
|
|
new->lsa_refresher = lsa_refresher;
|
|
|
|
new->new_lsa_hook = new_lsa_hook;
|
|
|
|
new->del_lsa_hook = del_lsa_hook;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
listnode_add(funclist, new);
|
|
|
|
|
2018-08-21 01:26:59 +02:00
|
|
|
return 0;
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
2018-03-27 21:13:34 +02:00
|
|
|
void ospf_delete_opaque_functab(uint8_t lsa_type, uint8_t opaque_type)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
2004-09-24 10:01:38 +02:00
|
|
|
struct list *funclist;
|
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_opaque_functab *functab;
|
|
|
|
|
|
|
|
if ((funclist = ospf_get_opaque_funclist(lsa_type)) != NULL)
|
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(funclist, node, nnode, functab)) {
|
|
|
|
if (functab->opaque_type == opaque_type) {
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Cleanup internal control information, if it
|
|
|
|
* still remains. */
|
2022-01-08 22:57:10 +01:00
|
|
|
if (functab->oipt != NULL)
|
|
|
|
free_opaque_info_per_type(functab->oipt,
|
|
|
|
true);
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Dequeue listnode entry from the list. */
|
|
|
|
listnode_delete(funclist, functab);
|
|
|
|
|
|
|
|
XFREE(MTYPE_OSPF_OPAQUE_FUNCTAB, functab);
|
2004-09-24 10:01:38 +02:00
|
|
|
break;
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
}
|
2004-09-24 10:01:38 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct ospf_opaque_functab *
|
|
|
|
ospf_opaque_functab_lookup(struct ospf_lsa *lsa)
|
|
|
|
{
|
2004-09-24 10:01:38 +02:00
|
|
|
struct list *funclist;
|
|
|
|
struct listnode *node;
|
2002-12-13 21:15:29 +01:00
|
|
|
struct ospf_opaque_functab *functab;
|
2018-03-27 21:13:34 +02:00
|
|
|
uint8_t key = GET_OPAQUE_TYPE(ntohl(lsa->data->id.s_addr));
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
if ((funclist = ospf_get_opaque_funclist(lsa->data->type)) != NULL)
|
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(funclist, node, functab))
|
2004-09-24 10:01:38 +02:00
|
|
|
if (functab->opaque_type == key)
|
|
|
|
return functab;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*------------------------------------------------------------------------*
|
2022-04-01 22:27:55 +02:00
|
|
|
* Following are management functions for self-originated LSA entries.
|
2002-12-13 21:15:29 +01:00
|
|
|
*------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Opaque-LSA control information per opaque-type.
|
|
|
|
* Single Opaque-Type may have multiple instances; each of them will be
|
|
|
|
* identified by their opaque-id.
|
|
|
|
*/
|
|
|
|
struct opaque_info_per_type {
|
2018-03-27 21:13:34 +02:00
|
|
|
uint8_t lsa_type;
|
|
|
|
uint8_t opaque_type;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
enum { PROC_NORMAL, PROC_SUSPEND } status;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/*
|
|
|
|
* Thread for (re-)origination scheduling for this opaque-type.
|
|
|
|
*
|
|
|
|
* Initial origination of Opaque-LSAs is controlled by generic
|
|
|
|
* Opaque-LSA handling module so that same opaque-type entries are
|
|
|
|
* called all at once when certain conditions are met.
|
|
|
|
* However, there might be cases that some Opaque-LSA clients need
|
|
|
|
* to (re-)originate their own Opaque-LSAs out-of-sync with others.
|
|
|
|
* This thread is prepared for that specific purpose.
|
|
|
|
*/
|
2022-03-01 22:18:12 +01:00
|
|
|
struct event *t_opaque_lsa_self;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/*
|
2003-01-18 01:12:02 +01:00
|
|
|
* Backpointer to an "owner" which is LSA-type dependent.
|
2002-12-13 21:15:29 +01:00
|
|
|
* type-9: struct ospf_interface
|
|
|
|
* type-10: struct ospf_area
|
|
|
|
* type-11: struct ospf
|
|
|
|
*/
|
|
|
|
void *owner;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Collection of callback functions for this opaque-type. */
|
|
|
|
struct ospf_opaque_functab *functab;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2018-10-25 20:06:59 +02:00
|
|
|
/* List of Opaque-LSA control information per opaque-id. */
|
2004-09-24 10:01:38 +02:00
|
|
|
struct list *id_list;
|
2002-12-13 21:15:29 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Opaque-LSA control information per opaque-id. */
|
|
|
|
struct opaque_info_per_id {
|
2018-03-27 21:13:34 +02:00
|
|
|
uint32_t opaque_id;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
/* Thread for refresh/flush scheduling for this opaque-type/id. */
|
2022-03-01 22:18:12 +01:00
|
|
|
struct event *t_opaque_lsa_self;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
/* Backpointer to Opaque-LSA control information per opaque-type. */
|
|
|
|
struct opaque_info_per_type *opqctl_type;
|
|
|
|
|
|
|
|
/* Here comes an actual Opaque-LSA entry for this opaque-type/id. */
|
|
|
|
struct ospf_lsa *lsa;
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct opaque_info_per_type *
|
|
|
|
register_opaque_info_per_type(struct ospf_opaque_functab *functab,
|
|
|
|
struct ospf_lsa *new);
|
|
|
|
static struct opaque_info_per_type *
|
|
|
|
lookup_opaque_info_by_type(struct ospf_lsa *lsa);
|
|
|
|
static struct opaque_info_per_id *
|
|
|
|
register_opaque_info_per_id(struct opaque_info_per_type *oipt,
|
|
|
|
struct ospf_lsa *new);
|
|
|
|
static struct opaque_info_per_id *
|
|
|
|
lookup_opaque_info_by_id(struct opaque_info_per_type *oipt,
|
|
|
|
struct ospf_lsa *lsa);
|
|
|
|
static struct opaque_info_per_id *register_opaque_lsa(struct ospf_lsa *new);
|
|
|
|
|
|
|
|
|
|
|
|
static struct opaque_info_per_type *
|
|
|
|
register_opaque_info_per_type(struct ospf_opaque_functab *functab,
|
|
|
|
struct ospf_lsa *new)
|
|
|
|
{
|
|
|
|
struct ospf *top;
|
|
|
|
struct opaque_info_per_type *oipt;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2018-06-14 14:58:05 +02:00
|
|
|
oipt = XCALLOC(MTYPE_OPAQUE_INFO_PER_TYPE,
|
|
|
|
sizeof(struct opaque_info_per_type));
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
switch (new->data->type) {
|
|
|
|
case OSPF_OPAQUE_LINK_LSA:
|
|
|
|
oipt->owner = new->oi;
|
|
|
|
listnode_add(new->oi->opaque_lsa_self, oipt);
|
|
|
|
break;
|
|
|
|
case OSPF_OPAQUE_AREA_LSA:
|
|
|
|
oipt->owner = new->area;
|
|
|
|
listnode_add(new->area->opaque_lsa_self, oipt);
|
|
|
|
break;
|
|
|
|
case OSPF_OPAQUE_AS_LSA:
|
2017-08-25 22:51:12 +02:00
|
|
|
top = ospf_lookup_by_vrf_id(new->vrf_id);
|
2003-03-25 06:07:42 +01:00
|
|
|
if (new->area != NULL && (top = new->area->ospf) == NULL) {
|
2022-01-08 22:57:10 +01:00
|
|
|
free_opaque_info_per_type(oipt, true);
|
2002-12-13 21:15:29 +01:00
|
|
|
oipt = NULL;
|
|
|
|
goto out; /* This case may not exist. */
|
|
|
|
}
|
|
|
|
oipt->owner = top;
|
|
|
|
listnode_add(top->opaque_lsa_self, oipt);
|
|
|
|
break;
|
|
|
|
default:
|
2022-08-23 18:45:38 +02:00
|
|
|
flog_warn(EC_OSPF_LSA_UNEXPECTED, "%s: Unexpected LSA-type(%u)",
|
|
|
|
__func__, new->data->type);
|
2022-01-08 22:57:10 +01:00
|
|
|
free_opaque_info_per_type(oipt, true);
|
2002-12-13 21:15:29 +01:00
|
|
|
oipt = NULL;
|
|
|
|
goto out; /* This case may not exist. */
|
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2003-01-18 01:12:02 +01:00
|
|
|
oipt->lsa_type = new->data->type;
|
2002-12-13 21:15:29 +01:00
|
|
|
oipt->opaque_type = GET_OPAQUE_TYPE(ntohl(new->data->id.s_addr));
|
|
|
|
oipt->status = PROC_NORMAL;
|
|
|
|
oipt->functab = functab;
|
|
|
|
functab->oipt = oipt;
|
|
|
|
oipt->id_list = list_new();
|
|
|
|
oipt->id_list->del = free_opaque_info_per_id;
|
|
|
|
|
|
|
|
out:
|
|
|
|
return oipt;
|
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2022-01-08 22:57:10 +01:00
|
|
|
static void free_opaque_info_per_type(struct opaque_info_per_type *oipt,
|
|
|
|
bool cleanup_owner)
|
2018-02-09 12:13:07 +01:00
|
|
|
{
|
2002-12-13 21:15:29 +01:00
|
|
|
struct opaque_info_per_id *oipi;
|
|
|
|
struct ospf_lsa *lsa;
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
struct listnode *node, *nnode;
|
2022-01-08 22:57:10 +01:00
|
|
|
struct list *l;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Control information per opaque-id may still exist. */
|
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(oipt->id_list, node, nnode, oipi)) {
|
2002-12-13 21:15:29 +01:00
|
|
|
if ((lsa = oipi->lsa) == NULL)
|
|
|
|
continue;
|
|
|
|
if (IS_LSA_MAXAGE(lsa))
|
|
|
|
continue;
|
|
|
|
ospf_opaque_lsa_flush_schedule(lsa);
|
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2022-06-03 16:28:11 +02:00
|
|
|
THREAD_OFF(oipt->t_opaque_lsa_self);
|
2018-10-02 11:39:51 +02:00
|
|
|
list_delete(&oipt->id_list);
|
2022-01-08 22:57:10 +01:00
|
|
|
if (cleanup_owner) {
|
|
|
|
/* Remove from its owner's self-originated LSA list. */
|
|
|
|
switch (oipt->lsa_type) {
|
|
|
|
case OSPF_OPAQUE_LINK_LSA:
|
|
|
|
l = ((struct ospf_interface *)oipt->owner)
|
|
|
|
->opaque_lsa_self;
|
|
|
|
break;
|
|
|
|
case OSPF_OPAQUE_AREA_LSA:
|
|
|
|
l = ((struct ospf_area *)oipt->owner)->opaque_lsa_self;
|
|
|
|
break;
|
|
|
|
case OSPF_OPAQUE_AS_LSA:
|
|
|
|
l = ((struct ospf *)oipt->owner)->opaque_lsa_self;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
flog_warn(
|
|
|
|
EC_OSPF_LSA_UNEXPECTED,
|
|
|
|
"free_opaque_info_owner: Unexpected LSA-type(%u)",
|
|
|
|
oipt->lsa_type);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
listnode_delete(l, oipt);
|
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
XFREE(MTYPE_OPAQUE_INFO_PER_TYPE, oipt);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-01-08 22:57:10 +01:00
|
|
|
static void free_opaque_info_per_type_del(void *val)
|
|
|
|
{
|
|
|
|
free_opaque_info_per_type((struct opaque_info_per_type *)val, false);
|
|
|
|
}
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
static struct opaque_info_per_type *
|
|
|
|
lookup_opaque_info_by_type(struct ospf_lsa *lsa)
|
|
|
|
{
|
|
|
|
struct ospf *top;
|
|
|
|
struct ospf_area *area;
|
|
|
|
struct ospf_interface *oi;
|
2004-09-24 10:01:38 +02:00
|
|
|
struct list *listtop = NULL;
|
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 opaque_info_per_type *oipt = NULL;
|
2018-03-27 21:13:34 +02:00
|
|
|
uint8_t key = GET_OPAQUE_TYPE(ntohl(lsa->data->id.s_addr));
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
switch (lsa->data->type) {
|
|
|
|
case OSPF_OPAQUE_LINK_LSA:
|
|
|
|
if ((oi = lsa->oi) != NULL)
|
|
|
|
listtop = oi->opaque_lsa_self;
|
|
|
|
else
|
2018-08-21 01:26:59 +02:00
|
|
|
flog_warn(
|
2018-09-13 20:56:04 +02:00
|
|
|
EC_OSPF_LSA,
|
2002-12-13 21:15:29 +01:00
|
|
|
"Type-9 Opaque-LSA: Reference to OI is missing?");
|
|
|
|
break;
|
|
|
|
case OSPF_OPAQUE_AREA_LSA:
|
|
|
|
if ((area = lsa->area) != NULL)
|
|
|
|
listtop = area->opaque_lsa_self;
|
|
|
|
else
|
2018-08-21 01:26:59 +02:00
|
|
|
flog_warn(
|
2018-09-13 20:56:04 +02:00
|
|
|
EC_OSPF_LSA,
|
2002-12-13 21:15:29 +01:00
|
|
|
"Type-10 Opaque-LSA: Reference to AREA is missing?");
|
|
|
|
break;
|
|
|
|
case OSPF_OPAQUE_AS_LSA:
|
2017-08-25 22:51:12 +02:00
|
|
|
top = ospf_lookup_by_vrf_id(lsa->vrf_id);
|
2003-03-25 06:07:42 +01:00
|
|
|
if ((area = lsa->area) != NULL && (top = area->ospf) == NULL) {
|
2018-08-21 01:26:59 +02:00
|
|
|
flog_warn(
|
2018-09-13 20:56:04 +02:00
|
|
|
EC_OSPF_LSA,
|
2002-12-13 21:15:29 +01:00
|
|
|
"Type-11 Opaque-LSA: Reference to OSPF is missing?");
|
|
|
|
break; /* Unlikely to happen. */
|
|
|
|
}
|
|
|
|
listtop = top->opaque_lsa_self;
|
|
|
|
break;
|
|
|
|
default:
|
2022-08-23 18:45:38 +02:00
|
|
|
flog_warn(EC_OSPF_LSA_UNEXPECTED, "%s: Unexpected LSA-type(%u)",
|
|
|
|
__func__, lsa->data->type);
|
2002-12-13 21:15:29 +01:00
|
|
|
break;
|
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
if (listtop != NULL)
|
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(listtop, node, nnode, oipt))
|
2004-09-24 10:01:38 +02:00
|
|
|
if (oipt->opaque_type == key)
|
|
|
|
return oipt;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct opaque_info_per_id *
|
|
|
|
register_opaque_info_per_id(struct opaque_info_per_type *oipt,
|
|
|
|
struct ospf_lsa *new)
|
|
|
|
{
|
|
|
|
struct opaque_info_per_id *oipi;
|
|
|
|
|
2018-06-14 14:58:05 +02:00
|
|
|
oipi = XCALLOC(MTYPE_OPAQUE_INFO_PER_ID,
|
|
|
|
sizeof(struct opaque_info_per_id));
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
oipi->opaque_id = GET_OPAQUE_ID(ntohl(new->data->id.s_addr));
|
|
|
|
oipi->opqctl_type = oipt;
|
|
|
|
oipi->lsa = ospf_lsa_lock(new);
|
|
|
|
|
|
|
|
listnode_add(oipt->id_list, oipi);
|
|
|
|
|
|
|
|
return oipi;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void free_opaque_info_per_id(void *val)
|
|
|
|
{
|
|
|
|
struct opaque_info_per_id *oipi = (struct opaque_info_per_id *)val;
|
|
|
|
|
2022-06-03 16:28:11 +02:00
|
|
|
THREAD_OFF(oipi->t_opaque_lsa_self);
|
2002-12-13 21:15:29 +01:00
|
|
|
if (oipi->lsa != NULL)
|
2006-07-26 11:37:26 +02:00
|
|
|
ospf_lsa_unlock(&oipi->lsa);
|
2002-12-13 21:15:29 +01:00
|
|
|
XFREE(MTYPE_OPAQUE_INFO_PER_ID, oipi);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct opaque_info_per_id *
|
|
|
|
lookup_opaque_info_by_id(struct opaque_info_per_type *oipt,
|
|
|
|
struct ospf_lsa *lsa)
|
|
|
|
{
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
struct listnode *node, *nnode;
|
2002-12-13 21:15:29 +01:00
|
|
|
struct opaque_info_per_id *oipi;
|
2018-03-27 21:13:34 +02:00
|
|
|
uint32_t key = GET_OPAQUE_ID(ntohl(lsa->data->id.s_addr));
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
for (ALL_LIST_ELEMENTS(oipt->id_list, node, nnode, oipi))
|
2004-09-24 10:01:38 +02:00
|
|
|
if (oipi->opaque_id == key)
|
|
|
|
return oipi;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct opaque_info_per_id *register_opaque_lsa(struct ospf_lsa *new)
|
|
|
|
{
|
|
|
|
struct ospf_opaque_functab *functab;
|
|
|
|
struct opaque_info_per_type *oipt;
|
|
|
|
struct opaque_info_per_id *oipi = NULL;
|
|
|
|
|
|
|
|
if ((functab = ospf_opaque_functab_lookup(new)) == NULL)
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
if ((oipt = lookup_opaque_info_by_type(new)) == NULL
|
|
|
|
&& (oipt = register_opaque_info_per_type(functab, new)) == NULL)
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
if ((oipi = register_opaque_info_per_id(oipt, new)) == NULL)
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
out:
|
|
|
|
return oipi;
|
|
|
|
}
|
|
|
|
|
2022-01-08 22:57:10 +01:00
|
|
|
int ospf_opaque_is_owned(struct ospf_lsa *lsa)
|
|
|
|
{
|
|
|
|
struct opaque_info_per_type *oipt = lookup_opaque_info_by_type(lsa);
|
|
|
|
|
|
|
|
return (oipt != NULL && lookup_opaque_info_by_id(oipt, lsa) != NULL);
|
|
|
|
}
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/*------------------------------------------------------------------------*
|
2022-04-01 22:27:55 +02:00
|
|
|
* Following are (vty) configuration functions for Opaque-LSAs handling.
|
2002-12-13 21:15:29 +01:00
|
|
|
*------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
DEFUN (capability_opaque,
|
|
|
|
capability_opaque_cmd,
|
|
|
|
"capability opaque",
|
|
|
|
"Enable specific OSPF feature\n"
|
|
|
|
"Opaque LSA\n")
|
|
|
|
{
|
2017-08-04 01:34:17 +02:00
|
|
|
VTY_DECLVAR_INSTANCE_CONTEXT(ospf, ospf);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
/* Turn on the "master switch" of opaque-lsa capability. */
|
|
|
|
if (!CHECK_FLAG(ospf->config, OSPF_OPAQUE_CAPABLE)) {
|
|
|
|
if (IS_DEBUG_OSPF_EVENT)
|
2004-12-08 19:43:03 +01:00
|
|
|
zlog_debug("Opaque capability: OFF -> ON");
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
SET_FLAG(ospf->config, OSPF_OPAQUE_CAPABLE);
|
|
|
|
ospf_renegotiate_optional_capabilities(ospf);
|
|
|
|
}
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2016-09-29 03:26:55 +02:00
|
|
|
DEFUN (ospf_opaque,
|
|
|
|
ospf_opaque_cmd,
|
|
|
|
"ospf opaque-lsa",
|
|
|
|
"OSPF specific commands\n"
|
|
|
|
"Enable the Opaque-LSA capability (rfc2370)\n")
|
|
|
|
{
|
|
|
|
return capability_opaque(self, vty, argc, argv);
|
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
DEFUN (no_capability_opaque,
|
|
|
|
no_capability_opaque_cmd,
|
|
|
|
"no capability opaque",
|
|
|
|
NO_STR
|
|
|
|
"Enable specific OSPF feature\n"
|
|
|
|
"Opaque LSA\n")
|
|
|
|
{
|
2017-08-04 01:34:17 +02:00
|
|
|
VTY_DECLVAR_INSTANCE_CONTEXT(ospf, ospf);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
/* Turn off the "master switch" of opaque-lsa capability. */
|
|
|
|
if (CHECK_FLAG(ospf->config, OSPF_OPAQUE_CAPABLE)) {
|
|
|
|
if (IS_DEBUG_OSPF_EVENT)
|
2004-12-08 19:43:03 +01:00
|
|
|
zlog_debug("Opaque capability: ON -> OFF");
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
UNSET_FLAG(ospf->config, OSPF_OPAQUE_CAPABLE);
|
|
|
|
ospf_renegotiate_optional_capabilities(ospf);
|
|
|
|
}
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2016-09-29 03:26:55 +02:00
|
|
|
DEFUN (no_ospf_opaque,
|
|
|
|
no_ospf_opaque_cmd,
|
|
|
|
"no ospf opaque-lsa",
|
|
|
|
NO_STR
|
|
|
|
"OSPF specific commands\n"
|
|
|
|
"Enable the Opaque-LSA capability (rfc2370)\n")
|
|
|
|
{
|
|
|
|
return no_capability_opaque(self, vty, argc, argv);
|
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
static void ospf_opaque_register_vty(void)
|
|
|
|
{
|
|
|
|
install_element(OSPF_NODE, &capability_opaque_cmd);
|
|
|
|
install_element(OSPF_NODE, &no_capability_opaque_cmd);
|
2016-09-29 03:26:55 +02:00
|
|
|
install_element(OSPF_NODE, &ospf_opaque_cmd);
|
|
|
|
install_element(OSPF_NODE, &no_ospf_opaque_cmd);
|
2002-12-13 21:15:29 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*------------------------------------------------------------------------*
|
2022-04-01 22:27:55 +02:00
|
|
|
* Following are collection of user-registered function callers.
|
2002-12-13 21:15:29 +01:00
|
|
|
*------------------------------------------------------------------------*/
|
|
|
|
|
2004-09-24 10:01:38 +02:00
|
|
|
static int opaque_lsa_new_if_callback(struct list *funclist,
|
|
|
|
struct interface *ifp)
|
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_opaque_functab *functab;
|
|
|
|
int rc = -1;
|
|
|
|
|
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(funclist, node, nnode, functab))
|
2004-09-24 10:01:38 +02:00
|
|
|
if (functab->new_if_hook != NULL)
|
|
|
|
if ((*functab->new_if_hook)(ifp) != 0)
|
|
|
|
goto out;
|
2002-12-13 21:15:29 +01:00
|
|
|
rc = 0;
|
|
|
|
out:
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2004-09-24 10:01:38 +02:00
|
|
|
static int opaque_lsa_del_if_callback(struct list *funclist,
|
|
|
|
struct interface *ifp)
|
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_opaque_functab *functab;
|
|
|
|
int rc = -1;
|
|
|
|
|
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(funclist, node, nnode, functab))
|
2004-09-24 10:01:38 +02:00
|
|
|
if (functab->del_if_hook != NULL)
|
|
|
|
if ((*functab->del_if_hook)(ifp) != 0)
|
|
|
|
goto out;
|
2002-12-13 21:15:29 +01:00
|
|
|
rc = 0;
|
|
|
|
out:
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2004-09-24 10:01:38 +02:00
|
|
|
static void opaque_lsa_ism_change_callback(struct list *funclist,
|
2002-12-13 21:15:29 +01:00
|
|
|
struct ospf_interface *oi,
|
|
|
|
int old_status)
|
|
|
|
{
|
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_opaque_functab *functab;
|
|
|
|
|
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(funclist, node, nnode, functab))
|
2004-09-24 10:01:38 +02:00
|
|
|
if (functab->ism_change_hook != NULL)
|
|
|
|
(*functab->ism_change_hook)(oi, old_status);
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2004-09-24 10:01:38 +02:00
|
|
|
static void opaque_lsa_nsm_change_callback(struct list *funclist,
|
2002-12-13 21:15:29 +01:00
|
|
|
struct ospf_neighbor *nbr,
|
|
|
|
int old_status)
|
|
|
|
{
|
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_opaque_functab *functab;
|
|
|
|
|
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(funclist, node, nnode, functab))
|
2004-09-24 10:01:38 +02:00
|
|
|
if (functab->nsm_change_hook != NULL)
|
|
|
|
(*functab->nsm_change_hook)(nbr, old_status);
|
2002-12-13 21:15:29 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2004-09-24 10:01:38 +02:00
|
|
|
static void opaque_lsa_config_write_router_callback(struct list *funclist,
|
|
|
|
struct vty *vty)
|
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_opaque_functab *functab;
|
|
|
|
|
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(funclist, node, nnode, functab))
|
2004-09-24 10:01:38 +02:00
|
|
|
if (functab->config_write_router != NULL)
|
|
|
|
(*functab->config_write_router)(vty);
|
2002-12-13 21:15:29 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2004-09-24 10:01:38 +02:00
|
|
|
static void opaque_lsa_config_write_if_callback(struct list *funclist,
|
2002-12-13 21:15:29 +01:00
|
|
|
struct vty *vty,
|
|
|
|
struct interface *ifp)
|
|
|
|
{
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
struct listnode *node, *nnode;
|
2002-12-13 21:15:29 +01:00
|
|
|
struct ospf_opaque_functab *functab;
|
|
|
|
|
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(funclist, node, nnode, functab))
|
2004-09-24 10:01:38 +02:00
|
|
|
if (functab->config_write_if != NULL)
|
|
|
|
(*functab->config_write_if)(vty, ifp);
|
2002-12-13 21:15:29 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2004-09-24 10:01:38 +02:00
|
|
|
static void opaque_lsa_config_write_debug_callback(struct list *funclist,
|
|
|
|
struct vty *vty)
|
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_opaque_functab *functab;
|
|
|
|
|
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(funclist, node, nnode, functab))
|
2004-09-24 10:01:38 +02:00
|
|
|
if (functab->config_write_debug != NULL)
|
|
|
|
(*functab->config_write_debug)(vty);
|
2002-12-13 21:15:29 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2004-09-24 10:01:38 +02:00
|
|
|
static int opaque_lsa_originate_callback(struct list *funclist,
|
|
|
|
void *lsa_type_dependent)
|
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_opaque_functab *functab;
|
|
|
|
int rc = -1;
|
|
|
|
|
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(funclist, node, nnode, functab))
|
2004-09-24 10:01:38 +02:00
|
|
|
if (functab->lsa_originator != NULL)
|
|
|
|
if ((*functab->lsa_originator)(lsa_type_dependent) != 0)
|
|
|
|
goto out;
|
2002-12-13 21:15:29 +01:00
|
|
|
rc = 0;
|
|
|
|
out:
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2004-09-24 10:01:38 +02:00
|
|
|
static int new_lsa_callback(struct list *funclist, struct ospf_lsa *lsa)
|
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_opaque_functab *functab;
|
|
|
|
int rc = -1;
|
|
|
|
|
|
|
|
/* This function handles ALL types of LSAs, not only opaque ones. */
|
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(funclist, node, nnode, functab))
|
2004-09-24 10:01:38 +02:00
|
|
|
if (functab->new_lsa_hook != NULL)
|
|
|
|
if ((*functab->new_lsa_hook)(lsa) != 0)
|
|
|
|
goto out;
|
2002-12-13 21:15:29 +01:00
|
|
|
rc = 0;
|
|
|
|
out:
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2004-09-24 10:01:38 +02:00
|
|
|
static int del_lsa_callback(struct list *funclist, struct ospf_lsa *lsa)
|
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_opaque_functab *functab;
|
|
|
|
int rc = -1;
|
|
|
|
|
|
|
|
/* This function handles ALL types of LSAs, not only opaque ones. */
|
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(funclist, node, nnode, functab))
|
2004-09-24 10:01:38 +02:00
|
|
|
if (functab->del_lsa_hook != NULL)
|
|
|
|
if ((*functab->del_lsa_hook)(lsa) != 0)
|
|
|
|
goto out;
|
2002-12-13 21:15:29 +01:00
|
|
|
rc = 0;
|
|
|
|
out:
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*------------------------------------------------------------------------*
|
2022-04-01 22:27:55 +02:00
|
|
|
* Following are glue functions to call Opaque-LSA specific processing.
|
2002-12-13 21:15:29 +01:00
|
|
|
*------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
int ospf_opaque_new_if(struct interface *ifp)
|
|
|
|
{
|
2004-09-24 10:01:38 +02:00
|
|
|
struct list *funclist;
|
2002-12-13 21:15:29 +01:00
|
|
|
int rc = -1;
|
|
|
|
|
2003-01-18 01:12:02 +01:00
|
|
|
funclist = ospf_opaque_wildcard_funclist;
|
|
|
|
if (opaque_lsa_new_if_callback(funclist, ifp) != 0)
|
|
|
|
goto out;
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
funclist = ospf_opaque_type9_funclist;
|
|
|
|
if (opaque_lsa_new_if_callback(funclist, ifp) != 0)
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
funclist = ospf_opaque_type10_funclist;
|
|
|
|
if (opaque_lsa_new_if_callback(funclist, ifp) != 0)
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
funclist = ospf_opaque_type11_funclist;
|
|
|
|
if (opaque_lsa_new_if_callback(funclist, ifp) != 0)
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
rc = 0;
|
|
|
|
out:
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
int ospf_opaque_del_if(struct interface *ifp)
|
|
|
|
{
|
2004-09-24 10:01:38 +02:00
|
|
|
struct list *funclist;
|
2002-12-13 21:15:29 +01:00
|
|
|
int rc = -1;
|
|
|
|
|
2003-01-18 01:12:02 +01:00
|
|
|
funclist = ospf_opaque_wildcard_funclist;
|
|
|
|
if (opaque_lsa_del_if_callback(funclist, ifp) != 0)
|
|
|
|
goto out;
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
funclist = ospf_opaque_type9_funclist;
|
|
|
|
if (opaque_lsa_del_if_callback(funclist, ifp) != 0)
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
funclist = ospf_opaque_type10_funclist;
|
|
|
|
if (opaque_lsa_del_if_callback(funclist, ifp) != 0)
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
funclist = ospf_opaque_type11_funclist;
|
|
|
|
if (opaque_lsa_del_if_callback(funclist, ifp) != 0)
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
rc = 0;
|
|
|
|
out:
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ospf_opaque_ism_change(struct ospf_interface *oi, int old_status)
|
|
|
|
{
|
2004-09-24 10:01:38 +02:00
|
|
|
struct list *funclist;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2003-01-18 01:12:02 +01:00
|
|
|
funclist = ospf_opaque_wildcard_funclist;
|
|
|
|
opaque_lsa_ism_change_callback(funclist, oi, old_status);
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
funclist = ospf_opaque_type9_funclist;
|
|
|
|
opaque_lsa_ism_change_callback(funclist, oi, old_status);
|
|
|
|
|
|
|
|
funclist = ospf_opaque_type10_funclist;
|
|
|
|
opaque_lsa_ism_change_callback(funclist, oi, old_status);
|
|
|
|
|
|
|
|
funclist = ospf_opaque_type11_funclist;
|
|
|
|
opaque_lsa_ism_change_callback(funclist, oi, old_status);
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ospf_opaque_nsm_change(struct ospf_neighbor *nbr, int old_state)
|
|
|
|
{
|
|
|
|
struct ospf *top;
|
2004-09-24 10:01:38 +02:00
|
|
|
struct list *funclist;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
if ((top = oi_to_top(nbr->oi)) == NULL)
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
if (old_state != NSM_Full && nbr->state == NSM_Full) {
|
|
|
|
if (CHECK_FLAG(nbr->options, OSPF_OPTION_O)) {
|
|
|
|
if (!CHECK_FLAG(top->opaque,
|
|
|
|
OPAQUE_OPERATION_READY_BIT)) {
|
|
|
|
if (IS_DEBUG_OSPF_EVENT)
|
2004-12-08 19:43:03 +01:00
|
|
|
zlog_debug(
|
|
|
|
"Opaque-LSA: Now get operational!");
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
SET_FLAG(top->opaque,
|
|
|
|
OPAQUE_OPERATION_READY_BIT);
|
|
|
|
}
|
|
|
|
|
|
|
|
ospf_opaque_lsa_originate_schedule(nbr->oi, NULL);
|
|
|
|
}
|
|
|
|
} else if (old_state == NSM_Full && nbr->state != NSM_Full) {
|
|
|
|
#ifdef NOTYET
|
|
|
|
/*
|
|
|
|
* If no more opaque-capable full-state neighbor remains in the
|
|
|
|
* flooding scope which corresponds to Opaque-LSA type, periodic
|
|
|
|
* LS flooding should be stopped.
|
|
|
|
*/
|
|
|
|
#endif /* NOTYET */
|
|
|
|
;
|
|
|
|
}
|
|
|
|
|
2003-01-18 01:12:02 +01:00
|
|
|
funclist = ospf_opaque_wildcard_funclist;
|
|
|
|
opaque_lsa_nsm_change_callback(funclist, nbr, old_state);
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
funclist = ospf_opaque_type9_funclist;
|
|
|
|
opaque_lsa_nsm_change_callback(funclist, nbr, old_state);
|
|
|
|
|
|
|
|
funclist = ospf_opaque_type10_funclist;
|
|
|
|
opaque_lsa_nsm_change_callback(funclist, nbr, old_state);
|
|
|
|
|
|
|
|
funclist = ospf_opaque_type11_funclist;
|
|
|
|
opaque_lsa_nsm_change_callback(funclist, nbr, old_state);
|
|
|
|
|
|
|
|
out:
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ospf_opaque_config_write_router(struct vty *vty, struct ospf *ospf)
|
|
|
|
{
|
2004-09-24 10:01:38 +02:00
|
|
|
struct list *funclist;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
if (CHECK_FLAG(ospf->config, OSPF_OPAQUE_CAPABLE))
|
2017-07-13 17:49:13 +02:00
|
|
|
vty_out(vty, " capability opaque\n");
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2003-01-18 01:12:02 +01:00
|
|
|
funclist = ospf_opaque_wildcard_funclist;
|
|
|
|
opaque_lsa_config_write_router_callback(funclist, vty);
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
funclist = ospf_opaque_type9_funclist;
|
|
|
|
opaque_lsa_config_write_router_callback(funclist, vty);
|
|
|
|
|
|
|
|
funclist = ospf_opaque_type10_funclist;
|
|
|
|
opaque_lsa_config_write_router_callback(funclist, vty);
|
|
|
|
|
|
|
|
funclist = ospf_opaque_type11_funclist;
|
|
|
|
opaque_lsa_config_write_router_callback(funclist, vty);
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ospf_opaque_config_write_if(struct vty *vty, struct interface *ifp)
|
|
|
|
{
|
2004-09-24 10:01:38 +02:00
|
|
|
struct list *funclist;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2003-01-18 01:12:02 +01:00
|
|
|
funclist = ospf_opaque_wildcard_funclist;
|
|
|
|
opaque_lsa_config_write_if_callback(funclist, vty, ifp);
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
funclist = ospf_opaque_type9_funclist;
|
|
|
|
opaque_lsa_config_write_if_callback(funclist, vty, ifp);
|
|
|
|
|
|
|
|
funclist = ospf_opaque_type10_funclist;
|
|
|
|
opaque_lsa_config_write_if_callback(funclist, vty, ifp);
|
|
|
|
|
|
|
|
funclist = ospf_opaque_type11_funclist;
|
|
|
|
opaque_lsa_config_write_if_callback(funclist, vty, ifp);
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ospf_opaque_config_write_debug(struct vty *vty)
|
|
|
|
{
|
2004-09-24 10:01:38 +02:00
|
|
|
struct list *funclist;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2003-01-18 01:12:02 +01:00
|
|
|
funclist = ospf_opaque_wildcard_funclist;
|
|
|
|
opaque_lsa_config_write_debug_callback(funclist, vty);
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
funclist = ospf_opaque_type9_funclist;
|
|
|
|
opaque_lsa_config_write_debug_callback(funclist, vty);
|
|
|
|
|
|
|
|
funclist = ospf_opaque_type10_funclist;
|
|
|
|
opaque_lsa_config_write_debug_callback(funclist, vty);
|
|
|
|
|
|
|
|
funclist = ospf_opaque_type11_funclist;
|
|
|
|
opaque_lsa_config_write_debug_callback(funclist, vty);
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-07-24 01:25:04 +02:00
|
|
|
void show_opaque_info_detail(struct vty *vty, struct ospf_lsa *lsa,
|
|
|
|
json_object *json)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
2023-02-18 18:16:18 +01:00
|
|
|
char buf[128], *bp;
|
2020-04-08 07:57:15 +02:00
|
|
|
struct lsa_header *lsah = lsa->data;
|
2018-03-27 21:13:34 +02:00
|
|
|
uint32_t lsid = ntohl(lsah->id.s_addr);
|
|
|
|
uint8_t opaque_type = GET_OPAQUE_TYPE(lsid);
|
|
|
|
uint32_t opaque_id = GET_OPAQUE_ID(lsid);
|
2002-12-13 21:15:29 +01:00
|
|
|
struct ospf_opaque_functab *functab;
|
2023-02-18 18:16:18 +01:00
|
|
|
int len, lenValid;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
/* Switch output functionality by vty address. */
|
|
|
|
if (vty != NULL) {
|
2020-07-24 01:25:04 +02:00
|
|
|
if (!json) {
|
|
|
|
vty_out(vty, " Opaque-Type %u (%s)\n", opaque_type,
|
|
|
|
ospf_opaque_type_name(opaque_type));
|
|
|
|
vty_out(vty, " Opaque-ID 0x%x\n", opaque_id);
|
|
|
|
|
|
|
|
vty_out(vty, " Opaque-Info: %u octets of data%s\n",
|
|
|
|
ntohs(lsah->length) - OSPF_LSA_HEADER_SIZE,
|
|
|
|
VALID_OPAQUE_INFO_LEN(lsah)
|
|
|
|
? ""
|
|
|
|
: "(Invalid length?)");
|
2021-10-08 02:05:20 +02:00
|
|
|
} else {
|
|
|
|
json_object_string_add(
|
|
|
|
json, "opaqueType",
|
|
|
|
ospf_opaque_type_name(opaque_type));
|
|
|
|
json_object_int_add(json, "opaqueId", opaque_id);
|
2023-02-18 18:16:18 +01:00
|
|
|
len = ntohs(lsah->length) - OSPF_LSA_HEADER_SIZE;
|
|
|
|
json_object_int_add(json, "opaqueDataLength", len);
|
|
|
|
lenValid = VALID_OPAQUE_INFO_LEN(lsah);
|
2021-10-08 02:05:20 +02:00
|
|
|
json_object_boolean_add(json, "opaqueDataLengthValid",
|
2023-02-18 18:16:18 +01:00
|
|
|
lenValid);
|
|
|
|
if (lenValid) {
|
|
|
|
bp = asnprintfrr(MTYPE_TMP, buf, sizeof(buf),
|
|
|
|
"%*pHXn", (int)len,
|
|
|
|
(lsah + 1));
|
|
|
|
json_object_string_add(json, "opaqueData", buf);
|
|
|
|
if (bp != buf)
|
|
|
|
XFREE(MTYPE_TMP, bp);
|
|
|
|
}
|
2020-07-24 01:25:04 +02:00
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
} else {
|
2004-12-08 19:43:03 +01:00
|
|
|
zlog_debug(" Opaque-Type %u (%s)", opaque_type,
|
2003-04-04 04:44:16 +02:00
|
|
|
ospf_opaque_type_name(opaque_type));
|
2004-12-08 19:43:03 +01:00
|
|
|
zlog_debug(" Opaque-ID 0x%x", opaque_id);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2004-12-08 19:43:03 +01:00
|
|
|
zlog_debug(" Opaque-Info: %u octets of data%s",
|
2002-12-13 21:15:29 +01:00
|
|
|
ntohs(lsah->length) - OSPF_LSA_HEADER_SIZE,
|
|
|
|
VALID_OPAQUE_INFO_LEN(lsah) ? ""
|
|
|
|
: "(Invalid length?)");
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Call individual output functions. */
|
|
|
|
if ((functab = ospf_opaque_functab_lookup(lsa)) != NULL)
|
|
|
|
if (functab->show_opaque_info != NULL)
|
2021-10-08 02:06:01 +02:00
|
|
|
(*functab->show_opaque_info)(vty, json, lsa);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-03-27 21:13:34 +02:00
|
|
|
void ospf_opaque_lsa_dump(struct stream *s, uint16_t length)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
ospfd: Correct Coverity defects
When browsing or parsing OSPF LSA TLVs, we need to use the LSA length which is
part of the LSA header. This length, encoded in 16 bits, must be first
converted to host byte order with ntohs() function. However, Coverity Scan
considers that ntohs() function return TAINTED data. Thus, when the length is
used to control for() loop, Coverity Scan marks this part of the code as defect
with "Untrusted Loop Bound" due to the usage of Tainted variable. Similar
problems occur when browsing sub-TLV where length is extracted with ntohs().
To overcome this limitation, a size attribute has been added to the ospf_lsa
structure. The size is set when lsa->data buffer is allocated. In addition,
when an OSPF packet is received, the size of the payload is controlled before
contains is processed. For OSPF LSA, this allow a secure buffer allocation.
Thus, new size attribute contains the exact buffer allocation allowing a
strict control during TLV browsing.
This patch adds extra control to bound for() loop during TLV browsing to
avoid potential problem as suggested by Coverity Scan. Controls are based
on new size attribute of the ospf_lsa structure to avoid any ambiguity.
Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
2021-04-06 12:09:25 +02:00
|
|
|
struct ospf_lsa lsa = {};
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2017-11-08 18:51:16 +01:00
|
|
|
lsa.data = (struct lsa_header *)stream_pnt(s);
|
ospfd: Correct Coverity defects
When browsing or parsing OSPF LSA TLVs, we need to use the LSA length which is
part of the LSA header. This length, encoded in 16 bits, must be first
converted to host byte order with ntohs() function. However, Coverity Scan
considers that ntohs() function return TAINTED data. Thus, when the length is
used to control for() loop, Coverity Scan marks this part of the code as defect
with "Untrusted Loop Bound" due to the usage of Tainted variable. Similar
problems occur when browsing sub-TLV where length is extracted with ntohs().
To overcome this limitation, a size attribute has been added to the ospf_lsa
structure. The size is set when lsa->data buffer is allocated. In addition,
when an OSPF packet is received, the size of the payload is controlled before
contains is processed. For OSPF LSA, this allow a secure buffer allocation.
Thus, new size attribute contains the exact buffer allocation allowing a
strict control during TLV browsing.
This patch adds extra control to bound for() loop during TLV browsing to
avoid potential problem as suggested by Coverity Scan. Controls are based
on new size attribute of the ospf_lsa structure to avoid any ambiguity.
Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
2021-04-06 12:09:25 +02:00
|
|
|
lsa.size = length;
|
2020-07-24 01:25:04 +02:00
|
|
|
show_opaque_info_detail(NULL, &lsa, NULL);
|
2002-12-13 21:15:29 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int ospf_opaque_lsa_install_hook(struct ospf_lsa *lsa)
|
|
|
|
{
|
2004-09-24 10:01:38 +02:00
|
|
|
struct list *funclist;
|
2002-12-13 21:15:29 +01:00
|
|
|
int rc = -1;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Some Opaque-LSA user may want to monitor every LSA installation
|
|
|
|
* into the LSDB, regardless with target LSA type.
|
|
|
|
*/
|
2003-01-18 01:12:02 +01:00
|
|
|
funclist = ospf_opaque_wildcard_funclist;
|
|
|
|
if (new_lsa_callback(funclist, lsa) != 0)
|
|
|
|
goto out;
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
funclist = ospf_opaque_type9_funclist;
|
|
|
|
if (new_lsa_callback(funclist, lsa) != 0)
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
funclist = ospf_opaque_type10_funclist;
|
|
|
|
if (new_lsa_callback(funclist, lsa) != 0)
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
funclist = ospf_opaque_type11_funclist;
|
|
|
|
if (new_lsa_callback(funclist, lsa) != 0)
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
rc = 0;
|
|
|
|
out:
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int ospf_opaque_lsa_delete_hook(struct ospf_lsa *lsa)
|
|
|
|
{
|
2004-09-24 10:01:38 +02:00
|
|
|
struct list *funclist;
|
2002-12-13 21:15:29 +01:00
|
|
|
int rc = -1;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Some Opaque-LSA user may want to monitor every LSA deletion
|
|
|
|
* from the LSDB, regardless with target LSA type.
|
|
|
|
*/
|
2003-01-18 01:12:02 +01:00
|
|
|
funclist = ospf_opaque_wildcard_funclist;
|
|
|
|
if (del_lsa_callback(funclist, lsa) != 0)
|
|
|
|
goto out;
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
funclist = ospf_opaque_type9_funclist;
|
|
|
|
if (del_lsa_callback(funclist, lsa) != 0)
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
funclist = ospf_opaque_type10_funclist;
|
|
|
|
if (del_lsa_callback(funclist, lsa) != 0)
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
funclist = ospf_opaque_type11_funclist;
|
|
|
|
if (del_lsa_callback(funclist, lsa) != 0)
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
rc = 0;
|
|
|
|
out:
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*------------------------------------------------------------------------*
|
2022-04-01 22:27:55 +02:00
|
|
|
* Following are Opaque-LSA origination/refresh management functions.
|
2002-12-13 21:15:29 +01:00
|
|
|
*------------------------------------------------------------------------*/
|
|
|
|
|
2022-03-01 22:18:12 +01:00
|
|
|
static void ospf_opaque_type9_lsa_originate(struct event *t);
|
|
|
|
static void ospf_opaque_type10_lsa_originate(struct event *t);
|
|
|
|
static void ospf_opaque_type11_lsa_originate(struct event *t);
|
2004-09-24 10:01:38 +02:00
|
|
|
static void ospf_opaque_lsa_reoriginate_resume(struct list *listtop, void *arg);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
void ospf_opaque_lsa_originate_schedule(struct ospf_interface *oi, int *delay0)
|
|
|
|
{
|
|
|
|
struct ospf *top;
|
|
|
|
struct ospf_area *area;
|
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 opaque_info_per_type *oipt;
|
|
|
|
int delay = 0;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
if ((top = oi_to_top(oi)) == NULL || (area = oi->area) == NULL) {
|
2018-08-21 01:26:59 +02:00
|
|
|
if (IS_DEBUG_OSPF_EVENT)
|
2022-08-23 18:45:38 +02:00
|
|
|
zlog_debug("%s: Invalid argument?", __func__);
|
2018-08-21 01:26:59 +02:00
|
|
|
return;
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* It may not a right time to schedule origination now. */
|
|
|
|
if (!CHECK_FLAG(top->opaque, OPAQUE_OPERATION_READY_BIT)) {
|
|
|
|
if (IS_DEBUG_OSPF_EVENT)
|
2022-08-23 18:45:38 +02:00
|
|
|
zlog_debug("%s: Not operational.", __func__);
|
2018-08-21 01:26:59 +02:00
|
|
|
return; /* This is not an error. */
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
if (delay0 != NULL)
|
|
|
|
delay = *delay0;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/*
|
|
|
|
* There might be some entries that have been waiting for triggering
|
|
|
|
* of per opaque-type re-origination get resumed.
|
|
|
|
*/
|
|
|
|
ospf_opaque_lsa_reoriginate_resume(oi->opaque_lsa_self, (void *)oi);
|
|
|
|
ospf_opaque_lsa_reoriginate_resume(area->opaque_lsa_self, (void *)area);
|
|
|
|
ospf_opaque_lsa_reoriginate_resume(top->opaque_lsa_self, (void *)top);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/*
|
|
|
|
* Now, schedule origination of all Opaque-LSAs per opaque-type.
|
|
|
|
*/
|
|
|
|
if (!list_isempty(ospf_opaque_type9_funclist)
|
|
|
|
&& list_isempty(oi->opaque_lsa_self)
|
|
|
|
&& oi->t_opaque_lsa_self == NULL) {
|
|
|
|
if (IS_DEBUG_OSPF_EVENT)
|
2015-07-27 21:05:44 +02:00
|
|
|
zlog_debug(
|
|
|
|
"Schedule Type-9 Opaque-LSA origination in %d ms later.",
|
|
|
|
delay);
|
2017-05-05 23:22:25 +02:00
|
|
|
oi->t_opaque_lsa_self = NULL;
|
|
|
|
thread_add_timer_msec(master, ospf_opaque_type9_lsa_originate,
|
|
|
|
oi, delay, &oi->t_opaque_lsa_self);
|
2015-07-27 21:05:44 +02:00
|
|
|
delay += top->min_ls_interval;
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
if (!list_isempty(ospf_opaque_type10_funclist)
|
|
|
|
&& list_isempty(area->opaque_lsa_self)
|
|
|
|
&& area->t_opaque_lsa_self == NULL) {
|
|
|
|
/*
|
|
|
|
* One AREA may contain multiple OIs, but above 2nd and 3rd
|
|
|
|
* conditions prevent from scheduling the originate function
|
|
|
|
* again and again.
|
|
|
|
*/
|
|
|
|
if (IS_DEBUG_OSPF_EVENT)
|
2015-07-27 21:05:44 +02:00
|
|
|
zlog_debug(
|
|
|
|
"Schedule Type-10 Opaque-LSA origination in %d ms later.",
|
|
|
|
delay);
|
2017-05-05 23:22:25 +02:00
|
|
|
area->t_opaque_lsa_self = NULL;
|
|
|
|
thread_add_timer_msec(master, ospf_opaque_type10_lsa_originate,
|
|
|
|
area, delay, &area->t_opaque_lsa_self);
|
2015-07-27 21:05:44 +02:00
|
|
|
delay += top->min_ls_interval;
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
if (!list_isempty(ospf_opaque_type11_funclist)
|
|
|
|
&& list_isempty(top->opaque_lsa_self)
|
|
|
|
&& top->t_opaque_lsa_self == NULL) {
|
|
|
|
/*
|
|
|
|
* One OSPF may contain multiple AREAs, but above 2nd and 3rd
|
|
|
|
* conditions prevent from scheduling the originate function
|
|
|
|
* again and again.
|
|
|
|
*/
|
|
|
|
if (IS_DEBUG_OSPF_EVENT)
|
2015-07-27 21:05:44 +02:00
|
|
|
zlog_debug(
|
|
|
|
"Schedule Type-11 Opaque-LSA origination in %d ms later.",
|
|
|
|
delay);
|
2017-05-05 23:22:25 +02:00
|
|
|
top->t_opaque_lsa_self = NULL;
|
|
|
|
thread_add_timer_msec(master, ospf_opaque_type11_lsa_originate,
|
|
|
|
top, delay, &top->t_opaque_lsa_self);
|
2015-07-27 21:05:44 +02:00
|
|
|
delay += top->min_ls_interval;
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/*
|
|
|
|
* Following section treats a special situation that this node's
|
|
|
|
* opaque capability has changed as "ON -> OFF -> ON".
|
|
|
|
*/
|
|
|
|
if (!list_isempty(ospf_opaque_type9_funclist)
|
|
|
|
&& !list_isempty(oi->opaque_lsa_self)) {
|
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->opaque_lsa_self, node, nnode,
|
|
|
|
oipt)) {
|
2004-03-18 20:18:33 +01:00
|
|
|
/*
|
|
|
|
* removed the test for
|
|
|
|
* (! list_isempty (oipt->id_list)) * Handler is
|
|
|
|
* already active. *
|
|
|
|
* because opaque cababilities ON -> OFF -> ON result in
|
|
|
|
* list_isempty (oipt->id_list)
|
|
|
|
* not being empty.
|
|
|
|
*/
|
2017-07-22 14:52:33 +02:00
|
|
|
if (oipt->t_opaque_lsa_self
|
|
|
|
!= NULL /* Waiting for a thread call. */
|
|
|
|
|| oipt->status == PROC_SUSPEND) /* Cannot
|
|
|
|
originate
|
|
|
|
now. */
|
2002-12-13 21:15:29 +01:00
|
|
|
continue;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
ospf_opaque_lsa_reoriginate_schedule(
|
|
|
|
(void *)oi, OSPF_OPAQUE_LINK_LSA,
|
|
|
|
oipt->opaque_type);
|
2017-07-17 14:03:14 +02:00
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
if (!list_isempty(ospf_opaque_type10_funclist)
|
|
|
|
&& !list_isempty(area->opaque_lsa_self)) {
|
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(area->opaque_lsa_self, node, nnode,
|
|
|
|
oipt)) {
|
2004-03-18 20:18:33 +01:00
|
|
|
/*
|
|
|
|
* removed the test for
|
|
|
|
* (! list_isempty (oipt->id_list)) * Handler is
|
|
|
|
* already active. *
|
|
|
|
* because opaque cababilities ON -> OFF -> ON result in
|
|
|
|
* list_isempty (oipt->id_list)
|
|
|
|
* not being empty.
|
|
|
|
*/
|
2017-07-22 14:52:33 +02:00
|
|
|
if (oipt->t_opaque_lsa_self
|
|
|
|
!= NULL /* Waiting for a thread call. */
|
|
|
|
|| oipt->status == PROC_SUSPEND) /* Cannot
|
|
|
|
originate
|
|
|
|
now. */
|
2002-12-13 21:15:29 +01:00
|
|
|
continue;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
ospf_opaque_lsa_reoriginate_schedule(
|
|
|
|
(void *)area, OSPF_OPAQUE_AREA_LSA,
|
|
|
|
oipt->opaque_type);
|
|
|
|
}
|
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
if (!list_isempty(ospf_opaque_type11_funclist)
|
|
|
|
&& !list_isempty(top->opaque_lsa_self)) {
|
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(top->opaque_lsa_self, node, nnode,
|
|
|
|
oipt)) {
|
2004-03-18 20:18:33 +01:00
|
|
|
/*
|
|
|
|
* removed the test for
|
|
|
|
* (! list_isempty (oipt->id_list)) * Handler is
|
|
|
|
* already active. *
|
|
|
|
* because opaque cababilities ON -> OFF -> ON result in
|
|
|
|
* list_isempty (oipt->id_list)
|
|
|
|
* not being empty.
|
|
|
|
*/
|
2017-07-22 14:52:33 +02:00
|
|
|
if (oipt->t_opaque_lsa_self
|
|
|
|
!= NULL /* Waiting for a thread call. */
|
|
|
|
|| oipt->status == PROC_SUSPEND) /* Cannot
|
|
|
|
originate
|
|
|
|
now. */
|
2002-12-13 21:15:29 +01:00
|
|
|
continue;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
ospf_opaque_lsa_reoriginate_schedule((void *)top,
|
|
|
|
OSPF_OPAQUE_AS_LSA,
|
|
|
|
oipt->opaque_type);
|
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
}
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
if (delay0 != NULL)
|
|
|
|
*delay0 = delay;
|
|
|
|
}
|
|
|
|
|
2022-03-01 22:18:12 +01:00
|
|
|
static void ospf_opaque_type9_lsa_originate(struct event *t)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
|
|
|
struct ospf_interface *oi;
|
|
|
|
|
|
|
|
oi = THREAD_ARG(t);
|
|
|
|
oi->t_opaque_lsa_self = NULL;
|
|
|
|
|
|
|
|
if (IS_DEBUG_OSPF_EVENT)
|
2004-12-08 19:43:03 +01:00
|
|
|
zlog_debug("Timer[Type9-LSA]: Originate Opaque-LSAs for OI %s",
|
2002-12-13 21:15:29 +01:00
|
|
|
IF_NAME(oi));
|
|
|
|
|
2022-02-23 01:04:25 +01:00
|
|
|
opaque_lsa_originate_callback(ospf_opaque_type9_funclist, oi);
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
2022-03-01 22:18:12 +01:00
|
|
|
static void ospf_opaque_type10_lsa_originate(struct event *t)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
|
|
|
struct ospf_area *area;
|
|
|
|
|
|
|
|
area = THREAD_ARG(t);
|
|
|
|
area->t_opaque_lsa_self = NULL;
|
|
|
|
|
|
|
|
if (IS_DEBUG_OSPF_EVENT)
|
2004-12-08 19:43:03 +01:00
|
|
|
zlog_debug(
|
2020-10-21 19:56:26 +02:00
|
|
|
"Timer[Type10-LSA]: Originate Opaque-LSAs for Area %pI4",
|
|
|
|
&area->area_id);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2022-02-23 01:04:25 +01:00
|
|
|
opaque_lsa_originate_callback(ospf_opaque_type10_funclist, area);
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
2022-03-01 22:18:12 +01:00
|
|
|
static void ospf_opaque_type11_lsa_originate(struct event *t)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
|
|
|
struct ospf *top;
|
|
|
|
|
|
|
|
top = THREAD_ARG(t);
|
|
|
|
top->t_opaque_lsa_self = NULL;
|
|
|
|
|
|
|
|
if (IS_DEBUG_OSPF_EVENT)
|
2004-12-08 19:43:03 +01:00
|
|
|
zlog_debug(
|
|
|
|
"Timer[Type11-LSA]: Originate AS-External Opaque-LSAs");
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2022-02-23 01:04:25 +01:00
|
|
|
opaque_lsa_originate_callback(ospf_opaque_type11_funclist, top);
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
2004-09-24 10:01:38 +02:00
|
|
|
static void ospf_opaque_lsa_reoriginate_resume(struct list *listtop, void *arg)
|
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 opaque_info_per_type *oipt;
|
|
|
|
struct ospf_opaque_functab *functab;
|
|
|
|
|
|
|
|
if (listtop == NULL)
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Pickup oipt entries those which in SUSPEND status, and give
|
|
|
|
* them a chance to start re-origination now.
|
|
|
|
*/
|
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(listtop, node, nnode, oipt)) {
|
2004-09-24 10:01:38 +02:00
|
|
|
if (oipt->status != PROC_SUSPEND)
|
2002-12-13 21:15:29 +01:00
|
|
|
continue;
|
|
|
|
|
|
|
|
oipt->status = PROC_NORMAL;
|
|
|
|
|
|
|
|
if ((functab = oipt->functab) == NULL
|
2004-09-24 10:01:38 +02:00
|
|
|
|| functab->lsa_originator == NULL)
|
2002-12-13 21:15:29 +01:00
|
|
|
continue;
|
|
|
|
|
|
|
|
if ((*functab->lsa_originator)(arg) != 0) {
|
2022-08-23 18:45:38 +02:00
|
|
|
flog_warn(EC_OSPF_LSA, "%s: Failed (opaque-type=%u)",
|
|
|
|
__func__, oipt->opaque_type);
|
2002-12-13 21:15:29 +01:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
out:
|
|
|
|
return;
|
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
struct ospf_lsa *ospf_opaque_lsa_install(struct ospf_lsa *lsa, int rt_recalc)
|
|
|
|
{
|
|
|
|
struct ospf_lsa *new = NULL;
|
|
|
|
struct opaque_info_per_type *oipt;
|
|
|
|
struct opaque_info_per_id *oipi;
|
|
|
|
struct ospf *top;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Don't take "rt_recalc" into consideration for now. */ /* XXX */
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
if (!IS_LSA_SELF(lsa)) {
|
|
|
|
new = lsa; /* Don't touch this LSA. */
|
|
|
|
goto out;
|
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
if (IS_DEBUG_OSPF(lsa, LSA_INSTALL))
|
2004-12-08 19:43:03 +01:00
|
|
|
zlog_debug(
|
|
|
|
"Install Type-%u Opaque-LSA: [opaque-type=%u, opaque-id=%x]",
|
|
|
|
lsa->data->type,
|
|
|
|
GET_OPAQUE_TYPE(ntohl(lsa->data->id.s_addr)),
|
|
|
|
GET_OPAQUE_ID(ntohl(lsa->data->id.s_addr)));
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Replace the existing lsa with the new one. */
|
|
|
|
if ((oipt = lookup_opaque_info_by_type(lsa)) != NULL
|
2004-09-24 10:01:38 +02:00
|
|
|
&& (oipi = lookup_opaque_info_by_id(oipt, lsa)) != NULL) {
|
2006-07-26 11:37:26 +02:00
|
|
|
ospf_lsa_unlock(&oipi->lsa);
|
2002-12-13 21:15:29 +01:00
|
|
|
oipi->lsa = ospf_lsa_lock(lsa);
|
|
|
|
}
|
2020-02-24 14:37:34 +01:00
|
|
|
/* Register the new lsa entry */
|
|
|
|
else if (register_opaque_lsa(lsa) == NULL) {
|
2022-08-23 18:45:38 +02:00
|
|
|
flog_warn(EC_OSPF_LSA, "%s: register_opaque_lsa() ?", __func__);
|
2002-12-13 21:15:29 +01:00
|
|
|
goto out;
|
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/*
|
|
|
|
* Make use of a common mechanism (ospf_lsa_refresh_walker)
|
|
|
|
* for periodic refresh of self-originated Opaque-LSAs.
|
|
|
|
*/
|
|
|
|
switch (lsa->data->type) {
|
|
|
|
case OSPF_OPAQUE_LINK_LSA:
|
2003-01-18 01:12:02 +01:00
|
|
|
if ((top = oi_to_top(lsa->oi)) == NULL) {
|
|
|
|
/* Above conditions must have passed. */
|
2022-08-23 18:45:38 +02:00
|
|
|
flog_warn(EC_OSPF_LSA, "%s: Something wrong?",
|
|
|
|
__func__);
|
2003-01-18 01:12:02 +01:00
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
break;
|
2002-12-13 21:15:29 +01:00
|
|
|
case OSPF_OPAQUE_AREA_LSA:
|
2003-03-25 06:07:42 +01:00
|
|
|
if (lsa->area == NULL || (top = lsa->area->ospf) == NULL) {
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Above conditions must have passed. */
|
2022-08-23 18:45:38 +02:00
|
|
|
flog_warn(EC_OSPF_LSA, "%s: Something wrong?",
|
|
|
|
__func__);
|
2002-12-13 21:15:29 +01:00
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OSPF_OPAQUE_AS_LSA:
|
2017-08-25 22:51:12 +02:00
|
|
|
top = ospf_lookup_by_vrf_id(lsa->vrf_id);
|
2003-03-25 06:07:42 +01:00
|
|
|
if (lsa->area != NULL && (top = lsa->area->ospf) == NULL) {
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Above conditions must have passed. */
|
2022-08-23 18:45:38 +02:00
|
|
|
flog_warn(EC_OSPF_LSA, "%s: Something wrong?",
|
|
|
|
__func__);
|
2002-12-13 21:15:29 +01:00
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
2022-08-23 18:45:38 +02:00
|
|
|
flog_warn(EC_OSPF_LSA_UNEXPECTED, "%s: Unexpected LSA-type(%u)",
|
|
|
|
__func__, lsa->data->type);
|
2002-12-13 21:15:29 +01:00
|
|
|
goto out;
|
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
ospf_refresher_register_lsa(top, lsa);
|
|
|
|
new = lsa;
|
|
|
|
|
|
|
|
out:
|
|
|
|
return new;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct ospf_lsa *ospf_opaque_lsa_refresh(struct ospf_lsa *lsa)
|
|
|
|
{
|
2003-04-04 04:44:16 +02:00
|
|
|
struct ospf *ospf;
|
2002-12-13 21:15:29 +01:00
|
|
|
struct ospf_opaque_functab *functab;
|
2011-03-22 16:23:55 +01:00
|
|
|
struct ospf_lsa *new = NULL;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2017-08-25 22:51:12 +02:00
|
|
|
ospf = ospf_lookup_by_vrf_id(lsa->vrf_id);
|
2003-04-04 04:44:16 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
if ((functab = ospf_opaque_functab_lookup(lsa)) == NULL
|
2004-09-24 10:01:38 +02:00
|
|
|
|| functab->lsa_refresher == NULL) {
|
2002-12-13 21:15:29 +01:00
|
|
|
/*
|
|
|
|
* Though this LSA seems to have originated on this node, the
|
|
|
|
* handling module for this "lsa-type and opaque-type" was
|
|
|
|
* already deleted sometime ago.
|
|
|
|
* Anyway, this node still has a responsibility to flush this
|
|
|
|
* LSA from the routing domain.
|
|
|
|
*/
|
|
|
|
if (IS_DEBUG_OSPF_EVENT)
|
2020-10-21 19:56:26 +02:00
|
|
|
zlog_debug("LSA[Type%d:%pI4]: Flush stray Opaque-LSA",
|
|
|
|
lsa->data->type, &lsa->data->id);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
lsa->data->ls_age = htons(OSPF_LSA_MAXAGE);
|
ospfd: Fix maxage/flush to not try flood twice, remember maxages for longer
2006-05-30 Paul Jakma <paul.jakma@sun.com>
* (general) Fix confusion around MaxAge-ing and problem with
high-latency networks. Analysis and suggested fixes by
Phillip Spagnolo, in [quagga-dev 4132], on which this commit
expands slightly.
* ospf_flood.{c,h}: (ospf_lsa_flush) new function.
Scope-general form of existing flush functions, essentially
the dormant ospf_maxage_flood() but without the ambiguity of
whether it is responsible for flooding.
* ospf_lsa.c: (ospf_lsa_maxage) Role minimised to simply setup
LSA on the Maxage list and schedule removal - no more.
ospf_lsa_flush* being the primary way to kick-off flushes
of LSAs.
Don't hardcode the remover-timer value, which was too
short for very high-latency networks.
(ospf_maxage_lsa_remover) Just do what needs to be done to
remove maxage LSAs from the maxage list, remove the call
to ospf_flood_through().
Don't hardcode remove-timer value.
(ospf_lsa_{install,flush_schedule}) ospf_lsa_flush is the correct
entrypoint to flushing maxaged LSAs.
(lsa_header_set) Use a define for the initial age, useful for
testing.
* ospf_opaque.c: (ospf_opaque_lsa_refresh) ditto.
(ospf_opaque_lsa_flush_schedule) ditto.
* ospfd.h: ({struct ospf,ospf_new}) Add maxage_delay parameter,
interval to wait before running the maxage_remover. Supply a
suitable default.
Add a define for OSPF_LSA_INITIAL_AGE, see lsa_header_set().
2010-01-25 00:36:20 +01:00
|
|
|
ospf_lsa_flush(ospf, lsa);
|
2002-12-13 21:15:29 +01:00
|
|
|
} else
|
2011-03-22 16:23:55 +01:00
|
|
|
new = (*functab->lsa_refresher)(lsa);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2011-03-22 16:23:55 +01:00
|
|
|
return new;
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*------------------------------------------------------------------------*
|
2022-04-01 22:27:55 +02:00
|
|
|
* Following are re-origination/refresh/flush operations of Opaque-LSAs,
|
2002-12-13 21:15:29 +01:00
|
|
|
* triggered by external interventions (vty session, signaling, etc).
|
|
|
|
*------------------------------------------------------------------------*/
|
|
|
|
|
2017-04-25 00:33:25 +02:00
|
|
|
#define OSPF_OPAQUE_TIMER_ON(T,F,L,V) thread_add_timer_msec (master, (F), (L), (V), &(T))
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
static struct ospf_lsa *pseudo_lsa(struct ospf_interface *oi,
|
2018-03-27 21:13:34 +02:00
|
|
|
struct ospf_area *area, uint8_t lsa_type,
|
|
|
|
uint8_t opaque_type);
|
2022-03-01 22:18:12 +01:00
|
|
|
static void ospf_opaque_type9_lsa_reoriginate_timer(struct event *t);
|
|
|
|
static void ospf_opaque_type10_lsa_reoriginate_timer(struct event *t);
|
|
|
|
static void ospf_opaque_type11_lsa_reoriginate_timer(struct event *t);
|
|
|
|
static void ospf_opaque_lsa_refresh_timer(struct event *t);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
void ospf_opaque_lsa_reoriginate_schedule(void *lsa_type_dependent,
|
2018-03-27 21:13:34 +02:00
|
|
|
uint8_t lsa_type, uint8_t opaque_type)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
2017-08-25 22:51:12 +02:00
|
|
|
struct ospf *top = NULL;
|
2002-12-13 21:15:29 +01:00
|
|
|
struct ospf_area dummy, *area = NULL;
|
|
|
|
struct ospf_interface *oi = NULL;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
struct ospf_lsa *lsa;
|
|
|
|
struct opaque_info_per_type *oipt;
|
2022-03-01 22:18:12 +01:00
|
|
|
void (*func)(struct event * t) = NULL;
|
2002-12-13 21:15:29 +01:00
|
|
|
int delay;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
switch (lsa_type) {
|
|
|
|
case OSPF_OPAQUE_LINK_LSA:
|
|
|
|
if ((oi = (struct ospf_interface *)lsa_type_dependent)
|
|
|
|
== NULL) {
|
2022-08-23 18:45:38 +02:00
|
|
|
flog_warn(EC_OSPF_LSA,
|
|
|
|
"%s: Type-9 Opaque-LSA: Invalid parameter?",
|
|
|
|
__func__);
|
2004-09-24 10:01:38 +02:00
|
|
|
goto out;
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
if ((top = oi_to_top(oi)) == NULL) {
|
2022-08-23 18:45:38 +02:00
|
|
|
flog_warn(EC_OSPF_LSA, "%s: OI(%s) -> TOP?", __func__,
|
|
|
|
IF_NAME(oi));
|
2002-12-13 21:15:29 +01:00
|
|
|
goto out;
|
|
|
|
}
|
2004-09-24 10:01:38 +02:00
|
|
|
if (!list_isempty(ospf_opaque_type9_funclist)
|
|
|
|
&& list_isempty(oi->opaque_lsa_self)
|
|
|
|
&& oi->t_opaque_lsa_self != NULL) {
|
2018-08-21 01:26:59 +02:00
|
|
|
flog_warn(
|
2018-09-13 20:56:04 +02:00
|
|
|
EC_OSPF_LSA,
|
2018-08-21 01:26:59 +02:00
|
|
|
"Type-9 Opaque-LSA (opaque_type=%u): Common origination for OI(%s) has already started",
|
2004-09-24 10:01:38 +02:00
|
|
|
opaque_type, IF_NAME(oi));
|
2002-12-13 21:15:29 +01:00
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
func = ospf_opaque_type9_lsa_reoriginate_timer;
|
|
|
|
break;
|
|
|
|
case OSPF_OPAQUE_AREA_LSA:
|
|
|
|
if ((area = (struct ospf_area *)lsa_type_dependent) == NULL) {
|
2022-08-23 18:45:38 +02:00
|
|
|
flog_warn(EC_OSPF_LSA,
|
|
|
|
"%s: Type-10 Opaque-LSA: Invalid parameter?",
|
|
|
|
__func__);
|
2002-12-13 21:15:29 +01:00
|
|
|
goto out;
|
|
|
|
}
|
2003-03-25 06:07:42 +01:00
|
|
|
if ((top = area->ospf) == NULL) {
|
2022-08-23 18:45:38 +02:00
|
|
|
flog_warn(EC_OSPF_LSA, "%s: AREA(%pI4) -> TOP?",
|
|
|
|
__func__, &area->area_id);
|
2002-12-13 21:15:29 +01:00
|
|
|
goto out;
|
|
|
|
}
|
2004-09-24 10:01:38 +02:00
|
|
|
if (!list_isempty(ospf_opaque_type10_funclist)
|
|
|
|
&& list_isempty(area->opaque_lsa_self)
|
|
|
|
&& area->t_opaque_lsa_self != NULL) {
|
2018-08-21 01:26:59 +02:00
|
|
|
flog_warn(
|
2018-09-13 20:56:04 +02:00
|
|
|
EC_OSPF_LSA,
|
2020-10-21 19:56:26 +02:00
|
|
|
"Type-10 Opaque-LSA (opaque_type=%u): Common origination for AREA(%pI4) has already started",
|
|
|
|
opaque_type, &area->area_id);
|
2002-12-13 21:15:29 +01:00
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
func = ospf_opaque_type10_lsa_reoriginate_timer;
|
|
|
|
break;
|
|
|
|
case OSPF_OPAQUE_AS_LSA:
|
|
|
|
if ((top = (struct ospf *)lsa_type_dependent) == NULL) {
|
2022-08-23 18:45:38 +02:00
|
|
|
flog_warn(EC_OSPF_LSA,
|
|
|
|
"%s: Type-11 Opaque-LSA: Invalid parameter?",
|
|
|
|
__func__);
|
2004-09-24 10:01:38 +02:00
|
|
|
goto out;
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
2004-09-24 10:01:38 +02:00
|
|
|
if (!list_isempty(ospf_opaque_type11_funclist)
|
|
|
|
&& list_isempty(top->opaque_lsa_self)
|
|
|
|
&& top->t_opaque_lsa_self != NULL) {
|
2018-08-21 01:26:59 +02:00
|
|
|
flog_warn(
|
2018-09-13 20:56:04 +02:00
|
|
|
EC_OSPF_LSA,
|
2018-08-21 01:26:59 +02:00
|
|
|
"Type-11 Opaque-LSA (opaque_type=%u): Common origination has already started",
|
2004-09-24 10:01:38 +02:00
|
|
|
opaque_type);
|
2002-12-13 21:15:29 +01:00
|
|
|
goto out;
|
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Fake "area" to pass "ospf" to a lookup function later. */
|
2003-03-25 06:07:42 +01:00
|
|
|
dummy.ospf = top;
|
2002-12-13 21:15:29 +01:00
|
|
|
area = &dummy;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
func = ospf_opaque_type11_lsa_reoriginate_timer;
|
|
|
|
break;
|
|
|
|
default:
|
2022-08-23 18:45:38 +02:00
|
|
|
flog_warn(EC_OSPF_LSA_UNEXPECTED, "%s: Unexpected LSA-type(%u)",
|
|
|
|
__func__, lsa_type);
|
2002-12-13 21:15:29 +01:00
|
|
|
goto out;
|
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* It may not a right time to schedule reorigination now. */
|
2004-09-24 10:01:38 +02:00
|
|
|
if (!CHECK_FLAG(top->opaque, OPAQUE_OPERATION_READY_BIT)) {
|
2002-12-13 21:15:29 +01:00
|
|
|
if (IS_DEBUG_OSPF_EVENT)
|
2022-08-23 18:45:38 +02:00
|
|
|
zlog_debug("%s: Not operational.", __func__);
|
2004-09-24 10:01:38 +02:00
|
|
|
goto out; /* This is not an error. */
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Generate a dummy lsa to be passed for a lookup function. */
|
|
|
|
lsa = pseudo_lsa(oi, area, lsa_type, opaque_type);
|
2017-08-25 22:51:12 +02:00
|
|
|
lsa->vrf_id = top->vrf_id;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
if ((oipt = lookup_opaque_info_by_type(lsa)) == NULL) {
|
|
|
|
struct ospf_opaque_functab *functab;
|
|
|
|
if ((functab = ospf_opaque_functab_lookup(lsa)) == NULL) {
|
2018-08-21 01:26:59 +02:00
|
|
|
flog_warn(
|
2018-09-13 20:56:04 +02:00
|
|
|
EC_OSPF_LSA,
|
2022-08-23 18:45:38 +02:00
|
|
|
"%s: No associated function?: lsa_type(%u), opaque_type(%u)",
|
|
|
|
__func__, lsa_type, opaque_type);
|
2002-12-13 21:15:29 +01:00
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
if ((oipt = register_opaque_info_per_type(functab, lsa))
|
|
|
|
== NULL) {
|
2018-08-21 01:26:59 +02:00
|
|
|
flog_warn(
|
2018-09-13 20:56:04 +02:00
|
|
|
EC_OSPF_LSA,
|
2022-08-23 18:45:38 +02:00
|
|
|
"%s: Cannot get a control info?: lsa_type(%u), opaque_type(%u)",
|
|
|
|
__func__, lsa_type, opaque_type);
|
2002-12-13 21:15:29 +01:00
|
|
|
goto out;
|
2017-07-17 14:03:14 +02:00
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
if (oipt->t_opaque_lsa_self != NULL) {
|
|
|
|
if (IS_DEBUG_OSPF_EVENT)
|
2004-12-08 19:43:03 +01:00
|
|
|
zlog_debug(
|
2020-03-27 12:35:23 +01:00
|
|
|
"Type-%u Opaque-LSA has already scheduled to RE-ORIGINATE: [opaque-type=%u]",
|
2004-09-24 10:01:38 +02:00
|
|
|
lsa_type,
|
|
|
|
GET_OPAQUE_TYPE(ntohl(lsa->data->id.s_addr)));
|
2002-12-13 21:15:29 +01:00
|
|
|
goto out;
|
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/*
|
|
|
|
* Different from initial origination time, in which various conditions
|
|
|
|
* (opaque capability, neighbor status etc) are assured by caller of
|
|
|
|
* the originating function "ospf_opaque_lsa_originate_schedule ()",
|
|
|
|
* it is highly possible that these conditions might not be satisfied
|
|
|
|
* at the time of re-origination function is to be called.
|
|
|
|
*/
|
2015-07-27 21:05:44 +02:00
|
|
|
delay = top->min_ls_interval; /* XXX */
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
if (IS_DEBUG_OSPF_EVENT)
|
2004-12-08 19:43:03 +01:00
|
|
|
zlog_debug(
|
2020-03-27 12:35:23 +01:00
|
|
|
"Schedule Type-%u Opaque-LSA to RE-ORIGINATE in %d ms later: [opaque-type=%u]",
|
2004-09-24 10:01:38 +02:00
|
|
|
lsa_type, delay,
|
|
|
|
GET_OPAQUE_TYPE(ntohl(lsa->data->id.s_addr)));
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2018-01-30 16:17:54 +01:00
|
|
|
OSPF_OPAQUE_TIMER_ON(oipt->t_opaque_lsa_self, func, oipt, delay);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
out:
|
|
|
|
return;
|
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
static struct ospf_lsa *pseudo_lsa(struct ospf_interface *oi,
|
2018-03-27 21:13:34 +02:00
|
|
|
struct ospf_area *area, uint8_t lsa_type,
|
|
|
|
uint8_t opaque_type)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
|
|
|
static struct ospf_lsa lsa = {0};
|
|
|
|
static struct lsa_header lsah = {0};
|
2018-03-27 21:13:34 +02:00
|
|
|
uint32_t tmp;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
lsa.oi = oi;
|
|
|
|
lsa.area = area;
|
|
|
|
lsa.data = &lsah;
|
2017-08-25 22:51:12 +02:00
|
|
|
lsa.vrf_id = VRF_DEFAULT;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
lsah.type = lsa_type;
|
|
|
|
tmp = SET_OPAQUE_LSID(opaque_type, 0); /* Opaque-ID is unused here. */
|
|
|
|
lsah.id.s_addr = htonl(tmp);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
return &lsa;
|
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2022-03-01 22:18:12 +01:00
|
|
|
static void ospf_opaque_type9_lsa_reoriginate_timer(struct event *t)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
|
|
|
struct opaque_info_per_type *oipt;
|
|
|
|
struct ospf_opaque_functab *functab;
|
|
|
|
struct ospf *top;
|
|
|
|
struct ospf_interface *oi;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
oipt = THREAD_ARG(t);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
if ((functab = oipt->functab) == NULL
|
|
|
|
|| functab->lsa_originator == NULL) {
|
2022-08-23 18:45:38 +02:00
|
|
|
flog_warn(EC_OSPF_LSA, "%s: No associated function?", __func__);
|
2022-02-23 01:04:25 +01:00
|
|
|
return;
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
oi = (struct ospf_interface *)oipt->owner;
|
|
|
|
if ((top = oi_to_top(oi)) == NULL) {
|
2022-08-23 18:45:38 +02:00
|
|
|
flog_warn(EC_OSPF_LSA, "%s: Something wrong?", __func__);
|
2022-02-23 01:04:25 +01:00
|
|
|
return;
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
if (!CHECK_FLAG(top->config, OSPF_OPAQUE_CAPABLE)
|
|
|
|
|| !ospf_if_is_enable(oi)
|
2003-03-25 06:07:42 +01:00
|
|
|
|| ospf_nbr_count_opaque_capable(oi) == 0) {
|
2002-12-13 21:15:29 +01:00
|
|
|
if (IS_DEBUG_OSPF_EVENT)
|
2004-12-08 19:43:03 +01:00
|
|
|
zlog_debug(
|
|
|
|
"Suspend re-origination of Type-9 Opaque-LSAs (opaque-type=%u) for a while...",
|
|
|
|
oipt->opaque_type);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
oipt->status = PROC_SUSPEND;
|
2022-02-23 01:04:25 +01:00
|
|
|
return;
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
if (IS_DEBUG_OSPF_EVENT)
|
2004-12-08 19:43:03 +01:00
|
|
|
zlog_debug(
|
|
|
|
"Timer[Type9-LSA]: Re-originate Opaque-LSAs (opaque-type=%u) for OI (%s)",
|
|
|
|
oipt->opaque_type, IF_NAME(oi));
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2022-02-23 01:04:25 +01:00
|
|
|
(*functab->lsa_originator)(oi);
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2022-03-01 22:18:12 +01:00
|
|
|
static void ospf_opaque_type10_lsa_reoriginate_timer(struct event *t)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
|
|
|
struct opaque_info_per_type *oipt;
|
|
|
|
struct ospf_opaque_functab *functab;
|
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 *top;
|
|
|
|
struct ospf_area *area;
|
|
|
|
struct ospf_interface *oi;
|
2022-02-23 01:04:25 +01:00
|
|
|
int n;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
oipt = THREAD_ARG(t);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
if ((functab = oipt->functab) == NULL
|
|
|
|
|| functab->lsa_originator == NULL) {
|
2022-08-23 18:45:38 +02:00
|
|
|
flog_warn(EC_OSPF_LSA, "%s: No associated function?", __func__);
|
2022-02-23 01:04:25 +01:00
|
|
|
return;
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
area = (struct ospf_area *)oipt->owner;
|
2003-03-25 06:07:42 +01:00
|
|
|
if (area == NULL || (top = area->ospf) == NULL) {
|
2022-08-23 18:45:38 +02:00
|
|
|
flog_warn(EC_OSPF_LSA, "%s: Something wrong?", __func__);
|
2022-02-23 01:04:25 +01:00
|
|
|
return;
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* There must be at least one "opaque-capable, full-state" neighbor. */
|
|
|
|
n = 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(area->oiflist, node, nnode, oi)) {
|
2003-03-25 06:07:42 +01:00
|
|
|
if ((n = ospf_nbr_count_opaque_capable(oi)) > 0)
|
2002-12-13 21:15:29 +01:00
|
|
|
break;
|
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
if (n == 0 || !CHECK_FLAG(top->config, OSPF_OPAQUE_CAPABLE)) {
|
|
|
|
if (IS_DEBUG_OSPF_EVENT)
|
2004-12-08 19:43:03 +01:00
|
|
|
zlog_debug(
|
2020-03-27 12:35:23 +01:00
|
|
|
"Suspend re-origination of Type-10 Opaque-LSAs (opaque-type=%u) for a while...",
|
2004-09-24 10:01:38 +02:00
|
|
|
oipt->opaque_type);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
oipt->status = PROC_SUSPEND;
|
2022-02-23 01:04:25 +01:00
|
|
|
return;
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
if (IS_DEBUG_OSPF_EVENT)
|
2004-12-08 19:43:03 +01:00
|
|
|
zlog_debug(
|
2020-10-21 19:56:26 +02:00
|
|
|
"Timer[Type10-LSA]: Re-originate Opaque-LSAs (opaque-type=%u) for Area %pI4",
|
|
|
|
oipt->opaque_type, &area->area_id);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2022-02-23 01:04:25 +01:00
|
|
|
(*functab->lsa_originator)(area);
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2022-03-01 22:18:12 +01:00
|
|
|
static void ospf_opaque_type11_lsa_reoriginate_timer(struct event *t)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
|
|
|
struct opaque_info_per_type *oipt;
|
|
|
|
struct ospf_opaque_functab *functab;
|
|
|
|
struct ospf *top;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
oipt = THREAD_ARG(t);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
if ((functab = oipt->functab) == NULL
|
2004-09-24 10:01:38 +02:00
|
|
|
|| functab->lsa_originator == NULL) {
|
2022-08-23 18:45:38 +02:00
|
|
|
flog_warn(EC_OSPF_LSA, "%s: No associated function?", __func__);
|
2022-02-23 01:04:25 +01:00
|
|
|
return;
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
if ((top = (struct ospf *)oipt->owner) == NULL) {
|
2022-08-23 18:45:38 +02:00
|
|
|
flog_warn(EC_OSPF_LSA, "%s: Something wrong?", __func__);
|
2022-02-23 01:04:25 +01:00
|
|
|
return;
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
if (!CHECK_FLAG(top->config, OSPF_OPAQUE_CAPABLE)) {
|
|
|
|
if (IS_DEBUG_OSPF_EVENT)
|
2004-12-08 19:43:03 +01:00
|
|
|
zlog_debug(
|
|
|
|
"Suspend re-origination of Type-11 Opaque-LSAs (opaque-type=%u) for a while...",
|
|
|
|
oipt->opaque_type);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
oipt->status = PROC_SUSPEND;
|
2022-02-23 01:04:25 +01:00
|
|
|
return;
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
if (IS_DEBUG_OSPF_EVENT)
|
2004-12-08 19:43:03 +01:00
|
|
|
zlog_debug(
|
|
|
|
"Timer[Type11-LSA]: Re-originate Opaque-LSAs (opaque-type=%u).",
|
|
|
|
oipt->opaque_type);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2022-02-23 01:04:25 +01:00
|
|
|
(*functab->lsa_originator)(top);
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
void ospf_opaque_lsa_refresh_schedule(struct ospf_lsa *lsa0)
|
|
|
|
{
|
|
|
|
struct opaque_info_per_type *oipt;
|
|
|
|
struct opaque_info_per_id *oipi;
|
|
|
|
struct ospf_lsa *lsa;
|
Update Traffic Engineering Support for OSPFD
NOTE: I am squashing several commits together because they
do not independently compile and we need this ability to
do any type of sane testing on the patches. Since this
series builds together I am doing this. -DBS
This new structure is the basis to get new link parameters for
Traffic Engineering from Zebra/interface layer to OSPFD and ISISD
for the support of Traffic Engineering
* lib/if.[c,h]: link parameters struture and get/set functions
* lib/command.[c,h]: creation of a new link-node
* lib/zclient.[c,h]: modification to the ZBUS message to convey the
link parameters structure
* lib/zebra.h: New ZBUS message
Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
Add support for IEEE 754 format
* lib/stream.[c,h]: Add stream_get{f,d} and stream_put{f,d}) demux and muxers to
safely convert between big-endian IEEE-754 single and double binary
format, as used in IETF RFCs, and C99. Implementation depends on host
using __STDC_IEC_559__, which should be everything we care about. Should
correctly error out otherwise.
* lib/network.[c,h]: Add ntohf and htonf converter
* lib/memtypes.c: Add new memeory type for Traffic Engineering support
Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
Add link parameters support to Zebra
* zebra/interface.c:
- Add new link-params CLI commands
- Add new functions to set/get link parameters for interface
* zebra/redistribute.[c,h]: Add new function to propagate link parameters
to routing daemon (essentially OSPFD and ISISD) for Traffic Engineering.
* zebra/redistribute_null.c: Add new function
zebra_interface_parameters_update()
* zebra/zserv.[c,h]: Add new functions to send link parameters
Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
Add support of new link-params CLI to vtysh
In vtysh_config.c/vtysh_config_parse_line(), it is not possible to continue
to use the ordered version for adding line i.e. config_add_line_uniq() to print
Interface CLI commands as it completely break the new LINK_PARAMS_NODE.
Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
Update Traffic Engineering support for OSPFD
These patches update original code to RFC3630 (OSPF-TE) and add support of
RFC5392 (Inter-AS v2) & RFC7471 (TE metric extensions) and partial support
of RFC6827 (ASON - GMPLS).
* ospfd/ospf_dump.[c,h]: Add new dump functions for Traffic Engineering
* ospfd/ospf_opaque.[c,h]: Add new TLV code points for RFC5392
* ospfd/ospf_packet.c: Update checking of OSPF_OPTION
* ospfd/ospf_vty.[c,h]: Update ospf_str2area_id
* ospfd/ospf_zebra.c: Add new function ospf_interface_link_params() to get
Link Parameters information from the interface to populate Traffic Engineering
metrics
* ospfd/ospfd.[c,h]: Update OSPF_OPTION flags (T -> MT and new DN)
* ospfd/ospf_te.[c,h]: Major modifications to update the code to new
link parameters structure and new RFCs
Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
tmp
2016-04-19 16:21:46 +02:00
|
|
|
struct ospf *top;
|
2002-12-13 21:15:29 +01:00
|
|
|
int delay;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
if ((oipt = lookup_opaque_info_by_type(lsa0)) == NULL
|
|
|
|
|| (oipi = lookup_opaque_info_by_id(oipt, lsa0)) == NULL) {
|
2022-08-23 18:45:38 +02:00
|
|
|
flog_warn(EC_OSPF_LSA, "%s: Invalid parameter?", __func__);
|
2002-12-13 21:15:29 +01:00
|
|
|
goto out;
|
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Given "lsa0" and current "oipi->lsa" may different, but harmless. */
|
|
|
|
if ((lsa = oipi->lsa) == NULL) {
|
2022-08-23 18:45:38 +02:00
|
|
|
flog_warn(EC_OSPF_LSA, "%s: Something wrong?", __func__);
|
2002-12-13 21:15:29 +01:00
|
|
|
goto out;
|
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
if (oipi->t_opaque_lsa_self != NULL) {
|
|
|
|
if (IS_DEBUG_OSPF_EVENT)
|
2004-12-08 19:43:03 +01:00
|
|
|
zlog_debug(
|
|
|
|
"Type-%u Opaque-LSA has already scheduled to REFRESH: [opaque-type=%u, opaque-id=%x]",
|
|
|
|
lsa->data->type,
|
|
|
|
GET_OPAQUE_TYPE(ntohl(lsa->data->id.s_addr)),
|
|
|
|
GET_OPAQUE_ID(ntohl(lsa->data->id.s_addr)));
|
2002-12-13 21:15:29 +01:00
|
|
|
goto out;
|
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Delete this lsa from neighbor retransmit-list. */
|
|
|
|
switch (lsa->data->type) {
|
|
|
|
case OSPF_OPAQUE_LINK_LSA:
|
|
|
|
case OSPF_OPAQUE_AREA_LSA:
|
2003-03-25 06:07:42 +01:00
|
|
|
ospf_ls_retransmit_delete_nbr_area(lsa->area, lsa);
|
2002-12-13 21:15:29 +01:00
|
|
|
break;
|
|
|
|
case OSPF_OPAQUE_AS_LSA:
|
2017-08-25 22:51:12 +02:00
|
|
|
top = ospf_lookup_by_vrf_id(lsa0->vrf_id);
|
Update Traffic Engineering Support for OSPFD
NOTE: I am squashing several commits together because they
do not independently compile and we need this ability to
do any type of sane testing on the patches. Since this
series builds together I am doing this. -DBS
This new structure is the basis to get new link parameters for
Traffic Engineering from Zebra/interface layer to OSPFD and ISISD
for the support of Traffic Engineering
* lib/if.[c,h]: link parameters struture and get/set functions
* lib/command.[c,h]: creation of a new link-node
* lib/zclient.[c,h]: modification to the ZBUS message to convey the
link parameters structure
* lib/zebra.h: New ZBUS message
Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
Add support for IEEE 754 format
* lib/stream.[c,h]: Add stream_get{f,d} and stream_put{f,d}) demux and muxers to
safely convert between big-endian IEEE-754 single and double binary
format, as used in IETF RFCs, and C99. Implementation depends on host
using __STDC_IEC_559__, which should be everything we care about. Should
correctly error out otherwise.
* lib/network.[c,h]: Add ntohf and htonf converter
* lib/memtypes.c: Add new memeory type for Traffic Engineering support
Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
Add link parameters support to Zebra
* zebra/interface.c:
- Add new link-params CLI commands
- Add new functions to set/get link parameters for interface
* zebra/redistribute.[c,h]: Add new function to propagate link parameters
to routing daemon (essentially OSPFD and ISISD) for Traffic Engineering.
* zebra/redistribute_null.c: Add new function
zebra_interface_parameters_update()
* zebra/zserv.[c,h]: Add new functions to send link parameters
Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
Add support of new link-params CLI to vtysh
In vtysh_config.c/vtysh_config_parse_line(), it is not possible to continue
to use the ordered version for adding line i.e. config_add_line_uniq() to print
Interface CLI commands as it completely break the new LINK_PARAMS_NODE.
Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
Update Traffic Engineering support for OSPFD
These patches update original code to RFC3630 (OSPF-TE) and add support of
RFC5392 (Inter-AS v2) & RFC7471 (TE metric extensions) and partial support
of RFC6827 (ASON - GMPLS).
* ospfd/ospf_dump.[c,h]: Add new dump functions for Traffic Engineering
* ospfd/ospf_opaque.[c,h]: Add new TLV code points for RFC5392
* ospfd/ospf_packet.c: Update checking of OSPF_OPTION
* ospfd/ospf_vty.[c,h]: Update ospf_str2area_id
* ospfd/ospf_zebra.c: Add new function ospf_interface_link_params() to get
Link Parameters information from the interface to populate Traffic Engineering
metrics
* ospfd/ospfd.[c,h]: Update OSPF_OPTION flags (T -> MT and new DN)
* ospfd/ospf_te.[c,h]: Major modifications to update the code to new
link parameters structure and new RFCs
Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
tmp
2016-04-19 16:21:46 +02:00
|
|
|
if ((lsa0->area != NULL) && (lsa0->area->ospf != NULL))
|
|
|
|
top = lsa0->area->ospf;
|
|
|
|
ospf_ls_retransmit_delete_nbr_as(top, lsa);
|
2002-12-13 21:15:29 +01:00
|
|
|
break;
|
|
|
|
default:
|
2022-08-23 18:45:38 +02:00
|
|
|
flog_warn(EC_OSPF_LSA_UNEXPECTED, "%s: Unexpected LSA-type(%u)",
|
|
|
|
__func__, lsa->data->type);
|
2002-12-13 21:15:29 +01:00
|
|
|
goto out;
|
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
delay = ospf_lsa_refresh_delay(lsa);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
if (IS_DEBUG_OSPF_EVENT)
|
2004-12-08 19:43:03 +01:00
|
|
|
zlog_debug(
|
|
|
|
"Schedule Type-%u Opaque-LSA to REFRESH in %d sec later: [opaque-type=%u, opaque-id=%x]",
|
|
|
|
lsa->data->type, delay,
|
|
|
|
GET_OPAQUE_TYPE(ntohl(lsa->data->id.s_addr)),
|
|
|
|
GET_OPAQUE_ID(ntohl(lsa->data->id.s_addr)));
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
OSPF_OPAQUE_TIMER_ON(oipi->t_opaque_lsa_self,
|
2015-07-27 21:05:44 +02:00
|
|
|
ospf_opaque_lsa_refresh_timer, oipi, delay * 1000);
|
2002-12-13 21:15:29 +01:00
|
|
|
out:
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-03-01 22:18:12 +01:00
|
|
|
static void ospf_opaque_lsa_refresh_timer(struct event *t)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
|
|
|
struct opaque_info_per_id *oipi;
|
|
|
|
struct ospf_opaque_functab *functab;
|
|
|
|
struct ospf_lsa *lsa;
|
|
|
|
|
|
|
|
if (IS_DEBUG_OSPF_EVENT)
|
2004-12-08 19:43:03 +01:00
|
|
|
zlog_debug("Timer[Opaque-LSA]: (Opaque-LSA Refresh expire)");
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
oipi = THREAD_ARG(t);
|
|
|
|
|
|
|
|
if ((lsa = oipi->lsa) != NULL)
|
|
|
|
if ((functab = oipi->opqctl_type->functab) != NULL)
|
|
|
|
if (functab->lsa_refresher != NULL)
|
|
|
|
(*functab->lsa_refresher)(lsa);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ospf_opaque_lsa_flush_schedule(struct ospf_lsa *lsa0)
|
|
|
|
{
|
|
|
|
struct opaque_info_per_type *oipt;
|
|
|
|
struct opaque_info_per_id *oipi;
|
|
|
|
struct ospf_lsa *lsa;
|
Update Traffic Engineering Support for OSPFD
NOTE: I am squashing several commits together because they
do not independently compile and we need this ability to
do any type of sane testing on the patches. Since this
series builds together I am doing this. -DBS
This new structure is the basis to get new link parameters for
Traffic Engineering from Zebra/interface layer to OSPFD and ISISD
for the support of Traffic Engineering
* lib/if.[c,h]: link parameters struture and get/set functions
* lib/command.[c,h]: creation of a new link-node
* lib/zclient.[c,h]: modification to the ZBUS message to convey the
link parameters structure
* lib/zebra.h: New ZBUS message
Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
Add support for IEEE 754 format
* lib/stream.[c,h]: Add stream_get{f,d} and stream_put{f,d}) demux and muxers to
safely convert between big-endian IEEE-754 single and double binary
format, as used in IETF RFCs, and C99. Implementation depends on host
using __STDC_IEC_559__, which should be everything we care about. Should
correctly error out otherwise.
* lib/network.[c,h]: Add ntohf and htonf converter
* lib/memtypes.c: Add new memeory type for Traffic Engineering support
Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
Add link parameters support to Zebra
* zebra/interface.c:
- Add new link-params CLI commands
- Add new functions to set/get link parameters for interface
* zebra/redistribute.[c,h]: Add new function to propagate link parameters
to routing daemon (essentially OSPFD and ISISD) for Traffic Engineering.
* zebra/redistribute_null.c: Add new function
zebra_interface_parameters_update()
* zebra/zserv.[c,h]: Add new functions to send link parameters
Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
Add support of new link-params CLI to vtysh
In vtysh_config.c/vtysh_config_parse_line(), it is not possible to continue
to use the ordered version for adding line i.e. config_add_line_uniq() to print
Interface CLI commands as it completely break the new LINK_PARAMS_NODE.
Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
Update Traffic Engineering support for OSPFD
These patches update original code to RFC3630 (OSPF-TE) and add support of
RFC5392 (Inter-AS v2) & RFC7471 (TE metric extensions) and partial support
of RFC6827 (ASON - GMPLS).
* ospfd/ospf_dump.[c,h]: Add new dump functions for Traffic Engineering
* ospfd/ospf_opaque.[c,h]: Add new TLV code points for RFC5392
* ospfd/ospf_packet.c: Update checking of OSPF_OPTION
* ospfd/ospf_vty.[c,h]: Update ospf_str2area_id
* ospfd/ospf_zebra.c: Add new function ospf_interface_link_params() to get
Link Parameters information from the interface to populate Traffic Engineering
metrics
* ospfd/ospfd.[c,h]: Update OSPF_OPTION flags (T -> MT and new DN)
* ospfd/ospf_te.[c,h]: Major modifications to update the code to new
link parameters structure and new RFCs
Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
tmp
2016-04-19 16:21:46 +02:00
|
|
|
struct ospf *top;
|
|
|
|
|
2017-08-25 22:51:12 +02:00
|
|
|
top = ospf_lookup_by_vrf_id(lsa0->vrf_id);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
if ((oipt = lookup_opaque_info_by_type(lsa0)) == NULL
|
|
|
|
|| (oipi = lookup_opaque_info_by_id(oipt, lsa0)) == NULL) {
|
2022-08-23 18:45:38 +02:00
|
|
|
flog_warn(EC_OSPF_LSA, "%s: Invalid parameter?", __func__);
|
2002-12-13 21:15:29 +01:00
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Given "lsa0" and current "oipi->lsa" may different, but harmless. */
|
|
|
|
if ((lsa = oipi->lsa) == NULL) {
|
2022-08-23 18:45:38 +02:00
|
|
|
flog_warn(EC_OSPF_LSA, "%s: Something wrong?", __func__);
|
2002-12-13 21:15:29 +01:00
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
2022-10-16 17:19:37 +02:00
|
|
|
if (lsa->opaque_zero_len_delete &&
|
|
|
|
lsa->data->length != htons(sizeof(struct lsa_header))) {
|
|
|
|
/* minimize the size of the withdrawal: */
|
|
|
|
/* increment the sequence number and make len just header */
|
|
|
|
/* and update checksum */
|
|
|
|
lsa->data->ls_seqnum = lsa_seqnum_increment(lsa);
|
|
|
|
lsa->data->length = htons(sizeof(struct lsa_header));
|
|
|
|
lsa->data->checksum = 0;
|
|
|
|
lsa->data->checksum = ospf_lsa_checksum(lsa->data);
|
|
|
|
}
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Delete this lsa from neighbor retransmit-list. */
|
|
|
|
switch (lsa->data->type) {
|
|
|
|
case OSPF_OPAQUE_LINK_LSA:
|
|
|
|
case OSPF_OPAQUE_AREA_LSA:
|
2003-03-25 06:07:42 +01:00
|
|
|
ospf_ls_retransmit_delete_nbr_area(lsa->area, lsa);
|
2002-12-13 21:15:29 +01:00
|
|
|
break;
|
|
|
|
case OSPF_OPAQUE_AS_LSA:
|
Update Traffic Engineering Support for OSPFD
NOTE: I am squashing several commits together because they
do not independently compile and we need this ability to
do any type of sane testing on the patches. Since this
series builds together I am doing this. -DBS
This new structure is the basis to get new link parameters for
Traffic Engineering from Zebra/interface layer to OSPFD and ISISD
for the support of Traffic Engineering
* lib/if.[c,h]: link parameters struture and get/set functions
* lib/command.[c,h]: creation of a new link-node
* lib/zclient.[c,h]: modification to the ZBUS message to convey the
link parameters structure
* lib/zebra.h: New ZBUS message
Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
Add support for IEEE 754 format
* lib/stream.[c,h]: Add stream_get{f,d} and stream_put{f,d}) demux and muxers to
safely convert between big-endian IEEE-754 single and double binary
format, as used in IETF RFCs, and C99. Implementation depends on host
using __STDC_IEC_559__, which should be everything we care about. Should
correctly error out otherwise.
* lib/network.[c,h]: Add ntohf and htonf converter
* lib/memtypes.c: Add new memeory type for Traffic Engineering support
Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
Add link parameters support to Zebra
* zebra/interface.c:
- Add new link-params CLI commands
- Add new functions to set/get link parameters for interface
* zebra/redistribute.[c,h]: Add new function to propagate link parameters
to routing daemon (essentially OSPFD and ISISD) for Traffic Engineering.
* zebra/redistribute_null.c: Add new function
zebra_interface_parameters_update()
* zebra/zserv.[c,h]: Add new functions to send link parameters
Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
Add support of new link-params CLI to vtysh
In vtysh_config.c/vtysh_config_parse_line(), it is not possible to continue
to use the ordered version for adding line i.e. config_add_line_uniq() to print
Interface CLI commands as it completely break the new LINK_PARAMS_NODE.
Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
Update Traffic Engineering support for OSPFD
These patches update original code to RFC3630 (OSPF-TE) and add support of
RFC5392 (Inter-AS v2) & RFC7471 (TE metric extensions) and partial support
of RFC6827 (ASON - GMPLS).
* ospfd/ospf_dump.[c,h]: Add new dump functions for Traffic Engineering
* ospfd/ospf_opaque.[c,h]: Add new TLV code points for RFC5392
* ospfd/ospf_packet.c: Update checking of OSPF_OPTION
* ospfd/ospf_vty.[c,h]: Update ospf_str2area_id
* ospfd/ospf_zebra.c: Add new function ospf_interface_link_params() to get
Link Parameters information from the interface to populate Traffic Engineering
metrics
* ospfd/ospfd.[c,h]: Update OSPF_OPTION flags (T -> MT and new DN)
* ospfd/ospf_te.[c,h]: Major modifications to update the code to new
link parameters structure and new RFCs
Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
tmp
2016-04-19 16:21:46 +02:00
|
|
|
if ((lsa0->area != NULL) && (lsa0->area->ospf != NULL))
|
|
|
|
top = lsa0->area->ospf;
|
|
|
|
ospf_ls_retransmit_delete_nbr_as(top, lsa);
|
2002-12-13 21:15:29 +01:00
|
|
|
break;
|
|
|
|
default:
|
2022-08-23 18:45:38 +02:00
|
|
|
flog_warn(EC_OSPF_LSA_UNEXPECTED, "%s: Unexpected LSA-type(%u)",
|
|
|
|
__func__, lsa->data->type);
|
2002-12-13 21:15:29 +01:00
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
2021-05-31 15:27:51 +02:00
|
|
|
/* This lsa will be flushed and removed eventually. */
|
|
|
|
ospf_lsa_flush(top, lsa);
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Dequeue listnode entry from the list. */
|
|
|
|
listnode_delete(oipt->id_list, oipi);
|
|
|
|
|
|
|
|
if (IS_DEBUG_OSPF_EVENT)
|
2004-12-08 19:43:03 +01:00
|
|
|
zlog_debug(
|
|
|
|
"Schedule Type-%u Opaque-LSA to FLUSH: [opaque-type=%u, opaque-id=%x]",
|
|
|
|
lsa->data->type,
|
|
|
|
GET_OPAQUE_TYPE(ntohl(lsa->data->id.s_addr)),
|
|
|
|
GET_OPAQUE_ID(ntohl(lsa->data->id.s_addr)));
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2021-05-31 15:27:51 +02:00
|
|
|
/* Disassociate internal control information with the given lsa. */
|
|
|
|
free_opaque_info_per_id((void *)oipi);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
out:
|
|
|
|
return;
|
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2004-09-24 10:01:38 +02:00
|
|
|
void ospf_opaque_self_originated_lsa_received(struct ospf_neighbor *nbr,
|
2005-05-11 20:09:59 +02:00
|
|
|
struct ospf_lsa *lsa)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
|
|
|
struct ospf *top;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
if ((top = oi_to_top(nbr->oi)) == NULL)
|
2006-07-26 11:37:26 +02:00
|
|
|
return;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2021-05-31 15:27:51 +02:00
|
|
|
if (IS_DEBUG_OSPF_EVENT)
|
|
|
|
zlog_debug(
|
|
|
|
"LSA[Type%d:%pI4]: processing self-originated Opaque-LSA",
|
|
|
|
lsa->data->type, &lsa->data->id);
|
|
|
|
|
2005-05-11 20:09:59 +02:00
|
|
|
/*
|
|
|
|
* Since these LSA entries are not yet installed into corresponding
|
|
|
|
* LSDB, just flush them without calling ospf_ls_maxage() afterward.
|
|
|
|
*/
|
|
|
|
lsa->data->ls_age = htons(OSPF_LSA_MAXAGE);
|
|
|
|
switch (lsa->data->type) {
|
|
|
|
case OSPF_OPAQUE_LINK_LSA:
|
|
|
|
ospf_flood_through_area(nbr->oi->area, NULL /*inbr*/, lsa);
|
|
|
|
break;
|
|
|
|
case OSPF_OPAQUE_AREA_LSA:
|
|
|
|
ospf_flood_through_area(nbr->oi->area, NULL /*inbr*/, lsa);
|
|
|
|
break;
|
|
|
|
case OSPF_OPAQUE_AS_LSA:
|
|
|
|
ospf_flood_through_as(top, NULL /*inbr*/, lsa);
|
|
|
|
break;
|
|
|
|
default:
|
2022-08-23 18:45:38 +02:00
|
|
|
flog_warn(EC_OSPF_LSA_UNEXPECTED, "%s: Unexpected LSA-type(%u)",
|
|
|
|
__func__, lsa->data->type);
|
2006-07-26 11:37:26 +02:00
|
|
|
return;
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
2015-01-20 16:45:36 +01:00
|
|
|
ospf_lsa_discard(lsa); /* List "lsas" will be deleted by caller. */
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*------------------------------------------------------------------------*
|
2022-04-01 22:27:55 +02:00
|
|
|
* Following are util functions; probably be used by Opaque-LSAs only...
|
2002-12-13 21:15:29 +01:00
|
|
|
*------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
struct ospf *oi_to_top(struct ospf_interface *oi)
|
|
|
|
{
|
|
|
|
struct ospf *top = NULL;
|
|
|
|
struct ospf_area *area;
|
|
|
|
|
2003-03-25 06:07:42 +01:00
|
|
|
if (oi == NULL || (area = oi->area) == NULL
|
|
|
|
|| (top = area->ospf) == NULL)
|
2018-09-13 20:56:04 +02:00
|
|
|
flog_warn(EC_OSPF_LSA,
|
2018-08-21 01:26:59 +02:00
|
|
|
"Broken relationship for \"OI -> AREA -> OSPF\"?");
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
return top;
|
|
|
|
}
|