From 897989f8710208ce8aa6cf5efe5de1927569fb4f Mon Sep 17 00:00:00 2001 From: Emanuele Di Pascale Date: Wed, 14 Nov 2018 16:09:43 +0100 Subject: [PATCH] isisd: implemented the 'sequence-number-skipped' notification Signed-off-by: Emanuele Di Pascale --- isisd/isis_northbound.c | 22 ++++++++++++++++++++++ isisd/isis_pdu.c | 15 +++++++++++++++ isisd/isisd.h | 2 ++ 3 files changed, 39 insertions(+) diff --git a/isisd/isis_northbound.c b/isisd/isis_northbound.c index 1b6f46feb1..f76d85cc36 100644 --- a/isisd/isis_northbound.c +++ b/isisd/isis_northbound.c @@ -2891,6 +2891,28 @@ void isis_notif_lsp_error(const struct isis_circuit *circuit, nb_notification_send(xpath, arguments); } +/* + * XPath: + * /frr-isisd:sequence-number-skipped + */ +void isis_notif_seqno_skipped(const struct isis_circuit *circuit, + const char *lsp_id) +{ + const char *xpath = "/frr-isisd:sequence-number-skipped"; + struct list *arguments = yang_data_list_new(); + char xpath_arg[XPATH_MAXLEN]; + struct yang_data *data; + struct isis_area *area = circuit->area; + + notif_prep_instance_hdr(xpath, area, "default", arguments); + notif_prepr_iface_hdr(xpath, circuit, arguments); + snprintf(xpath_arg, sizeof(xpath_arg), "%s/lsp-id", xpath); + data = yang_data_new_string(xpath_arg, lsp_id); + listnode_add(arguments, data); + + nb_notification_send(xpath, arguments); +} + /* clang-format off */ const struct frr_yang_module_info frr_isisd_info = { .name = "frr-isisd", diff --git a/isisd/isis_pdu.c b/isisd/isis_pdu.c index 2db07ea79e..a5ec27e47e 100644 --- a/isisd/isis_pdu.c +++ b/isisd/isis_pdu.c @@ -1091,6 +1091,16 @@ dontcheckadj: } else if (lsp->hdr.rem_lifetime != 0) { /* our own LSP -> 7.3.16.4 c) */ if (comp == LSP_NEWER) { +#ifndef FABRICD + if (lsp->hdr.seqno < hdr.seqno) { + /* send northbound + * notification */ + isis_notif_seqno_skipped( + circuit, + rawlspid_print( + hdr.lsp_id)); + } +#endif /* ifndef FABRICD */ lsp_inc_seqno(lsp, hdr.seqno); lsp_flood_or_update(lsp, NULL, circuit_scoped); @@ -1131,6 +1141,11 @@ dontcheckadj: if (comp == LSP_NEWER) { /* 7.3.16.1 */ lsp_inc_seqno(lsp, hdr.seqno); +#ifndef FABRICD + /* send northbound notification */ + isis_notif_seqno_skipped(circuit, + rawlspid_print(hdr.lsp_id)); +#endif /* ifndef FABRICD */ if (isis->debugs & DEBUG_UPDATE_PACKETS) { zlog_debug( "ISIS-Upd (%s): (2) re-originating LSP %s new seq 0x%08" PRIx32, diff --git a/isisd/isisd.h b/isisd/isisd.h index 199e64b442..9d0d7f690f 100644 --- a/isisd/isisd.h +++ b/isisd/isisd.h @@ -259,6 +259,8 @@ extern void isis_notif_version_skew(const struct isis_circuit *circuit, extern void isis_notif_lsp_error(const struct isis_circuit *circuit, const char *lsp_id, const char *raw_pdu, uint32_t offset, uint8_t tlv_type); +extern void isis_notif_seqno_skipped(const struct isis_circuit *circuit, + const char *lsp_id); /* Master of threads. */ extern struct thread_master *master; -- 2.39.5