diff options
author | Isabella de Leon <ideleon@microsoft.com> | 2023-03-31 02:00:39 +0200 |
---|---|---|
committer | Isabella de Leon <ideleon@microsoft.com> | 2023-04-04 18:23:21 +0200 |
commit | 4b24eae01dc531b3145bcfb7965aec13a350d39e (patch) | |
tree | ad63bc83a948d3eca055d3f20e8d750290f33068 /isisd/isis_pdu.c | |
parent | isisd: Add log-pdu-drops CLI/YANG support (diff) | |
download | frr-4b24eae01dc531b3145bcfb7965aec13a350d39e.tar.xz frr-4b24eae01dc531b3145bcfb7965aec13a350d39e.zip |
isisd: Add log-pdu-drops log functionality
If log-pdu-drops is configured, create an INFO log that displays the PDU type and drop counts when a PDU drop is detected.
Example logs:
2023/03/30 23:54:59.749 ISIS: [VAS9N-1JNNR] PDU drop detected of type: P2P IIH. 1 Total Drops; 0 L1 IIH drops; 0 L2 IIH drops; 1 P2P IIH drops; 0 L1 LSP drops; 0 L2 LSP drops; 0 FS LSP drops; 0 L1 CSNP drops; 0 L2 CSNP drops; 0 L1 PSNP drops; 0 L2 PSNP drops.
2023/03/30 23:54:59.848 ISIS: [VAS9N-1JNNR] PDU drop detected of type: P2P IIH. 2 Total Drops; 0 L1 IIH drops; 0 L2 IIH drops; 2 P2P IIH drops; 0 L1 LSP drops; 0 L2 LSP drops; 0 FS LSP drops; 0 L1 CSNP drops; 0 L2 CSNP drops; 0 L1 PSNP drops; 0 L2 PSNP drops.
Code changes:
Add a new PDU counter function that increments the drop counter and runs the logging functionality if log-pdu-drops is configured.
Signed-off-by: Isabella de Leon <ideleon@microsoft.com>
Diffstat (limited to 'isisd/isis_pdu.c')
-rw-r--r-- | isisd/isis_pdu.c | 64 |
1 files changed, 48 insertions, 16 deletions
diff --git a/isisd/isis_pdu.c b/isisd/isis_pdu.c index d53d43ad0..d489bb98c 100644 --- a/isisd/isis_pdu.c +++ b/isisd/isis_pdu.c @@ -1654,14 +1654,14 @@ int isis_handle_pdu(struct isis_circuit *circuit, uint8_t *ssnpa) if (idrp == ISO9542_ESIS) { flog_err(EC_LIB_DEVELOPMENT, "No support for ES-IS packet IDRP=%hhx", idrp); - pdu_counter_count(circuit->area->pdu_drop_counters, pdu_type); + pdu_counter_count_drop(circuit->area, pdu_type); return ISIS_ERROR; } if (idrp != ISO10589_ISIS) { flog_err(EC_ISIS_PACKET, "Not an IS-IS packet IDRP=%hhx", idrp); - pdu_counter_count(circuit->area->pdu_drop_counters, pdu_type); + pdu_counter_count_drop(circuit->area, pdu_type); return ISIS_ERROR; } @@ -1672,7 +1672,7 @@ int isis_handle_pdu(struct isis_circuit *circuit, uint8_t *ssnpa) isis_notif_version_skew(circuit, version1, raw_pdu, sizeof(raw_pdu)); #endif /* ifndef FABRICD */ - pdu_counter_count(circuit->area->pdu_drop_counters, pdu_type); + pdu_counter_count_drop(circuit->area, pdu_type); return ISIS_WARNING; } @@ -1696,14 +1696,14 @@ int isis_handle_pdu(struct isis_circuit *circuit, uint8_t *ssnpa) isis_notif_id_len_mismatch(circuit, id_len, raw_pdu, sizeof(raw_pdu)); #endif /* ifndef FABRICD */ - pdu_counter_count(circuit->area->pdu_drop_counters, pdu_type); + pdu_counter_count_drop(circuit->area, pdu_type); return ISIS_ERROR; } uint8_t expected_length; if (pdu_size(pdu_type, &expected_length)) { zlog_warn("Unsupported ISIS PDU %hhu", pdu_type); - pdu_counter_count(circuit->area->pdu_drop_counters, pdu_type); + pdu_counter_count_drop(circuit->area, pdu_type); return ISIS_WARNING; } @@ -1711,7 +1711,7 @@ int isis_handle_pdu(struct isis_circuit *circuit, uint8_t *ssnpa) flog_err(EC_ISIS_PACKET, "Expected fixed header length = %hhu but got %hhu", expected_length, length); - pdu_counter_count(circuit->area->pdu_drop_counters, pdu_type); + pdu_counter_count_drop(circuit->area, pdu_type); return ISIS_ERROR; } @@ -1719,7 +1719,7 @@ int isis_handle_pdu(struct isis_circuit *circuit, uint8_t *ssnpa) flog_err( EC_ISIS_PACKET, "PDU is too short to contain fixed header of given PDU type."); - pdu_counter_count(circuit->area->pdu_drop_counters, pdu_type); + pdu_counter_count_drop(circuit->area, pdu_type); return ISIS_ERROR; } @@ -1730,14 +1730,14 @@ int isis_handle_pdu(struct isis_circuit *circuit, uint8_t *ssnpa) isis_notif_version_skew(circuit, version2, raw_pdu, sizeof(raw_pdu)); #endif /* ifndef FABRICD */ - pdu_counter_count(circuit->area->pdu_drop_counters, pdu_type); + pdu_counter_count_drop(circuit->area, pdu_type); return ISIS_WARNING; } if (circuit->is_passive) { zlog_warn("Received ISIS PDU on passive circuit %s", circuit->interface->name); - pdu_counter_count(circuit->area->pdu_drop_counters, pdu_type); + pdu_counter_count_drop(circuit->area, pdu_type); return ISIS_WARNING; } @@ -1756,7 +1756,7 @@ int isis_handle_pdu(struct isis_circuit *circuit, uint8_t *ssnpa) isis_notif_max_area_addr_mismatch(circuit, max_area_addrs, raw_pdu, sizeof(raw_pdu)); #endif /* ifndef FABRICD */ - pdu_counter_count(circuit->area->pdu_drop_counters, pdu_type); + pdu_counter_count_drop(circuit->area, pdu_type); return ISIS_ERROR; } @@ -1765,8 +1765,7 @@ int isis_handle_pdu(struct isis_circuit *circuit, uint8_t *ssnpa) case L2_LAN_HELLO: case P2P_HELLO: if (fabricd && pdu_type != P2P_HELLO) { - pdu_counter_count(circuit->area->pdu_drop_counters, - pdu_type); + pdu_counter_count_drop(circuit->area, pdu_type); return ISIS_ERROR; } @@ -1777,8 +1776,7 @@ int isis_handle_pdu(struct isis_circuit *circuit, uint8_t *ssnpa) case FS_LINK_STATE: if (fabricd && pdu_type != L2_LINK_STATE && pdu_type != FS_LINK_STATE) { - pdu_counter_count(circuit->area->pdu_drop_counters, - pdu_type); + pdu_counter_count_drop(circuit->area, pdu_type); return ISIS_ERROR; } @@ -1791,12 +1789,12 @@ int isis_handle_pdu(struct isis_circuit *circuit, uint8_t *ssnpa) retval = process_snp(pdu_type, circuit, ssnpa); break; default: - pdu_counter_count(circuit->area->pdu_drop_counters, pdu_type); + pdu_counter_count_drop(circuit->area, pdu_type); return ISIS_ERROR; } if (retval != ISIS_OK) - pdu_counter_count(circuit->area->pdu_drop_counters, pdu_type); + pdu_counter_count_drop(circuit->area, pdu_type); return retval; } @@ -2554,3 +2552,37 @@ out: isis_tx_queue_del(circuit->tx_queue, lsp); } } + +void isis_log_pdu_drops(struct isis_area *area, const char *pdu_type) +{ + uint64_t total_drops = 0; + + for (int i = 0; i < PDU_COUNTER_SIZE; i++) { + if (!area->pdu_drop_counters[i]) + continue; + total_drops += area->pdu_drop_counters[i]; + } + + zlog_info("PDU drop detected of type: %s. %" PRIu64 + " Total Drops; %" PRIu64 " L1 IIH drops; %" PRIu64 + " L2 IIH drops; %" PRIu64 " P2P IIH drops; %" PRIu64 + " L1 LSP drops; %" PRIu64 " L2 LSP drops; %" PRIu64 + " FS LSP drops; %" PRIu64 " L1 CSNP drops; %" PRIu64 + " L2 CSNP drops; %" PRIu64 " L1 PSNP drops; %" PRIu64 + " L2 PSNP drops.", + pdu_type, total_drops, + pdu_counter_get_count(area->pdu_drop_counters, L1_LAN_HELLO), + pdu_counter_get_count(area->pdu_drop_counters, L2_LAN_HELLO), + pdu_counter_get_count(area->pdu_drop_counters, P2P_HELLO), + pdu_counter_get_count(area->pdu_drop_counters, L1_LINK_STATE), + pdu_counter_get_count(area->pdu_drop_counters, L2_LINK_STATE), + pdu_counter_get_count(area->pdu_drop_counters, FS_LINK_STATE), + pdu_counter_get_count(area->pdu_drop_counters, + L1_COMPLETE_SEQ_NUM), + pdu_counter_get_count(area->pdu_drop_counters, + L2_COMPLETE_SEQ_NUM), + pdu_counter_get_count(area->pdu_drop_counters, + L1_PARTIAL_SEQ_NUM), + pdu_counter_get_count(area->pdu_drop_counters, + L2_PARTIAL_SEQ_NUM)); +} |