Beniamino Galvani 2018-09-06 09:23:55 +02:00
commit b23403559e
23 changed files with 1063 additions and 718 deletions

View file

@ -5829,6 +5829,14 @@ static const NMMetaPropertyInfo *const property_infos_CONNECTION[] = {
),
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_CONNECTION_LLMNR,
.property_type = &_pt_gobject_enum,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
PROPERTY_TYP_DATA_SUBTYPE (gobject_enum,
.get_gtype = nm_setting_connection_llmnr_get_type,
),
),
),
NULL
};

View file

@ -135,8 +135,9 @@
#define DESCRIBE_DOC_NM_SETTING_CONNECTION_ID N_("A human readable unique identifier for the connection, like \"Work Wi-Fi\" or \"T-Mobile 3G\".")
#define DESCRIBE_DOC_NM_SETTING_CONNECTION_INTERFACE_NAME N_("The name of the network interface this connection is bound to. If not set, then the connection can be attached to any interface of the appropriate type (subject to restrictions imposed by other settings). For software devices this specifies the name of the created device. For connection types where interface names cannot easily be made persistent (e.g. mobile broadband or USB Ethernet), this property should not be used. Setting this property restricts the interfaces a connection can be used with, and if interface names change or are reordered the connection may be applied to the wrong interface.")
#define DESCRIBE_DOC_NM_SETTING_CONNECTION_LLDP N_("Whether LLDP is enabled for the connection.")
#define DESCRIBE_DOC_NM_SETTING_CONNECTION_LLMNR N_("Whether Link-Local Multicast Name Resolution (LLMNR) is enabled for the connection. LLMNR is a protocol based on the Domain Name System (DNS) packet format that allows both IPv4 and IPv6 hosts to perform name resolution for hosts on the same local link. The permitted values are: yes: register hostname and resolving for the connection, no: disable LLMNR for the interface, resolve: do not register hostname but allow resolving of LLMNR host names. This feature requires a plugin which supports LLMNR. One such plugin is dns-systemd-resolved.")
#define DESCRIBE_DOC_NM_SETTING_CONNECTION_MASTER N_("Interface name of the master device or UUID of the master connection.")
#define DESCRIBE_DOC_NM_SETTING_CONNECTION_MDNS N_("Whether mDNS is enabled for the connection. The permitted values are: yes: register hostname and resolving for the connection, no: disable mDNS for the interface, resolve: do not register hostname but allow resolving of mDNS host names. When updating this property on a currently activated connection, the change takes effect immediately. This feature requires a plugin which supports mDNS. One such plugin is dns-systemd-resolved.")
#define DESCRIBE_DOC_NM_SETTING_CONNECTION_MDNS N_("Whether mDNS is enabled for the connection. The permitted values are: yes: register hostname and resolving for the connection, no: disable mDNS for the interface, resolve: do not register hostname but allow resolving of mDNS host names. This feature requires a plugin which supports mDNS. One such plugin is dns-systemd-resolved.")
#define DESCRIBE_DOC_NM_SETTING_CONNECTION_METERED N_("Whether the connection is metered. When updating this property on a currently activated connection, the change takes effect immediately.")
#define DESCRIBE_DOC_NM_SETTING_CONNECTION_MULTI_CONNECT N_("Specifies whether the profile can be active multiple times at a particular moment. The value is of type NMConnectionMultiConnect.")
#define DESCRIBE_DOC_NM_SETTING_CONNECTION_PERMISSIONS N_("An array of strings defining what access a given user has to this connection. If this is NULL or empty, all users are allowed to access this connection; otherwise users are allowed if and only if they are in this list. When this is not empty, the connection can be active only when one of the specified users is logged into an active session. Each entry is of the form \"[type]:[id]:[reserved]\"; for example, \"user:dcbw:blah\". At this time only the \"user\" [type] is allowed. Any other values are ignored and reserved for future use. [id] is the username that this permission refers to, which may not contain the \":\" character. Any [reserved] information present must be ignored and is reserved for future use. All of [type], [id], and [reserved] must be valid UTF-8.")

View file

