client/doublezerod: set tunnel interface down before deleting#3312
Merged
client/doublezerod: set tunnel interface down before deleting#3312
Conversation
When tearing down a tunnel, external applications (e.g. validators) may have sockets bound to the tunnel interface's IP address. Deleting the interface without first setting it down causes those sockets to break silently. Setting the interface down first triggers errors on bound sockets, giving applications a chance to notice the interface is going away before it is removed.
packethog
approved these changes
Mar 19, 2026
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
LinkSetDown) before deleting it during teardown across all service types (IBRL, edge filtering, multicast)TunnelDownto theNetlinkerinterface, called in each service'sTeardown()beforeTunnelDeleteWhy
When doublezerod deletes a tunnel, external applications (e.g. validators) may have sockets bound to the tunnel interface's overlay IP. If we delete the interface directly:
ENETUNREACH/EINVAL, but there's no explicit error delivered to the application — it just breaks quietly.Setting the interface down first triggers
ENETUNREACHerrors on bound sockets immediately (the kernel processesLinkSetDownsynchronously). Applications blocked onrecv/epollwill see errors before the interface object is removed. This is a small improvement in behavior — not strictly necessary since the kernel does clean up everything on delete, but it turns silent breakage into explicit errors that are easier to debug.The
TunnelDownerror is logged but not fatal — if the interface is already gone (e.g. double teardown), we don't want to block theTunnelDeletecleanup.Testing Verification
GOOS=linux go vet ./client/doublezerod/...passesNetlinkerinterface