Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.)

share|improve this question

closed as not a real question by Michael Hampton, Everett, Brad Patton, 8088, Ƭᴇcʜιᴇ007 May 2 '13 at 11:35

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

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 '13 at 17:32
Just a research – Hanna May 1 '13 at 7:50
up vote 3 down vote accepted

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.

share|improve this answer
A more detailed answer:link – Hanna May 5 '13 at 16:53

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.

share|improve this answer
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 '13 at 16:30
40 octects is only for IPV6 link layer. – Diogo Apr 30 '13 at 16:53

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