43 const uint8_t *pkt, uint32_t
len, uint16_t proto_offset)
45 const uint32_t data_offset = proto_offset + 1;
46 switch (*(pkt + proto_offset)) {
53 uint16_t iplen = (uint16_t)
MIN((uint32_t)USHRT_MAX,
len - data_offset);
88 const uint8_t *pkt, uint32_t
len,
const uint16_t
proto,
const uint32_t data_offset)
181 uint16_t proto_offset = 0;
192 uint8_t proto_byte = *(pkt + proto_offset);
194 if (proto_byte & 0x01) {
203 if (!PacketIncreaseCheckLayers(
p)) {
207 const uint32_t data_offset = proto_offset +
proto_size;
208 if (data_offset != 4) {
210 return DecodePPPCompressedProto(
tv,
dtv,
p, pkt,
len, proto_offset);
212 const uint16_t
proto =
SCNtohs(*(uint16_t *)(pkt + proto_offset));
213 return DecodePPPUncompressedProto(
tv,
dtv,
p, pkt,
len,
proto, data_offset);
218 const PPPHdr *ppph = (PPPHdr *)pkt;
220 "p %p pkt %p PPP protocol %04x Len: %" PRIu32
"",
p, pkt,
SCNtohs(ppph->protocol),
len);
221 return DecodePPPUncompressedProto(
tv,
dtv,
p, pkt,
len,
SCNtohs(ppph->protocol), data_offset);
231 static int DecodePPPtest01(
void)
233 uint8_t raw_ppp[] = { 0xff, 0x03, 0x00, 0x21, 0x45, 0xc0, 0x00 };
256 static int DecodePPPtest02(
void)
258 uint8_t raw_ppp[] = { 0xff, 0x03, 0x00, 0xff, 0x45, 0xc0, 0x00, 0x2c, 0x4d, 0xed, 0x00, 0x00,
259 0xff, 0x06, 0xd5, 0x17, 0xbf, 0x01, 0x0d, 0x01, 0xbf, 0x01, 0x0d, 0x03, 0xea, 0x37, 0x00,
260 0x17, 0x6d, 0x0b, 0xba, 0xc3, 0x00, 0x00, 0x00, 0x00, 0x60, 0x02, 0x10, 0x20, 0xdd, 0xe1,
287 static int DecodePPPtest03(
void)
289 uint8_t raw_ppp[] = { 0xff, 0x03, 0x00, 0x21, 0x45, 0xc0, 0x00, 0x2c, 0x4d, 0xed, 0x00, 0x00,
290 0xff, 0x06, 0xd5, 0x17, 0xbf, 0x01, 0x0d, 0x01, 0xbf, 0x01, 0x0d, 0x03, 0xea, 0x37, 0x00,
291 0x17, 0x6d, 0x0b, 0xba, 0xc3, 0x00, 0x00, 0x00, 0x00, 0x60, 0x02, 0x10, 0x20, 0xdd, 0xe1,
321 static int DecodePPPtest04(
void)
323 uint8_t raw_ppp[] = { 0xff, 0x03, 0x00, 0x21, 0x45, 0xc0, 0x00, 0x2c, 0x4d, 0xed, 0x00, 0x00,
324 0xff, 0x06, 0xd5, 0x17, 0xbf, 0x01, 0x0d, 0x01, 0xbf, 0x01, 0x0d, 0x03, 0xea, 0x37, 0x00,
325 0x17, 0x6d, 0x0b, 0xba, 0xc3, 0x00, 0x00, 0x00, 0x00, 0x60, 0x02, 0x10, 0x20, 0xdd, 0xe1,