44 const uint8_t *pkt, uint32_t
len, uint16_t proto_offset)
46 const uint32_t data_offset = proto_offset + 1;
47 switch (*(pkt + proto_offset)) {
54 uint16_t iplen = (uint16_t)
MIN((uint32_t)USHRT_MAX,
len - data_offset);
63 uint16_t iplen = (uint16_t)
MIN((uint32_t)USHRT_MAX,
len - data_offset);
90 const uint8_t *pkt, uint32_t
len,
const uint16_t
proto,
const uint32_t data_offset)
187 uint16_t proto_offset = 0;
198 uint8_t proto_byte = *(pkt + proto_offset);
200 if (proto_byte & 0x01) {
209 if (!PacketIncreaseCheckLayers(p)) {
213 const uint32_t data_offset = proto_offset +
proto_size;
214 if (data_offset != 4) {
216 return DecodePPPCompressedProto(
tv,
dtv, p, pkt,
len, proto_offset);
218 const uint16_t
proto =
SCNtohs(*(uint16_t *)(pkt + proto_offset));
219 return DecodePPPUncompressedProto(
tv,
dtv, p, pkt,
len,
proto, data_offset);
224 const PPPHdr *ppph = (PPPHdr *)pkt;
226 "p %p pkt %p PPP protocol %04x Len: %" PRIu32
"", p, pkt,
SCNtohs(ppph->protocol),
len);
227 return DecodePPPUncompressedProto(
tv,
dtv, p, pkt,
len,
SCNtohs(ppph->protocol), data_offset);
237 static int DecodePPPtest01(
void)
239 uint8_t raw_ppp[] = { 0xff, 0x03, 0x00, 0x21, 0x45, 0xc0, 0x00 };
262 static int DecodePPPtest02(
void)
264 uint8_t raw_ppp[] = { 0xff, 0x03, 0x00, 0xff, 0x45, 0xc0, 0x00, 0x2c, 0x4d, 0xed, 0x00, 0x00,
265 0xff, 0x06, 0xd5, 0x17, 0xbf, 0x01, 0x0d, 0x01, 0xbf, 0x01, 0x0d, 0x03, 0xea, 0x37, 0x00,
266 0x17, 0x6d, 0x0b, 0xba, 0xc3, 0x00, 0x00, 0x00, 0x00, 0x60, 0x02, 0x10, 0x20, 0xdd, 0xe1,
293 static int DecodePPPtest03(
void)
295 uint8_t raw_ppp[] = { 0xff, 0x03, 0x00, 0x21, 0x45, 0xc0, 0x00, 0x2c, 0x4d, 0xed, 0x00, 0x00,
296 0xff, 0x06, 0xd5, 0x17, 0xbf, 0x01, 0x0d, 0x01, 0xbf, 0x01, 0x0d, 0x03, 0xea, 0x37, 0x00,
297 0x17, 0x6d, 0x0b, 0xba, 0xc3, 0x00, 0x00, 0x00, 0x00, 0x60, 0x02, 0x10, 0x20, 0xdd, 0xe1,
327 static int DecodePPPtest04(
void)
329 uint8_t raw_ppp[] = { 0xff, 0x03, 0x00, 0x21, 0x45, 0xc0, 0x00, 0x2c, 0x4d, 0xed, 0x00, 0x00,
330 0xff, 0x06, 0xd5, 0x17, 0xbf, 0x01, 0x0d, 0x01, 0xbf, 0x01, 0x0d, 0x03, 0xea, 0x37, 0x00,
331 0x17, 0x6d, 0x0b, 0xba, 0xc3, 0x00, 0x00, 0x00, 0x00, 0x60, 0x02, 0x10, 0x20, 0xdd, 0xe1,