mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-25 08:20:08 +01:00
libnm: add nm_dns_server_validate()
Add a new public symbol nm_dns_server_validate() that clients can use to validate a single DNS server before adding it to the connection.
This commit is contained in:
parent
d62c25ef2f
commit
9f76e11a75
3 changed files with 27 additions and 0 deletions
|
|
@ -2076,3 +2076,8 @@ global:
|
|||
nm_setting_sriov_get_preserve_on_down;
|
||||
nm_sriov_preserve_on_down_get_type;
|
||||
} libnm_1_52_0;
|
||||
|
||||
libnm_1_56_0 {
|
||||
global:
|
||||
nm_dns_server_validate;
|
||||
} libnm_1_54_0;
|
||||
|
|
|
|||
|
|
@ -4221,6 +4221,25 @@ nm_setting_ip_config_clear_dns(NMSettingIPConfig *setting)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_dns_server_validate:
|
||||
* @str: the string containing the DNS server
|
||||
* @family: the IP address family (%AF_INET for IPv4, %AF_INET6 for IPv6,
|
||||
* %AF_UNSPEC to accept both IPv4 and IPv6)
|
||||
* @error: (nullable): a pointer to %NULL #GError, or %NULL
|
||||
*
|
||||
* Validates a DNS name server string.
|
||||
*
|
||||
* Return: %TRUE if the name server is valid, %FALSE otherwise
|
||||
*
|
||||
* Since: 1.56
|
||||
*/
|
||||
gboolean
|
||||
nm_dns_server_validate(const char *str, int family, GError **error)
|
||||
{
|
||||
return nm_dns_uri_parse(family, str, NULL, error);
|
||||
}
|
||||
|
||||
GPtrArray *
|
||||
_nm_setting_ip_config_get_dns_array(NMSettingIPConfig *setting)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -567,6 +567,9 @@ int nm_setting_ip_config_get_shared_dhcp_lease_time(NMSettingIPConfig *setting);
|
|||
NM_AVAILABLE_IN_1_54
|
||||
NMSettingIPConfigForwarding nm_setting_ip_config_get_forwarding(NMSettingIPConfig *setting);
|
||||
|
||||
NM_AVAILABLE_IN_1_56
|
||||
gboolean nm_dns_server_validate(const char *str, int family, GError **error);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* NM_SETTING_IP_CONFIG_H */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue