diff options
-rw-r--r-- | clients/cli/generate-docs-nm-settings-nmcli.xml.in | 2 | ||||
-rw-r--r-- | clients/common/settings-docs.h.in | 2 | ||||
-rw-r--r-- | libnm-core/nm-setting-hostname.c | 2 | ||||
-rw-r--r-- | src/nm-policy.c | 8 |
4 files changed, 10 insertions, 4 deletions
diff --git a/clients/cli/generate-docs-nm-settings-nmcli.xml.in b/clients/cli/generate-docs-nm-settings-nmcli.xml.in index f269af0646..cc47e6aa9b 100644 --- a/clients/cli/generate-docs-nm-settings-nmcli.xml.in +++ b/clients/cli/generate-docs-nm-settings-nmcli.xml.in @@ -572,7 +572,7 @@ <property name="from-dns-lookup" description="Whether the system hostname can be determined from reverse DNS lookup of addresses on this device. When set to NM_TERNARY_DEFAULT (-1), the value from global configuration is used. If the property doesn't have a value in the global configuration, NetworkManager assumes the value to be NM_TERNARY_TRUE (1)." /> <property name="only-from-default" - description="If set to NM_TERNARY_TRUE (1), NetworkManager attempts to get the hostname via DHCPv4/DHCPv6 or reverse DNS lookup on this device only when the device has the default route for the given address family (IPv4/IPv6). If set to NM_TERNARY_FALSE (0), the hostname can be set from this device even if it doesn't have the default route. When set to NM_TERNARY_DEFAULT (-1), the value from global configuration is used. If the property doesn't have a value in the global configuration, NetworkManager assumes the value to be NM_TERNARY_TRUE (1)." /> + description="If set to NM_TERNARY_TRUE (1), NetworkManager attempts to get the hostname via DHCPv4/DHCPv6 or reverse DNS lookup on this device only when the device has the default route for the given address family (IPv4/IPv6). If set to NM_TERNARY_FALSE (0), the hostname can be set from this device even if it doesn't have the default route. When set to NM_TERNARY_DEFAULT (-1), the value from global configuration is used. If the property doesn't have a value in the global configuration, NetworkManager assumes the value to be NM_TERNARY_FALSE (0)." /> </setting> <setting name="infiniband" > <property name="mac-address" diff --git a/clients/common/settings-docs.h.in b/clients/common/settings-docs.h.in index 99da011c2f..aed7e977dc 100644 --- a/clients/common/settings-docs.h.in +++ b/clients/common/settings-docs.h.in @@ -205,7 +205,7 @@ #define DESCRIBE_DOC_NM_SETTING_GSM_USERNAME N_("The username used to authenticate with the network, if required. Many providers do not require a username, or accept any username. But if a username is required, it is specified here.") #define DESCRIBE_DOC_NM_SETTING_HOSTNAME_FROM_DHCP N_("Whether the system hostname can be determined from DHCP on this connection. When set to NM_TERNARY_DEFAULT (-1), the value from global configuration is used. If the property doesn't have a value in the global configuration, NetworkManager assumes the value to be NM_TERNARY_TRUE (1).") #define DESCRIBE_DOC_NM_SETTING_HOSTNAME_FROM_DNS_LOOKUP N_("Whether the system hostname can be determined from reverse DNS lookup of addresses on this device. When set to NM_TERNARY_DEFAULT (-1), the value from global configuration is used. If the property doesn't have a value in the global configuration, NetworkManager assumes the value to be NM_TERNARY_TRUE (1).") -#define DESCRIBE_DOC_NM_SETTING_HOSTNAME_ONLY_FROM_DEFAULT N_("If set to NM_TERNARY_TRUE (1), NetworkManager attempts to get the hostname via DHCPv4/DHCPv6 or reverse DNS lookup on this device only when the device has the default route for the given address family (IPv4/IPv6). If set to NM_TERNARY_FALSE (0), the hostname can be set from this device even if it doesn't have the default route. When set to NM_TERNARY_DEFAULT (-1), the value from global configuration is used. If the property doesn't have a value in the global configuration, NetworkManager assumes the value to be NM_TERNARY_TRUE (1).") +#define DESCRIBE_DOC_NM_SETTING_HOSTNAME_ONLY_FROM_DEFAULT N_("If set to NM_TERNARY_TRUE (1), NetworkManager attempts to get the hostname via DHCPv4/DHCPv6 or reverse DNS lookup on this device only when the device has the default route for the given address family (IPv4/IPv6). If set to NM_TERNARY_FALSE (0), the hostname can be set from this device even if it doesn't have the default route. When set to NM_TERNARY_DEFAULT (-1), the value from global configuration is used. If the property doesn't have a value in the global configuration, NetworkManager assumes the value to be NM_TERNARY_FALSE (0).") #define DESCRIBE_DOC_NM_SETTING_HOSTNAME_PRIORITY N_("The relative priority of this connection to determine the system hostname. A lower numerical value is better (higher priority). A connection with higher priority is considered before connections with lower priority. If the value is zero, it can be overridden by a global value from NetworkManager configuration. If the property doesn't have a value in the global configuration, the value is assumed to be 100. Negative values have the special effect of excluding other connections with a greater numerical priority value; so in presence of at least one negative priority, only connections with the lowest priority value will be used to determine the hostname.") #define DESCRIBE_DOC_NM_SETTING_INFINIBAND_MAC_ADDRESS N_("If specified, this connection will only apply to the IPoIB device whose permanent MAC address matches. This property does not change the MAC address of the device (i.e. MAC spoofing).") #define DESCRIBE_DOC_NM_SETTING_INFINIBAND_MTU N_("If non-zero, only transmit packets of the specified size or smaller, breaking larger packets up into multiple frames.") diff --git a/libnm-core/nm-setting-hostname.c b/libnm-core/nm-setting-hostname.c index f3ed1cafac..fa781b1fbb 100644 --- a/libnm-core/nm-setting-hostname.c +++ b/libnm-core/nm-setting-hostname.c @@ -312,7 +312,7 @@ nm_setting_hostname_class_init(NMSettingHostnameClass *klass) * * When set to %NM_TERNARY_DEFAULT, the value from global configuration * is used. If the property doesn't have a value in the global - * configuration, NetworkManager assumes the value to be %NM_TERNARY_TRUE. + * configuration, NetworkManager assumes the value to be %NM_TERNARY_FALSE. * * Since: 1.30 **/ diff --git a/src/nm-policy.c b/src/nm-policy.c index 97d7e92e2c..e74531e92c 100644 --- a/src/nm-policy.c +++ b/src/nm-policy.c @@ -666,6 +666,7 @@ device_get_hostname_property_boolean(NMDevice *device, const char *name) NMSettingHostname *s_hostname; char buf[128]; int value; + NMTernary default_value; nm_assert(NM_IN_STRSET(name, NM_SETTING_HOSTNAME_FROM_DHCP, @@ -680,12 +681,17 @@ device_get_hostname_property_boolean(NMDevice *device, const char *name) return value; } + if (nm_streq(name, NM_SETTING_HOSTNAME_ONLY_FROM_DEFAULT)) + default_value = NM_TERNARY_FALSE; + else + default_value = NM_TERNARY_TRUE; + return nm_config_data_get_connection_default_int64(NM_CONFIG_GET_DATA, nm_sprintf_buf(buf, "hostname.%s", name), device, NM_TERNARY_FALSE, NM_TERNARY_TRUE, - NM_TERNARY_TRUE); + default_value); } static int |