Skip to content
Snippets Groups Projects
Verified Commit d44a1ea3 authored by Petr Špaček's avatar Petr Špaček
Browse files

extract-clients: detect non-monotonic timestamps in input PCAP

parent eaee914e
No related branches found
No related tags found
1 merge request!31PCAP sanity checks
......@@ -166,7 +166,7 @@ local function chunk_finalize()
log:info(string.format(" number of clients: %d", i_client))
end
local obj, obj_pcap_in, obj_ip, obj_udp, obj_pl, client, src_ip, ip_len
local obj, obj_pcap_in, obj_ip, obj_udp, obj_pl, client, src_ip, ip_len, prev_ms
while true do
obj = produce(pctx)
if obj == nil then break end
......@@ -183,6 +183,14 @@ while true do
obj_pcap_in = obj:cast_to(object.PCAP)
if obj_ip ~= nil and obj_udp ~= nil and obj_pl ~= nil and obj_pcap_in ~= nil then
now_ms = tonumber(obj_pcap_in.ts.sec) * 1e3 + tonumber(obj_pcap_in.ts.nsec) * 1e-6
if prev_ms then
if (now_ms < prev_ms) then
log:fatal('non-monotonic packet timestamp detected, exiting '
.. '(current ts %f < previous %f)', now_ms, prev_ms)
break
end
end
prev_ms = now_ms
if chunk_until_ms == nil or now_ms >= chunk_until_ms then
if chunk_until_ms ~= nil then
chunk_finalize()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment