Fix IndexError when parsing FIB route keys without colon#22290
Open
nnelluri-cisco wants to merge 2 commits intosonic-net:masterfrom
Open
Fix IndexError when parsing FIB route keys without colon#22290nnelluri-cisco wants to merge 2 commits intosonic-net:masterfrom
nnelluri-cisco wants to merge 2 commits intosonic-net:masterfrom
Conversation
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
0042993 to
7d9abbc
Compare
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Contributor
Author
|
@bhavani |
7d9abbc to
07299cc
Compare
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
bpar9
previously approved these changes
Feb 11, 2026
07299cc to
40a0eb1
Compare
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
40a0eb1 to
ed5e3bc
Compare
Contributor
Author
|
@prabhataravind @xwjiang-ms |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes an IndexError in FIB (Forwarding Information Base) route parsing that occurs when Redis keys without colons (e.g., ROUTE_TABLE_DEL_SET) are encountered. The code previously assumed all route keys contain a colon and attempted to split on it unconditionally, causing an IndexError when accessing the second element of a single-element list.
Changes:
- Added safety check to verify colon presence before splitting route keys in
get_fib_infofunction - Keys without colons are now skipped gracefully using
continuestatement
ed5e3bc to
2d19d92
Compare
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
2d19d92 to
38abe92
Compare
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
38abe92 to
9f7c648
Compare
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
9f7c648 to
1d0b44e
Compare
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
1d0b44e to
78e3985
Compare
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Signed-off-by: nnelluri-cisco <nnelluri@cisco.com> Signed-off-by: nnelluri <nnelluri@cisco.com>
…t represent route entries Signed-off-by: nnelluri <nnelluri@cisco.com>
78e3985 to
956d49c
Compare
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
kazinator-arista
pushed a commit
to kazinator-arista/sonic-mgmt
that referenced
this pull request
Mar 4, 2026
…tomatically (sonic-net#22290) #### Why I did it src/sonic-linux-kernel ``` * a89afbc - (HEAD -> 202411, origin/202411) [202411] Update to Linux 6.1.123 (sonic-net#459) (4 days ago) [Saikrishna Arcot] ``` #### How I did it #### How to verify it #### Description for the changelog
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.
Description of PR
The FIB parsing code assumed all route keys contain a colon (:) and
attempted to split on it unconditionally:
prefix = k.split(':', 1)[1]
When a key like 'ROUTE_TABLE_DEL_SET' (without colon) is encountered,
split(':') returns a single-element list, causing IndexError when
accessing index [1].
Error:
prefix = k.split(':', 1)[1]
IndexError: list index out of range
Summary:
Added a safety check to verify colon exists before splitting:
if ":" in k:
prefix = k.split(':', 1)[1]
else:
continue
This ensures only properly formatted route keys (containing ':') are
processed, and malformed keys are skipped gracefully.
Fixes # (issue)
Type of change
Back port request
Approach
What is the motivation for this PR?
Fix an IndexError crash in FIB (Forwarding Information Base) route parsing that occurs when processing route table
Error:
How did you do it?
Added a safety check to verify the presence of a colon before attempting to split route keys:
Before:
After:
This ensures only properly formatted route keys (e.g.,
ROUTE_TABLE:192.168.0.0/24) are processed, while malformed or special keys are gracefully skipped.How did you verify/test it?
ROUTE_TABLE:10.0.0.0/24✓ROUTE_TABLE:fc00::fc/126✓ROUTE_TABLE_DEL_SET✓ (now skipped gracefully)Any platform specific information?
Platform dependency: None - this is a generic parsing fix
Supported testbed topology if it's a new test case?
Documentation