Skip to content
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

use network callback to update DNS config when network changes #147

Merged
merged 8 commits into from
Jan 17, 2024

Conversation

kari-ts
Copy link
Collaborator

@kari-ts kari-ts commented Jan 12, 2024

-Use requestNetwork, which gets the best network matching the passed in network request, to listen for changes to network and cache DNS config
-Call netmon.InjectEvent on network change to indicate a change
Follow-up will fix issue in netmon where IsMajorChangeFrom doesn't identify major changes when a network is added

Updates tailscale/tailscale#10107

-Use requestNetwork, which gets the best network matching the passed in network request, to listen for changes to network and cache DNS config
-Call netmon.InjectEvent on network change to indicate a change
Follow-up will fix issue in netmon where IsMajorChangeFrom doesn't identify major changes when a network is added

Fixes #10107
Copy link
Member

@danderson danderson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good in general, a couple of suggestions for code organization and stuff.

android/src/main/java/com/tailscale/ipn/DnsConfig.java Outdated Show resolved Hide resolved
android/src/main/java/com/tailscale/ipn/DnsConfig.java Outdated Show resolved Hide resolved
cmd/tailscale/backend.go Outdated Show resolved Hide resolved
android/src/main/java/com/tailscale/ipn/App.java Outdated Show resolved Hide resolved
cmd/tailscale/callbacks.go Show resolved Hide resolved
@danderson
Copy link
Member

Oh, and you need to make the commit say Updates tailscale/tailscale#10107 for the issue linking to work, since it's in another repository

-Use requestNetwork, which gets the best network matching the passed in network request, to listen for changes to network and cache DNS config
-Call netmon.InjectEvent on network change to indicate a change
Follow-up will fix issue in netmon where IsMajorChangeFrom doesn't identify major changes when a network is added

Updates tailscale/tailscale/#10107

hi
-Use requestNetwork, which gets the best network matching the passed in network request, to listen for changes to network and cache DNS config
-Call netmon.InjectEvent on network change to indicate a change
Follow-up will fix issue in netmon where IsMajorChangeFrom doesn't identify major changes when a network is added

Updates tailscale/tailscale/#10107
Copy link
Member

@danderson danderson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks right to me! One small change suggestion but no need for another round of review.

}

s = getDnsServersFromSystemProperties();
String s = getDnsConfigs();
if (!s.trim().isEmpty()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unnecessary? We're now returning empty string regardless

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We return the string if it's nonempty

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, but if the string is empty, we return "" below. So, you could skip the conditional and always return getDnsConfigs().trim() for the same effect

@kari-ts kari-ts merged commit 1b42117 into main Jan 17, 2024
1 check passed
@kari-ts kari-ts deleted the kari/10107 branch January 17, 2024 19:10
tm-sanjay pushed a commit to SwiftSku/tailscale-android-pos that referenced this pull request Jan 24, 2024
…cale#147)

* use network callback to update DNS config when network changes

-Use requestNetwork, which gets the best network matching the passed in network request, to listen for changes to network and cache DNS config
-Call netmon.InjectEvent on network change to indicate a change
Follow-up will fix issue in netmon where IsMajorChangeFrom doesn't identify major changes when a network is added

Fixes #10107

* use network callback to update DNS config when network changes

-Use requestNetwork, which gets the best network matching the passed in network request, to listen for changes to network and cache DNS config
-Call netmon.InjectEvent on network change to indicate a change
Follow-up will fix issue in netmon where IsMajorChangeFrom doesn't identify major changes when a network is added

Updates tailscale/tailscale/#10107

hi

* hi

* .

* use network callback to update DNS config when network changes

-Use requestNetwork, which gets the best network matching the passed in network request, to listen for changes to network and cache DNS config
-Call netmon.InjectEvent on network change to indicate a change
Follow-up will fix issue in netmon where IsMajorChangeFrom doesn't identify major changes when a network is added

Updates tailscale/tailscale/#10107

* fixed missing connectivity manager
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants