-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
pbrd: Fix PBR handling for last rule deletion #15206
Merged
Merged
Conversation
This file contains 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
Issue: Previously, the PBR common was updated for every rule update or deletion example: let say we have three rule 11, 12, 13 and if we are removing rule 12. in the current code we are making the entire map "valid" to false. pbr-map MAP1 seq 11 match src-ip 90.1.1.2/32 set nexthop 20.1.1.2 swp1 pbr-map MAP1 seq 12 match src-ip 90.1.1.3/32 set nexthop 20.1.1.2 swp1 pbr-map MAP1 seq 13 match src-ip 90.1.1.4/32 set nexthop 20.1.1.2 swp1 no pbr-map MAP1 seq 12 ==> turns whole map valid to false. r1(config)# end r1# show pbr map pbr-map MAP1 valid: no Seq: 11 rule: 310 Installed: yes Reason: Valid SRC IP Match: 90.1.1.2/32 nexthop 20.1.1.2 swp1 Installed: yes Tableid: 10002 Seq: 13 rule: 312 Installed: yes Reason: Valid SRC IP Match: 90.1.1.4/32 nexthop 20.1.1.2 swp1 Installed: yes Tableid: 10004 Fix: Now, the PBR common will only be updated when the last rule is being deleted. This change ensures that we only send a delete request to Zebra once, and only set the valid and installed flags to false when the last rule is deleted. This optimizes the handling of PBR rules and reduces unnecessary interactions with Zebra Testing: UT in MR notes Ticket: # Signed-off-by: Rajesh Varatharaj <[email protected]>
UT Logs:
|
chiragshah6
approved these changes
Jan 23, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good finding!
@Mergifyio backport stable/9.1 stable/9.0 stable/8.5 |
✅ Backports have been created
|
ton31337
approved these changes
Jan 23, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This was referenced Jan 25, 2024
donaldsharp
added a commit
that referenced
this pull request
Jan 25, 2024
pbrd: Fix PBR handling for last rule deletion (backport #15206)
donaldsharp
added a commit
that referenced
this pull request
Jan 25, 2024
pbrd: Fix PBR handling for last rule deletion (backport #15206)
donaldsharp
added a commit
that referenced
this pull request
Jan 25, 2024
pbrd: Fix PBR handling for last rule deletion (backport #15206)
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.
Issue:
Previously, the PBR common was updated for every rule update or deletion
example:
let say we have three rule 11, 12, 13 and if we are removing rule 12. in the current code we are making the entire map "valid" to false.
pbr-map MAP1 seq 11
match src-ip 90.1.1.2/32
set nexthop 20.1.1.2 swp1
pbr-map MAP1 seq 12
match src-ip 90.1.1.3/32
set nexthop 20.1.1.2 swp1
pbr-map MAP1 seq 13
match src-ip 90.1.1.4/32
set nexthop 20.1.1.2 swp1
no pbr-map MAP1 seq 12 ==> turns whole map valid to false.
r1(config)# end
r1# show pbr map
pbr-map MAP1 valid: no
Seq: 11 rule: 310
Installed: yes Reason: Valid
SRC IP Match: 90.1.1.2/32
nexthop 20.1.1.2 swp1
Installed: yes Tableid: 10002
Seq: 13 rule: 312
Installed: yes Reason: Valid
SRC IP Match: 90.1.1.4/32
nexthop 20.1.1.2 swp1
Installed: yes Tableid: 10004
Fix:
Now, the PBR common will only be updated when the last rule is being deleted. This change ensures that we only send a delete request to Zebra once, and only set the valid and installed flags to false when the last rule is deleted. This optimizes the handling of PBR rules and reduces unnecessary interactions with Zebra
Testing: UT in MR notes
Ticket: #
Signed-off-by: Rajesh Varatharaj [email protected]