diff --git a/isisd/isis_pdu.c b/isisd/isis_pdu.c index dd442840d0..d53d43ad0e 100644 --- a/isisd/isis_pdu.c +++ b/isisd/isis_pdu.c @@ -1654,12 +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); 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); return ISIS_ERROR; } @@ -1670,6 +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); return ISIS_WARNING; } @@ -1693,12 +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); 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); return ISIS_WARNING; } @@ -1706,6 +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); return ISIS_ERROR; } @@ -1713,6 +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); return ISIS_ERROR; } @@ -1723,12 +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); 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); return ISIS_WARNING; } @@ -1747,6 +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); return ISIS_ERROR; } @@ -1754,17 +1764,24 @@ int isis_handle_pdu(struct isis_circuit *circuit, uint8_t *ssnpa) case L1_LAN_HELLO: case L2_LAN_HELLO: case P2P_HELLO: - if (fabricd && pdu_type != P2P_HELLO) + if (fabricd && pdu_type != P2P_HELLO) { + pdu_counter_count(circuit->area->pdu_drop_counters, + pdu_type); return ISIS_ERROR; + } + retval = process_hello(pdu_type, circuit, ssnpa); break; case L1_LINK_STATE: case L2_LINK_STATE: case FS_LINK_STATE: - if (fabricd - && pdu_type != L2_LINK_STATE - && pdu_type != 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); return ISIS_ERROR; + } + retval = process_lsp(pdu_type, circuit, ssnpa, max_area_addrs); break; case L1_COMPLETE_SEQ_NUM: @@ -1774,9 +1791,13 @@ 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); return ISIS_ERROR; } + if (retval != ISIS_OK) + pdu_counter_count(circuit->area->pdu_drop_counters, pdu_type); + return retval; } diff --git a/isisd/isisd.c b/isisd/isisd.c index d216d100e1..c6369a884e 100644 --- a/isisd/isisd.c +++ b/isisd/isisd.c @@ -2503,6 +2503,9 @@ static void common_isis_summary_vty(struct vty *vty, struct isis *isis) vty_out(vty, " RX counters per PDU type:\n"); pdu_counter_print(vty, " ", area->pdu_rx_counters); + vty_out(vty, " Drop counters per PDU type:\n"); + pdu_counter_print(vty, " ", area->pdu_drop_counters); + vty_out(vty, " Advertise high metrics: %s\n", area->advertise_high_metrics ? "Enabled" : "Disabled"); diff --git a/isisd/isisd.h b/isisd/isisd.h index a06dc46a38..0b1f1cb620 100644 --- a/isisd/isisd.h +++ b/isisd/isisd.h @@ -232,6 +232,7 @@ struct isis_area { pdu_counter_t pdu_tx_counters; pdu_counter_t pdu_rx_counters; + pdu_counter_t pdu_drop_counters; uint64_t lsp_rxmt_count; /* Area counters */