-2

I know there is IHL field in IPV4 which is Internet Header Length.Since an IPv4 header may contain a variable number of options, this field specifies the size of the header. But there is no IHL or something like that in IPV6.So how to get the exact size of header length? (We know There may be extensions.I need to know the size of IPv6 header including header extensions but without upper layer data.)

2
  • Why do you need to know this? Your question is very abstract, you might get a more useful answer if you can explain what you are really after.
    – Zoredache
    Apr 30, 2013 at 17:32
  • Just a research
    – Hanna
    May 1, 2013 at 7:50

2 Answers 2

3

As far as I know, there simply is no simple way to do this.

You basically have to inspect the Next header field, determine if the next header is an extension, add the length of that extension to your total, and repeat until you run out of extensions.

1
  • A more detailed answer:link
    – Hanna
    May 5, 2013 at 16:53
3

Actually you don't need to check it because IPV6 have a fixed header lengh:

The IPv6 packet header has a fixed size (40 octets). Options are implemented as additional extension headers after the IPv6 header, which limits their size only by the size of an entire packet. The extension header mechanism makes the protocol extensible in that it allows future services for quality of service, security, mobility, and others to be added without redesign of the basic protocol.

The fixed header occupies the first 40 octets (320 bits) of the IPv6 packet. It contains the source and destination addresses, traffic classification options, a hop counter, and the type of the optional extension or payload which follows the header. This Next Header field tells the receiver how to interpret the data which follows the header. If the packet contains options, this field contains the option type of the next option. The "Next Header" field of the last option, points to the upper-layer protocol that is carried in the packet's payload.

This was a choice of IPV6 comitee to increase performance(in comparison with IPV4), you don't need to check the size on a parameter inside the header having a fixed number of bytes to check for every packet.

2
  • 2
    But there may be extensions.I need to know the size of IPv6 header including header extensions but without transport layer data.
    – Hanna
    Apr 30, 2013 at 16:30
  • 40 octects is only for IPV6 link layer.
    – Diogo
    Apr 30, 2013 at 16:53

Not the answer you're looking for? Browse other questions tagged .