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);
89 const uint8_t *pkt, uint32_t
len,
const uint16_t
proto,
const uint32_t data_offset)
182 uint16_t proto_offset = 0;
193 uint8_t proto_byte = *(pkt + proto_offset);
195 if (proto_byte & 0x01) {
204 if (!PacketIncreaseCheckLayers(
p)) {
208 const uint32_t data_offset = proto_offset +
proto_size;
209 if (data_offset != 4) {
211 return DecodePPPCompressedProto(
tv,
dtv,
p, pkt,
len, proto_offset);
213 const uint16_t
proto =
SCNtohs(*(uint16_t *)(pkt + proto_offset));
214 return DecodePPPUncompressedProto(
tv,
dtv,
p, pkt,
len,
proto, data_offset);
219 const PPPHdr *ppph = (PPPHdr *)pkt;
221 "p %p pkt %p PPP protocol %04x Len: %" PRIu32
"",
p, pkt,
SCNtohs(ppph->protocol),
len);
222 return DecodePPPUncompressedProto(
tv,
dtv,
p, pkt,
len,
SCNtohs(ppph->protocol), data_offset);
232 static int DecodePPPtest01(
void)
234 uint8_t raw_ppp[] = { 0xff, 0x03, 0x00, 0x21, 0x45, 0xc0, 0x00 };
257 static int DecodePPPtest02(
void)
259 uint8_t raw_ppp[] = { 0xff, 0x03, 0x00, 0xff, 0x45, 0xc0, 0x00, 0x2c, 0x4d, 0xed, 0x00, 0x00,
260 0xff, 0x06, 0xd5, 0x17, 0xbf, 0x01, 0x0d, 0x01, 0xbf, 0x01, 0x0d, 0x03, 0xea, 0x37, 0x00,
261 0x17, 0x6d, 0x0b, 0xba, 0xc3, 0x00, 0x00, 0x00, 0x00, 0x60, 0x02, 0x10, 0x20, 0xdd, 0xe1,
288 static int DecodePPPtest03(
void)
290 uint8_t raw_ppp[] = { 0xff, 0x03, 0x00, 0x21, 0x45, 0xc0, 0x00, 0x2c, 0x4d, 0xed, 0x00, 0x00,
291 0xff, 0x06, 0xd5, 0x17, 0xbf, 0x01, 0x0d, 0x01, 0xbf, 0x01, 0x0d, 0x03, 0xea, 0x37, 0x00,
292 0x17, 0x6d, 0x0b, 0xba, 0xc3, 0x00, 0x00, 0x00, 0x00, 0x60, 0x02, 0x10, 0x20, 0xdd, 0xe1,
322 static int DecodePPPtest04(
void)
324 uint8_t raw_ppp[] = { 0xff, 0x03, 0x00, 0x21, 0x45, 0xc0, 0x00, 0x2c, 0x4d, 0xed, 0x00, 0x00,
325 0xff, 0x06, 0xd5, 0x17, 0xbf, 0x01, 0x0d, 0x01, 0xbf, 0x01, 0x0d, 0x03, 0xea, 0x37, 0x00,
326 0x17, 0x6d, 0x0b, 0xba, 0xc3, 0x00, 0x00, 0x00, 0x00, 0x60, 0x02, 0x10, 0x20, 0xdd, 0xe1,