@ -484,12 +484,12 @@ NAME UUID TYPE DEVICE
con-1 5fcfd6d7-1e63-3332-8826-a7eda103792d ethernet --
<<<
size: 1171
size: 1224
location: clients/tests/test-client.py:859:test_002()/23
cmd: $NMCLI c s con-1
lang: C
returncode: 0
stdout: 1042 bytes
stdout: 1095 bytes
>>>
connection.id: con-1
connection.uuid: 5fcfd6d7-1e63-3332-8826-a7eda103792d
@ -513,14 +513,15 @@ connection.gateway-ping-timeout: 0
connection.metered: unknown
connection.lldp: default
connection.mdns: -1 (default)
connection.llmnr: -1 (default)
<<<
size: 1183
size: 1236
location: clients/tests/test-client.py:859:test_002()/24
cmd: $NMCLI c s con-1
lang: pl_PL.UTF-8
returncode: 0
stdout: 1044 bytes
stdout: 1097 bytes
>>>
connection.id: con-1
connection.uuid: 5fcfd6d7-1e63-3332-8826-a7eda103792d
@ -544,5 +545,6 @@ connection.gateway-ping-timeout: 0
connection.metered: nieznane
connection.lldp: default
connection.mdns: -1 (default)
connection.llmnr: -1 (default)
<<<

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -81,6 +81,7 @@ typedef struct {
NMSettingConnectionLldp lldp;
int auth_retries;
int mdns;
int llmnr;
} NMSettingConnectionPrivate;
enum {
@ -105,6 +106,7 @@ enum {
PROP_METERED,
PROP_LLDP,
PROP_MDNS,
PROP_LLMNR,
PROP_STABLE_ID,
PROP_AUTH_RETRIES,
@ -896,6 +898,23 @@ nm_setting_connection_get_mdns (NMSettingConnection *setting)
return NM_SETTING_CONNECTION_GET_PRIVATE (setting)->mdns;
}
/**
* nm_setting_connection_get_llmnr:
* @setting: the #NMSettingConnection
*
* Returns: the #NMSettingConnection:llmnr property of the setting.
*
* Since: 1.14
**/
NMSettingConnectionLlmnr
nm_setting_connection_get_llmnr (NMSettingConnection *setting)
{
g_return_val_if_fail (NM_IS_SETTING_CONNECTION (setting),
NM_SETTING_CONNECTION_LLMNR_DEFAULT);
return NM_SETTING_CONNECTION_GET_PRIVATE (setting)->llmnr;
}
static void
_set_error_missing_base_setting (GError **error, const char *type)
{
@ -1093,17 +1112,28 @@ verify (NMSetting *setting, NMConnection *connection, GError **error)
return FALSE;
}
if ( priv->mdns < NM_SETTING_CONNECTION_MDNS_DEFAULT
|| priv->mdns > NM_SETTING_CONNECTION_MDNS_YES) {
if ( priv->mdns < (int) NM_SETTING_CONNECTION_MDNS_DEFAULT
|| priv->mdns > (int) NM_SETTING_CONNECTION_MDNS_YES) {
g_set_error (error,
NM_CONNECTION_ERROR,
NM_CONNECTION_ERROR_INVALID_PROPERTY,
_("mdns value %d is not valid"), priv->mdns);
_("value %d is not valid"), priv->mdns);
g_prefix_error (error, "%s.%s: ", NM_SETTING_CONNECTION_SETTING_NAME,
NM_SETTING_CONNECTION_MDNS);
return FALSE;
}
if ( priv->llmnr < (int) NM_SETTING_CONNECTION_LLMNR_DEFAULT
|| priv->llmnr > (int) NM_SETTING_CONNECTION_LLMNR_YES) {
g_set_error (error,
NM_CONNECTION_ERROR,
NM_CONNECTION_ERROR_INVALID_PROPERTY,
_("value %d is not valid"), priv->llmnr);
g_prefix_error (error, "%s.%s: ", NM_SETTING_CONNECTION_SETTING_NAME,
NM_SETTING_CONNECTION_LLMNR);
return FALSE;
}
if (!NM_IN_SET (priv->multi_connect, (int) NM_CONNECTION_MULTI_CONNECT_DEFAULT,
(int) NM_CONNECTION_MULTI_CONNECT_SINGLE,
(int) NM_CONNECTION_MULTI_CONNECT_MANUAL_MULTIPLE,
@ -1276,6 +1306,7 @@ nm_setting_connection_init (NMSettingConnection *setting)
NMSettingConnectionPrivate *priv = NM_SETTING_CONNECTION_GET_PRIVATE (setting);
priv->mdns = NM_SETTING_CONNECTION_MDNS_DEFAULT;
priv->llmnr = NM_SETTING_CONNECTION_LLMNR_DEFAULT;
}
static void
@ -1400,6 +1431,9 @@ set_property (GObject *object, guint prop_id,
case PROP_MDNS:
priv->mdns = g_value_get_int (value);
break;
case PROP_LLMNR:
priv->llmnr = g_value_get_int (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@ -1494,6 +1528,9 @@ get_property (GObject *object, guint prop_id,
case PROP_MDNS:
g_value_set_int (value, priv->mdns);
break;
case PROP_LLMNR:
g_value_set_int (value, priv->llmnr);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@ -2104,8 +2141,6 @@ nm_setting_connection_class_init (NMSettingConnectionClass *klass)
* The permitted values are: yes: register hostname and resolving
* for the connection, no: disable mDNS for the interface, resolve:
* do not register hostname but allow resolving of mDNS host names.
* When updating this property on a currently activated connection,
* the change takes effect immediately.
*
* This feature requires a plugin which supports mDNS. One such
* plugin is dns-systemd-resolved.
@ -2114,11 +2149,11 @@ nm_setting_connection_class_init (NMSettingConnectionClass *klass)
**/
/* ---ifcfg-rh---
* property: mdns
* variable: CONNECTION_MDNS(+)
* variable: MDNS(+)
* values: yes,no,resolve
* default: missing variable means global default
* description: Whether or not mDNS is enabled for the connection
* example: CONNECTION_MDNS=yes
* example: MDNS=yes
* ---end---
*/
g_object_class_install_property
@ -2129,6 +2164,40 @@ nm_setting_connection_class_init (NMSettingConnectionClass *klass)
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
/**
* NMSettingConnection:llmnr:
*
* Whether Link-Local Multicast Name Resolution (LLMNR) is enabled
* for the connection. LLMNR is a protocol based on the Domain Name
* System (DNS) packet format that allows both IPv4 and IPv6 hosts
* to perform name resolution for hosts on the same local link.
*
* The permitted values are: yes: register hostname and resolving
* for the connection, no: disable LLMNR for the interface, resolve:
* do not register hostname but allow resolving of LLMNR host names.
*
* This feature requires a plugin which supports LLMNR. One such
* plugin is dns-systemd-resolved.
*
* Since: 1.14
**/
/* ---ifcfg-rh---
* property: llmnr
* variable: LLMNR(+)
* values: yes,no,resolve
* default: missing variable means global default
* description: Whether or not LLMNR is enabled for the connection
* example: LLMNR=yes
* ---end---
*/
g_object_class_install_property
(object_class, PROP_LLMNR,
g_param_spec_int (NM_SETTING_CONNECTION_LLMNR, "", "",
G_MININT32, G_MAXINT32,
NM_SETTING_CONNECTION_LLMNR_DEFAULT,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
_nm_setting_class_commit_full (setting_class, NM_META_SETTING_TYPE_CONNECTION,
NULL, properties_override);
}

View file

@ -66,6 +66,7 @@ G_BEGIN_DECLS
#define NM_SETTING_CONNECTION_LLDP "lldp"
#define NM_SETTING_CONNECTION_AUTH_RETRIES "auth-retries"
#define NM_SETTING_CONNECTION_MDNS "mdns"
#define NM_SETTING_CONNECTION_LLMNR "llmnr"
/* Types for property values */
/**
@ -117,6 +118,24 @@ typedef enum {
NM_SETTING_CONNECTION_MDNS_YES = 2,
} NMSettingConnectionMdns;
/**
* NMSettingConnectionLlmnr:
* @NM_SETTING_CONNECTION_LLMNR_DEFAULT: default value
* @NM_SETTING_CONNECTION_LLMNR_NO: disable LLMNR
* @NM_SETTING_CONNECTION_LLMNR_RESOLVE: support only resolving, do not register hostname
* @NM_SETTING_CONNECTION_LLMNR_YES: enable LLMNR
*
* #NMSettingConnectionLlmnr values indicate whether LLMNR should be enabled.
*
* Since: 1.14
*/
typedef enum {
NM_SETTING_CONNECTION_LLMNR_DEFAULT = -1,
NM_SETTING_CONNECTION_LLMNR_NO = 0,
NM_SETTING_CONNECTION_LLMNR_RESOLVE = 1,
NM_SETTING_CONNECTION_LLMNR_YES = 2,
} NMSettingConnectionLlmnr;
/**
* NMSettingConnection:
*
@ -194,6 +213,9 @@ int nm_setting_connection_get_auth_retries (NMSettingConnection *set
NM_AVAILABLE_IN_1_12
NMSettingConnectionMdns nm_setting_connection_get_mdns (NMSettingConnection *setting);
NM_AVAILABLE_IN_1_14
NMSettingConnectionLlmnr nm_setting_connection_get_llmnr (NMSettingConnection *setting);
G_END_DECLS
#endif /* __NM_SETTING_CONNECTION_H__ */

View file

@ -2618,6 +2618,7 @@ test_connection_diff_a_only (void)
{ NM_SETTING_CONNECTION_LLDP, NM_SETTING_DIFF_RESULT_IN_A },
{ NM_SETTING_CONNECTION_AUTH_RETRIES, NM_SETTING_DIFF_RESULT_IN_A },
{ NM_SETTING_CONNECTION_MDNS, NM_SETTING_DIFF_RESULT_IN_A },
{ NM_SETTING_CONNECTION_LLMNR, NM_SETTING_DIFF_RESULT_IN_A },
{ NULL, NM_SETTING_DIFF_RESULT_UNKNOWN }
} },
{ NM_SETTING_WIRED_SETTING_NAME, {

View file

@ -1393,7 +1393,9 @@ global:
nm_device_wireguard_get_type;
nm_device_wpan_get_type;
nm_setting_6lowpan_get_type;
nm_setting_connection_get_llmnr;
nm_setting_connection_get_multi_connect;
nm_setting_connection_llmnr_get_type;
nm_setting_ethtool_clear_features;
nm_setting_ethtool_get_feature;
nm_setting_ethtool_get_type;

View file

@ -653,6 +653,9 @@ ipv6.ip6-privacy=0
<varlistentry>
<term><varname>connection.lldp</varname></term>
</varlistentry>
<varlistentry>
<term><varname>connection.llmnr</varname></term>
</varlistentry>
<varlistentry>
<term><varname>connection.mdns</varname></term>
</varlistentry>

View file

@ -1198,7 +1198,6 @@ wake_on_lan_enable (NMDevice *device)
NMSettingWiredWakeOnLan wol;
NMSettingWired *s_wired;
const char *password = NULL;
gs_free char *value = NULL;
s_wired = (NMSettingWired *) nm_device_get_applied_setting (device, NM_TYPE_SETTING_WIRED);
if (s_wired) {
@ -1208,27 +1207,25 @@ wake_on_lan_enable (NMDevice *device)
goto found;
}
value = nm_config_data_get_connection_default (NM_CONFIG_GET_DATA,
"ethernet.wake-on-lan",
device);
wol = nm_config_data_get_connection_default_int64 (NM_CONFIG_GET_DATA,
"ethernet.wake-on-lan",
device,
NM_SETTING_WIRED_WAKE_ON_LAN_NONE,
G_MAXINT32,
NM_SETTING_WIRED_WAKE_ON_LAN_DEFAULT);
if (value) {
wol = _nm_utils_ascii_str_to_int64 (value, 10,
NM_SETTING_WIRED_WAKE_ON_LAN_NONE,
G_MAXINT32,
NM_SETTING_WIRED_WAKE_ON_LAN_DEFAULT);
if ( NM_FLAGS_ANY (wol, NM_SETTING_WIRED_WAKE_ON_LAN_EXCLUSIVE_FLAGS)
&& !nm_utils_is_power_of_two (wol)) {
nm_log_dbg (LOGD_ETHER, "invalid default value %u for wake-on-lan", (guint) wol);
wol = NM_SETTING_WIRED_WAKE_ON_LAN_DEFAULT;
}
if (wol != NM_SETTING_WIRED_WAKE_ON_LAN_DEFAULT)
goto found;
if ( NM_FLAGS_ANY (wol, NM_SETTING_WIRED_WAKE_ON_LAN_EXCLUSIVE_FLAGS)
&& !nm_utils_is_power_of_two (wol)) {
nm_log_dbg (LOGD_ETHER, "invalid default value %u for wake-on-lan", (guint) wol);
wol = NM_SETTING_WIRED_WAKE_ON_LAN_DEFAULT;
}
if (wol != NM_SETTING_WIRED_WAKE_ON_LAN_DEFAULT)
goto found;
wol = NM_SETTING_WIRED_WAKE_ON_LAN_IGNORE;
found:
return nm_platform_ethtool_set_wake_on_lan (nm_device_get_platform (device), nm_device_get_ifindex (device), wol, password);
return nm_platform_ethtool_set_wake_on_lan (nm_device_get_platform (device),
nm_device_get_ifindex (device),
wol, password);
}
/*****************************************************************************/

View file

@ -1101,15 +1101,19 @@ nm_device_assume_state_reset (NMDevice *self)
static void
init_ip_config_dns_priority (NMDevice *self, NMIPConfig *config)
{
gs_free char *value = NULL;
const char *property;
int priority;
value = nm_config_data_get_connection_default (NM_CONFIG_GET_DATA,
(nm_ip_config_get_addr_family (config) == AF_INET)
? "ipv4.dns-priority"
: "ipv6.dns-priority",
self);
priority = _nm_utils_ascii_str_to_int64 (value, 10, G_MININT, G_MAXINT, 0);
property = (nm_ip_config_get_addr_family (config) == AF_INET)
? "ipv4.dns-priority"
: "ipv6.dns-priority";
priority = nm_config_data_get_connection_default_int64 (NM_CONFIG_GET_DATA,
property,
self,
G_MININT,
G_MAXINT,
0);
nm_ip_config_set_dns_priority (config, priority ?: NM_DNS_PRIORITY_DEFAULT_NORMAL);
}
@ -2108,10 +2112,10 @@ guint32
nm_device_get_route_metric (NMDevice *self,
int addr_family)
{
char *value;
gint64 route_metric;
NMSettingIPConfig *s_ip;
NMConnection *connection;
const char *property;
g_return_val_if_fail (NM_IS_DEVICE (self), G_MAXUINT32);
g_return_val_if_fail (NM_IN_SET (addr_family, AF_INET, AF_INET6), G_MAXUINT32);
@ -2136,15 +2140,13 @@ nm_device_get_route_metric (NMDevice *self,
/* use the current NMConfigData, which makes this configuration reloadable.
* Note that that means that the route-metric might change between SIGHUP.
* You must cache the returned value if that is a problem. */
value = nm_config_data_get_connection_default (NM_CONFIG_GET_DATA,
addr_family == AF_INET ? "ipv4.route-metric" : "ipv6.route-metric", self);
if (value) {
route_metric = _nm_utils_ascii_str_to_int64 (value, 10, 0, G_MAXUINT32, -1);
g_free (value);
if (route_metric >= 0)
goto out;
}
property = addr_family == AF_INET ? "ipv4.route-metric" : "ipv6.route-metric";
route_metric = nm_config_data_get_connection_default_int64 (NM_CONFIG_GET_DATA,
property,
self,
0, G_MAXUINT32, -1);
if (route_metric >= 0)
goto out;
route_metric = nm_manager_device_route_metric_reserve (nm_manager_get (),
nm_device_get_ip_ifindex (self),
@ -2164,21 +2166,37 @@ _get_mdns (NMDevice *self)
connection = nm_device_get_applied_connection (self);
if (connection)
mdns = nm_setting_connection_get_mdns (nm_connection_get_setting_connection (connection));
if (mdns != NM_SETTING_CONNECTION_MDNS_DEFAULT)
return mdns;
if (mdns == NM_SETTING_CONNECTION_MDNS_DEFAULT) {
gs_free char *value = NULL;
return nm_config_data_get_connection_default_int64 (NM_CONFIG_GET_DATA,
"connection.mdns",
self,
NM_SETTING_CONNECTION_MDNS_NO,
NM_SETTING_CONNECTION_MDNS_YES,
NM_SETTING_CONNECTION_MDNS_DEFAULT);
}
value = nm_config_data_get_connection_default (NM_CONFIG_GET_DATA,
"connection.mdns",
self);
mdns = _nm_utils_ascii_str_to_int64 (value,
10,
NM_SETTING_CONNECTION_MDNS_NO,
NM_SETTING_CONNECTION_MDNS_YES,
NM_SETTING_CONNECTION_MDNS_DEFAULT);
}
static NMSettingConnectionLlmnr
_get_llmnr (NMDevice *self)
{
NMConnection *connection;
NMSettingConnectionLlmnr llmnr = NM_SETTING_CONNECTION_LLMNR_DEFAULT;
return mdns;
g_return_val_if_fail (NM_IS_DEVICE (self), NM_SETTING_CONNECTION_LLMNR_DEFAULT);
connection = nm_device_get_applied_connection (self);
if (connection)
llmnr = nm_setting_connection_get_llmnr (nm_connection_get_setting_connection (connection));
if (llmnr != NM_SETTING_CONNECTION_LLMNR_DEFAULT)
return llmnr;
return nm_config_data_get_connection_default_int64 (NM_CONFIG_GET_DATA,
"connection.llmnr",
self,
NM_SETTING_CONNECTION_LLMNR_NO,
NM_SETTING_CONNECTION_LLMNR_YES,
NM_SETTING_CONNECTION_LLMNR_DEFAULT);
}
guint32
@ -2221,14 +2239,13 @@ nm_device_get_route_table (NMDevice *self,
* connection. Otherwise, the connection is not active, and the
* connection default doesn't matter. */
if (route_table == 0) {
gs_free char *value = NULL;
const char *property;
value = nm_config_data_get_connection_default (NM_CONFIG_GET_DATA,
addr_family == AF_INET
? "ipv4.route-table"
: "ipv6.route-table",
self);
route_table = _nm_utils_ascii_str_to_int64 (value, 10, 0, G_MAXUINT32, 0);
property = addr_family == AF_INET ? "ipv4.route-table" : "ipv6.route-table";
route_table = nm_config_data_get_connection_default_int64 (NM_CONFIG_GET_DATA,
property,
self,
0, G_MAXUINT32, 0);
}
}
@ -6028,15 +6045,12 @@ lldp_rx_enabled (NMDevice *self)
lldp = nm_setting_connection_get_lldp (s_con);
if (lldp == NM_SETTING_CONNECTION_LLDP_DEFAULT) {
gs_free char *value = NULL;
value = nm_config_data_get_connection_default (NM_CONFIG_GET_DATA,
"connection.lldp",
self);
lldp = _nm_utils_ascii_str_to_int64 (value, 10,
NM_SETTING_CONNECTION_LLDP_DEFAULT,
NM_SETTING_CONNECTION_LLDP_ENABLE_RX,
NM_SETTING_CONNECTION_LLDP_DEFAULT);
lldp = nm_config_data_get_connection_default_int64 (NM_CONFIG_GET_DATA,
"connection.lldp",
self,
NM_SETTING_CONNECTION_LLDP_DEFAULT,
NM_SETTING_CONNECTION_LLDP_ENABLE_RX,
NM_SETTING_CONNECTION_LLDP_DEFAULT);
if (lldp == NM_SETTING_CONNECTION_LLDP_DEFAULT)
lldp = NM_SETTING_CONNECTION_LLDP_DISABLE;
}
@ -6130,18 +6144,17 @@ act_stage1_prepare (NMDevice *self, NMDeviceStateReason *out_failure_reason)
&& (s_sriov = (NMSettingSriov *) nm_device_get_applied_setting (self, NM_TYPE_SETTING_SRIOV))) {
nm_auto_freev NMPlatformVF **plat_vfs = NULL;
gs_free_error GError *error = NULL;
gs_free const char *str = NULL;
NMSriovVF *vf;
int autoprobe;
autoprobe = nm_setting_sriov_get_autoprobe_drivers (s_sriov);
if (autoprobe == NM_TERNARY_DEFAULT) {
str = nm_config_data_get_connection_default (NM_CONFIG_GET_DATA,
"sriov.autoprobe-drivers", self);
autoprobe = _nm_utils_ascii_str_to_int64 (str, 10,
NM_TERNARY_FALSE,
NM_TERNARY_TRUE,
NM_TERNARY_TRUE);
autoprobe = nm_config_data_get_connection_default_int64 (NM_CONFIG_GET_DATA,
"sriov.autoprobe-drivers",
self,
NM_TERNARY_FALSE,
NM_TERNARY_TRUE,
NM_TERNARY_TRUE);
}
num = nm_setting_sriov_get_num_vfs (s_sriov);
@ -6496,27 +6509,22 @@ get_ipv4_dad_timeout (NMDevice *self)
{
NMConnection *connection;
NMSettingIPConfig *s_ip4 = NULL;
gs_free char *value = NULL;
int ret = 0;
int timeout = -1;
connection = nm_device_get_applied_connection (self);
if (connection)
s_ip4 = nm_connection_get_setting_ip4_config (connection);
if (s_ip4)
timeout = nm_setting_ip_config_get_dad_timeout (s_ip4);
if (timeout >= 0)
return timeout;
if (s_ip4) {
ret = nm_setting_ip_config_get_dad_timeout (s_ip4);
if (ret < 0) {
value = nm_config_data_get_connection_default (NM_CONFIG_GET_DATA,
"ipv4.dad-timeout", self);
ret = _nm_utils_ascii_str_to_int64 (value, 10, -1,
NM_SETTING_IP_CONFIG_DAD_TIMEOUT_MAX,
-1);
ret = ret < 0 ? 0 : ret;
}
}
return ret;
return nm_config_data_get_connection_default_int64 (NM_CONFIG_GET_DATA,
"ipv4.dad-timeout",
self,
0,
NM_SETTING_IP_CONFIG_DAD_TIMEOUT_MAX,
0);
}
static void
@ -6897,6 +6905,7 @@ ensure_con_ip_config (NMDevice *self, int addr_family)
nm_ip4_config_merge_setting (NM_IP4_CONFIG (con_ip_config),
nm_connection_get_setting_ip4_config (connection),
_get_mdns (self),
_get_llmnr (self),
nm_device_get_route_table (self, addr_family, TRUE),
nm_device_get_route_metric (self, addr_family));
} else {
@ -7309,6 +7318,7 @@ dhcp4_state_changed (NMDhcpClient *client,
nm_ip4_config_merge_setting (manual,
nm_connection_get_setting_ip4_config (connection),
NM_SETTING_CONNECTION_MDNS_DEFAULT,
NM_SETTING_CONNECTION_LLMNR_DEFAULT,
nm_device_get_route_table (self, AF_INET, TRUE),
nm_device_get_route_metric (self, AF_INET));
@ -7363,19 +7373,14 @@ get_dhcp_timeout (NMDevice *self, int addr_family)
if (timeout)
return timeout;
{
gs_free char *value = NULL;
value = nm_config_data_get_connection_default (NM_CONFIG_GET_DATA,
addr_family == AF_INET
? "ipv4.dhcp-timeout"
: "ipv6.dhcp-timeout",
self);
timeout = _nm_utils_ascii_str_to_int64 (value, 10,
0, G_MAXINT32, 0);
if (timeout)
return timeout;
}
timeout = nm_config_data_get_connection_default_int64 (NM_CONFIG_GET_DATA,
addr_family == AF_INET
? "ipv4.dhcp-timeout"
: "ipv6.dhcp-timeout",
self,
0, G_MAXINT32, 0);
if (timeout)
return timeout;
klass = NM_DEVICE_GET_CLASS (self);
if (klass->get_dhcp_timeout)
@ -7836,6 +7841,7 @@ act_stage3_ip4_config_start (NMDevice *self,
nm_ip4_config_merge_setting (config,
nm_connection_get_setting_ip4_config (connection),
NM_SETTING_CONNECTION_MDNS_DEFAULT,
NM_SETTING_CONNECTION_LLMNR_DEFAULT,
nm_device_get_route_table (self, AF_INET, TRUE),
nm_device_get_route_metric (self, AF_INET));
configs = g_new0 (NMIP4Config *, 2);
@ -8747,10 +8753,10 @@ gint64
nm_device_get_configured_mtu_from_connection_default (NMDevice *self,
const char *property_name)
{
gs_free char *str = NULL;
str = nm_config_data_get_connection_default (NM_CONFIG_GET_DATA, property_name, self);
return _nm_utils_ascii_str_to_int64 (str, 10, 0, G_MAXUINT32, -1);
return nm_config_data_get_connection_default_int64 (NM_CONFIG_GET_DATA,
property_name,
self,
0, G_MAXUINT32, -1);
}
guint32
@ -9447,7 +9453,6 @@ static NMSettingIP6ConfigPrivacy
_ip6_privacy_get (NMDevice *self)
{
NMSettingIP6ConfigPrivacy ip6_privacy;
gs_free char *value = NULL;
NMConnection *connection;
g_return_val_if_fail (self, NM_SETTING_IP6_CONFIG_PRIVACY_UNKNOWN);
@ -9466,14 +9471,13 @@ _ip6_privacy_get (NMDevice *self)
}
}
value = nm_config_data_get_connection_default (NM_CONFIG_GET_DATA,
"ipv6.ip6-privacy", self);
/* 2.) use the default value from the configuration. */
ip6_privacy = _nm_utils_ascii_str_to_int64 (value, 10,
NM_SETTING_IP6_CONFIG_PRIVACY_UNKNOWN,
NM_SETTING_IP6_CONFIG_PRIVACY_PREFER_TEMP_ADDR,
NM_SETTING_IP6_CONFIG_PRIVACY_UNKNOWN);
ip6_privacy = nm_config_data_get_connection_default_int64 (NM_CONFIG_GET_DATA,
"ipv6.ip6-privacy",
self,
NM_SETTING_IP6_CONFIG_PRIVACY_UNKNOWN,
NM_SETTING_IP6_CONFIG_PRIVACY_PREFER_TEMP_ADDR,
NM_SETTING_IP6_CONFIG_PRIVACY_UNKNOWN);
if (ip6_privacy != NM_SETTING_IP6_CONFIG_PRIVACY_UNKNOWN)
return ip6_privacy;
@ -10703,6 +10707,7 @@ nm_device_reactivate_ip4_config (NMDevice *self,
nm_ip4_config_merge_setting (priv->con_ip_config_4,
s_ip4_new,
_get_mdns (self),
_get_llmnr (self),
nm_device_get_route_table (self, AF_INET, TRUE),
nm_device_get_route_metric (self, AF_INET));
@ -10874,7 +10879,9 @@ can_reapply_change (NMDevice *self, const char *setting_name,
NM_SETTING_CONNECTION_AUTOCONNECT,
NM_SETTING_CONNECTION_ZONE,
NM_SETTING_CONNECTION_METERED,
NM_SETTING_CONNECTION_LLDP);
NM_SETTING_CONNECTION_LLDP,
NM_SETTING_CONNECTION_MDNS,
NM_SETTING_CONNECTION_LLMNR);
} else if (NM_IN_STRSET (setting_name,
NM_SETTING_PROXY_SETTING_NAME)) {
return TRUE;
@ -15647,7 +15654,6 @@ nm_device_get_supplicant_timeout (NMDevice *self)
{
NMConnection *connection;
NMSetting8021x *s_8021x;
gs_free char *value = NULL;
int timeout;
#define SUPPLICANT_DEFAULT_TIMEOUT 25
@ -15662,11 +15668,12 @@ nm_device_get_supplicant_timeout (NMDevice *self)
return timeout;
}
value = nm_config_data_get_connection_default (NM_CONFIG_GET_DATA,
"802-1x.auth-timeout",
self);
return _nm_utils_ascii_str_to_int64 (value, 10, 1, G_MAXINT32,
SUPPLICANT_DEFAULT_TIMEOUT);
return nm_config_data_get_connection_default_int64 (NM_CONFIG_GET_DATA,
"802-1x.auth-timeout",
self,
1,
G_MAXINT32,
SUPPLICANT_DEFAULT_TIMEOUT);
}
gboolean
@ -15689,12 +15696,10 @@ nm_device_auth_retries_try_next (NMDevice *self)
auth_retries = nm_setting_connection_get_auth_retries (s_con);
if (auth_retries == -1) {
gs_free char *value = NULL;
value = nm_config_data_get_connection_default (NM_CONFIG_GET_DATA,
"connection.auth-retries",
self);
auth_retries = _nm_utils_ascii_str_to_int64 (value, 10, -1, G_MAXINT32, -1);
auth_retries = nm_config_data_get_connection_default_int64 (NM_CONFIG_GET_DATA,
"connection.auth-retries",
self,
-1, G_MAXINT32, -1);
}
if (auth_retries == 0)

View file

@ -2364,7 +2364,6 @@ build_supplicant_config (NMDeviceWifi *self,
NMSettingWirelessSecurity *s_wireless_sec;
NMSettingWirelessSecurityPmf pmf;
NMSettingWirelessSecurityFils fils;
gs_free char *value = NULL;
g_return_val_if_fail (priv->sup_iface, NULL);
@ -2406,25 +2405,23 @@ build_supplicant_config (NMDeviceWifi *self,
/* Configure PMF (802.11w) */
pmf = nm_setting_wireless_security_get_pmf (s_wireless_sec);
if (pmf == NM_SETTING_WIRELESS_SECURITY_PMF_DEFAULT) {
value = nm_config_data_get_connection_default (NM_CONFIG_GET_DATA,
"wifi-sec.pmf",
NM_DEVICE (self));
pmf = _nm_utils_ascii_str_to_int64 (value, 10,
NM_SETTING_WIRELESS_SECURITY_PMF_DISABLE,
NM_SETTING_WIRELESS_SECURITY_PMF_REQUIRED,
NM_SETTING_WIRELESS_SECURITY_PMF_OPTIONAL);
pmf = nm_config_data_get_connection_default_int64 (NM_CONFIG_GET_DATA,
"wifi-sec.pmf",
NM_DEVICE (self),
NM_SETTING_WIRELESS_SECURITY_PMF_DISABLE,
NM_SETTING_WIRELESS_SECURITY_PMF_REQUIRED,
NM_SETTING_WIRELESS_SECURITY_PMF_OPTIONAL);
}
/* Configure FILS (802.11ai) */
fils = nm_setting_wireless_security_get_fils (s_wireless_sec);
if (fils == NM_SETTING_WIRELESS_SECURITY_FILS_DEFAULT) {
value = nm_config_data_get_connection_default (NM_CONFIG_GET_DATA,
"wifi-sec.fils",
NM_DEVICE (self));
fils = _nm_utils_ascii_str_to_int64 (value, 10,
NM_SETTING_WIRELESS_SECURITY_FILS_DISABLE,
NM_SETTING_WIRELESS_SECURITY_FILS_REQUIRED,
NM_SETTING_WIRELESS_SECURITY_FILS_OPTIONAL);
fils = nm_config_data_get_connection_default_int64 (NM_CONFIG_GET_DATA,
"wifi-sec.fils",
NM_DEVICE (self),
NM_SETTING_WIRELESS_SECURITY_FILS_DISABLE,
NM_SETTING_WIRELESS_SECURITY_FILS_REQUIRED,
NM_SETTING_WIRELESS_SECURITY_FILS_OPTIONAL);
}
s_8021x = nm_connection_get_setting_802_1x (connection);
@ -2461,7 +2458,6 @@ wake_on_wlan_enable (NMDeviceWifi *self)
NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self);
NMSettingWirelessWakeOnWLan wowl;
NMSettingWireless *s_wireless;
gs_free char *value = NULL;
s_wireless = (NMSettingWireless *) nm_device_get_applied_setting (NM_DEVICE (self), NM_TYPE_SETTING_WIRELESS);
if (s_wireless) {
@ -2470,31 +2466,27 @@ wake_on_wlan_enable (NMDeviceWifi *self)
goto found;
}
value = nm_config_data_get_connection_default (NM_CONFIG_GET_DATA,
"wifi.wake-on-wlan",
NM_DEVICE (self));
wowl = nm_config_data_get_connection_default_int64 (NM_CONFIG_GET_DATA,
"wifi.wake-on-wlan",
NM_DEVICE (self),
NM_SETTING_WIRELESS_WAKE_ON_WLAN_NONE,
G_MAXINT32,
NM_SETTING_WIRELESS_WAKE_ON_WLAN_DEFAULT);
if (value) {
wowl = _nm_utils_ascii_str_to_int64 (value, 10,
NM_SETTING_WIRELESS_WAKE_ON_WLAN_NONE,
G_MAXINT32,
NM_SETTING_WIRELESS_WAKE_ON_WLAN_DEFAULT);
if (NM_FLAGS_ANY (wowl, NM_SETTING_WIRELESS_WAKE_ON_WLAN_EXCLUSIVE_FLAGS)) {
if (!nm_utils_is_power_of_two (wowl)) {
_LOGD (LOGD_WIFI, "invalid default value %u for wake-on-wlan: "
"'default' and 'ignore' are exclusive flags", (guint) wowl);
wowl = NM_SETTING_WIRELESS_WAKE_ON_WLAN_DEFAULT;
}
} else if (NM_FLAGS_ANY (wowl, ~NM_SETTING_WIRELESS_WAKE_ON_WLAN_ALL)) {
_LOGD (LOGD_WIFI, "invalid default value %u for wake-on-wlan", (guint) wowl);
if (NM_FLAGS_ANY (wowl, NM_SETTING_WIRELESS_WAKE_ON_WLAN_EXCLUSIVE_FLAGS)) {
if (!nm_utils_is_power_of_two (wowl)) {
_LOGD (LOGD_WIFI, "invalid default value %u for wake-on-wlan: "
"'default' and 'ignore' are exclusive flags", (guint) wowl);
wowl = NM_SETTING_WIRELESS_WAKE_ON_WLAN_DEFAULT;
}
if (wowl != NM_SETTING_WIRELESS_WAKE_ON_WLAN_DEFAULT)
goto found;
} else if (NM_FLAGS_ANY (wowl, ~NM_SETTING_WIRELESS_WAKE_ON_WLAN_ALL)) {
_LOGD (LOGD_WIFI, "invalid default value %u for wake-on-wlan", (guint) wowl);
wowl = NM_SETTING_WIRELESS_WAKE_ON_WLAN_DEFAULT;
}
wowl = NM_SETTING_WIRELESS_WAKE_ON_WLAN_IGNORE;
if (wowl != NM_SETTING_WIRELESS_WAKE_ON_WLAN_DEFAULT)
goto found;
wowl = NM_SETTING_WIRELESS_WAKE_ON_WLAN_IGNORE;
found:
if (wowl == NM_SETTING_WIRELESS_WAKE_ON_WLAN_IGNORE) {
priv->wowlan_restore = wowl;
@ -2641,31 +2633,29 @@ set_powersave (NMDevice *device)
{
NMDeviceWifi *self = NM_DEVICE_WIFI (device);
NMSettingWireless *s_wireless;
NMSettingWirelessPowersave powersave;
gs_free char *value = NULL;
NMSettingWirelessPowersave val;
s_wireless = (NMSettingWireless *) nm_device_get_applied_setting (device, NM_TYPE_SETTING_WIRELESS);
g_return_if_fail (s_wireless);
powersave = nm_setting_wireless_get_powersave (s_wireless);
if (powersave == NM_SETTING_WIRELESS_POWERSAVE_DEFAULT) {
value = nm_config_data_get_connection_default (NM_CONFIG_GET_DATA,
"wifi.powersave",
device);
powersave = _nm_utils_ascii_str_to_int64 (value, 10,
NM_SETTING_WIRELESS_POWERSAVE_IGNORE,
NM_SETTING_WIRELESS_POWERSAVE_ENABLE,
NM_SETTING_WIRELESS_POWERSAVE_IGNORE);
val = nm_setting_wireless_get_powersave (s_wireless);
if (val == NM_SETTING_WIRELESS_POWERSAVE_DEFAULT) {
val = nm_config_data_get_connection_default_int64 (NM_CONFIG_GET_DATA,
"wifi.powersave",
device,
NM_SETTING_WIRELESS_POWERSAVE_IGNORE,
NM_SETTING_WIRELESS_POWERSAVE_ENABLE,
NM_SETTING_WIRELESS_POWERSAVE_IGNORE);
}
_LOGT (LOGD_WIFI, "powersave is set to %u", (unsigned) powersave);
_LOGT (LOGD_WIFI, "powersave is set to %u", (unsigned) val);
if (powersave == NM_SETTING_WIRELESS_POWERSAVE_IGNORE)
if (val == NM_SETTING_WIRELESS_POWERSAVE_IGNORE)
return;
nm_platform_wifi_set_powersave (nm_device_get_platform (device),
nm_device_get_ifindex (device),
powersave == NM_SETTING_WIRELESS_POWERSAVE_ENABLE);
val == NM_SETTING_WIRELESS_POWERSAVE_ENABLE);
}
static NMActStageReturn

View file

@ -970,6 +970,8 @@ compute_hash (NMDnsManager *self, const NMGlobalDnsConfig *global, guint8 buffer
else {
const CList *head;
/* FIXME(ip-config-checksum): this relies on the fact that an IP
* configuration without DNS parameters gives a zero checksum. */
head = _ip_config_lst_head (self);
c_list_for_each_entry (ip_data, head, ip_config_lst)
nm_ip_config_hash (ip_data->ip_config, sum, TRUE);

View file

@ -65,7 +65,6 @@ typedef struct {
GDBusProxy *resolve;
GCancellable *init_cancellable;
GCancellable *update_cancellable;
GCancellable *mdns_cancellable;
CList request_queue_lst_head;
} NMDnsSystemdResolvedPrivate;
@ -192,7 +191,8 @@ prepare_one_interface (NMDnsSystemdResolved *self, InterfaceConfig *ic)
GVariantBuilder dns, domains;
NMCListElem *elem;
NMSettingConnectionMdns mdns = NM_SETTING_CONNECTION_MDNS_DEFAULT;
const char *mdns_arg = NULL;
NMSettingConnectionLlmnr llmnr = NM_SETTING_CONNECTION_LLMNR_DEFAULT;
const char *mdns_arg = NULL, *llmnr_arg = NULL;
g_variant_builder_init (&dns, G_VARIANT_TYPE ("(ia(iay))"));
g_variant_builder_add (&dns, "i", ic->ifindex);
@ -208,8 +208,10 @@ prepare_one_interface (NMDnsSystemdResolved *self, InterfaceConfig *ic)
update_add_ip_config (self, &dns, &domains, data);
if (NM_IS_IP4_CONFIG (ip_config))
if (NM_IS_IP4_CONFIG (ip_config)) {
mdns = NM_MAX (mdns, nm_ip4_config_mdns_get (NM_IP4_CONFIG (ip_config)));
llmnr = NM_MAX (llmnr, nm_ip4_config_llmnr_get (NM_IP4_CONFIG (ip_config)));
}
}
g_variant_builder_close (&dns);
@ -231,6 +233,22 @@ prepare_one_interface (NMDnsSystemdResolved *self, InterfaceConfig *ic)
}
nm_assert (mdns_arg);
switch (llmnr) {
case NM_SETTING_CONNECTION_LLMNR_NO:
llmnr_arg = "no";
break;
case NM_SETTING_CONNECTION_LLMNR_RESOLVE:
llmnr_arg = "resolve";
break;
case NM_SETTING_CONNECTION_LLMNR_YES:
llmnr_arg = "yes";
break;
case NM_SETTING_CONNECTION_LLMNR_DEFAULT:
llmnr_arg = "";
break;
}
nm_assert (llmnr_arg);
_request_item_append (&priv->request_queue_lst_head,
"SetLinkDNS",
g_variant_builder_end (&dns));
@ -240,6 +258,9 @@ prepare_one_interface (NMDnsSystemdResolved *self, InterfaceConfig *ic)
_request_item_append (&priv->request_queue_lst_head,
"SetLinkMulticastDNS",
g_variant_new ("(is)", ic->ifindex, mdns_arg ?: ""));
_request_item_append (&priv->request_queue_lst_head,
"SetLinkLLMNR",
g_variant_new ("(is)", ic->ifindex, llmnr_arg ?: ""));
}
static void
@ -410,7 +431,6 @@ dispose (GObject *object)
g_clear_object (&priv->resolve);
nm_clear_g_cancellable (&priv->init_cancellable);
nm_clear_g_cancellable (&priv->update_cancellable);
nm_clear_g_cancellable (&priv->mdns_cancellable);
G_OBJECT_CLASS (nm_dns_systemd_resolved_parent_class)->dispose (object);
}

View file

@ -1371,6 +1371,20 @@ nm_config_data_get_connection_default (const NMConfigData *self,
return value;
}
gint64
nm_config_data_get_connection_default_int64 (const NMConfigData *self,
const char *property,
NMDevice *device,
gint64 min,
gint64 max,
gint64 fallback)
{
gs_free char *value = NULL;
value = nm_config_data_get_connection_default (self, property, device);
return _nm_utils_ascii_str_to_int64 (value, 10, min, max, fallback);
}
static void
_get_connection_info_init (MatchSectionInfo *connection_info, GKeyFile *keyfile, char *group)
{

View file

@ -181,6 +181,13 @@ char *nm_config_data_get_connection_default (const NMConfigData *self,
const char *property,
NMDevice *device);
gint64 nm_config_data_get_connection_default_int64 (const NMConfigData *self,
const char *property,
NMDevice *device,
gint64 min,
gint64 max,
gint64 fallback);
char *nm_config_data_get_device_config (const NMConfigData *self,
const char *property,
NMDevice *device,

View file

@ -295,6 +295,7 @@ typedef struct {
NMIPConfigSource mtu_source;
int dns_priority;
NMSettingConnectionMdns mdns;
NMSettingConnectionLlmnr llmnr;
GArray *nameservers;
GPtrArray *domains;
GPtrArray *searches;
@ -916,6 +917,7 @@ void
nm_ip4_config_merge_setting (NMIP4Config *self,
NMSettingIPConfig *setting,
NMSettingConnectionMdns mdns,
NMSettingConnectionLlmnr llmnr,
guint32 route_table,
guint32 route_metric)
{
@ -1033,6 +1035,7 @@ nm_ip4_config_merge_setting (NMIP4Config *self,
nm_ip4_config_set_dns_priority (self, priority);
nm_ip4_config_mdns_set (self, mdns);
nm_ip4_config_llmnr_set (self, llmnr);
g_object_thaw_notify (G_OBJECT (self));
}
@ -1253,6 +1256,10 @@ nm_ip4_config_merge (NMIP4Config *dst,
nm_ip4_config_mdns_set (dst,
NM_MAX (nm_ip4_config_mdns_get (src),
nm_ip4_config_mdns_get (dst)));
/* LLMNR */
nm_ip4_config_llmnr_set (dst,
NM_MAX (nm_ip4_config_llmnr_get (src),
nm_ip4_config_llmnr_get (dst)));
g_object_thaw_notify (G_OBJECT (dst));
}
@ -1494,6 +1501,10 @@ nm_ip4_config_subtract (NMIP4Config *dst,
if (nm_ip4_config_mdns_get (src) == nm_ip4_config_mdns_get (dst))
nm_ip4_config_mdns_set (dst, NM_SETTING_CONNECTION_MDNS_DEFAULT);
/* LLMNR */
if (nm_ip4_config_llmnr_get (src) == nm_ip4_config_llmnr_get (dst))
nm_ip4_config_llmnr_set (dst, NM_SETTING_CONNECTION_LLMNR_DEFAULT);
g_object_thaw_notify (G_OBJECT (dst));
}
@ -1595,6 +1606,7 @@ _nm_ip4_config_intersect_helper (NMIP4Config *dst,
/* ignore NIS */
/* ignore WINS */
/* ignore mdns */
/* ignore LLMNR */
if (update_dst)
g_object_thaw_notify (G_OBJECT (dst));
@ -1873,7 +1885,15 @@ nm_ip4_config_replace (NMIP4Config *dst, const NMIP4Config *src, gboolean *relev
has_relevant_changes = TRUE;
}
dst_priv->mdns = src_priv->mdns;
if (src_priv->mdns != dst_priv->mdns) {
dst_priv->mdns = src_priv->mdns;
has_relevant_changes = TRUE;
}
if (src_priv->llmnr != dst_priv->llmnr) {
dst_priv->llmnr = src_priv->llmnr;
has_relevant_changes = TRUE;
}
/* DNS priority */
if (src_priv->dns_priority != dst_priv->dns_priority) {
@ -2562,6 +2582,19 @@ nm_ip4_config_mdns_set (NMIP4Config *self,
NM_IP4_CONFIG_GET_PRIVATE (self)->mdns = mdns;
}
NMSettingConnectionLlmnr
nm_ip4_config_llmnr_get (const NMIP4Config *self)
{
return NM_IP4_CONFIG_GET_PRIVATE (self)->llmnr;
}
void
nm_ip4_config_llmnr_set (NMIP4Config *self,
NMSettingConnectionLlmnr llmnr)
{
NM_IP4_CONFIG_GET_PRIVATE (self)->llmnr = llmnr;
}
/*****************************************************************************/
void
@ -2851,6 +2884,7 @@ nm_ip4_config_hash (const NMIP4Config *self, GChecksum *sum, gboolean dns_only)
NMDedupMultiIter ipconf_iter;
const NMPlatformIP4Address *address;
const NMPlatformIP4Route *route;
int val;
g_return_if_fail (self);
g_return_if_fail (sum);
@ -2897,6 +2931,25 @@ nm_ip4_config_hash (const NMIP4Config *self, GChecksum *sum, gboolean dns_only)
s = nm_ip4_config_get_dns_option (self, i);
g_checksum_update (sum, (const guint8 *) s, strlen (s));
}
val = nm_ip4_config_mdns_get (self);
if (val != NM_SETTING_CONNECTION_MDNS_DEFAULT)
g_checksum_update (sum, (const guint8 *) &val, sizeof (val));
val = nm_ip4_config_llmnr_get (self);
if (val != NM_SETTING_CONNECTION_LLMNR_DEFAULT)
g_checksum_update (sum, (const guint8 *) &val, sizeof (val));
/* FIXME(ip-config-checksum): the DNS priority should be considered relevant
* and added into the checksum as well, but this can't be done right now
* because in the DNS manager we rely on the fact that an empty
* configuration (i.e. just created) has a zero checksum. This is needed to
* avoid rewriting resolv.conf when there is no change.
*
* The DNS priority initial value depends on the connection type (VPN or
* not), so it's a bit difficult to add it to checksum maintaining the
* assumption of checksum(empty)=0
*/
}
/**
@ -3212,6 +3265,7 @@ nm_ip4_config_init (NMIP4Config *self)
NMP_OBJECT_TYPE_IP4_ROUTE);
priv->mdns = NM_SETTING_CONNECTION_MDNS_DEFAULT;
priv->llmnr = NM_SETTING_CONNECTION_LLMNR_DEFAULT;
priv->nameservers = g_array_new (FALSE, FALSE, sizeof (guint32));
priv->domains = g_ptr_array_new_with_free_func (g_free);
priv->searches = g_ptr_array_new_with_free_func (g_free);

View file

@ -175,6 +175,7 @@ gboolean nm_ip4_config_commit (const NMIP4Config *self,
void nm_ip4_config_merge_setting (NMIP4Config *self,
NMSettingIPConfig *setting,
NMSettingConnectionMdns mdns,
NMSettingConnectionLlmnr llmnr,
guint32 route_table,
guint32 route_metric);
NMSetting *nm_ip4_config_create_setting (const NMIP4Config *self);
@ -203,6 +204,9 @@ in_addr_t nmtst_ip4_config_get_gateway (NMIP4Config *config);
NMSettingConnectionMdns nm_ip4_config_mdns_get (const NMIP4Config *self);
void nm_ip4_config_mdns_set (NMIP4Config *self,
NMSettingConnectionMdns mdns);
NMSettingConnectionLlmnr nm_ip4_config_llmnr_get (const NMIP4Config *self);
void nm_ip4_config_llmnr_set (NMIP4Config *self,
NMSettingConnectionLlmnr llmnr);
const NMDedupMultiHeadEntry *nm_ip4_config_lookup_addresses (const NMIP4Config *self);
void nm_ip4_config_reset_addresses (NMIP4Config *self);

View file

@ -3959,27 +3959,24 @@ static gboolean
should_connect_slaves (NMConnection *connection, NMDevice *device)
{
NMSettingConnection *s_con;
NMSettingConnectionAutoconnectSlaves autoconnect_slaves;
gs_free char *value = NULL;
NMSettingConnectionAutoconnectSlaves val;
s_con = nm_connection_get_setting_connection (connection);
g_assert (s_con);
/* Check autoconnect-slaves property */
autoconnect_slaves = nm_setting_connection_get_autoconnect_slaves (s_con);
if (autoconnect_slaves != NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES_DEFAULT)
val = nm_setting_connection_get_autoconnect_slaves (s_con);
if (val != NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES_DEFAULT)
goto out;
/* Check configuration default for autoconnect-slaves property */
value = nm_config_data_get_connection_default (NM_CONFIG_GET_DATA,
"connection.autoconnect-slaves", device);
if (value)
autoconnect_slaves = _nm_utils_ascii_str_to_int64 (value, 10, 0, 1, -1);
val = nm_config_data_get_connection_default_int64 (NM_CONFIG_GET_DATA,
"connection.autoconnect-slaves",
device,
0, 1, -1);
out:
if (autoconnect_slaves == NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES_NO)
if (val == NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES_NO)
return FALSE;
if (autoconnect_slaves == NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES_YES)
if (val == NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES_YES)
return TRUE;
return FALSE;
}

View file

@ -554,6 +554,13 @@ make_connection_setting (const char *file,
PARSE_WARNING ("invalid MDNS setting");
g_object_set (s_con, NM_SETTING_CONNECTION_MDNS, i_val, NULL);
i_val = NM_SETTING_CONNECTION_LLMNR_DEFAULT;
if (!svGetValueEnum (ifcfg, "LLMNR",
nm_setting_connection_llmnr_get_type (),
&i_val, NULL))
PARSE_WARNING ("invalid LLMNR setting");
g_object_set (s_con, NM_SETTING_CONNECTION_LLMNR, i_val, NULL);
return NM_SETTING (s_con);
}

View file

@ -1790,6 +1790,7 @@ write_connection_setting (NMSettingConnection *s_con, shvarFile *ifcfg)
const char *master, *master_iface = NULL, *type;
int vint;
NMSettingConnectionMdns mdns;
NMSettingConnectionLlmnr llmnr;
guint32 vuint32;
const char *tmp;
@ -1960,6 +1961,13 @@ write_connection_setting (NMSettingConnection *s_con, shvarFile *ifcfg)
mdns);
} else
svUnsetValue (ifcfg, "MDNS");
llmnr = nm_setting_connection_get_llmnr (s_con);
if (llmnr != NM_SETTING_CONNECTION_LLMNR_DEFAULT) {
svSetValueEnum (ifcfg, "LLMNR", nm_setting_connection_llmnr_get_type (),
llmnr);
} else
svUnsetValue (ifcfg, "LLMNR");
}
static char *

View file

@ -1619,6 +1619,7 @@ nm_vpn_connection_ip4_config_get (NMVpnConnection *self, GVariant *dict)
nm_ip4_config_merge_setting (config,
s_ip,
nm_setting_connection_get_mdns (s_con),
nm_setting_connection_get_llmnr (s_con),
route_table,
route_metric);
@ -1876,13 +1877,10 @@ connect_success (NMVpnConnection *self)
* It is a configured value or 60 seconds */
timeout = nm_setting_vpn_get_timeout (s_vpn);
if (timeout == 0) {
char *value;
value = nm_config_data_get_connection_default (NM_CONFIG_GET_DATA,
"vpn.timeout", NULL);
timeout = _nm_utils_ascii_str_to_int64 (value, 10, 0, G_MAXUINT32, 60);
timeout = timeout == 0 ? 60 : timeout;
g_free (value);
timeout = nm_config_data_get_connection_default_int64 (NM_CONFIG_GET_DATA,
"vpn.timeout",
NULL,
1, G_MAXUINT32, 60);
}
priv->connect_timeout = g_timeout_add_seconds (timeout, connect_timeout_cb, self);