51 const uint8_t *pkt, uint32_t
len)
62 p->
pppoedh = (PPPOEDiscoveryHdr *)pkt;
85 uint32_t tag_length = 0;
91 SCLogDebug(
"pppoe_length %"PRIu32
", packet_length %"PRIu32
"",
100 while (pppoedt < (PPPOEDiscoveryTag*) (pkt + (
len -
sizeof(PPPOEDiscoveryTag))) &&
pppoe_length >=4 && packet_length >=4)
103 uint16_t tag_type =
SCNtohs(pppoedt->pppoe_tag_type);
105 tag_length =
SCNtohs(pppoedt->pppoe_tag_length);
107 SCLogDebug (
"PPPoE Tag type %x, length %"PRIu32, tag_type, tag_length);
115 if (packet_length >= 4 + tag_length) {
116 packet_length -= (4 + tag_length);
121 pppoedt = pppoedt + (4 + tag_length);
131 const uint8_t *pkt, uint32_t
len)
144 SCLogDebug(
"PPPOE VERSION %" PRIu32
" TYPE %" PRIu32
" CODE %" PRIu32
" SESSIONID %" PRIu32
" LENGTH %" PRIu32
"",
156 if (ppp_protocol & 0x0100) {
164 if (
len < pppoesh_len) {
170 SCLogDebug(
"Protocol %" PRIu16
" len %" PRIu8
"", ppp_protocol, pppoesh_len);
172 switch (ppp_protocol) {
244 SCLogDebug(
"unknown PPP protocol: %" PRIx32
"", ppp_protocol);
257 static int DecodePPPOEtest01 (
void)
260 uint8_t raw_pppoe[] = { 0x11, 0x00, 0x00, 0x00, 0x00 };
281 static int DecodePPPOEtest02 (
void)
284 uint8_t raw_pppoe[] = {
285 0x11, 0x00, 0x00, 0x01, 0x00, 0x40, 0x00, 0x21,
286 0x45, 0x00, 0x00, 0x3c, 0x05, 0x5c, 0x00, 0x00,
287 0x20, 0x01, 0xff, 0x30, 0xc0, 0xa8, 0x0a, 0x7f,
288 0xc0, 0xa8, 0x0a, 0x65, 0xab, 0xcd, 0x16, 0x5e,
289 0x02, 0x00, 0x37, 0x00, 0x41, 0x42, 0x43, 0x44,
290 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c,
291 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54,
292 0x55, 0x56, 0x57, 0x41, 0x42, 0x43, 0x44, 0x45,
293 0x46, 0x47, 0x48, 0x49 };
322 static int DecodePPPOEtest03 (
void)
326 uint8_t raw_pppoe[] = {
327 0x11, 0x07, 0x00, 0x00, 0x00, 0x20, 0x01, 0x01,
328 0x00, 0x00, 0x01, 0x02, 0x00, 0x18, 0x47, 0x6f,
329 0x20, 0x52, 0x65, 0x64, 0x42, 0x61, 0x63, 0x6b,
330 0x20, 0x2d, 0x20, 0x65, 0x73, 0x68, 0x73, 0x68,
331 0x65, 0x73, 0x68, 0x6f, 0x6f, 0x74
353 static int DecodePPPOEtest04 (
void)
357 uint8_t raw_pppoe[] = {
358 0x11, 0xbb, 0x00, 0x00, 0x00, 0x04, 0x01, 0x01,
382 static int DecodePPPOEtest05 (
void)
386 uint8_t raw_pppoe[] = {
387 0x11, 0x07, 0x00, 0x00, 0x00, 0x20, 0x01, 0x01,
388 0x00, 0x00, 0x01, 0x02, 0x00, 0x18, 0x47, 0x6f,
389 0x20, 0x52, 0x65, 0x64, 0x42, 0x61, 0x63, 0x6b,
390 0x20, 0x2d, 0x20, 0x65, 0x73, 0x68, 0x73, 0x68
415 static int DecodePPPOEtest06 (
void)
419 PPPOEDiscoveryHdr pppoedh;
421 pppoedh.pppoe_version_type = 0xCD;
434 static int DecodePPPOEtest07(
void)
437 uint8_t raw_pppoe[] = { 0x11, 0x00, 0x00, 0x2d, 0x00, 0x1c, 0x21, 0x45, 0x00, 0x00, 0x1d, 0x97,
438 0xc3, 0x00, 0x00, 0x40, 0x01, 0x47, 0x0f, 0x0a, 0x64, 0x00, 0x00, 0xc0, 0xa8, 0xd1, 0x01,
439 0x08, 0x00, 0xd4, 0x4c, 0x1f, 0x32, 0x04, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
440 0x00, 0x00, 0x00, 0x00 };
461 static int DecodePPPOEtest08(
void)
464 uint8_t raw_pppoe[] = { 0x11, 0x00, 0x00, 0x2d, 0x00, 0x3d, 0x21, 0x45, 0x00, 0x00, 0x3c, 0x00,
465 0x00, 0x40, 0x00, 0x40, 0x06, 0xed, 0xda, 0x0a, 0x64, 0x00, 0x00, 0x8e, 0xfa, 0xb3, 0x83,
466 0xde, 0xb5, 0x00, 0x50, 0xd4, 0xbd, 0x76, 0x54, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x02, 0xfe,
467 0xcc, 0x74, 0x2f, 0x00, 0x00, 0x02, 0x04, 0x05, 0xac, 0x01, 0x03, 0x03, 0x07, 0x04, 0x02,
468 0x08, 0x0a, 0xcb, 0xae, 0x92, 0x63, 0x00, 0x00, 0x00, 0x00 };
489 static int DecodePPPOEtest09(
void)
492 uint8_t raw_pppoe[] = { 0x11, 0x00, 0x00, 0x2d, 0x00, 0x1c, 0x00, 0x21, 0x45, 0x00, 0x00, 0x1d,
493 0x97, 0xc3, 0x00, 0x00, 0x40, 0x01, 0x47, 0x0f, 0x0a, 0x64, 0x00, 0x00, 0xc0, 0xa8, 0xd1,
494 0x01, 0x08, 0x00, 0xd4, 0x4c, 0x1f, 0x32, 0x04, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
495 0x00, 0x00, 0x00, 0x00, 0x00 };
516 static int DecodePPPOEtest10(
void)
519 uint8_t raw_pppoe[] = { 0x11, 0x00, 0x00, 0x2d, 0x00, 0x3d, 0x00, 0x21, 0x45, 0x00, 0x00, 0x3c,
520 0x00, 0x00, 0x40, 0x00, 0x40, 0x06, 0xed, 0xda, 0x0a, 0x64, 0x00, 0x00, 0x8e, 0xfa, 0xb3,
521 0x83, 0xde, 0xb5, 0x00, 0x50, 0xd4, 0xbd, 0x76, 0x54, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x02,
522 0xfe, 0xcc, 0x74, 0x2f, 0x00, 0x00, 0x02, 0x04, 0x05, 0xac, 0x01, 0x03, 0x03, 0x07, 0x04,
523 0x02, 0x08, 0x0a, 0xcb, 0xae, 0x92, 0x63, 0x00, 0x00, 0x00, 0x00 };