Remove tunnel_proto field from Packet structure.

remotes/origin/master-1.1.x
Victor Julien 15 years ago
parent 3d22713b09
commit 54cd3552e1

@ -200,7 +200,8 @@ void DecodeGRE(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, uint8_t *pkt, u
Packet *tp = PacketPseudoPktSetup(p, pkt + header_len, Packet *tp = PacketPseudoPktSetup(p, pkt + header_len,
len - header_len, IPPROTO_IP); len - header_len, IPPROTO_IP);
if (tp != NULL) { if (tp != NULL) {
DecodeTunnel(tv, dtv, tp, GET_PKT_DATA(tp), GET_PKT_LEN(tp), pq); DecodeTunnel(tv, dtv, tp, GET_PKT_DATA(tp),
GET_PKT_LEN(tp), pq, IPPROTO_IP);
PacketEnqueue(pq,tp); PacketEnqueue(pq,tp);
} }
} }
@ -213,7 +214,8 @@ void DecodeGRE(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, uint8_t *pkt, u
Packet *tp = PacketPseudoPktSetup(p, pkt + header_len, Packet *tp = PacketPseudoPktSetup(p, pkt + header_len,
len - header_len, PPP_OVER_GRE); len - header_len, PPP_OVER_GRE);
if (tp != NULL) { if (tp != NULL) {
DecodeTunnel(tv, dtv, tp, GET_PKT_DATA(tp), GET_PKT_LEN(tp), pq); DecodeTunnel(tv, dtv, tp, GET_PKT_DATA(tp),
GET_PKT_LEN(tp), pq, PPP_OVER_GRE);
PacketEnqueue(pq,tp); PacketEnqueue(pq,tp);
} }
} }
@ -226,7 +228,8 @@ void DecodeGRE(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, uint8_t *pkt, u
Packet *tp = PacketPseudoPktSetup(p, pkt + header_len, Packet *tp = PacketPseudoPktSetup(p, pkt + header_len,
len - header_len, IPPROTO_IPV6); len - header_len, IPPROTO_IPV6);
if (tp != NULL) { if (tp != NULL) {
DecodeTunnel(tv, dtv, tp, GET_PKT_DATA(tp), GET_PKT_LEN(tp), pq); DecodeTunnel(tv, dtv, tp, GET_PKT_DATA(tp),
GET_PKT_LEN(tp), pq, IPPROTO_IPV6);
PacketEnqueue(pq,tp); PacketEnqueue(pq,tp);
} }
} }
@ -239,7 +242,8 @@ void DecodeGRE(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, uint8_t *pkt, u
Packet *tp = PacketPseudoPktSetup(p, pkt + header_len, Packet *tp = PacketPseudoPktSetup(p, pkt + header_len,
len - header_len, VLAN_OVER_GRE); len - header_len, VLAN_OVER_GRE);
if (tp != NULL) { if (tp != NULL) {
DecodeTunnel(tv, dtv, tp, GET_PKT_DATA(tp), GET_PKT_LEN(tp), pq); DecodeTunnel(tv, dtv, tp, GET_PKT_DATA(tp),
GET_PKT_LEN(tp), pq, VLAN_OVER_GRE);
PacketEnqueue(pq,tp); PacketEnqueue(pq,tp);
} }
} }

