summaryrefslogtreecommitdiff
path: root/isisd/isis_pdu_counter.c
diff options
context:
space:
mode:
authorIsabella de Leon <ideleon@microsoft.com>2023-03-30 17:00:39 -0700
committerIsabella de Leon <ideleon@microsoft.com>2023-04-04 09:23:21 -0700
commit4b24eae01dc531b3145bcfb7965aec13a350d39e (patch)
treead63bc83a948d3eca055d3f20e8d750290f33068 /isisd/isis_pdu_counter.c
parent9ace83b9525677c8996fee56cf1ec28a02a96711 (diff)
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_counter.c')
-rw-r--r--isisd/isis_pdu_counter.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/isisd/isis_pdu_counter.c b/isisd/isis_pdu_counter.c
index 9d07b5e598..a3605a32a1 100644
--- a/isisd/isis_pdu_counter.c
+++ b/isisd/isis_pdu_counter.c
@@ -8,10 +8,10 @@
#include "vty.h"
-#include "isisd/isis_pdu_counter.h"
#include "isisd/isisd.h"
#include "isisd/isis_circuit.h"
#include "isisd/isis_pdu.h"
+#include "isisd/isis_pdu_counter.h"
static int pdu_type_to_counter_index(uint8_t pdu_type)
{
@@ -91,3 +91,23 @@ void pdu_counter_print(struct vty *vty, const char *prefix,
pdu_counter_index_to_name(i), counter[i]);
}
}
+
+void pdu_counter_count_drop(struct isis_area *area, uint8_t pdu_type)
+{
+ pdu_counter_count(area->pdu_drop_counters, pdu_type);
+
+ if (area->log_pdu_drops) {
+ isis_log_pdu_drops(
+ area, pdu_counter_index_to_name(
+ pdu_type_to_counter_index(pdu_type)));
+ }
+}
+
+uint64_t pdu_counter_get_count(pdu_counter_t counter, uint8_t pdu_type)
+{
+ int index = pdu_type_to_counter_index(pdu_type);
+
+ if (index < 0)
+ return -1;
+ return counter[index];
+}