Repository navigation
Missing IPv6 Header Extensions, IPv4 Options & Parsing from the IP Layer downwards
Overview
- Previously missing IPv6 extension header id's have been added and are now correctly handled by the skipping & slicing functions.
- Functions have been added to SlicedPacket & PacketHeader & PacketBuilder that allow the slicing, reading, and generation of packets starting from the ip layer downwards (thanks to @razorheadfx ).
- Additionally the IPv4 header options, that were previously passed in as an argument, have now moved into the Ipv4Header struct itself. This sadly means there are some breaking changes.
- All headers now also have methods for slicing packets directly from slices.
Ipv4Header Changes in Detail:
Breaking changes for Ipv4Header:
- Ipv4Header now contains two private fields: "options_buffer" & "options_len". As such you can no longer directly initialize header fields directly. Instead you will have to use Default::default() or Ipv4Header::new() and set fields afterwords.
- Renamed "set_payload_and_options_length" to "set_payload_len" as the options are now present in the header.
- "new" method changes:
- No longer returns a result (use check_ranges if you want to verfy if your values can be used)
- Takes the payload_len as a u16 (previously usize, use set_payload_len if you want to use usize)
- "write" & "write_raw" no longer take a slice to the options. The options are now present in the header, use the "set_options" method if you want to write Ipv4Header options.
Additional Ipv4Header changes:
- Added method "ihl" for reading the internet header length
- Added method "options" to get a slice of to the options
- Added method "header_len" to get the bytes length of the header + options
- Added method "total_len" to get the bytes length of ip header + payload
- Added method "set_options" to set the options of the header
- Added method "check_ranges" for checking the ranges of the values in the header (used in the write methods).
Ipv4HeaderSlice changes:
- "from_slice" added check of the total length (no sizes smaller then the header itsel allowed)