IPv6
IPv6 Header
A IPv6 header consists of a set of fields:
1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-------+---------------+---------------------------------------+
|VERSION| Traffic Class | Flow Label |
+-------+---------------+-------+---------------+---------------+
| Payload Length | Next Header | Hop-Limit |
+-------------------------------+---------------+---------------+
| |
| Source Address |
| (128 bits) |
| |
+---------------------------------------------------------------+
| |
| Destination Address |
| (128 bits) |
| |
+---------------------------------------------------------------+4-bit protocol version (
IPV6#version). Attended value is 6 for IPv6,8-bit traffic class (`IPV6#traffic_class),
20-bit flow label (
IPv6#flow_label),16-bit payload length (
IPV6#length), size of IPV6 payload, excluding the header,8-bit next header (
IPV6#next) to indicate upper protocol (6 for TCP, and 17 for UDPby example, but this may also be IPv6 options),
8-bit hop-limit (
IPV6#hop),128-bit source IPV6 address (
IPV6#src),128-bit destination IPV6 address (
IPV6#dst),a body (
IPV6#body) containing data conveyed by IPv6.
A IPV6 header may be built this way:
IPv6 Packet
A IPv6 packet may be created this way:
As you can see, length is not automatically set to correct value. But it may be set easily with IPv6#calc_length. Packet#calc may be used too: it automatically call #calc_sum and #calc_length on all headers responding to them:
TCP and UDP headers over IPv6
TCP and UDP headers may be added to a IPv6 packet:
See also http://rubydoc.info/gems/packetgen/PacketGen/Header/IPv6.
Last updated