ntp: count packets with invalid format
Include packets that cannot be parsed in the total RX count.
This commit is contained in:
parent
b8ee6d6e56
commit
567e66a0bb
2 changed files with 4 additions and 8 deletions
|
@ -1602,8 +1602,6 @@ process_response(NCR_Instance inst, NTP_Local_Address *local_addr,
|
|||
|
||||
stats = SRC_GetSourcestats(inst->source);
|
||||
|
||||
inst->report.total_rx_count++;
|
||||
|
||||
pkt_leap = NTP_LVM_TO_LEAP(message->lvm);
|
||||
pkt_version = NTP_LVM_TO_VERSION(message->lvm);
|
||||
pkt_refid = ntohl(message->reference_id);
|
||||
|
@ -2023,6 +2021,8 @@ NCR_ProcessRxKnown(NCR_Instance inst, NTP_Local_Address *local_addr,
|
|||
int proc_packet, proc_as_unknown;
|
||||
NTP_PacketInfo info;
|
||||
|
||||
inst->report.total_rx_count++;
|
||||
|
||||
if (!parse_packet(message, length, &info))
|
||||
return 0;
|
||||
|
||||
|
|
|
@ -239,7 +239,7 @@ proc_response(NCR_Instance inst, int good, int valid, int updated_sync, int upda
|
|||
NTP_Packet *res;
|
||||
uint32_t prev_rx_count, prev_valid_count;
|
||||
struct timespec prev_rx_ts, prev_init_rx_ts;
|
||||
int prev_open_socket, ret;
|
||||
int ret;
|
||||
|
||||
res = &res_buffer;
|
||||
|
||||
|
@ -254,7 +254,6 @@ proc_response(NCR_Instance inst, int good, int valid, int updated_sync, int upda
|
|||
prev_valid_count = inst->report.total_valid_count;
|
||||
prev_rx_ts = inst->local_rx.ts;
|
||||
prev_init_rx_ts = inst->init_local_rx.ts;
|
||||
prev_open_socket = inst->local_addr.sock_fd != INVALID_SOCK_FD;
|
||||
|
||||
ret = NCR_ProcessRxKnown(inst, &local_addr, &local_ts, res, res_length);
|
||||
|
||||
|
@ -263,10 +262,7 @@ proc_response(NCR_Instance inst, int good, int valid, int updated_sync, int upda
|
|||
else if (!good)
|
||||
TEST_CHECK(!ret);
|
||||
|
||||
if (prev_open_socket)
|
||||
TEST_CHECK(prev_rx_count + 1 == inst->report.total_rx_count);
|
||||
else
|
||||
TEST_CHECK(prev_rx_count == inst->report.total_rx_count);
|
||||
|
||||
if (valid)
|
||||
TEST_CHECK(prev_valid_count + 1 == inst->report.total_valid_count);
|
||||
|
|
Loading…
Reference in a new issue