Keep the whole table index when caching dynamic filter matches - #1689
Open
arpitjain099 wants to merge 1 commit into
Open
Keep the whole table index when caching dynamic filter matches#1689arpitjain099 wants to merge 1 commit into
arpitjain099 wants to merge 1 commit into
Conversation
Signed-off-by: Arpit Jain <arpitjain099@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
filterAllowedIndicestook the index of a matching row withwhich is only the last sub-identifier. That is right for a table indexed by a single integer, and wrong for anything else.
jnxBgpM2PeerTablein #1687 is indexed by routing instance plus a local and a remote InetAddress, so every matching row cached the same trailing byte, andaddAllowedIndicesthen built a GET for an OID that does not exist. The target metric simply goes missing, with nothing in the logs pointing at the index.The index is everything after the filter's own OID, so
indexFromOIDnow takes that, tolerating a leading dot on either side (gosnmp emits names both ways) and returning empty for a PDU outside the filter's subtree, which is then skipped rather than cached as a bad index.Two tests.
TestFilterAllowedIndicesCompositeIndexuses the issue's table and asserts both the cached indices and the GET OIDs that come out ofaddAllowedIndices, since that is where the damage actually shows. Against the current code it fails the way the report describes, with two distinct peers collapsing onto one index:TestIndexFromOIDcovers the parsing directly, including the case that would be easy to get wrong with a plainTrimPrefix:1.3.6.1.2.1.2.2.1.80.2is not under1.3.6.1.2.1.2.2.1.8.The existing
TestFilterAllowedIndicesis untouched and still passes, which is the single-component case.go test ./...andgo vet ./...are clean.Verified against unit tests only; I do not have a Juniper device to reproduce the original walk on.
Fixes #1687