49 GRESreHdr *gsre = NULL;
58 p->
greh = (GREHdr *)pkt;
62 SCLogDebug(
"p %p pkt %p GRE protocol %04x Len: %d GRE version %x",
99 if (header_len > len) {
114 gsre = (GRESreHdr *)(pkt + header_len);
118 if ((
SCNtohs(gsre->af) == 0) && (gsre->sre_length == 0))
121 header_len += gsre->sre_length;
122 if (header_len > len) {
187 if (header_len > len) {
290 static int DecodeGREtest01 (
void)
293 uint8_t raw_gre[] = { 0x00 ,0x6e ,0x62 };
303 DecodeGRE(&tv, &dtv, p, raw_gre,
sizeof(raw_gre), NULL);
318 static int DecodeGREtest02 (
void)
320 uint8_t raw_gre[] = {
321 0x00, 0x6e, 0x62, 0xac, 0x40, 0x00, 0x40, 0x2f,
322 0xc2, 0xc7, 0x0a, 0x00, 0x00, 0x64, 0x0a, 0x00,
323 0x00, 0x8a, 0x30, 0x01, 0x0b, 0x00, 0x4e, 0x00,
324 0x00, 0x00, 0x18, 0x4a, 0x50, 0xff, 0x03, 0x00,
325 0x21, 0x45, 0x00, 0x00, 0x4a, 0x00, 0x00, 0x40,
326 0x00, 0x40, 0x11, 0x94, 0x22, 0x50, 0x7e, 0x2b,
327 0x2d, 0xc2, 0x6d, 0x68, 0x68, 0x80, 0x0e, 0x00,
328 0x35, 0x00, 0x36, 0x9f, 0x18, 0xdb, 0xc4, 0x01,
329 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
330 0x01, 0x03, 0x73, 0x31, 0x36, 0x09, 0x73, 0x69,
331 0x74, 0x65, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x03,
332 0x63, 0x6f, 0x6d, 0x00, 0x00, 0x01, 0x00, 0x01,
333 0x00, 0x00, 0x29, 0x10, 0x00, 0x00, 0x00, 0x00,
344 DecodeGRE(&tv, &dtv, p, raw_gre,
sizeof(raw_gre), NULL);
360 static int DecodeGREtest03 (
void)
362 uint8_t raw_gre[] = {
363 0x00, 0x6e, 0x62, 0xac, 0x40, 0x00, 0x40, 0x2f,
364 0xc2, 0xc7, 0x0a, 0x00, 0x00, 0x64, 0x0a, 0x00,
365 0x00, 0x8a, 0x30, 0x01, 0x88, 0x0b, 0x00, 0x4e,
366 0x00, 0x00, 0x00, 0x18, 0x4a, 0x50, 0xff, 0x03,
367 0x00, 0x21, 0x45, 0x00, 0x00, 0x4a, 0x00, 0x00,
368 0x40, 0x00, 0x40, 0x11, 0x94, 0x22, 0x50, 0x7e,
369 0x2b, 0x2d, 0xc2, 0x6d, 0x68, 0x68, 0x80, 0x0e,
370 0x00, 0x35, 0x00, 0x36, 0x9f, 0x18, 0xdb, 0xc4,
371 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
372 0x00, 0x01, 0x03, 0x73, 0x31, 0x36, 0x09, 0x73,
373 0x69, 0x74, 0x65, 0x6d, 0x65, 0x74, 0x65, 0x72,
374 0x03, 0x63, 0x6f, 0x6d, 0x00, 0x00, 0x01, 0x00,
375 0x01, 0x00, 0x00, 0x29, 0x10, 0x00, 0x00, 0x00,
376 0x00, 0x00, 0x00, 0x00 };
386 DecodeGRE(&tv, &dtv, p, raw_gre,
sizeof(raw_gre), NULL);
388 if(p->
greh == NULL) {
#define GRE_FLAG_ISSET_ROUTE(r)
#define GRE_GET_VERSION(r)
Packet * PacketTunnelPktSetup(ThreadVars *tv, DecodeThreadVars *dtv, Packet *parent, const uint8_t *pkt, uint32_t len, enum DecodeTunnelProto proto, PacketQueue *pq)
Setup a pseudo packet (tunnel)
#define ENGINE_ISSET_EVENT(p, e)
#define GRE_FLAG_ISSET_CHKSUM(r)
#define ETHERNET_TYPE_VLAN
#define ETHERNET_TYPE_BRIDGE
#define ETHERNET_TYPE_ERSPAN
int DecodeGRE(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, const uint8_t *pkt, uint32_t len, PacketQueue *pq)
Function to decode GRE packets.
#define PKT_SET_SRC(p, src_val)
#define GREV1_FLAG_ISSET_FLAGS(r)
void UtRegisterTest(const char *name, int(*TestFn)(void))
Register unit test.
Structure to hold thread specific data for all decode modules.
void StatsIncr(ThreadVars *tv, uint16_t id)
Increments the local counter.
#define GRE_FLAG_ISSET_SQ(r)
void DecodeGRERegisterTests(void)
this function registers unit tests for GRE decoder
#define GREV1_FLAG_ISSET_ACK(r)
#define GRE_FLAG_ISSET_KY(r)
#define GRE_FLAG_ISSET_SSR(r)
Per thread variable structure.
#define ETHERNET_TYPE_IPV6
void PacketEnqueue(PacketQueue *q, Packet *p)
#define ENGINE_SET_INVALID_EVENT(p, e)
Packet * PacketGetFromAlloc(void)
Get a malloced packet.
#define GRE_FLAG_ISSET_RECUR(r)