[PATCH v2 38/42] service: Send the DNS servers of VPN's transport when VPN is ready
Jussi Laakkonen <[email protected]> Wed, 13 Aug 2025 18:02:10 +0300
| Newsgroups | dev.linux.lists.connman |
|---|---|
| Message-ID | <[email protected]> |
Add a new property to be sent from the VPN service's path when the VPN
reports being ready. This is sent similar to other DNS service lists
when they change but with name "TransportNameservers".
The reason for doing this is that WireGuard does the periodic DNS
reresolve after getting connected, and the reresolving needs to be
done using the DNS server(s) of the transport service, and not the ones
WireGuard has set up.
---
src/service.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/src/service.c b/src/service.c
index 73f777f3..0fddaa20 100644
--- a/src/service.c
+++ b/src/service.c
@@ -4929,6 +4929,30 @@ static void dns_configuration_changed(struct connman_service *service)
dns_changed(service);
}
+static void vpn_transport_dns_changed(struct connman_service *service)
+{
+ struct connman_service *transport;
+ const char *ident;
+
+ if (!service || service->type != CONNMAN_SERVICE_TYPE_VPN)
+ return;
+
+ ident = connman_provider_get_string(service->provider, "Transport");
+ if (!ident)
+ return;
+
+ transport = connman_service_lookup_from_identifier(ident);
+ if (!transport)
+ return;
+
+ DBG("transport %p/%s", transport, ident);
+
+ connman_dbus_property_changed_array(service->path,
+ CONNMAN_SERVICE_INTERFACE,
+ "TransportNameservers",
+ DBUS_TYPE_STRING, append_dns, transport);
+}
+
static void domain_changed(struct connman_service *service)
{
if (!allow_property_changed(service))
@@ -9401,6 +9425,9 @@ static int service_indicate_state(struct connman_service *service)
"WiFi.UseWPS", false);
}
+ if (service->type == CONNMAN_SERVICE_TYPE_VPN)
+ vpn_transport_dns_changed(service);
+
gettimeofday(&service->modified, NULL);
service_save(service);
--
2.39.5