forked from Mirror/frr
Merge pull request #18046 from LabNConsulting/aceelindem/ospf-lsa-add-delete-hook
ospfd: Replace LSDB callbacks with LSA Update/Delete hooks.
This commit is contained in:
commit
fbff0436d3
|
@ -1284,76 +1284,67 @@ Debugging OSPF
|
|||
|
||||
.. clicmd:: debug ospf [(1-65535)] client-api
|
||||
|
||||
Show debug information for the OSPF opaque data client API.
|
||||
Enable or disable debugging for the OSPF opaque data client API.
|
||||
|
||||
.. clicmd:: debug ospf [(1-65535)] default-information
|
||||
|
||||
Show debug information of default information
|
||||
Enable or disable debugging of default information origination
|
||||
|
||||
.. clicmd:: debug ospf [(1-65535)] packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv) [detail]
|
||||
|
||||
|
||||
Dump Packet for debugging
|
||||
Enable or disable debugging for received and transmitted OSPF packets
|
||||
|
||||
.. clicmd:: debug ospf [(1-65535)] ism [status|events|timers]
|
||||
|
||||
|
||||
|
||||
Show debug information of Interface State Machine
|
||||
Enable or disable debugging of Interface State Machine
|
||||
|
||||
.. clicmd:: debug ospf [(1-65535)] nsm [status|events|timers]
|
||||
|
||||
|
||||
|
||||
Show debug information of Network State Machine
|
||||
Enable or disable debugging of Neighbor State Machine transitions
|
||||
|
||||
.. clicmd:: debug ospf [(1-65535)] event
|
||||
|
||||
|
||||
Show debug information of OSPF event
|
||||
Enable or disable debugging of OSPF events
|
||||
|
||||
.. clicmd:: debug ospf [(1-65535)] nssa
|
||||
|
||||
|
||||
Show debug information about Not So Stub Area
|
||||
Enable or disable debugging about Not-So-Stubby-Areas (NSSAs)
|
||||
|
||||
.. clicmd:: debug ospf [(1-65535)] ldp-sync
|
||||
|
||||
Show debug information about LDP-Sync
|
||||
Enable or disable debugging about LDP-Sync
|
||||
|
||||
.. clicmd:: debug ospf [(1-65535)] lsa [aggregate|flooding|generate|install|refresh]
|
||||
|
||||
|
||||
|
||||
Show debug detail of Link State messages
|
||||
Enable or disable detail debuggin of Link State Advertisements (LSAs)
|
||||
|
||||
.. clicmd:: debug ospf [(1-65535)] sr
|
||||
|
||||
Show debug information about Segment Routing
|
||||
Enable or disable debugging about Segment Routing
|
||||
|
||||
.. clicmd:: debug ospf [(1-65535)] te
|
||||
|
||||
|
||||
Show debug information about Traffic Engineering LSA
|
||||
Enable or disable debugging about MPLS Traffic Engineering LSA
|
||||
|
||||
.. clicmd:: debug ospf [(1-65535)] ti-lfa
|
||||
|
||||
Show debug information about SR TI-LFA
|
||||
Enable or disable debugging about SR TI-LFA
|
||||
|
||||
.. clicmd:: debug ospf [(1-65535)] zebra [interface|redistribute]
|
||||
|
||||
|
||||
|
||||
Show debug information of ZEBRA API
|
||||
Enable or disable debugging of ZEBRA API
|
||||
|
||||
.. clicmd:: debug ospf [(1-65535)] graceful-restart
|
||||
|
||||
Enable or disable debugying for OSPF Graceful Restart Helper
|
||||
|
||||
Enable/disable debug information for OSPF Graceful Restart Helper
|
||||
.. clicmd:: debug ospf [(1-65535)] graceful-restart
|
||||
|
||||
Enable or disable debugging for OSPF Opaque LSA processing
|
||||
|
||||
.. clicmd:: show debugging ospf
|
||||
|
||||
|
||||
Show enabled OSPF debugging options
|
||||
|
||||
Sample Configuration
|
||||
====================
|
||||
|
|
|
@ -234,26 +234,6 @@ static struct ospf_apiserver *lookup_apiserver_by_lsa(struct ospf_lsa *lsa)
|
|||
return found;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------
|
||||
* Following are functions to manage client connections.
|
||||
* -----------------------------------------------------------
|
||||
*/
|
||||
static int ospf_apiserver_new_lsa_hook(struct ospf_lsa *lsa)
|
||||
{
|
||||
if (IS_DEBUG_OSPF_EVENT)
|
||||
zlog_debug("API: Put LSA(%p)[%s] into reserve, total=%ld",
|
||||
(void *)lsa, dump_lsa_key(lsa), lsa->lsdb->total);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ospf_apiserver_del_lsa_hook(struct ospf_lsa *lsa)
|
||||
{
|
||||
if (IS_DEBUG_OSPF_EVENT)
|
||||
zlog_debug("API: Get LSA(%p)[%s] from reserve, total=%ld",
|
||||
(void *)lsa, dump_lsa_key(lsa), lsa->lsdb->total);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Allocate new connection structure. */
|
||||
struct ospf_apiserver *ospf_apiserver_new(int fd_sync, int fd_async)
|
||||
{
|
||||
|
@ -270,12 +250,11 @@ struct ospf_apiserver *ospf_apiserver_new(int fd_sync, int fd_async)
|
|||
new->opaque_types = list_new();
|
||||
|
||||
/* Initialize temporary strage for LSA instances to be refreshed. */
|
||||
if (IS_DEBUG_OSPF_CLIENT_API)
|
||||
zlog_debug("API: Initiallize the reserve LSDB");
|
||||
memset(&new->reserve, 0, sizeof(struct ospf_lsdb));
|
||||
ospf_lsdb_init(&new->reserve);
|
||||
|
||||
new->reserve.new_lsa_hook = ospf_apiserver_new_lsa_hook; /* debug */
|
||||
new->reserve.del_lsa_hook = ospf_apiserver_del_lsa_hook; /* debug */
|
||||
|
||||
new->out_sync_fifo = msg_fifo_new();
|
||||
new->out_async_fifo = msg_fifo_new();
|
||||
new->t_sync_read = NULL;
|
||||
|
@ -363,6 +342,9 @@ void ospf_apiserver_free(struct ospf_apiserver *apiserv)
|
|||
msg_fifo_free(apiserv->out_async_fifo);
|
||||
|
||||
/* Clear temporary strage for LSA instances to be refreshed. */
|
||||
if (IS_DEBUG_OSPF_CLIENT_API)
|
||||
zlog_debug("API: Delete all LSAs from reserve LSDB, total=%ld",
|
||||
apiserv->reserve.total);
|
||||
ospf_lsdb_delete_all(&apiserv->reserve);
|
||||
ospf_lsdb_cleanup(&apiserv->reserve);
|
||||
|
||||
|
@ -371,7 +353,7 @@ void ospf_apiserver_free(struct ospf_apiserver *apiserv)
|
|||
|
||||
XFREE(MTYPE_APISERVER_MSGFILTER, apiserv->filter);
|
||||
|
||||
if (IS_DEBUG_OSPF_EVENT)
|
||||
if (IS_DEBUG_OSPF_CLIENT_API)
|
||||
zlog_debug("API: Delete apiserv(%p), total#(%d)",
|
||||
(void *)apiserv, apiserver_list->count);
|
||||
|
||||
|
@ -393,7 +375,7 @@ void ospf_apiserver_read(struct event *thread)
|
|||
event = OSPF_APISERVER_SYNC_READ;
|
||||
apiserv->t_sync_read = NULL;
|
||||
|
||||
if (IS_DEBUG_OSPF_EVENT)
|
||||
if (IS_DEBUG_OSPF_CLIENT_API)
|
||||
zlog_debug("API: %s: Peer: %pI4/%u", __func__,
|
||||
&apiserv->peer_sync.sin_addr,
|
||||
ntohs(apiserv->peer_sync.sin_port));
|
||||
|
@ -403,7 +385,7 @@ void ospf_apiserver_read(struct event *thread)
|
|||
event = OSPF_APISERVER_ASYNC_READ;
|
||||
apiserv->t_async_read = NULL;
|
||||
|
||||
if (IS_DEBUG_OSPF_EVENT)
|
||||
if (IS_DEBUG_OSPF_CLIENT_API)
|
||||
zlog_debug("API: %s: Peer: %pI4/%u", __func__,
|
||||
&apiserv->peer_async.sin_addr,
|
||||
ntohs(apiserv->peer_async.sin_port));
|
||||
|
@ -426,7 +408,7 @@ void ospf_apiserver_read(struct event *thread)
|
|||
return;
|
||||
}
|
||||
|
||||
if (IS_DEBUG_OSPF_EVENT)
|
||||
if (IS_DEBUG_OSPF_CLIENT_API)
|
||||
msg_print(msg);
|
||||
|
||||
/* Dispatch to corresponding message handler. */
|
||||
|
@ -457,7 +439,7 @@ void ospf_apiserver_sync_write(struct event *thread)
|
|||
goto out;
|
||||
}
|
||||
|
||||
if (IS_DEBUG_OSPF_EVENT)
|
||||
if (IS_DEBUG_OSPF_CLIENT_API)
|
||||
zlog_debug("API: %s: Peer: %pI4/%u", __func__,
|
||||
&apiserv->peer_sync.sin_addr,
|
||||
ntohs(apiserv->peer_sync.sin_port));
|
||||
|
@ -469,7 +451,7 @@ void ospf_apiserver_sync_write(struct event *thread)
|
|||
return;
|
||||
}
|
||||
|
||||
if (IS_DEBUG_OSPF_EVENT)
|
||||
if (IS_DEBUG_OSPF_CLIENT_API)
|
||||
msg_print(msg);
|
||||
|
||||
rc = msg_write(fd, msg);
|
||||
|
@ -517,7 +499,7 @@ void ospf_apiserver_async_write(struct event *thread)
|
|||
goto out;
|
||||
}
|
||||
|
||||
if (IS_DEBUG_OSPF_EVENT)
|
||||
if (IS_DEBUG_OSPF_CLIENT_API)
|
||||
zlog_debug("API: %s: Peer: %pI4/%u", __func__,
|
||||
&apiserv->peer_async.sin_addr,
|
||||
ntohs(apiserv->peer_async.sin_port));
|
||||
|
@ -529,7 +511,7 @@ void ospf_apiserver_async_write(struct event *thread)
|
|||
return;
|
||||
}
|
||||
|
||||
if (IS_DEBUG_OSPF_EVENT)
|
||||
if (IS_DEBUG_OSPF_CLIENT_API)
|
||||
msg_print(msg);
|
||||
|
||||
rc = msg_write(fd, msg);
|
||||
|
@ -639,7 +621,7 @@ void ospf_apiserver_accept(struct event *thread)
|
|||
return;
|
||||
}
|
||||
|
||||
if (IS_DEBUG_OSPF_EVENT)
|
||||
if (IS_DEBUG_OSPF_CLIENT_API)
|
||||
zlog_debug("API: %s: New peer: %pI4/%u", __func__,
|
||||
&peer_sync.sin_addr, ntohs(peer_sync.sin_port));
|
||||
|
||||
|
@ -701,7 +683,7 @@ void ospf_apiserver_accept(struct event *thread)
|
|||
apiserv);
|
||||
#endif /* USE_ASYNC_READ */
|
||||
|
||||
if (IS_DEBUG_OSPF_EVENT)
|
||||
if (IS_DEBUG_OSPF_CLIENT_API)
|
||||
zlog_debug("API: New apiserv(%p), total#(%d)", (void *)apiserv,
|
||||
apiserver_list->count);
|
||||
}
|
||||
|
@ -888,7 +870,7 @@ int ospf_apiserver_register_opaque_type(struct ospf_apiserver *apiserv,
|
|||
/* Add to list of registered opaque types */
|
||||
listnode_add(apiserv->opaque_types, regtype);
|
||||
|
||||
if (IS_DEBUG_OSPF_EVENT)
|
||||
if (IS_DEBUG_OSPF_CLIENT_API)
|
||||
zlog_debug(
|
||||
"API: Add LSA-type(%d)/Opaque-type(%d) into apiserv(%p), total#(%d)",
|
||||
lsa_type, opaque_type, (void *)apiserv,
|
||||
|
@ -919,7 +901,7 @@ int ospf_apiserver_unregister_opaque_type(struct ospf_apiserver *apiserv,
|
|||
listnode_delete(apiserv->opaque_types, regtype);
|
||||
|
||||
XFREE(MTYPE_APISERVER, regtype);
|
||||
if (IS_DEBUG_OSPF_EVENT)
|
||||
if (IS_DEBUG_OSPF_CLIENT_API)
|
||||
zlog_debug(
|
||||
"API: Del LSA-type(%d)/Opaque-type(%d) from apiserv(%p), total#(%d)",
|
||||
lsa_type, opaque_type, (void *)apiserv,
|
||||
|
@ -1553,7 +1535,7 @@ struct ospf_lsa *ospf_apiserver_opaque_lsa_new(struct ospf_area *area,
|
|||
|
||||
options |= OSPF_OPTION_O; /* Don't forget to set option bit */
|
||||
|
||||
if (IS_DEBUG_OSPF(lsa, LSA_GENERATE)) {
|
||||
if (IS_DEBUG_OSPF_CLIENT_API) {
|
||||
zlog_debug("LSA[Type%d:%pI4]: Creating an Opaque-LSA instance",
|
||||
protolsa->type, &protolsa->id);
|
||||
}
|
||||
|
@ -1716,6 +1698,9 @@ int ospf_apiserver_handle_originate_request(struct ospf_apiserver *apiserv,
|
|||
*/
|
||||
new->lsdb = &apiserv->reserve;
|
||||
ospf_lsdb_add(&apiserv->reserve, new);
|
||||
if (IS_DEBUG_OSPF_CLIENT_API)
|
||||
zlog_debug("API: Add LSA(%p)[%s] into reserve LSDB, total=%ld", (void *)new,
|
||||
dump_lsa_key(new), new->lsdb->total);
|
||||
|
||||
/* Kick the scheduler function. */
|
||||
ospf_opaque_lsa_refresh_schedule(old);
|
||||
|
@ -1878,7 +1863,7 @@ struct ospf_lsa *ospf_apiserver_lsa_refresher(struct ospf_lsa *lsa)
|
|||
ospf = ospf_lookup_by_vrf_id(VRF_DEFAULT);
|
||||
assert(ospf);
|
||||
|
||||
if (IS_DEBUG_OSPF(lsa, LSA_GENERATE)) {
|
||||
if (IS_DEBUG_OSPF_CLIENT_API) {
|
||||
zlog_debug("LSA[Type%d:%pI4]: OSPF API Server LSA Refresher",
|
||||
lsa->data->type, &lsa->data->id);
|
||||
}
|
||||
|
@ -1909,6 +1894,9 @@ struct ospf_lsa *ospf_apiserver_lsa_refresher(struct ospf_lsa *lsa)
|
|||
}
|
||||
} else {
|
||||
/* This is a forcible refresh, requested by OSPF-API client. */
|
||||
if (IS_DEBUG_OSPF_CLIENT_API)
|
||||
zlog_debug("API: Delete LSA(%p)[%s] from reserve LSDB, total=%ld",
|
||||
(void *)new, dump_lsa_key(new), new->lsdb->total);
|
||||
ospf_lsdb_delete(&apiserv->reserve, new);
|
||||
new->lsdb = NULL;
|
||||
}
|
||||
|
@ -2597,18 +2585,23 @@ static int apiserver_clients_lsa_change_notify(uint8_t msgtype,
|
|||
|
||||
int ospf_apiserver_lsa_update(struct ospf_lsa *lsa)
|
||||
{
|
||||
if (IS_DEBUG_OSPF_CLIENT_API)
|
||||
zlog_debug("API: LSA Update Hook Type-%u Opaque-LSA: [opaque-type=%u, opaque-id=%x] Seq: 0x%x %s",
|
||||
lsa->data->type, GET_OPAQUE_TYPE(ntohl(lsa->data->id.s_addr)),
|
||||
GET_OPAQUE_ID(ntohl(lsa->data->id.s_addr)), ntohl(lsa->data->ls_seqnum),
|
||||
IS_LSA_MAXAGE(lsa) ? "MaxAged " : "");
|
||||
|
||||
/* Only notify this update if the LSA's age is smaller than
|
||||
MAXAGE. Otherwise clients would see LSA updates with max age just
|
||||
before they are deleted from the LSDB. LSA delete messages have
|
||||
MAXAGE too but should not be filtered. */
|
||||
if (IS_LSA_MAXAGE(lsa))
|
||||
return 0;
|
||||
return apiserver_clients_lsa_change_notify(MSG_LSA_UPDATE_NOTIFY, lsa);
|
||||
}
|
||||
|
||||
int ospf_apiserver_lsa_delete(struct ospf_lsa *lsa)
|
||||
{
|
||||
if (IS_DEBUG_OSPF_CLIENT_API)
|
||||
zlog_debug("API: LSA Delete Hook Type-%u Opaque-LSA: [opaque-type=%u, opaque-id=%x] Seq: 0x%x %s",
|
||||
lsa->data->type, GET_OPAQUE_TYPE(ntohl(lsa->data->id.s_addr)),
|
||||
GET_OPAQUE_ID(ntohl(lsa->data->id.s_addr)), ntohl(lsa->data->ls_seqnum),
|
||||
IS_LSA_MAXAGE(lsa) ? "MaxAged " : "");
|
||||
|
||||
return apiserver_clients_lsa_change_notify(MSG_LSA_DELETE_NOTIFY, lsa);
|
||||
}
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@ unsigned long conf_debug_ospf_ldp_sync;
|
|||
unsigned long conf_debug_ospf_gr;
|
||||
unsigned long conf_debug_ospf_bfd;
|
||||
unsigned long conf_debug_ospf_client_api;
|
||||
unsigned long conf_debug_ospf_opaque_lsa;
|
||||
|
||||
/* Enable debug option variables -- valid only session. */
|
||||
unsigned long term_debug_ospf_packet[5] = {0, 0, 0, 0, 0};
|
||||
|
@ -64,6 +65,7 @@ unsigned long term_debug_ospf_ldp_sync;
|
|||
unsigned long term_debug_ospf_gr;
|
||||
unsigned long term_debug_ospf_bfd;
|
||||
unsigned long term_debug_ospf_client_api;
|
||||
unsigned long term_debug_ospf_opaque_lsa;
|
||||
|
||||
const char *ospf_redist_string(unsigned int route_type)
|
||||
{
|
||||
|
@ -1577,6 +1579,33 @@ DEFPY (debug_ospf_client_api,
|
|||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
DEFPY (debug_ospf_opaque_lsa,
|
||||
debug_ospf_opaque_lsa_cmd,
|
||||
"[no$no] debug ospf [(1-65535)$instance] opaque-lsa",
|
||||
NO_STR
|
||||
DEBUG_STR
|
||||
OSPF_STR
|
||||
"Instance ID\n"
|
||||
"OSPF Opaque LSA information\n")
|
||||
{
|
||||
if (instance && instance != ospf_instance)
|
||||
return CMD_NOT_MY_INSTANCE;
|
||||
|
||||
if (vty->node == CONFIG_NODE) {
|
||||
if (no)
|
||||
DEBUG_OFF(opaque_lsa, OPAQUE_LSA);
|
||||
else
|
||||
DEBUG_ON(opaque_lsa, OPAQUE_LSA);
|
||||
} else {
|
||||
if (no)
|
||||
TERM_DEBUG_OFF(opaque_lsa, OPAQUE_LSA);
|
||||
else
|
||||
TERM_DEBUG_ON(opaque_lsa, OPAQUE_LSA);
|
||||
}
|
||||
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
DEFUN (no_debug_ospf,
|
||||
no_debug_ospf_cmd,
|
||||
"no debug ospf",
|
||||
|
@ -1612,6 +1641,7 @@ DEFUN (no_debug_ospf,
|
|||
DEBUG_OFF(sr, SR);
|
||||
DEBUG_OFF(ti_lfa, TI_LFA);
|
||||
DEBUG_OFF(client_api, CLIENT_API);
|
||||
DEBUG_OFF(opaque_lsa, OPAQUE_LSA);
|
||||
|
||||
/* BFD debugging is two parts: OSPF and library. */
|
||||
DEBUG_OFF(bfd, BFD_LIB);
|
||||
|
@ -1649,6 +1679,7 @@ DEFUN (no_debug_ospf,
|
|||
TERM_DEBUG_OFF(ti_lfa, TI_LFA);
|
||||
TERM_DEBUG_OFF(bfd, BFD_LIB);
|
||||
TERM_DEBUG_OFF(client_api, CLIENT_API);
|
||||
TERM_DEBUG_OFF(opaque_lsa, OPAQUE_LSA);
|
||||
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
@ -1774,10 +1805,14 @@ static int show_debugging_ospf_common(struct vty *vty)
|
|||
vty_out(vty,
|
||||
" OSPF BFD integration library debugging is on\n");
|
||||
|
||||
/* Show debug status for LDP-SYNC. */
|
||||
/* Show debug status for CLIENT-API. */
|
||||
if (IS_DEBUG_OSPF(client_api, CLIENT_API) == OSPF_DEBUG_CLIENT_API)
|
||||
vty_out(vty, " OSPF client-api debugging is on\n");
|
||||
|
||||
/* Show debug status for OPAQUE-LSA. */
|
||||
if (IS_DEBUG_OSPF(opaque_lsa, OPAQUE_LSA) == OSPF_DEBUG_OPAQUE_LSA)
|
||||
vty_out(vty, " OSPF opaque-lsa debugging is on\n");
|
||||
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -1983,6 +2018,12 @@ static int config_write_debug(struct vty *vty)
|
|||
write = 1;
|
||||
}
|
||||
|
||||
/* debug ospf opaque-lsa */
|
||||
if (IS_CONF_DEBUG_OSPF(opaque_lsa, OPAQUE_LSA) == OSPF_DEBUG_OPAQUE_LSA) {
|
||||
vty_out(vty, "debug ospf%s opaque-lsa\n", str);
|
||||
write = 1;
|
||||
}
|
||||
|
||||
/* debug ospf default-information */
|
||||
if (IS_CONF_DEBUG_OSPF(defaultinfo, DEFAULTINFO) ==
|
||||
OSPF_DEBUG_DEFAULTINFO) {
|
||||
|
@ -2011,6 +2052,7 @@ void ospf_debug_init(void)
|
|||
install_element(ENABLE_NODE, &debug_ospf_default_info_cmd);
|
||||
install_element(ENABLE_NODE, &debug_ospf_ldp_sync_cmd);
|
||||
install_element(ENABLE_NODE, &debug_ospf_client_api_cmd);
|
||||
install_element(ENABLE_NODE, &debug_ospf_opaque_lsa_cmd);
|
||||
install_element(ENABLE_NODE, &no_debug_ospf_ism_cmd);
|
||||
install_element(ENABLE_NODE, &no_debug_ospf_nsm_cmd);
|
||||
install_element(ENABLE_NODE, &no_debug_ospf_lsa_cmd);
|
||||
|
@ -2050,6 +2092,7 @@ void ospf_debug_init(void)
|
|||
install_element(CONFIG_NODE, &debug_ospf_default_info_cmd);
|
||||
install_element(CONFIG_NODE, &debug_ospf_ldp_sync_cmd);
|
||||
install_element(CONFIG_NODE, &debug_ospf_client_api_cmd);
|
||||
install_element(CONFIG_NODE, &debug_ospf_opaque_lsa_cmd);
|
||||
install_element(CONFIG_NODE, &no_debug_ospf_nsm_cmd);
|
||||
install_element(CONFIG_NODE, &no_debug_ospf_lsa_cmd);
|
||||
install_element(CONFIG_NODE, &no_debug_ospf_zebra_cmd);
|
||||
|
|
|
@ -55,6 +55,8 @@
|
|||
|
||||
#define OSPF_DEBUG_CLIENT_API 0x01
|
||||
|
||||
#define OSPF_DEBUG_OPAQUE_LSA 0x01
|
||||
|
||||
/* Macro for setting debug option. */
|
||||
#define CONF_DEBUG_PACKET_ON(a, b) conf_debug_ospf_packet[a] |= (b)
|
||||
#define CONF_DEBUG_PACKET_OFF(a, b) conf_debug_ospf_packet[a] &= ~(b)
|
||||
|
@ -106,6 +108,7 @@
|
|||
#define IS_DEBUG_OSPF_LDP_SYNC IS_DEBUG_OSPF(ldp_sync, LDP_SYNC)
|
||||
#define IS_DEBUG_OSPF_GR IS_DEBUG_OSPF(gr, GR)
|
||||
#define IS_DEBUG_OSPF_CLIENT_API IS_DEBUG_OSPF(client_api, CLIENT_API)
|
||||
#define IS_DEBUG_OSPF_OPAQUE_LSA IS_DEBUG_OSPF(opaque_lsa, OPAQUE_LSA)
|
||||
|
||||
#define IS_CONF_DEBUG_OSPF_PACKET(a, b) \
|
||||
(conf_debug_ospf_packet[a] & OSPF_DEBUG_##b)
|
||||
|
@ -131,6 +134,7 @@ extern unsigned long term_debug_ospf_ldp_sync;
|
|||
extern unsigned long term_debug_ospf_gr;
|
||||
extern unsigned long term_debug_ospf_bfd;
|
||||
extern unsigned long term_debug_ospf_client_api;
|
||||
extern unsigned long term_debug_ospf_opaque_lsa;
|
||||
|
||||
/* Message Strings. */
|
||||
extern char *ospf_lsa_type_str[];
|
||||
|
|
|
@ -61,6 +61,12 @@ static struct ospf_lsa *
|
|||
ospf_exnl_lsa_prepare_and_flood(struct ospf *ospf, struct external_info *ei,
|
||||
struct in_addr id);
|
||||
|
||||
/*
|
||||
* LSA Update and Delete Hook LSAs.
|
||||
*/
|
||||
DEFINE_HOOK(ospf_lsa_update, (struct ospf_lsa *lsa), (lsa));
|
||||
DEFINE_HOOK(ospf_lsa_delete, (struct ospf_lsa *lsa), (lsa));
|
||||
|
||||
uint32_t get_metric(uint8_t *metric)
|
||||
{
|
||||
uint32_t m;
|
||||
|
@ -3146,6 +3152,11 @@ struct ospf_lsa *ospf_lsa_install(struct ospf *ospf, struct ospf_interface *oi,
|
|||
zlog_debug("LSA[%s]: Install LSA %p, MaxAge",
|
||||
dump_lsa_key(new), lsa);
|
||||
ospf_lsa_maxage(ospf, lsa);
|
||||
} else {
|
||||
/*
|
||||
* Invoke the LSA update hook.
|
||||
*/
|
||||
hook_call(ospf_lsa_update, new);
|
||||
}
|
||||
|
||||
return new;
|
||||
|
@ -3364,6 +3375,11 @@ void ospf_lsa_maxage(struct ospf *ospf, struct ospf_lsa *lsa)
|
|||
zlog_debug("LSA[%s]: MaxAge LSA remover scheduled.",
|
||||
dump_lsa_key(lsa));
|
||||
|
||||
/*
|
||||
* Invoke the LSA delete hook.
|
||||
*/
|
||||
hook_call(ospf_lsa_delete, lsa);
|
||||
|
||||
OSPF_TIMER_ON(ospf->t_maxage, ospf_maxage_lsa_remover,
|
||||
ospf->maxage_delay);
|
||||
}
|
||||
|
|
|
@ -363,4 +363,10 @@ static inline bool ospf_check_indication_lsa(struct ospf_lsa *lsa)
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* LSA Update and Delete Hook LSAs.
|
||||
*/
|
||||
DECLARE_HOOK(ospf_lsa_update, (struct ospf_lsa *lsa), (lsa));
|
||||
DECLARE_HOOK(ospf_lsa_delete, (struct ospf_lsa *lsa), (lsa));
|
||||
#endif /* _ZEBRA_OSPF_LSA_H */
|
||||
|
|
|
@ -147,10 +147,6 @@ static void ospf_lsdb_delete_entry(struct ospf_lsdb *lsdb,
|
|||
|
||||
rn->info = NULL;
|
||||
route_unlock_node(rn);
|
||||
#ifdef MONITOR_LSDB_CHANGE
|
||||
if (lsdb->del_lsa_hook != NULL)
|
||||
(*lsdb->del_lsa_hook)(lsa);
|
||||
#endif /* MONITOR_LSDB_CHANGE */
|
||||
ospf_lsa_unlock(&lsa); /* lsdb */
|
||||
return;
|
||||
}
|
||||
|
@ -187,10 +183,6 @@ void ospf_lsdb_add(struct ospf_lsdb *lsdb, struct ospf_lsa *lsa)
|
|||
CHECK_FLAG(lsa->data->options, OSPF_OPTION_DC))
|
||||
lsa->area->fr_info.router_lsas_recv_dc_bit++;
|
||||
|
||||
#ifdef MONITOR_LSDB_CHANGE
|
||||
if (lsdb->new_lsa_hook != NULL)
|
||||
(*lsdb->new_lsa_hook)(lsa);
|
||||
#endif /* MONITOR_LSDB_CHANGE */
|
||||
lsdb->type[lsa->data->type].checksum += ntohs(lsa->data->checksum);
|
||||
rn->info = ospf_lsa_lock(lsa); /* lsdb */
|
||||
}
|
||||
|
|
|
@ -19,12 +19,6 @@ struct ospf_lsdb {
|
|||
struct route_table *db;
|
||||
} type[OSPF_MAX_LSA];
|
||||
unsigned long total;
|
||||
#define MONITOR_LSDB_CHANGE 1 /* XXX */
|
||||
#ifdef MONITOR_LSDB_CHANGE
|
||||
/* Hooks for callback functions to catch every add/del event. */
|
||||
int (*new_lsa_hook)(struct ospf_lsa *);
|
||||
int (*del_lsa_hook)(struct ospf_lsa *);
|
||||
#endif /* MONITOR_LSDB_CHANGE */
|
||||
};
|
||||
|
||||
/* Macros. */
|
||||
|
|
|
@ -62,8 +62,13 @@ static void ospf_opaque_funclist_init(void);
|
|||
static void ospf_opaque_funclist_term(void);
|
||||
static void free_opaque_info_per_type_del(void *val);
|
||||
static void free_opaque_info_per_id(void *val);
|
||||
static int ospf_opaque_lsa_install_hook(struct ospf_lsa *lsa);
|
||||
|
||||
/*
|
||||
* OSPF Opaque specific hooks and state.
|
||||
*/
|
||||
static int ospf_opaque_lsa_update_hook(struct ospf_lsa *lsa);
|
||||
static int ospf_opaque_lsa_delete_hook(struct ospf_lsa *lsa);
|
||||
static bool ospf_opaque_lsa_hooks_registered;
|
||||
|
||||
void ospf_opaque_init(void)
|
||||
{
|
||||
|
@ -152,19 +157,19 @@ int ospf_opaque_type10_lsa_init(struct ospf_area *area)
|
|||
area->opaque_lsa_self = list_new();
|
||||
area->opaque_lsa_self->del = free_opaque_info_per_type_del;
|
||||
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 */
|
||||
if (!ospf_opaque_lsa_hooks_registered) {
|
||||
hook_register(ospf_lsa_update, ospf_opaque_lsa_update_hook);
|
||||
hook_register(ospf_lsa_delete, ospf_opaque_lsa_delete_hook);
|
||||
ospf_opaque_lsa_hooks_registered = true;
|
||||
}
|
||||
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 */
|
||||
hook_unregister(ospf_lsa_update, ospf_opaque_lsa_update_hook);
|
||||
hook_unregister(ospf_lsa_delete, ospf_opaque_lsa_delete_hook);
|
||||
ospf_opaque_lsa_hooks_registered = false;
|
||||
|
||||
EVENT_OFF(area->t_opaque_lsa_self);
|
||||
if (area->opaque_lsa_self != NULL)
|
||||
|
@ -181,19 +186,11 @@ int ospf_opaque_type11_lsa_init(struct ospf *top)
|
|||
top->opaque_lsa_self->del = free_opaque_info_per_type_del;
|
||||
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 */
|
||||
|
||||
EVENT_OFF(top->t_opaque_lsa_self);
|
||||
if (top->opaque_lsa_self != NULL)
|
||||
list_delete(&top->opaque_lsa_self);
|
||||
|
@ -297,7 +294,7 @@ static void ospf_opaque_del_functab(void *val)
|
|||
{
|
||||
struct ospf_opaque_functab *functab = (struct ospf_opaque_functab *)val;
|
||||
|
||||
if (IS_DEBUG_OSPF_EVENT)
|
||||
if (IS_DEBUG_OSPF_OPAQUE_LSA)
|
||||
zlog_debug("%s: Opaque LSA functab list deletion callback type %u (%p)",
|
||||
__func__, functab->opaque_type, functab);
|
||||
|
||||
|
@ -309,7 +306,7 @@ static void ospf_opaque_funclist_init(void)
|
|||
{
|
||||
struct list *funclist;
|
||||
|
||||
if (IS_DEBUG_OSPF_EVENT)
|
||||
if (IS_DEBUG_OSPF_OPAQUE_LSA)
|
||||
zlog_debug("%s: Function list initialize", __func__);
|
||||
|
||||
funclist = ospf_opaque_wildcard_funclist = list_new();
|
||||
|
@ -330,7 +327,7 @@ static void ospf_opaque_funclist_term(void)
|
|||
{
|
||||
struct list *funclist;
|
||||
|
||||
if (IS_DEBUG_OSPF_EVENT)
|
||||
if (IS_DEBUG_OSPF_OPAQUE_LSA)
|
||||
zlog_debug("%s: Function list terminate", __func__);
|
||||
|
||||
funclist = ospf_opaque_wildcard_funclist;
|
||||
|
@ -408,7 +405,7 @@ int ospf_register_opaque_functab(
|
|||
|
||||
for (ALL_LIST_ELEMENTS(funclist, node, nnode, functab))
|
||||
if (functab->opaque_type == opaque_type) {
|
||||
if (IS_DEBUG_OSPF_EVENT)
|
||||
if (IS_DEBUG_OSPF_OPAQUE_LSA)
|
||||
zlog_debug("%s: Opaque LSA functab found type %u, (%p)",
|
||||
__func__, functab->opaque_type,
|
||||
functab);
|
||||
|
@ -419,7 +416,7 @@ int ospf_register_opaque_functab(
|
|||
new = XCALLOC(MTYPE_OSPF_OPAQUE_FUNCTAB,
|
||||
sizeof(struct ospf_opaque_functab));
|
||||
else {
|
||||
if (IS_DEBUG_OSPF_EVENT)
|
||||
if (IS_DEBUG_OSPF_OPAQUE_LSA)
|
||||
zlog_debug("%s: Re-register Opaque LSA type %u, opaque type %u, (%p)",
|
||||
__func__, lsa_type, opaque_type, functab);
|
||||
return 0;
|
||||
|
@ -439,7 +436,7 @@ int ospf_register_opaque_functab(
|
|||
new->new_lsa_hook = new_lsa_hook;
|
||||
new->del_lsa_hook = del_lsa_hook;
|
||||
|
||||
if (IS_DEBUG_OSPF_EVENT)
|
||||
if (IS_DEBUG_OSPF_OPAQUE_LSA)
|
||||
zlog_debug("%s: Register Opaque LSA type %u, opaque type %u, (%p)",
|
||||
__func__, lsa_type, opaque_type, new);
|
||||
|
||||
|
@ -458,7 +455,7 @@ void ospf_delete_opaque_functab(uint8_t lsa_type, uint8_t opaque_type)
|
|||
if ((funclist = ospf_get_opaque_funclist(lsa_type)) != NULL)
|
||||
for (ALL_LIST_ELEMENTS(funclist, node, nnode, functab)) {
|
||||
if (functab->opaque_type == opaque_type) {
|
||||
if (IS_DEBUG_OSPF_EVENT)
|
||||
if (IS_DEBUG_OSPF_OPAQUE_LSA)
|
||||
zlog_debug("%s: Delete Opaque functab LSA type %u, opaque type %u, (%p)",
|
||||
__func__, lsa_type,
|
||||
opaque_type, functab);
|
||||
|
@ -608,7 +605,7 @@ register_opaque_info_per_type(struct ospf_opaque_functab *functab,
|
|||
oipt->id_list = list_new();
|
||||
oipt->id_list->del = free_opaque_info_per_id;
|
||||
|
||||
if (IS_DEBUG_OSPF_EVENT)
|
||||
if (IS_DEBUG_OSPF_OPAQUE_LSA)
|
||||
zlog_debug("%s: Register Opaque info-per-type LSA type %u, opaque type %u, (%p), Functab (%p)",
|
||||
__func__, oipt->lsa_type, oipt->opaque_type, oipt,
|
||||
oipt->functab);
|
||||
|
@ -662,7 +659,7 @@ static void free_opaque_info_per_type(struct opaque_info_per_type *oipt,
|
|||
if (oipt->functab)
|
||||
ospf_opaque_functab_deref(oipt->functab);
|
||||
|
||||
if (IS_DEBUG_OSPF_EVENT)
|
||||
if (IS_DEBUG_OSPF_OPAQUE_LSA)
|
||||
zlog_debug("%s: Free Opaque info-per-type LSA type %u, opaque type %u, (%p), Functab (%p)",
|
||||
__func__, oipt->lsa_type, oipt->opaque_type, oipt,
|
||||
oipt->functab);
|
||||
|
@ -825,7 +822,7 @@ void ospf_opaque_type9_lsa_if_cleanup(struct ospf_interface *oi)
|
|||
* is removed from the interface opaque info list.
|
||||
*/
|
||||
if (lsa->oi == oi) {
|
||||
if (IS_DEBUG_OSPF_EVENT)
|
||||
if (IS_DEBUG_OSPF_OPAQUE_LSA)
|
||||
zlog_debug("Delete Type-9 Opaque-LSA on interface delete: [opaque-type=%u, opaque-id=%x]",
|
||||
GET_OPAQUE_TYPE(
|
||||
ntohl(lsa->data->id.s_addr)),
|
||||
|
@ -833,6 +830,12 @@ void ospf_opaque_type9_lsa_if_cleanup(struct ospf_interface *oi)
|
|||
lsa->data->id.s_addr)));
|
||||
ospf_lsdb_delete(lsdb, lsa);
|
||||
lsa->data->ls_age = htons(OSPF_LSA_MAXAGE);
|
||||
|
||||
/*
|
||||
* Invoke the delete hook directly since it bypasses the normal MAXAGE
|
||||
* processing.
|
||||
*/
|
||||
ospf_opaque_lsa_delete_hook(lsa);
|
||||
lsa->oi = NULL;
|
||||
ospf_lsa_discard(lsa);
|
||||
}
|
||||
|
@ -859,7 +862,7 @@ DEFUN (capability_opaque,
|
|||
|
||||
/* Turn on the "master switch" of opaque-lsa capability. */
|
||||
if (!CHECK_FLAG(ospf->config, OSPF_OPAQUE_CAPABLE)) {
|
||||
if (IS_DEBUG_OSPF_EVENT)
|
||||
if (IS_DEBUG_OSPF_OPAQUE_LSA)
|
||||
zlog_debug("Opaque capability: OFF -> ON");
|
||||
|
||||
SET_FLAG(ospf->config, OSPF_OPAQUE_CAPABLE);
|
||||
|
@ -888,7 +891,7 @@ DEFUN (no_capability_opaque,
|
|||
|
||||
/* Turn off the "master switch" of opaque-lsa capability. */
|
||||
if (CHECK_FLAG(ospf->config, OSPF_OPAQUE_CAPABLE)) {
|
||||
if (IS_DEBUG_OSPF_EVENT)
|
||||
if (IS_DEBUG_OSPF_OPAQUE_LSA)
|
||||
zlog_debug("Opaque capability: ON -> OFF");
|
||||
|
||||
UNSET_FLAG(ospf->config, OSPF_OPAQUE_CAPABLE);
|
||||
|
@ -1151,7 +1154,7 @@ void ospf_opaque_nsm_change(struct ospf_neighbor *nbr, int old_state)
|
|||
if (CHECK_FLAG(nbr->options, OSPF_OPTION_O)) {
|
||||
if (!CHECK_FLAG(top->opaque,
|
||||
OPAQUE_OPERATION_READY_BIT)) {
|
||||
if (IS_DEBUG_OSPF_EVENT)
|
||||
if (IS_DEBUG_OSPF_OPAQUE_LSA)
|
||||
zlog_debug(
|
||||
"Opaque-LSA: Now get operational!");
|
||||
|
||||
|
@ -1316,11 +1319,15 @@ void ospf_opaque_lsa_dump(struct stream *s, uint16_t length)
|
|||
return;
|
||||
}
|
||||
|
||||
static int ospf_opaque_lsa_install_hook(struct ospf_lsa *lsa)
|
||||
static int ospf_opaque_lsa_update_hook(struct ospf_lsa *lsa)
|
||||
{
|
||||
struct list *funclist;
|
||||
int rc = -1;
|
||||
|
||||
if (IS_DEBUG_OSPF_OPAQUE_LSA)
|
||||
zlog_debug("%s: LSA [Type %d: %pI4] Seq: 0x%x %sLSA Update Hook ", __func__,
|
||||
lsa->data->type, &lsa->data->id, ntohl(lsa->data->ls_seqnum),
|
||||
IS_LSA_MAXAGE(lsa) ? "MaxAged " : "");
|
||||
/*
|
||||
* Some Opaque-LSA user may want to monitor every LSA installation
|
||||
* into the LSDB, regardless with target LSA type.
|
||||
|
@ -1351,6 +1358,10 @@ static int ospf_opaque_lsa_delete_hook(struct ospf_lsa *lsa)
|
|||
struct list *funclist;
|
||||
int rc = -1;
|
||||
|
||||
if (IS_DEBUG_OSPF_OPAQUE_LSA)
|
||||
zlog_debug("%s: LSA [Type %d: %pI4] Seq: 0x%x %sLSA Delete Hook ", __func__,
|
||||
lsa->data->type, &lsa->data->id, ntohl(lsa->data->ls_seqnum),
|
||||
IS_LSA_MAXAGE(lsa) ? "MaxAged " : "");
|
||||
/*
|
||||
* Some Opaque-LSA user may want to monitor every LSA deletion
|
||||
* from the LSDB, regardless with target LSA type.
|
||||
|
@ -1394,14 +1405,14 @@ void ospf_opaque_lsa_originate_schedule(struct ospf_interface *oi, int *delay0)
|
|||
int delay = 0;
|
||||
|
||||
if ((top = oi_to_top(oi)) == NULL || (area = oi->area) == NULL) {
|
||||
if (IS_DEBUG_OSPF_EVENT)
|
||||
if (IS_DEBUG_OSPF_OPAQUE_LSA)
|
||||
zlog_debug("%s: Invalid argument?", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
/* It may not a right time to schedule origination now. */
|
||||
if (!CHECK_FLAG(top->opaque, OPAQUE_OPERATION_READY_BIT)) {
|
||||
if (IS_DEBUG_OSPF_EVENT)
|
||||
if (IS_DEBUG_OSPF_OPAQUE_LSA)
|
||||
zlog_debug("%s: Not operational.", __func__);
|
||||
return; /* This is not an error. */
|
||||
}
|
||||
|
@ -1423,7 +1434,7 @@ void ospf_opaque_lsa_originate_schedule(struct ospf_interface *oi, int *delay0)
|
|||
if (!list_isempty(ospf_opaque_type9_funclist)
|
||||
&& list_isempty(oi->opaque_lsa_self)
|
||||
&& oi->t_opaque_lsa_self == NULL) {
|
||||
if (IS_DEBUG_OSPF_EVENT)
|
||||
if (IS_DEBUG_OSPF_OPAQUE_LSA)
|
||||
zlog_debug(
|
||||
"Schedule Type-9 Opaque-LSA origination in %d ms later.",
|
||||
delay);
|
||||
|
@ -1441,7 +1452,7 @@ void ospf_opaque_lsa_originate_schedule(struct ospf_interface *oi, int *delay0)
|
|||
* conditions prevent from scheduling the originate function
|
||||
* again and again.
|
||||
*/
|
||||
if (IS_DEBUG_OSPF_EVENT)
|
||||
if (IS_DEBUG_OSPF_OPAQUE_LSA)
|
||||
zlog_debug(
|
||||
"Schedule Type-10 Opaque-LSA origination in %d ms later.",
|
||||
delay);
|
||||
|
@ -1459,7 +1470,7 @@ void ospf_opaque_lsa_originate_schedule(struct ospf_interface *oi, int *delay0)
|
|||
* conditions prevent from scheduling the originate function
|
||||
* again and again.
|
||||
*/
|
||||
if (IS_DEBUG_OSPF_EVENT)
|
||||
if (IS_DEBUG_OSPF_OPAQUE_LSA)
|
||||
zlog_debug(
|
||||
"Schedule Type-11 Opaque-LSA origination in %d ms later.",
|
||||
delay);
|
||||
|
@ -1559,7 +1570,7 @@ static void ospf_opaque_type9_lsa_originate(struct event *t)
|
|||
oi = EVENT_ARG(t);
|
||||
oi->t_opaque_lsa_self = NULL;
|
||||
|
||||
if (IS_DEBUG_OSPF_EVENT)
|
||||
if (IS_DEBUG_OSPF_OPAQUE_LSA)
|
||||
zlog_debug("Timer[Type9-LSA]: Originate Opaque-LSAs for OI %s",
|
||||
IF_NAME(oi));
|
||||
|
||||
|
@ -1573,7 +1584,7 @@ static void ospf_opaque_type10_lsa_originate(struct event *t)
|
|||
area = EVENT_ARG(t);
|
||||
area->t_opaque_lsa_self = NULL;
|
||||
|
||||
if (IS_DEBUG_OSPF_EVENT)
|
||||
if (IS_DEBUG_OSPF_OPAQUE_LSA)
|
||||
zlog_debug(
|
||||
"Timer[Type10-LSA]: Originate Opaque-LSAs for Area %pI4",
|
||||
&area->area_id);
|
||||
|
@ -1588,7 +1599,7 @@ static void ospf_opaque_type11_lsa_originate(struct event *t)
|
|||
top = EVENT_ARG(t);
|
||||
top->t_opaque_lsa_self = NULL;
|
||||
|
||||
if (IS_DEBUG_OSPF_EVENT)
|
||||
if (IS_DEBUG_OSPF_OPAQUE_LSA)
|
||||
zlog_debug(
|
||||
"Timer[Type11-LSA]: Originate AS-External Opaque-LSAs");
|
||||
|
||||
|
@ -1643,12 +1654,10 @@ struct ospf_lsa *ospf_opaque_lsa_install(struct ospf_lsa *lsa, int rt_recalc)
|
|||
goto out;
|
||||
}
|
||||
|
||||
if (IS_DEBUG_OSPF(lsa, LSA_INSTALL))
|
||||
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)));
|
||||
if (IS_DEBUG_OSPF_OPAQUE_LSA)
|
||||
zlog_debug("%s: Install Type-%u Opaque-LSA: [opaque-type=%u, opaque-id=%x]",
|
||||
__func__, lsa->data->type, GET_OPAQUE_TYPE(ntohl(lsa->data->id.s_addr)),
|
||||
GET_OPAQUE_ID(ntohl(lsa->data->id.s_addr)));
|
||||
|
||||
/* Replace the existing lsa with the new one. */
|
||||
if ((oipt = lookup_opaque_info_by_type(lsa)) != NULL
|
||||
|
@ -1722,7 +1731,7 @@ struct ospf_lsa *ospf_opaque_lsa_refresh(struct ospf_lsa *lsa)
|
|||
* Anyway, this node still has a responsibility to flush this
|
||||
* LSA from the routing domain.
|
||||
*/
|
||||
if (IS_DEBUG_OSPF_EVENT)
|
||||
if (IS_DEBUG_OSPF_OPAQUE_LSA)
|
||||
zlog_debug("LSA[Type%d:%pI4]: Flush stray Opaque-LSA",
|
||||
lsa->data->type, &lsa->data->id);
|
||||
|
||||
|
@ -1841,7 +1850,7 @@ void ospf_opaque_lsa_reoriginate_schedule(void *lsa_type_dependent,
|
|||
|
||||
/* It may not a right time to schedule reorigination now. */
|
||||
if (!CHECK_FLAG(top->opaque, OPAQUE_OPERATION_READY_BIT)) {
|
||||
if (IS_DEBUG_OSPF_EVENT)
|
||||
if (IS_DEBUG_OSPF_OPAQUE_LSA)
|
||||
zlog_debug("%s: Not operational.", __func__);
|
||||
goto out; /* This is not an error. */
|
||||
}
|
||||
|
@ -1870,7 +1879,7 @@ void ospf_opaque_lsa_reoriginate_schedule(void *lsa_type_dependent,
|
|||
}
|
||||
|
||||
if (oipt->t_opaque_lsa_self != NULL) {
|
||||
if (IS_DEBUG_OSPF_EVENT)
|
||||
if (IS_DEBUG_OSPF_OPAQUE_LSA)
|
||||
zlog_debug(
|
||||
"Type-%u Opaque-LSA has already scheduled to RE-ORIGINATE: [opaque-type=%u]",
|
||||
lsa_type,
|
||||
|
@ -1887,7 +1896,7 @@ void ospf_opaque_lsa_reoriginate_schedule(void *lsa_type_dependent,
|
|||
*/
|
||||
delay = top->min_ls_interval; /* XXX */
|
||||
|
||||
if (IS_DEBUG_OSPF_EVENT)
|
||||
if (IS_DEBUG_OSPF_OPAQUE_LSA)
|
||||
zlog_debug(
|
||||
"Schedule Type-%u Opaque-LSA to RE-ORIGINATE in %d ms later: [opaque-type=%u]",
|
||||
lsa_type, delay,
|
||||
|
@ -1943,7 +1952,7 @@ static void ospf_opaque_type9_lsa_reoriginate_timer(struct event *t)
|
|||
if (!CHECK_FLAG(top->config, OSPF_OPAQUE_CAPABLE) ||
|
||||
!OSPF_IF_PARAM(oi, opaque_capable) || !ospf_if_is_enable(oi) ||
|
||||
ospf_nbr_count_opaque_capable(oi) == 0) {
|
||||
if (IS_DEBUG_OSPF_EVENT)
|
||||
if (IS_DEBUG_OSPF_OPAQUE_LSA)
|
||||
zlog_debug(
|
||||
"Suspend re-origination of Type-9 Opaque-LSAs (opaque-type=%u) for a while...",
|
||||
oipt->opaque_type);
|
||||
|
@ -1952,7 +1961,7 @@ static void ospf_opaque_type9_lsa_reoriginate_timer(struct event *t)
|
|||
return;
|
||||
}
|
||||
|
||||
if (IS_DEBUG_OSPF_EVENT)
|
||||
if (IS_DEBUG_OSPF_OPAQUE_LSA)
|
||||
zlog_debug(
|
||||
"Timer[Type9-LSA]: Re-originate Opaque-LSAs (opaque-type=%u) for OI (%s)",
|
||||
oipt->opaque_type, IF_NAME(oi));
|
||||
|
@ -1992,7 +2001,7 @@ static void ospf_opaque_type10_lsa_reoriginate_timer(struct event *t)
|
|||
}
|
||||
|
||||
if (n == 0 || !CHECK_FLAG(top->config, OSPF_OPAQUE_CAPABLE)) {
|
||||
if (IS_DEBUG_OSPF_EVENT)
|
||||
if (IS_DEBUG_OSPF_OPAQUE_LSA)
|
||||
zlog_debug(
|
||||
"Suspend re-origination of Type-10 Opaque-LSAs (opaque-type=%u) for a while...",
|
||||
oipt->opaque_type);
|
||||
|
@ -2001,7 +2010,7 @@ static void ospf_opaque_type10_lsa_reoriginate_timer(struct event *t)
|
|||
return;
|
||||
}
|
||||
|
||||
if (IS_DEBUG_OSPF_EVENT)
|
||||
if (IS_DEBUG_OSPF_OPAQUE_LSA)
|
||||
zlog_debug(
|
||||
"Timer[Type10-LSA]: Re-originate Opaque-LSAs (opaque-type=%u) for Area %pI4",
|
||||
oipt->opaque_type, &area->area_id);
|
||||
|
@ -2029,7 +2038,7 @@ static void ospf_opaque_type11_lsa_reoriginate_timer(struct event *t)
|
|||
}
|
||||
|
||||
if (!CHECK_FLAG(top->config, OSPF_OPAQUE_CAPABLE)) {
|
||||
if (IS_DEBUG_OSPF_EVENT)
|
||||
if (IS_DEBUG_OSPF_OPAQUE_LSA)
|
||||
zlog_debug(
|
||||
"Suspend re-origination of Type-11 Opaque-LSAs (opaque-type=%u) for a while...",
|
||||
oipt->opaque_type);
|
||||
|
@ -2038,7 +2047,7 @@ static void ospf_opaque_type11_lsa_reoriginate_timer(struct event *t)
|
|||
return;
|
||||
}
|
||||
|
||||
if (IS_DEBUG_OSPF_EVENT)
|
||||
if (IS_DEBUG_OSPF_OPAQUE_LSA)
|
||||
zlog_debug(
|
||||
"Timer[Type11-LSA]: Re-originate Opaque-LSAs (opaque-type=%u).",
|
||||
oipt->opaque_type);
|
||||
|
@ -2067,7 +2076,7 @@ void ospf_opaque_lsa_refresh_schedule(struct ospf_lsa *lsa0)
|
|||
}
|
||||
|
||||
if (oipi->t_opaque_lsa_self != NULL) {
|
||||
if (IS_DEBUG_OSPF_EVENT)
|
||||
if (IS_DEBUG_OSPF_OPAQUE_LSA)
|
||||
zlog_debug(
|
||||
"Type-%u Opaque-LSA has already scheduled to REFRESH: [opaque-type=%u, opaque-id=%x]",
|
||||
lsa->data->type,
|
||||
|
@ -2098,7 +2107,7 @@ void ospf_opaque_lsa_refresh_schedule(struct ospf_lsa *lsa0)
|
|||
|
||||
delay = ospf_lsa_refresh_delay(ospf, lsa);
|
||||
|
||||
if (IS_DEBUG_OSPF_EVENT)
|
||||
if (IS_DEBUG_OSPF_OPAQUE_LSA)
|
||||
zlog_debug("Schedule Type-%u Opaque-LSA to REFRESH in %d msec 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)));
|
||||
|
@ -2114,7 +2123,7 @@ static void ospf_opaque_lsa_refresh_timer(struct event *t)
|
|||
struct ospf_opaque_functab *functab;
|
||||
struct ospf_lsa *lsa;
|
||||
|
||||
if (IS_DEBUG_OSPF_EVENT)
|
||||
if (IS_DEBUG_OSPF_OPAQUE_LSA)
|
||||
zlog_debug("Timer[Opaque-LSA]: (Opaque-LSA Refresh expire)");
|
||||
|
||||
oipi = EVENT_ARG(t);
|
||||
|
@ -2180,7 +2189,7 @@ void ospf_opaque_lsa_flush_schedule(struct ospf_lsa *lsa0)
|
|||
/* Dequeue listnode entry from the list. */
|
||||
listnode_delete(oipt->id_list, oipi);
|
||||
|
||||
if (IS_DEBUG_OSPF_EVENT)
|
||||
if (IS_DEBUG_OSPF_OPAQUE_LSA)
|
||||
zlog_debug(
|
||||
"Schedule Type-%u Opaque-LSA to FLUSH: [opaque-type=%u, opaque-id=%x]",
|
||||
lsa->data->type,
|
||||
|
@ -2202,7 +2211,7 @@ void ospf_opaque_self_originated_lsa_received(struct ospf_neighbor *nbr,
|
|||
if ((top = oi_to_top(nbr->oi)) == NULL)
|
||||
return;
|
||||
|
||||
if (IS_DEBUG_OSPF_EVENT)
|
||||
if (IS_DEBUG_OSPF_OPAQUE_LSA)
|
||||
zlog_debug(
|
||||
"LSA[Type%d:%pI4]: processing self-originated Opaque-LSA",
|
||||
lsa->data->type, &lsa->data->id);
|
||||
|
|
|
@ -3015,7 +3015,7 @@ static int ospf_te_delete_opaque_lsa(struct ls_ted *ted, struct ospf_lsa *lsa)
|
|||
|
||||
/**
|
||||
* Update Traffic Engineering Database Elements that correspond to the received
|
||||
* OSPF LSA. If LSA age is equal to MAX_AGE, call deletion function instead.
|
||||
* OSPF LSA.
|
||||
*
|
||||
* @param lsa OSPF Link State Advertisement
|
||||
*
|
||||
|
@ -3037,34 +3037,18 @@ static int ospf_mpls_te_lsa_update(struct ospf_lsa *lsa)
|
|||
return -1;
|
||||
}
|
||||
|
||||
/* If LSA is MAX_AGE, remove corresponding Link State element */
|
||||
if (IS_LSA_MAXAGE(lsa)) {
|
||||
switch (lsa->data->type) {
|
||||
case OSPF_ROUTER_LSA:
|
||||
rc = ospf_te_delete_router_lsa(OspfMplsTE.ted, lsa);
|
||||
break;
|
||||
case OSPF_OPAQUE_AREA_LSA:
|
||||
case OSPF_OPAQUE_AS_LSA:
|
||||
rc = ospf_te_delete_opaque_lsa(OspfMplsTE.ted, lsa);
|
||||
break;
|
||||
default:
|
||||
rc = 0;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
/* Parse LSA to Update corresponding Link State element */
|
||||
switch (lsa->data->type) {
|
||||
case OSPF_ROUTER_LSA:
|
||||
rc = ospf_te_parse_router_lsa(OspfMplsTE.ted, lsa);
|
||||
break;
|
||||
case OSPF_OPAQUE_AREA_LSA:
|
||||
case OSPF_OPAQUE_AS_LSA:
|
||||
rc = ospf_te_parse_opaque_lsa(OspfMplsTE.ted, lsa);
|
||||
break;
|
||||
default:
|
||||
rc = 0;
|
||||
break;
|
||||
}
|
||||
/* Parse LSA to Update corresponding Link State element */
|
||||
switch (lsa->data->type) {
|
||||
case OSPF_ROUTER_LSA:
|
||||
rc = ospf_te_parse_router_lsa(OspfMplsTE.ted, lsa);
|
||||
break;
|
||||
case OSPF_OPAQUE_AREA_LSA:
|
||||
case OSPF_OPAQUE_AS_LSA:
|
||||
rc = ospf_te_parse_opaque_lsa(OspfMplsTE.ted, lsa);
|
||||
break;
|
||||
default:
|
||||
rc = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
return rc;
|
||||
|
@ -3096,19 +3080,6 @@ static int ospf_mpls_te_lsa_delete(struct ospf_lsa *lsa)
|
|||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Process only self LSAs that reach MAX_AGE. Indeed, when the router
|
||||
* need to update or refresh an LSA, it first removes the old LSA from
|
||||
* the LSDB and then insert the new one. Thus, to avoid removing
|
||||
* corresponding Link State element and loosing some parameters
|
||||
* instead of just updating it, only self LSAs that reach MAX_AGE are
|
||||
* processed here. Other LSAs are processed by ospf_mpls_te_lsa_update()
|
||||
* and eventually removed when LSA age is MAX_AGE i.e. LSA is flushed
|
||||
* by the originator.
|
||||
*/
|
||||
if (!IS_LSA_SELF(lsa) || !IS_LSA_MAXAGE(lsa))
|
||||
return 0;
|
||||
|
||||
/* Parse Link State information */
|
||||
switch (lsa->data->type) {
|
||||
case OSPF_ROUTER_LSA:
|
||||
|
|
Loading…
Reference in a new issue