mctpd: Remove downstream peers when bridge node is removed - #173
Open
potinlai wants to merge 1 commit into
Open
Conversation
Currently, remove_bridged_peers() checks 'if (!sources)' and returns
early if bridge_ep_poll.sources is NULL. The sources array is only
allocated when periodic bridge endpoint polling is enabled.
However, downstream endpoints within the allocated bridge pool range
can still be discovered and added to the network via the LearnEndpoint
D-Bus method (or static assignment) even when periodic polling is not
active.
When a bridge node is removed, the early return in
remove_bridged_peers() causes the pool iteration loop to be skipped if
polling was inactive. As a result, downstream node EID objects remain
registered in mctpd and published on D-Bus as orphaned endpoints.
Fix this by:
1. Replacing the early 'if (!sources) return 0;' check with network
validation ('if (!n) return -EPROTO;').
2. Guarding polling timer teardown with 'if (sources && sources[idx])'.
This ensures remove_bridged_peers() always iterates across the bridge's
allocated pool range [pool_start, pool_end] and invokes remove_peer() on
all existing downstream node EID objects when the parent bridge node is
removed.
Signed-off-by: Potin Lai <potin.lai@quantatw.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.
Currently, remove_bridged_peers() checks 'if (!sources)' and returns
early if bridge_ep_poll.sources is NULL. The sources array is only
allocated when periodic bridge endpoint polling is enabled.
However, downstream endpoints within the allocated bridge pool range
can still be discovered and added to the network via the LearnEndpoint
D-Bus method (or static assignment) even when periodic polling is not
active.
When a bridge node is removed, the early return in
remove_bridged_peers() causes the pool iteration loop to be skipped if
polling was inactive. As a result, downstream node EID objects remain
registered in mctpd and published on D-Bus as orphaned endpoints.
Fix this by:
validation ('if (!n) return -EPROTO;').
This ensures remove_bridged_peers() always iterates across the bridge's
allocated pool range [pool_start, pool_end] and invokes remove_peer() on
all existing downstream node EID objects when the parent bridge node is
removed.