Improve handling of IPv6 routing type 0 extension headers.

- flow_weird event with name argument value of "routing0_hdr" is raised
  for packets containing an IPv6 routing type 0 header because this
  type of header is now deprecated according to RFC 5095.

- packets with a routing type 0 header and non-zero segments left
  now use the last address in that header in order to associate
  with a connection/flow and for calculating TCP/UDP checksums.

- added a set of IPv4/IPv6 TCP/UDP checksum unit tests
This commit is contained in:
Jon Siwek 2012-03-27 16:05:45 -05:00
parent d889f14638
commit f4101b5265
39 changed files with 171 additions and 121 deletions

View file

@ -305,6 +305,20 @@ void IPv6_Hdr_Chain::Init(const struct ip6_hdr* ip6, bool set_next, uint16 next)
chain.push_back(p);
// Check for routing type 0 header.
if ( current_type == IPPROTO_ROUTING &&
((const struct ip6_rthdr*)hdrs)->ip6r_type == 0 )
{
if ( ((const struct ip6_rthdr*)hdrs)->ip6r_segleft > 0 )
// Remember the index for later so we can determine the final
// destination of the packet.
route0_hdr_idx = chain.size() - 1;
// RFC 5095 deprecates routing type 0 headers, so raise weirds
IPAddr src(((const struct ip6_hdr*)(chain[0]->Data()))->ip6_src);
reporter->Weird(src, FinalDst(), "routing0_hdr");
}
hdrs += len;
length += len;
} while ( current_type != IPPROTO_FRAGMENT &&