Fix PIA packet replay to deliver copy of IP header

This prevented one from writing a packet-wise analyzer that needs access
to IP headers and can be attached to a connection via signature match.

None of the analyzers currently shipping are affected.  And maybe it's
unlikely there will be many that ever would be, but it's awkward for the
API to omit IP headers in this special case (i.e. packets buffer for use
with DPD signature matching).

Addresses BIT-1298
This commit is contained in:
Jon Siwek 2014-12-10 15:12:38 -06:00
parent 69724c5e1f
commit c211a2c91a
4 changed files with 113 additions and 7 deletions

View file

@ -157,6 +157,12 @@ public:
delete finalDst;
}
/**
* @return a copy of the header chain, but with pointers to individual
* IPv6 headers now pointing within \a new_hdr.
*/
IPv6_Hdr_Chain* Copy(const struct ip6_hdr* new_hdr) const;
/**
* Returns the number of headers in the chain.
*/
@ -264,6 +270,14 @@ protected:
// point to a fragment
friend class FragReassembler;
IPv6_Hdr_Chain() :
length(0),
#ifdef ENABLE_MOBILE_IPV6
homeAddr(0),
#endif
finalDst(0)
{}
/**
* Initializes the header chain from an IPv6 header structure, and replaces
* the first next protocol pointer field that points to a fragment header.
@ -353,6 +367,20 @@ public:
{
}
/**
* Copy constructor. The internal buffer of \a other which contains
* the header data must not be truncated. Also not that if that buffer
* points to a full packet payload, only the IP header portion is copied.
*/
IP_Hdr(const IP_Hdr& other);
/**
* Copy assignment. The internal buffer of \a other which contains
* the header data must not be truncated. Also not that if that buffer
* points to a full packet payload, only the IP header portion is copied.
*/
IP_Hdr& operator=(IP_Hdr other);
/**
* Destructor.
*/
@ -553,7 +581,10 @@ public:
*/
RecordVal* BuildPktHdrVal() const;
friend void swap(IP_Hdr& a, IP_Hdr& b);
private:
const struct ip* ip4;
const struct ip6_hdr* ip6;
bool del;