Commit Graph

7 Commits (87a8003d397174b54c2bc25b0dc8f32222a01420)

Author SHA1 Message Date
James Tucker 87a8003d39 *: add a CI check for license headers and fix all files
Updates tailscale/tailscale#10992

Signed-off-by: James Tucker <james@tailscale.com>
3 months ago
kari-ts a76b36506c
DnsConfig: get rid of unnecessary isEmpty check (#149)
* DnsConfig: remove unnecessary isEmpty check

Updates #cleanup

* DnsConfig: remove unnecessary isEmpty check

Updates #cleanup

* k
5 months ago
kari-ts 1b42117791
use network callback to update DNS config when network changes (#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
5 months ago
Denton Gentry 283dd77bcc Add a unit test for DnsConfig.intToInetString
adds JUnit dependencies and basic gradle support to run unit tests,
and a test for DnsConfig.intToInetString().

Signed-off-by: Denton Gentry <dgentry@tailscale.com>
2 years ago
Denton Gentry 63dba694af DnsConfig: don't use signed bytes when printing.
intToInetString(0x0101a8c0) returns "-64.-88.1.1" because Java
integers are always signed. There is not a %u format specifier.

Though the quads of an IP address literally are bytes, they can
be left as an int to pass to String.format. This allows room for
sign bits, so intToInetString(0x0101a8c0) returns "192.168.1.1"

Signed-off-by: Denton Gentry <dgentry@tailscale.com>
2 years ago
Denton Gentry fd42b4b352 java: format strings containing integers in ROOT locale.
We use strings to pass structured data from the JVM to Go.
In a locale using Indian-Arabic numerals: ۰ ۱ ۲ ۳ ۴ ۵ ۶ ۷ ۸ ۹
the Java code will format decimal strings using Indian-Arabic
glyphs.

Go doesn't get a locale set automatically by the Android
runtime, so it always parses strings in a default en-US
`unable to parse "lo ١ ٦٥٥٣٦ true false true false false |": expected integer`

Make the Java code format using the ROOT locale. These strings
are purely internal to pass between the two runtimes, they are
not shown to the user.

Fixes https://github.com/tailscale/tailscale/issues/4156

Signed-off-by: Denton Gentry <dgentry@tailscale.com>
2 years ago
Denton Gentry 5c9cec0064 retrieve current DNS servers.
Add getDnsConfigAsString() to retrieve the current DNS
configuration from the Android platform. This implements
several mechanisms to retrieve DNS information, suitable
for different Android versions:

Android 7 and later use ConnectivityManager getAllNetworks(),
then iterate over each network to retrieve DNS servers and
search domains using the LinkProperties.

Android 6 and earlier can only retrieve the currently active
interface using ConnectivityManager getActiveNetwork(), but have
two additional fallback options which leverage the system
properties available in older Android releases.

--------

Also changed how LinkChange notification works, switching from
the older BroadcastReceiver of a ConnectivityManager Intent to
the newer ConnectivityManager.registerNetworkCallback. We need
this because the onAvailable event is too early, we get notified
that LTE is up before its DNS servers have been set. We need
to wait for the onLinkPropertiesChanged event instead, which is
only available with registerNetworkCallback.

Fixes https://github.com/tailscale/tailscale/issues/2116
Updates https://github.com/tailscale/tailscale/issues/988

Signed-off-by: Denton Gentry <dgentry@tailscale.com>
3 years ago