From b21b068dc9066197fc499801eb386c373a743a92 Mon Sep 17 00:00:00 2001 From: Emanuele Di Pascale Date: Wed, 14 Nov 2018 15:08:26 +0100 Subject: [PATCH] isisd: implement the 'attempt-to-exceed-max-sequence' notification Signed-off-by: Emanuele Di Pascale --- isisd/isis_lsp.c | 9 +++++++++ isisd/isis_northbound.c | 19 +++++++++++++++++++ isisd/isisd.h | 2 ++ 3 files changed, 30 insertions(+) diff --git a/isisd/isis_lsp.c b/isisd/isis_lsp.c index 8d393c7a08..8b2af9975c 100644 --- a/isisd/isis_lsp.c +++ b/isisd/isis_lsp.c @@ -355,6 +355,15 @@ void lsp_inc_seqno(struct isis_lsp *lsp, uint32_t seqno) else newseq = seqno + 1; +#ifndef FABRICD + /* check for overflow */ + if (newseq < lsp->hdr.seqno) { + /* send northbound notification */ + isis_notif_lsp_exceed_max(lsp->area, + rawlspid_print(lsp->hdr.lsp_id)); + } +#endif /* ifndef FABRICD */ + lsp->hdr.seqno = newseq; lsp_pack_pdu(lsp); diff --git a/isisd/isis_northbound.c b/isisd/isis_northbound.c index 136fec2375..c112c64ca1 100644 --- a/isisd/isis_northbound.c +++ b/isisd/isis_northbound.c @@ -2569,6 +2569,25 @@ void isis_notif_corrupted_lsp(const struct isis_area *area, const char *lsp_id) nb_notification_send(xpath, arguments); } +/* + * XPath: + * /frr-isisd:attempt-to-exceed-max-sequence + */ +void isis_notif_lsp_exceed_max(const struct isis_area *area, const char *lsp_id) +{ + const char *xpath = "/frr-isisd:attempt-to-exceed-max-sequence"; + struct list *arguments = yang_data_list_new(); + char xpath_arg[XPATH_MAXLEN]; + struct yang_data *data; + + notif_prep_instance_hdr(xpath, area, "default", 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/isisd.h b/isisd/isisd.h index 12d3f2bec2..6f32dbdd58 100644 --- a/isisd/isisd.h +++ b/isisd/isisd.h @@ -229,6 +229,8 @@ extern void isis_notif_if_state_change(const struct isis_circuit *circuit, bool down); extern void isis_notif_corrupted_lsp(const struct isis_area *area, const char *lsp_id); /* currently unused */ +extern void isis_notif_lsp_exceed_max(const struct isis_area *area, + const char *lsp_id); /* Master of threads. */ extern struct thread_master *master; -- 2.39.5