tcpip/ipv6: use isEnabled() in disableLocked() to match ipv4 sibling#13214
Open
ibondarenko1 wants to merge 1 commit into
Open
tcpip/ipv6: use isEnabled() in disableLocked() to match ipv4 sibling#13214ibondarenko1 wants to merge 1 commit into
ibondarenko1 wants to merge 1 commit into
Conversation
The IPv4 (*endpoint).disableLocked at pkg/tcpip/network/ipv4/ipv4.go:363 early-returns on !e.isEnabled(). The IPv6 sibling at pkg/tcpip/network/ipv6/ipv6.go:675 early-returns on !e.Enabled(), and e.Enabled() folds in e.nic.Enabled(). When the NIC has been disabled independently but the endpoint's local enabled flag is still set, the IPv6 path skips ndp.stopSolicitingRouters, ndp.cleanupState, MLD softLeaveAll, DAD stop, the all-nodes multicast leave, and the final setEnabled(false). After early-return, e.isEnabled() still reports true. A subsequent endpoint.Close calls disableLocked again, hits the same early-return, then runs addressableEndpointState.Cleanup while NDP state and any still-armed SLAAC, RS, or DAD timer remain alive against the wiped address state. The 2020 commit 53a95ad introduced e.Enabled() for packet-sending sites that need to honor both nic and endpoint flags. The disable path should not gate on nic state; it should run the local teardown regardless and let the per-protocol state machine reach a clean stop. IPv4 already gets this right. Mirror the IPv4 form. Signed-off-by: Ievgen Bondarenko <sactransport2000@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.
Summary
Swap
e.Enabled()fore.isEnabled()in(*endpoint).disableLocked()atpkg/tcpip/network/ipv6/ipv6.go. The IPv4 sibling atpkg/tcpip/network/ipv4/ipv4.go:363already usese.isEnabled().Why
e.Enabled()returnse.nic.Enabled() && e.isEnabled(). If the NIC has been disabled but the endpoint's ownisEnabled()is still set, the current code early-returns fromdisableLockedand skips the full per-protocol teardown:ndp.stopSolicitingRouters,ndp.cleanupState, MLDsoftLeaveAll, DAD stop, the all-nodes multicast leave, andsetEnabled(false). After the early-return,e.isEnabled()still reports true. A subsequentendpoint.Close()callsdisableLockedagain, hits the same early-return, then runsaddressableEndpointState.Cleanupwhile NDP state and any still-armed SLAAC, RS, or DAD timer remain alive against the wiped address state.IPv4 at
ipv4.go:363usese.isEnabled()and runs the local teardown regardless of the NIC's state. The 2020 commit 53a95ad that introduced thee.Enabled()form was about gating packet-sending paths during shutdown; the disable path itself should not be one of those gated sites.Test
bazel test //pkg/tcpip/network/ipv6/... //pkg/tcpip/tests/integration/...The intent of the original 2020 commit (gating packet-sending paths during shutdown) is preserved at the packet sites that still call
e.Enabled(); onlydisableLockedis changed to match IPv4.CLA
Signed via individual Google CLA on
sactransport2000@gmail.com.