@ -575,7 +575,8 @@ void DecodeIPV4(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, uint8_t *pkt,
IPV4_GET_IPPROTO(p)); IPV4_GET_IPPROTO(p));
if (tp != NULL) { if (tp != NULL) {
/* send that to the Tunnel decoder */ /* send that to the Tunnel decoder */
DecodeTunnel(tv, dtv, tp, GET_PKT_DATA(tp), GET_PKT_LEN(tp), pq); DecodeTunnel(tv, dtv, tp, GET_PKT_DATA(tp),
GET_PKT_LEN(tp), pq, IPV4_GET_IPPROTO(p));
/* add the tp to the packet queue. */ /* add the tp to the packet queue. */
PacketEnqueue(pq,tp); PacketEnqueue(pq,tp);

@ -33,9 +33,10 @@
#include "util-error.h" #include "util-error.h"
#include "tmqh-packetpool.h" #include "tmqh-packetpool.h"
void DecodeTunnel(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, uint8_t *pkt, uint16_t len, PacketQueue *pq) void DecodeTunnel(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p,
uint8_t *pkt, uint16_t len, PacketQueue *pq, uint8_t proto)
{ {
switch (p->tunnel_proto) { switch (proto) {
case PPP_OVER_GRE: case PPP_OVER_GRE:
return DecodePPP(tv, dtv, p, pkt, len, pq); return DecodePPP(tv, dtv, p, pkt, len, pq);
case IPPROTO_IP: case IPPROTO_IP:
@ -45,7 +46,7 @@ void DecodeTunnel(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, uint8_t *pkt
case VLAN_OVER_GRE: case VLAN_OVER_GRE:
return DecodeVLAN(tv, dtv, p, pkt, len, pq); return DecodeVLAN(tv, dtv, p, pkt, len, pq);
default: default:
SCLogInfo("FIXME: DecodeTunnel: protocol %" PRIu32 " not supported.", p->tunnel_proto); SCLogInfo("FIXME: DecodeTunnel: protocol %" PRIu32 " not supported.", proto);
break; break;
} }
} }
@ -108,7 +109,6 @@ Packet *PacketPseudoPktSetup(Packet *parent, uint8_t *pkt, uint16_t len, uint8_t
p->root = parent; p->root = parent;
/* copy packet and set lenght, proto */ /* copy packet and set lenght, proto */
p->tunnel_proto = proto;
PacketCopyData(p, pkt, len); PacketCopyData(p, pkt, len);
p->recursion_level = parent->recursion_level + 1; p->recursion_level = parent->recursion_level + 1;
p->ts.tv_sec = parent->ts.tv_sec; p->ts.tv_sec = parent->ts.tv_sec;

@ -386,8 +386,6 @@ typedef struct Packet_
/* tunnel packet ref count */ /* tunnel packet ref count */
uint8_t tpr_cnt; uint8_t tpr_cnt;
SCMutex mutex_rtv_cnt; SCMutex mutex_rtv_cnt;
/* tunnel stuff */
uint8_t tunnel_proto;
/* decoder events */ /* decoder events */
PacketDecoderEvents events; PacketDecoderEvents events;
@ -582,7 +580,6 @@ typedef struct DecodeThreadVars_
(p)->tpr_cnt = 0; \ (p)->tpr_cnt = 0; \
SCMutexDestroy(&(p)->mutex_rtv_cnt); \ SCMutexDestroy(&(p)->mutex_rtv_cnt); \
SCMutexInit(&(p)->mutex_rtv_cnt, NULL); \ SCMutexInit(&(p)->mutex_rtv_cnt, NULL); \
(p)->tunnel_proto = 0; \
(p)->events.cnt = 0; \ (p)->events.cnt = 0; \
(p)->next = NULL; \ (p)->next = NULL; \
(p)->prev = NULL; \ (p)->prev = NULL; \
@ -718,7 +715,7 @@ void DecodeSll(ThreadVars *, DecodeThreadVars *, Packet *, uint8_t *, uint16_t,
void DecodePPP(ThreadVars *, DecodeThreadVars *, Packet *, uint8_t *, uint16_t, PacketQueue *); void DecodePPP(ThreadVars *, DecodeThreadVars *, Packet *, uint8_t *, uint16_t, PacketQueue *);
void DecodePPPOESession(ThreadVars *, DecodeThreadVars *, Packet *, uint8_t *, uint16_t, PacketQueue *); void DecodePPPOESession(ThreadVars *, DecodeThreadVars *, Packet *, uint8_t *, uint16_t, PacketQueue *);
void DecodePPPOEDiscovery(ThreadVars *, DecodeThreadVars *, Packet *, uint8_t *, uint16_t, PacketQueue *); void DecodePPPOEDiscovery(ThreadVars *, DecodeThreadVars *, Packet *, uint8_t *, uint16_t, PacketQueue *);
void DecodeTunnel(ThreadVars *, DecodeThreadVars *, Packet *, uint8_t *, uint16_t, PacketQueue *); void DecodeTunnel(ThreadVars *, DecodeThreadVars *, Packet *, uint8_t *, uint16_t, PacketQueue *, uint8_t);
void DecodeRaw(ThreadVars *, DecodeThreadVars *, Packet *, uint8_t *, uint16_t, PacketQueue *); void DecodeRaw(ThreadVars *, DecodeThreadVars *, Packet *, uint8_t *, uint16_t, PacketQueue *);
void DecodeIPV4(ThreadVars *, DecodeThreadVars *, Packet *, uint8_t *, uint16_t, PacketQueue *); void DecodeIPV4(ThreadVars *, DecodeThreadVars *, Packet *, uint8_t *, uint16_t, PacketQueue *);
void DecodeIPV6(ThreadVars *, DecodeThreadVars *, Packet *, uint8_t *, uint16_t, PacketQueue *); void DecodeIPV6(ThreadVars *, DecodeThreadVars *, Packet *, uint8_t *, uint16_t, PacketQueue *);

@ -4449,7 +4449,6 @@ Packet *StreamTcpPseudoSetup(Packet *parent, uint8_t *pkt, uint32_t len)
p->root = parent; p->root = parent;
/* copy packet and set lenght, proto */ /* copy packet and set lenght, proto */
p->tunnel_proto = parent->proto;
p->proto = parent->proto; p->proto = parent->proto;
p->datalink = parent->datalink; p->datalink = parent->datalink;

Loading…
Cancel
Save