diff options
| -rw-r--r-- | isisd/isis_northbound.c | 28 | ||||
| -rw-r--r-- | isisd/isis_pdu.c | 11 | ||||
| -rw-r--r-- | isisd/isisd.h | 3 |
3 files changed, 42 insertions, 0 deletions
diff --git a/isisd/isis_northbound.c b/isisd/isis_northbound.c index 593f5be054..1b6f46feb1 100644 --- a/isisd/isis_northbound.c +++ b/isisd/isis_northbound.c @@ -2863,6 +2863,34 @@ void isis_notif_version_skew(const struct isis_circuit *circuit, nb_notification_send(xpath, arguments); } +/* + * XPath: + * /frr-isisd:lsp-error-detected + */ +void isis_notif_lsp_error(const struct isis_circuit *circuit, + const char *lsp_id, const char *raw_pdu, + __attribute__((unused)) uint32_t offset, + __attribute__((unused)) uint8_t tlv_type) +{ + const char *xpath = "/frr-isisd:lsp-error-detected"; + 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); + snprintf(xpath_arg, sizeof(xpath_arg), "%s/raw-pdu", xpath); + data = yang_data_new(xpath_arg, raw_pdu); + listnode_add(arguments, data); + /* ignore offset and tlv_type which cannot be set properly */ + + 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 219900bba0..2db07ea79e 100644 --- a/isisd/isis_pdu.c +++ b/isisd/isis_pdu.c @@ -916,6 +916,17 @@ static int process_lsp(uint8_t pdu_type, struct isis_circuit *circuit, circuit->rcv_stream, &tlvs, &error_log)) { zlog_warn("Something went wrong unpacking the LSP: %s", error_log); +#ifndef FABRICD + /* send northbound notification. Note that the tlv-type and + * offset cannot correctly be set here as they are not returned + * by isis_unpack_tlvs, but in there I cannot fire a + * notification because I have no circuit information. So until + * we change the code above to return those extra fields, we + * will send dummy values which are ignored in the callback + */ + isis_notif_lsp_error(circuit, rawlspid_print(hdr.lsp_id), + raw_pdu, 0, 0); +#endif /* ifndef FABRICD */ goto out; } diff --git a/isisd/isisd.h b/isisd/isisd.h index 87d2065142..199e64b442 100644 --- a/isisd/isisd.h +++ b/isisd/isisd.h @@ -256,6 +256,9 @@ extern void isis_notif_id_len_mismatch(const struct isis_circuit *circuit, uint8_t rcv_id_len, const char *raw_pdu); extern void isis_notif_version_skew(const struct isis_circuit *circuit, uint8_t version, const char *raw_pdu); +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); /* Master of threads. */ extern struct thread_master *master; |
