Skip to content

Conversation

@eronez
Copy link

@eronez eronez commented Feb 11, 2026

Description

This PR adds unsetSearchDomainForSystemdResolved() to the func (t *NativeTun) Close() method.

Motivation and Context

Previously, the initialization and teardown procedures were asymmetrical, causing DNS configurations to persist in systemd-resolved after the interface was closed.

In configure(tunLink) (Setup):
The initialization flow sets up the environment in the following order:
setAddresses -> setRoute -> setRules -> setSearchDomainForSystemdResolved

In Close() (Teardown - Before Fix):
The cleanup flow missed the corresponding step for systemd-resolved:
unsetAddresses -> unsetRoute -> unsetRules -> (Missing)

In Close() (Teardown - After Fix):
This PR ensures the cleanup logic mirrors the initialization:
unsetSearchDomainForSystemdResolved -> unsetAddresses -> unsetRoute -> unsetRules

Changes

  • Invoked t.unsetSearchDomainForSystemdResolved() in func (t *NativeTun) Close() to ensure proper DNS cleanup.

Add `unsetSearchDomainForSystemdResolved` to revert dns setting before `unsetAddresses` while closing TUN.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant