diff options
author | Ivan Nardi <12729895+IvanNardi@users.noreply.github.com> | 2020-10-21 22:27:42 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-21 22:27:42 +0200 |
commit | 6027a7c7995eda54905f126f3495b4fea8515c5c (patch) | |
tree | d768e4ff5622c045af296075e7aef5b6c7500570 /example/reader_util.c | |
parent | 9dac9945c9954d82cce16364e1f1190cee16063b (diff) |
Fix parsing of DLT_PPP datalink type (#1042)
Diffstat (limited to 'example/reader_util.c')
-rw-r--r-- | example/reader_util.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/example/reader_util.c b/example/reader_util.c index 3853aa919..c212597ac 100644 --- a/example/reader_util.c +++ b/example/reader_util.c @@ -1637,9 +1637,14 @@ struct ndpi_proto ndpi_workflow_process_packet(struct ndpi_workflow * workflow, /* Cisco PPP - 9 or 104 */ case DLT_C_HDLC: case DLT_PPP: - chdlc = (struct ndpi_chdlc *) &packet[eth_offset]; - ip_offset = sizeof(struct ndpi_chdlc); /* CHDLC_OFF = 4 */ - type = ntohs(chdlc->proto_code); + if(packet[0] == 0x0f || packet[0] == 0x8f) { + chdlc = (struct ndpi_chdlc *) &packet[eth_offset]; + ip_offset = sizeof(struct ndpi_chdlc); /* CHDLC_OFF = 4 */ + type = ntohs(chdlc->proto_code); + } else { + ip_offset = 2; + type = ntohs(*((u_int16_t*)&packet[eth_offset])); + } break; /* IEEE 802.3 Ethernet - 1 */ |