fgsect/scat

diag1xlogparser parse IP is ignoring timestamps

Closed this issue · 1 comments

The parse_ip function returns a parser_result without ts field:

return {'up': [item_data]}

return {'up': [pkt_buf]}

Even if it's present in pkt_header and it's correctly parsed in parse_diag_log:

pkt_ts = util.parse_qxdm_ts(pkt_header.timestamp)

Furthermore, this will cause pcapwriter to throw an exception because it will call the timestamp method on None:

def postprocess_parse_result(self, parse_result):
if 'radio_id' in parse_result:
radio_id = parse_result['radio_id']
else:
radio_id = 0
if 'ts' in parse_result:
ts = parse_result['ts']
else:
ts = None
if 'cp' in parse_result:
for sock_content in parse_result['cp']:
self.writer.write_cp(sock_content, radio_id, ts)
if 'up' in parse_result:
for sock_content in parse_result['up']:
self.writer.write_up(sock_content, radio_id, ts)

def write_up(self, sock_content, radio_id=0, ts=datetime.datetime.now()):
self.write_pkt(sock_content, self.port_up, radio_id, ts)

def write_pkt(self, sock_content, port, radio_id=0, ts=datetime.datetime.now()):
pcap_hdr = struct.pack('<LLLL',
int(ts.timestamp()),

Closed with fix.