Improve handling of IPv6 Routing Type 0 headers.

- For RH0 headers with non-zero segments left, a "routing0_segleft"
  flow_weird event is raised (with a destination indicating the last
  address in the routing header), and an "rh0_segleft" event can also
  be handled if the other contents of the packet header are of interest.
  No further analysis is done as the complexity required to correctly
  identify destination endpoints of connections doesn't seem worth it
  as RH0 has been deprecated by RFC 5095.

- For RH0 headers without any segments left, a "routing0_header"
  flow_weird event is raised, but further analysis still occurs
  as normal.
This commit is contained in:
Jon Siwek 2012-03-28 13:49:28 -05:00
parent d889f14638
commit 256cd592a7
12 changed files with 93 additions and 4 deletions

View file

@ -171,6 +171,20 @@ public:
{ return IsFragment() ?
(ntohs(GetFragHdr()->ip6f_offlg) & 0x0001) != 0 : 0; }
/**
* Returns whether the chain contains a routing type 0 extension header
* with nonzero segments left.
*/
bool RH0SegLeft() const
{
for ( size_t i = 0; i < chain.size(); ++i )
if ( chain[i]->Type() == IPPROTO_ROUTING &&
((const struct ip6_rthdr*)chain[i]->Data())->ip6r_type == 0 &&
((const struct ip6_rthdr*)chain[i]->Data())->ip6r_segleft > 0 )
return true;
return false;
}
/**
* Returns a vector of ip6_ext_hdr RecordVals that includes script-layer
* representation of all extension headers in the chain.
@ -343,6 +357,13 @@ public:
size_t NumHeaders() const
{ return ip4 ? 1 : ip6_hdrs->Size(); }
/**
* Returns true if this is an IPv6 header containing a routing type 0
* extension with nonzero segments left, else returns false.
*/
bool RH0SegLeft() const
{ return ip4 ? false : ip6_hdrs->RH0SegLeft(); }
/**
* Returns an ip_hdr or ip6_hdr_chain RecordVal.
*/