Skip to content

udp: Encode 0 checksums as 0xFFFF#883

Open
arthurfabre wants to merge 1 commit intogoogle:masterfrom
arthurfabre:afabre/udpcsum
Open

udp: Encode 0 checksums as 0xFFFF#883
arthurfabre wants to merge 1 commit intogoogle:masterfrom
arthurfabre:afabre/udpcsum

Conversation

@arthurfabre
Copy link
Copy Markdown

RFC768 states:

If the computed checksum is zero, it is transmitted as all ones (the
equivalent in one's complement arithmetic). An all zero transmitted
checksum  value means that the transmitter generated no checksum.

Updated the serialization logic to correctly handle this. It isn't a big
problem for IPv4 where checksums are optional, but affects IPv6 which
has mandatory UDP checksums.

RFC768 states:

    If the computed checksum is zero, it is transmitted as all ones (the
    equivalent in one's complement arithmetic). An all zero transmitted
    checksum  value means that the transmitter generated no checksum.

Updated the serialization logic to correctly handle this. It isn't a big
problem for IPv4 where checksums are optional, but affects IPv6 which
has mandatory UDP checksums.
@MarcusWichelmann
Copy link
Copy Markdown

MarcusWichelmann commented Sep 6, 2022

@gconnell Sorry for tagging you, but is there a reason this PR hasn't been merged yet?
I'm currently working on a follow-up PR that refactors some things about the checksum calculation and also adds functions to verify checksums of decoded packets, and would like to base my work on this PR. Would be great, if this could be merged beforehand.

Also the changes in this PR look all valid IMO.

@joewilliams
Copy link
Copy Markdown

Please merge this PR.

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.

3 participants