49 GRESreHdr *gsre = NULL;
57 if (!PacketIncreaseCheckLayers(p)) {
61 p->
greh = (GREHdr *)pkt;
65 SCLogDebug(
"p %p pkt %p GRE protocol %04x Len: %d GRE version %x",
102 if (header_len >
len) {
117 gsre = (GRESreHdr *)(pkt + header_len);
121 if ((
SCNtohs(gsre->af) == 0) && (gsre->sre_length == 0))
124 header_len += gsre->sre_length;
125 if (header_len >
len) {
190 if (header_len >
len) {
288 static int DecodeGREtest01 (
void)
290 uint8_t raw_gre[] = { 0x00 ,0x6e ,0x62 };
310 static int DecodeGREtest02 (
void)
312 uint8_t raw_gre[] = {
313 0x00, 0x6e, 0x62, 0xac, 0x40, 0x00, 0x40, 0x2f,
314 0xc2, 0xc7, 0x0a, 0x00, 0x00, 0x64, 0x0a, 0x00,
315 0x00, 0x8a, 0x30, 0x01, 0x0b, 0x00, 0x4e, 0x00,
316 0x00, 0x00, 0x18, 0x4a, 0x50, 0xff, 0x03, 0x00,
317 0x21, 0x45, 0x00, 0x00, 0x4a, 0x00, 0x00, 0x40,
318 0x00, 0x40, 0x11, 0x94, 0x22, 0x50, 0x7e, 0x2b,
319 0x2d, 0xc2, 0x6d, 0x68, 0x68, 0x80, 0x0e, 0x00,
320 0x35, 0x00, 0x36, 0x9f, 0x18, 0xdb, 0xc4, 0x01,
321 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
322 0x01, 0x03, 0x73, 0x31, 0x36, 0x09, 0x73, 0x69,
323 0x74, 0x65, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x03,
324 0x63, 0x6f, 0x6d, 0x00, 0x00, 0x01, 0x00, 0x01,
325 0x00, 0x00, 0x29, 0x10, 0x00, 0x00, 0x00, 0x00,
347 static int DecodeGREtest03 (
void)
349 uint8_t raw_gre[] = {
350 0x00, 0x6e, 0x62, 0xac, 0x40, 0x00, 0x40, 0x2f,
351 0xc2, 0xc7, 0x0a, 0x00, 0x00, 0x64, 0x0a, 0x00,
352 0x00, 0x8a, 0x30, 0x01, 0x88, 0x0b, 0x00, 0x4e,
353 0x00, 0x00, 0x00, 0x18, 0x4a, 0x50, 0xff, 0x03,
354 0x00, 0x21, 0x45, 0x00, 0x00, 0x4a, 0x00, 0x00,
355 0x40, 0x00, 0x40, 0x11, 0x94, 0x22, 0x50, 0x7e,
356 0x2b, 0x2d, 0xc2, 0x6d, 0x68, 0x68, 0x80, 0x0e,
357 0x00, 0x35, 0x00, 0x36, 0x9f, 0x18, 0xdb, 0xc4,
358 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
359 0x00, 0x01, 0x03, 0x73, 0x31, 0x36, 0x09, 0x73,
360 0x69, 0x74, 0x65, 0x6d, 0x65, 0x74, 0x65, 0x72,
361 0x03, 0x63, 0x6f, 0x6d, 0x00, 0x00, 0x01, 0x00,
362 0x01, 0x00, 0x00, 0x29, 0x10, 0x00, 0x00, 0x00,
363 0x00, 0x00, 0x00, 0x00 };