- actually re-inject ipv6 re-assembled packets. - set the next header.

remotes/origin/master-1.0.x
Jason Ish 16 years ago committed by Victor Julien
parent 8570976ee0
commit 8f618b2121

@ -1,6 +1,7 @@
/* Copyright (c) 2008 Victor Julien <victor@inliniac.net> */ /* Copyright (c) 2008 Victor Julien <victor@inliniac.net> */
#include "suricata-common.h" #include "suricata-common.h"
#include "packet-queue.h"
#include "decode.h" #include "decode.h"
#include "decode-ipv6.h" #include "decode-ipv6.h"
#include "decode-icmpv6.h" #include "decode-icmpv6.h"
@ -413,15 +414,18 @@ void DecodeIPV6(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, uint8_t *pkt,
break; break;
} }
#if 0
/* Pass to defragger if a fragment. */ /* Pass to defragger if a fragment. */
if (IPV6_EXTHDR_ISSET_FH(p)) { if (IPV6_EXTHDR_ISSET_FH(p)) {
Packet *rp = Defrag(tv, NULL, p); Packet *rp = Defrag(tv, NULL, p);
if (rp != NULL) { if (rp != NULL) {
/* Reinject. */ DecodeIPV6(tv, dtv, rp, rp->pkt, rp->pktlen, pq);
PacketEnqueue(pq, rp);
/* Not really a tunnel packet, but we're piggybacking that
* functionality for now. */
SET_TUNNEL_PKT(p);
} }
} }
#endif
#ifdef DEBUG #ifdef DEBUG
if (IPV6_EXTHDR_ISSET_FH(p)) { if (IPV6_EXTHDR_ISSET_FH(p)) {

@ -654,12 +654,17 @@ Defrag6Reassemble(ThreadVars *tv, DefragContext *dc, DefragTracker *tracker,
int fragmentable_offset = 0; int fragmentable_offset = 0;
int fragmentable_len = 0; int fragmentable_len = 0;
int ip_hdr_offset = 0; int ip_hdr_offset = 0;
uint8_t next_hdr = 0;
TAILQ_FOREACH(frag, &tracker->frags, next) { TAILQ_FOREACH(frag, &tracker->frags, next) {
if (frag->skip) if (frag->skip)
continue; continue;
if (frag->data_len - frag->ltrim <= 0) if (frag->data_len - frag->ltrim <= 0)
continue; continue;
if (frag->offset == 0) { if (frag->offset == 0) {
IPV6FragHdr *frag_hdr = (IPV6FragHdr *)(frag->pkt +
frag->frag_hdr_offset);
next_hdr = frag_hdr->ip6fh_nxt;
/* This is the first packet, we use this packets link and /* This is the first packet, we use this packets link and
* IPv6 headers. We also copy in its data, but remove the * IPv6 headers. We also copy in its data, but remove the
* fragmentation header. */ * fragmentation header. */
@ -686,7 +691,9 @@ Defrag6Reassemble(ThreadVars *tv, DefragContext *dc, DefragTracker *tracker,
} }
BUG_ON(rp->ip6h == NULL); BUG_ON(rp->ip6h == NULL);
rp->ip6h->s_ip6_plen = htons(fragmentable_len); rp->ip6h->s_ip6_plen = htons(fragmentable_len);
rp->ip6h->s_ip6_nxt = next_hdr;
rp->pktlen = ip_hdr_offset + sizeof(IPV6Hdr) + fragmentable_len; rp->pktlen = ip_hdr_offset + sizeof(IPV6Hdr) + fragmentable_len;
IPV6_CACHE_INIT(rp);
remove_tracker: remove_tracker:
/* Remove the frag tracker. */ /* Remove the frag tracker. */

Loading…
Cancel
Save