Support 64 bit limit for police actions #1084
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The issue
The library currently only supports 32 bit values for "rate" and "peak rate" in police actions.
Fixes #1081.
Implementation notes
The fields are stored in the struct
nl.TcPolice
, which only supports 32 bits. The protocol supports separate 64 bit attributes, which can be appended after thenl.TcPolice
instance.This change is completely analogous to the commit "implemented handling of uint64 for HTB class rate/ceil
".
Related bug fixes
It is possible to receive the 64 bit attribute before the
TcPolice
instance. (I saw this during my testing.)That means we must check if we have already received the value, to avoid overwriting it with an incorrect 32 bit value.
In the existing code, we fail to account for this when parsing
TCA_HTB_PARMS
andTCA_TBF_PARMS
.I have added checks there, but I have not tested it thoroughly to see if there are other bugs.