]> git.proxmox.com Git - mirror_frr.git/blobdiff - isisd/isis_pdu.c
lib: enforce vrf_name_to_id by returning default_vrf when name is null
[mirror_frr.git] / isisd / isis_pdu.c
index 49869ccbab8d369b6aa9d8b047f0f596d5438968..330da9b216b62a5c760200dacf64f6bb0b3adf57 100644 (file)
@@ -683,6 +683,10 @@ static int process_hello(uint8_t pdu_type, struct isis_circuit *circuit,
 
        if (!iih.tlvs->area_addresses.count) {
                zlog_warn("No Area addresses TLV in %s", pdu_name);
+#ifndef FABRICD
+               /* send northbound notification */
+               isis_notif_area_mismatch(circuit, raw_pdu);
+#endif /* ifndef FABRICD */
                goto out;
        }
 
@@ -736,6 +740,10 @@ static int process_hello(uint8_t pdu_type, struct isis_circuit *circuit,
                                circuit->area->area_tag, level,
                                circuit->interface->name);
                }
+#ifndef FABRICD
+               /* send northbound notification */
+               isis_notif_area_mismatch(circuit, raw_pdu);
+#endif /* ifndef FABRICD */
                goto out;
        }
 
@@ -836,6 +844,12 @@ static int process_lsp(uint8_t pdu_type, struct isis_circuit *circuit,
        hdr.checksum = stream_getw(circuit->rcv_stream);
        hdr.lsp_bits = stream_getc(circuit->rcv_stream);
 
+#ifndef FABRICD
+       /* send northbound notification */
+       isis_notif_lsp_received(circuit, rawlspid_print(hdr.lsp_id), hdr.seqno,
+                               time(NULL), sysid_print(hdr.lsp_id));
+#endif /* ifndef FABRICD */
+
        if (pdu_len_validate(hdr.pdu_len, circuit)) {
                zlog_debug("ISIS-Upd (%s): LSP %s invalid LSP length %" PRIu16,
                           circuit->area->area_tag, rawlspid_print(hdr.lsp_id),
@@ -902,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;
        }
 
@@ -1066,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);
@@ -1082,6 +1117,13 @@ dontcheckadj:
                                                circuit->area->area_tag,
                                                rawlspid_print(hdr.lsp_id),
                                                lsp->hdr.seqno);
+                       } else {
+                               /* our own LSP with 0 remaining life time */
+#ifndef FABRICD
+                               /* send northbound notification */
+                               isis_notif_own_lsp_purge(
+                                       circuit, rawlspid_print(hdr.lsp_id));
+#endif /* ifndef FABRICD */
                        }
                }
                goto out;
@@ -1106,6 +1148,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,
@@ -1561,6 +1608,10 @@ int isis_handle_pdu(struct isis_circuit *circuit, uint8_t *ssnpa)
 
        if (version1 != 1) {
                zlog_warn("Unsupported ISIS version %" PRIu8, version1);
+#ifndef FABRICD
+               /* send northbound notification */
+               isis_notif_version_skew(circuit, version1, raw_pdu);
+#endif /* ifndef FABRICD */
                return ISIS_WARNING;
        }
 
@@ -1570,6 +1621,10 @@ int isis_handle_pdu(struct isis_circuit *circuit, uint8_t *ssnpa)
                        "IDFieldLengthMismatch: ID Length field in a received PDU  %" PRIu8
                        ", while the parameter for this IS is %u",
                        id_len, ISIS_SYS_ID_LEN);
+#ifndef FABRICD
+               /* send northbound notification */
+               isis_notif_id_len_mismatch(circuit, id_len, raw_pdu);
+#endif /* ifndef FABRICD */
                return ISIS_ERROR;
        }
 
@@ -1596,6 +1651,10 @@ int isis_handle_pdu(struct isis_circuit *circuit, uint8_t *ssnpa)
 
        if (version2 != 1) {
                zlog_warn("Unsupported ISIS PDU version %" PRIu8, version2);
+#ifndef FABRICD
+               /* send northbound notification */
+               isis_notif_version_skew(circuit, version2, raw_pdu);
+#endif /* ifndef FABRICD */
                return ISIS_WARNING;
        }