mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-11 10:28:13 +02:00
dns: Introduce NMDnsUpdateData structure
NMDnsUpdateData structure holds information required for DNS plugins to change their behavior based on connection update.
This commit is contained in:
parent
0b04d9ad83
commit
8e7c19d237
4 changed files with 20 additions and 21 deletions
|
|
@ -679,11 +679,7 @@ parse_all_interface_config(GVariantBuilder *argument_builder,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
update(NMDnsPlugin *plugin,
|
||||
const NMGlobalDnsConfig *global_config,
|
||||
const CList *ip_data_lst_head,
|
||||
const char *hostdomain,
|
||||
GError **error)
|
||||
update(NMDnsPlugin *plugin, NMDnsUpdateData *update_data, GError **error)
|
||||
{
|
||||
NMDnsDnsconfd *self = NM_DNS_DNSCONFD(plugin);
|
||||
NMDnsDnsconfdPrivate *priv = NM_DNS_DNSCONFD_GET_PRIVATE(self);
|
||||
|
|
@ -698,12 +694,12 @@ update(NMDnsPlugin *plugin,
|
|||
g_variant_builder_init(&argument_builder, G_VARIANT_TYPE("(aa{sv}u)"));
|
||||
g_variant_builder_open(&argument_builder, G_VARIANT_TYPE("aa{sv}"));
|
||||
|
||||
if (global_config) {
|
||||
if (update_data->global_config) {
|
||||
_LOGT("parsing global configuration");
|
||||
parse_global_config(global_config, &argument_builder, &resolve_mode, &ca);
|
||||
parse_global_config(update_data->global_config, &argument_builder, &resolve_mode, &ca);
|
||||
}
|
||||
_LOGT("parsing configuration of interfaces");
|
||||
parse_all_interface_config(&argument_builder, ip_data_lst_head, ca);
|
||||
parse_all_interface_config(&argument_builder, update_data->ip_data_lst_head, ca);
|
||||
|
||||
g_variant_builder_close(&argument_builder);
|
||||
g_variant_builder_add(&argument_builder, "u", resolve_mode);
|
||||
|
|
|
|||
|
|
@ -1207,11 +1207,7 @@ start_dnsmasq(NMDnsDnsmasq *self, gboolean force_start, GError **error)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
update(NMDnsPlugin *plugin,
|
||||
const NMGlobalDnsConfig *global_config,
|
||||
const CList *ip_data_lst_head,
|
||||
const char *hostdomain,
|
||||
GError **error)
|
||||
update(NMDnsPlugin *plugin, NMDnsUpdateData *update_data, GError **error)
|
||||
{
|
||||
NMDnsDnsmasq *self = NM_DNS_DNSMASQ(plugin);
|
||||
NMDnsDnsmasqPrivate *priv = NM_DNS_DNSMASQ_GET_PRIVATE(self);
|
||||
|
|
@ -1220,8 +1216,10 @@ update(NMDnsPlugin *plugin,
|
|||
return FALSE;
|
||||
|
||||
nm_clear_pointer(&priv->set_server_ex_args, g_variant_unref);
|
||||
priv->set_server_ex_args =
|
||||
g_variant_ref_sink(create_update_args(self, global_config, ip_data_lst_head, hostdomain));
|
||||
priv->set_server_ex_args = g_variant_ref_sink(create_update_args(self,
|
||||
update_data->global_config,
|
||||
update_data->ip_data_lst_head,
|
||||
update_data->hostdomain));
|
||||
priv->set_server_ex_args_dirty = TRUE;
|
||||
|
||||
send_dnsmasq_update(self);
|
||||
|
|
|
|||
|
|
@ -20,6 +20,15 @@
|
|||
(G_TYPE_INSTANCE_GET_CLASS((obj), NM_TYPE_DNS_PLUGIN, NMDnsPluginClass))
|
||||
|
||||
#define NM_DNS_PLUGIN_UPDATE_PENDING_CHANGED "update-pending-changed"
|
||||
typedef struct {
|
||||
const CList *ip_data_lst_head;
|
||||
gboolean caching_successful;
|
||||
gboolean resolved_used;
|
||||
gboolean resolver_depends_on_nm;
|
||||
NMDnsManagerResolvConfManager rc_manager;
|
||||
const char *hostdomain;
|
||||
NMGlobalDnsConfig *global_config;
|
||||
} NMDnsUpdateData;
|
||||
|
||||
struct _NMDnsPluginPrivate;
|
||||
|
||||
|
|
|
|||
|
|
@ -801,11 +801,7 @@ start_resolve:
|
|||
}
|
||||
|
||||
static gboolean
|
||||
update(NMDnsPlugin *plugin,
|
||||
const NMGlobalDnsConfig *global_config,
|
||||
const CList *ip_data_lst_head,
|
||||
const char *hostdomain,
|
||||
GError **error)
|
||||
update(NMDnsPlugin *plugin, NMDnsUpdateData *update_data, GError **error)
|
||||
{
|
||||
NMDnsSystemdResolved *self = NM_DNS_SYSTEMD_RESOLVED(plugin);
|
||||
NMDnsSystemdResolvedPrivate *priv = NM_DNS_SYSTEMD_RESOLVED_GET_PRIVATE(self);
|
||||
|
|
@ -826,7 +822,7 @@ update(NMDnsPlugin *plugin,
|
|||
interfaces =
|
||||
g_hash_table_new_full(nm_direct_hash, NULL, NULL, (GDestroyNotify) _interface_config_free);
|
||||
|
||||
c_list_for_each_entry (ip_data, ip_data_lst_head, ip_data_lst) {
|
||||
c_list_for_each_entry (ip_data, update_data->ip_data_lst_head, ip_data_lst) {
|
||||
InterfaceConfig *ic = NULL;
|
||||
int ifindex = ip_data->data->ifindex;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue