|
|
/* $Id: decode.c,v 1.130 2006/10/13 17:40:42 ssturges Exp $ */ |
/* $Id: decode.c,v 1.131 2007/01/10 22:41:54 ssturges Exp $ */ |
| |
/* | /* |
** Copyright (C) 1998-2002 Martin Roesch <roesch@sourcefire.com> | ** Copyright (C) 1998-2002 Martin Roesch <roesch@sourcefire.com> |
|
Lines 2339-2352
void DecodeIP(u_int8_t * pkt, const u_in
|
Link Here
|
|---|
|
else | else |
{ | { |
#ifdef GRE | #ifdef GRE |
/* if delivery header for GRE encapsulated packet is IP and it |
/* If delivery header for GRE encapsulated packet is IP and it |
* had options, p->ip_options_data will be pointing to this outer |
* had options, the packet's ip options will be refering to this |
* IP's options |
* outer IP's options |
* set to NULL so these options aren't associated with this inner IP |
* Zero these options so they aren't associated with this inner IP |
* since p->iph will be pointing to this inner IP |
* since p->iph will be pointing to this inner IP |
*/ |
*/ |
if (p->greh != NULL) |
if (p->greh != NULL) |
p->ip_options_data = NULL; |
{ |
|
p->ip_options_data = NULL; |
|
p->ip_options_len = 0; |
|
memset(&(p->ip_options[0]), 0, sizeof(p->ip_options)); |
|
p->ip_lastopt_bad = 0; |
|
} |
#endif | #endif |
| |
p->ip_option_count = 0; | p->ip_option_count = 0; |
|
Lines 3462-3468
void DecodeGRE(u_int8_t *pkt, const u_in
|
Link Here
|
|---|
|
u_int32_t hlen; /* GRE header length */ | u_int32_t hlen; /* GRE header length */ |
u_int32_t payload_len; | u_int32_t payload_len; |
| |
if (len < sizeof(GREHdr)) |
if (len < GRE_HEADER_LEN) |
{ | { |
if(pv.verbose_flag) | if(pv.verbose_flag) |
ErrorMessage("GRE header length > rest of packet length"); | ErrorMessage("GRE header length > rest of packet length"); |
|
Lines 3553-3560
void DecodeGRE(u_int8_t *pkt, const u_in
|
Link Here
|
|---|
|
| |
sre_addrfamily = ntohs(*((u_int16_t *)sre_ptr)); | sre_addrfamily = ntohs(*((u_int16_t *)sre_ptr)); |
sre_ptr += sizeof(sre_addrfamily); | sre_ptr += sizeof(sre_addrfamily); |
|
|
sre_offset = *((u_int8_t *)sre_ptr); | sre_offset = *((u_int8_t *)sre_ptr); |
sre_ptr += sizeof(sre_offset); | sre_ptr += sizeof(sre_offset); |
|
|
sre_length = *((u_int8_t *)sre_ptr); | sre_length = *((u_int8_t *)sre_ptr); |
sre_ptr += sizeof(sre_length); | sre_ptr += sizeof(sre_length); |
| |
|
Lines 3566-3574
void DecodeGRE(u_int8_t *pkt, const u_in
|
Link Here
|
|---|
|
} | } |
} | } |
| |
payload_len = len - hlen; |
if (hlen > len) |
|
|
if (payload_len < 0) |
|
{ | { |
if(pv.verbose_flag) | if(pv.verbose_flag) |
ErrorMessage("GRE header length > rest of packet length"); | ErrorMessage("GRE header length > rest of packet length"); |
|
Lines 3589-3595
void DecodeGRE(u_int8_t *pkt, const u_in
|
Link Here
|
|---|
|
return; | return; |
} | } |
| |
/* send to next protocol decoder */ |
payload_len = len - hlen; |
|
|
|
/* Send to next protocol decoder */ |
/* As described in RFC 2784 the possible protocols are listed in | /* As described in RFC 2784 the possible protocols are listed in |
* RFC 1700 under "ETHER TYPES" | * RFC 1700 under "ETHER TYPES" |
* See also "Current List of Protocol Types" in RFC 1701 | * See also "Current List of Protocol Types" in RFC 1701 |