Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Total Length is the length of the datagram, measured in octets, *including* internet header and data. #131

Merged
merged 1 commit into from
Mar 1, 2024

Conversation

lemmy
Copy link
Contributor

@lemmy lemmy commented Feb 23, 2024

Total Length: 16 bits

Total Length is the length of the datagram, measured in octets,
including internet header and data.  This field allows the length of
a datagram to be up to 65,535 octets.  Such long datagrams are
impractical for most hosts and networks.  All hosts must be prepared
to accept datagrams of up to 576 octets (whether they arrive whole
or in fragments).  It is recommended that hosts only send datagrams
larger than 576 octets if they have assurance that the destination
is prepared to accept the larger datagrams.

The number 576 is selected to allow a reasonable sized data block to
be transmitted in addition to the required header information.  For
example, this size allows a data block of 512 octets plus 64 header
octets to fit in a datagram.  The maximal internet header is 60
octets, and a typical internet header is 20 octets, allowing a
margin for headers of higher level protocols.

Page 13 of https://datatracker.ietf.org/doc/html/rfc791

Generating a witness without this constraint causes e.g. this wireshark message:

Layer IP
:       0100 .... = Version: 4
        .... 0110 = Header Length: 24 bytes (6)
        Differentiated Services Field: 0x00 (DSCP: CS0, ECN: Not-ECT)
        0000 00.. = Differentiated Services Codepoint: Default (0)
        .... ..00 = Explicit Congestion Notification: Not ECN-Capable Transport (0)
        Total Length: 12 bytes (reported as 0, presumed to be because of "TCP segmentation offload" (TSO))
        Identification: 0x0000 (0)
        000. .... = Flags: 0x0
        0... .... = Reserved bit: Not set
        .0.. .... = Don't fragment: Not set
        ..0. .... = More fragments: Not set
        ...0 0000 0000 0000 = Fragment Offset: 0
        Time to Live: 0
        Protocol: IPv6 Hop-by-Hop Option (0)
        Header Checksum: 0x0000 [validation disabled]
        Header checksum status: Unverified

An even stronger constraint would be TotalLength >= sizeof(this) if sizeof(this) would equal the size of the _IP_DATAGRAM_HEADER_PARAMETRIZED struct.

@project-everest project-everest deleted a comment from lemmy Mar 1, 2024
@tahina-pro tahina-pro merged commit ab77836 into project-everest:master Mar 1, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants