.. 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]
+ Enable or disable debugging of ZEBRA API
+.. clicmd:: debug ospf [(1-65535)] graceful-restart
- Show debug information of ZEBRA API
+ Enable or disable debugying for OSPF Graceful Restart Helper
.. clicmd:: debug ospf [(1-65535)] graceful-restart
-
- Enable/disable debug information for OSPF Graceful Restart Helper
+ Enable or disable debugging for OSPF Opaque LSA processing
.. clicmd:: show debugging ospf
-
+ Show enabled OSPF debugging options
Sample Configuration
====================
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)
{
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;
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);
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);
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));
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));
return;
}
- if (IS_DEBUG_OSPF_EVENT)
+ if (IS_DEBUG_OSPF_CLIENT_API)
msg_print(msg);
/* Dispatch to corresponding message handler. */
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));
return;
}
- if (IS_DEBUG_OSPF_EVENT)
+ if (IS_DEBUG_OSPF_CLIENT_API)
msg_print(msg);
rc = msg_write(fd, msg);
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));
return;
}
- if (IS_DEBUG_OSPF_EVENT)
+ if (IS_DEBUG_OSPF_CLIENT_API)
msg_print(msg);
rc = msg_write(fd, msg);
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));
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);
}
/* 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,
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,
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);
}
*/
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);
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);
}
}
} 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;
}
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);
}
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};
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)
{
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",
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);
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;
}
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;
}
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) {
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);
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);
#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)
#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)
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[];
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;
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;
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);
}
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 */
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;
}
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 */
}
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. */
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)
{
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)
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);
{
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);
{
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();
{
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;
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);
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;
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);
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);
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);
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);
* 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)),
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);
}
/* 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);
/* 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);
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!");
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.
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.
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. */
}
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);
* 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);
* 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);
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));
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);
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");
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
* 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);
/* 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. */
}
}
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,
*/
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,
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);
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));
}
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);
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);
}
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);
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);
}
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,
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)));
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);
/* 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,
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);
/**
* 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
*
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;
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: