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

Match XM Parsing - Type & Length Ignored #127

Merged
merged 3 commits into from
Mar 29, 2018
Merged

Conversation

kent-h
Copy link
Contributor

@kent-h kent-h commented Mar 27, 2018

Fixed an off-by-4-bytes issue in match xm parsing. The type and length (4 bytes) are read before the LimitReader is created, and so must be subtracted from the rdlen.

…h have already been read, which was not previously taken into account.
…ed in the length, per the OF 1.3.3 spec ("uint16_t length; Length of ofp_match (excluding padding)"). This bug was previously masked by another bug (see previous commit).
@kent-h
Copy link
Contributor Author

kent-h commented Mar 27, 2018

Changes due to secondary bug (which was masking the first one):
Padding is not included in the length per the spec, but was being added to the rdlen anyways.

Also changed the - int(n) to a plain - 4, since it's a guaranteed constant.

ofp/match.go Outdated
matchlen := int(length)
rdlen := matchlen - padLen(matchlen)

// Subtract the length of the alread-read Type & Length fields
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: alread.

@ybubnov
Copy link
Member

ybubnov commented Mar 28, 2018

Tests failures aren't related to the changes.

@ybubnov
Copy link
Member

ybubnov commented Mar 28, 2018

@kent-h, thank you for the pull-request, I highly appreciate it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants