Enhance NTP support, add protocol version identification; Add pcap examples for NTPv2, NTPv3, NTPv4; Fix bug with identification of NTP monlist packets as QUIC
This commit is contained in:
@@ -722,7 +722,12 @@ typedef struct ndpi_flow_struct {
|
|||||||
u_int8_t bad_packet /* the received packet looks bad */;
|
u_int8_t bad_packet /* the received packet looks bad */;
|
||||||
u_int16_t query_type, query_class, rsp_type;
|
u_int16_t query_type, query_class, rsp_type;
|
||||||
} dns;
|
} dns;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
u_int8_t request_code;
|
||||||
|
u_int8_t version;
|
||||||
|
} ntp;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
char client_certificate[48], server_certificate[48];
|
char client_certificate[48], server_certificate[48];
|
||||||
} ssl;
|
} ssl;
|
||||||
|
|||||||
+11
-2
@@ -46,14 +46,23 @@ void ndpi_search_ntp_udp(struct ndpi_detection_module_struct *ndpi_struct, struc
|
|||||||
|
|
||||||
NDPI_LOG(NDPI_PROTOCOL_NTP, ndpi_struct, NDPI_LOG_DEBUG, "NTP port detected\n");
|
NDPI_LOG(NDPI_PROTOCOL_NTP, ndpi_struct, NDPI_LOG_DEBUG, "NTP port detected\n");
|
||||||
|
|
||||||
if (packet->payload_packet_len != 48)
|
// It's not correct because packets could be bigger
|
||||||
goto exclude_ntp;
|
//if (packet->payload_packet_len != 48)
|
||||||
|
// goto exclude_ntp;
|
||||||
|
|
||||||
NDPI_LOG(NDPI_PROTOCOL_NTP, ndpi_struct, NDPI_LOG_DEBUG, "NTP length detected\n");
|
NDPI_LOG(NDPI_PROTOCOL_NTP, ndpi_struct, NDPI_LOG_DEBUG, "NTP length detected\n");
|
||||||
|
|
||||||
|
|
||||||
if ((((packet->payload[0] & 0x38) >> 3) <= 4)) {
|
if ((((packet->payload[0] & 0x38) >> 3) <= 4)) {
|
||||||
NDPI_LOG(NDPI_PROTOCOL_NTP, ndpi_struct, NDPI_LOG_DEBUG, "detected NTP.");
|
NDPI_LOG(NDPI_PROTOCOL_NTP, ndpi_struct, NDPI_LOG_DEBUG, "detected NTP.");
|
||||||
|
|
||||||
|
// 38 in binary representation is 00111000
|
||||||
|
flow->protos.ntp.version = (packet->payload[0] & 0x38) >> 3;
|
||||||
|
|
||||||
|
if (flow->protos.ntp.version == 2) {
|
||||||
|
flow->protos.ntp.request_code = packet->payload[3];
|
||||||
|
}
|
||||||
|
|
||||||
ndpi_int_ntp_add_connection(ndpi_struct, flow);
|
ndpi_int_ntp_add_connection(ndpi_struct, flow);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -36,4 +36,4 @@ check_results() {
|
|||||||
build_results
|
build_results
|
||||||
check_results
|
check_results
|
||||||
|
|
||||||
exit $RC
|
exit $RC
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,3 @@
|
|||||||
|
NTP 1 410 1
|
||||||
|
|
||||||
|
1 UDP 78.46.76.2:80 <-> 208.104.95.10:123 [proto: 9/NTP][1 pkts/410 bytes]
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
NTP 1 90 1
|
||||||
|
|
||||||
|
1 UDP 78.46.76.2:80 <-> 175.144.140.29:123 [proto: 9/NTP][1 pkts/90 bytes]
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
NTP 1 90 1
|
||||||
|
|
||||||
|
1 UDP 78.46.76.11:123 <-> 85.22.62.120:123 [proto: 9/NTP][1 pkts/90 bytes]
|
||||||
Reference in New Issue
Block a user