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

IPv6 packets can be dumped to file incorrectly #42

Closed
jpanczyk opened this issue Jun 4, 2015 · 1 comment
Closed

IPv6 packets can be dumped to file incorrectly #42

jpanczyk opened this issue Jun 4, 2015 · 1 comment
Labels

Comments

@jpanczyk
Copy link

jpanczyk commented Jun 4, 2015

An IPv6 packet with a high (>127) traffic class will not be properly written to a pcap file. Since traffic class is a byte, values higher than 127 are actually negative, and corrupt the version nibble (all bits are high) when raw data is created through bitwise or'ing.

The method getRawFields():

rawFields.add(
    ByteArrays.toByteArray(
        version.value() << 28 | trafficClass.value() << 20 | flowLabel.value()
    )
);

Bit masking of trafficClass.value() with 0xFF before the shift should fix the problem.

kaitoy added a commit that referenced this issue Jun 4, 2015
@kaitoy
Copy link
Owner

kaitoy commented Jun 4, 2015

Thank you for pointing it.
You are right. I fixed it.

@kaitoy kaitoy closed this as completed Jun 4, 2015
@kaitoy kaitoy added the bug label Jun 4, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants