merge: branch 'global_dhcp_hostname_flags'

device: Support configuring dhcp-send-hostname globally

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2029
This commit is contained in:
Wen Liang 2024-10-28 13:45:11 +00:00
commit afab26a8fa
22 changed files with 1644 additions and 1001 deletions

View file

@ -961,6 +961,10 @@ ipv6.ip6-privacy=0
<term><varname>ipv4.dhcp-hostname-flags</varname></term>
<listitem><para>If left unspecified, the value 3 (fqdn-encoded,fqdn-serv-update) is used.</para></listitem>
</varlistentry>
<varlistentry>
<term><varname>ipv4.dhcp-send-hostname</varname></term>
<listitem><para>Whether a hostname is sent to the DHCP server when acquiring a lease. When the property is not specified in the connection, the global value from NetworkManager configuration is looked up. If the global value is not set, the value from ipv4.dhcp-send-hostname-deprecated, which defaults to true, is used for backwards compatibility. In the future this will change and, in absence of a global default, it will always fallback to true.</para></listitem>
</varlistentry>
<varlistentry>
<term><varname>ipv4.dhcp-send-release</varname></term>
<listitem><para>Whether the DHCP client will send RELEASE message when bringing the connection down.</para></listitem>
@ -1021,6 +1025,10 @@ ipv6.ip6-privacy=0
<term><varname>ipv6.dhcp-hostname-flags</varname></term>
<listitem><para>If left unspecified, the value 1 (fqdn-serv-update) is used.</para></listitem>
</varlistentry>
<varlistentry>
<term><varname>ipv6.dhcp-send-hostname</varname></term>
<listitem><para>Whether a hostname is sent to the DHCP server when acquiring a lease. When the property is not specified in the connection, the global value from NetworkManager configuration is looked up. If the global value is not set, the value from ipv6.dhcp-send-hostname-deprecated, which defaults to true, is used for backwards compatibility. In the future this will change and, in absence of a global default, it will always fallback to true.</para></listitem>
</varlistentry>
<varlistentry>
<term><varname>ipv6.dhcp-send-release</varname></term>
<listitem><para>Whether the DHCP client will send RELEASE message when bringing the connection down.</para></listitem>

View file

@ -141,7 +141,14 @@
<term>
<option>
<xsl:attribute name="id">nm-settings-nmcli.property.<xsl:value-of select="$setting_name"/>.<xsl:value-of select="@name"/></xsl:attribute>
<xsl:value-of select="$setting_name"/>.<xsl:value-of select="@name"/>
<xsl:choose>
<xsl:when test="@rename">
<xsl:value-of select="$setting_name"/>.<xsl:value-of select="@rename"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$setting_name"/>.<xsl:value-of select="@name"/>
</xsl:otherwise>
</xsl:choose>
</option>
</term>
<listitem>

View file

@ -2078,6 +2078,35 @@ _prop_get_ipvx_dhcp_hostname_flags(NMDevice *self, int addr_family)
return NM_DHCP_HOSTNAME_FLAGS_FQDN_DEFAULT_IP6;
}
static gboolean
_prop_get_ipvx_dhcp_send_hostname(NMDevice *self, int addr_family)
{
const int IS_IPv4 = NM_IS_IPv4(addr_family);
NMSettingIPConfig *s_ip = IS_IPv4
? nm_device_get_applied_setting(self, NM_TYPE_SETTING_IP4_CONFIG)
: nm_device_get_applied_setting(self, NM_TYPE_SETTING_IP6_CONFIG);
gboolean send_hostname;
gboolean send_hostname_v2;
g_return_val_if_fail(s_ip, FALSE);
send_hostname = nm_setting_ip_config_get_dhcp_send_hostname(s_ip);
send_hostname_v2 = nm_setting_ip_config_get_dhcp_send_hostname_v2(s_ip);
if (send_hostname_v2 == NM_TERNARY_DEFAULT) {
send_hostname_v2 = nm_config_data_get_connection_default_int64(
NM_CONFIG_GET_DATA,
IS_IPv4 ? NM_CON_DEFAULT("ipv4.dhcp-send-hostname")
: NM_CON_DEFAULT("ipv6.dhcp-send-hostname"),
self,
NM_TERNARY_FALSE,
NM_TERNARY_TRUE,
send_hostname ? NM_TERNARY_TRUE : NM_TERNARY_FALSE);
}
return send_hostname_v2;
}
static const char *
_prop_get_connection_mud_url(NMDevice *self, NMSettingConnection *s_con)
{
@ -11360,7 +11389,7 @@ _dev_ipdhcpx_start(NMDevice *self, int addr_family)
.uuid = nm_connection_get_uuid(connection),
.hwaddr = hwaddr,
.bcast_hwaddr = bcast_hwaddr,
.send_hostname = nm_setting_ip_config_get_dhcp_send_hostname(s_ip),
.send_hostname = _prop_get_ipvx_dhcp_send_hostname(self, AF_INET),
.hostname = hostname,
.hostname_flags = _prop_get_ipvx_dhcp_hostname_flags(self, AF_INET),
.client_id = client_id,
@ -11400,7 +11429,7 @@ _dev_ipdhcpx_start(NMDevice *self, int addr_family)
.iface = nm_device_get_ip_iface(self),
.iface_type_log = nm_device_get_type_desc_for_log(self),
.uuid = nm_connection_get_uuid(connection),
.send_hostname = nm_setting_ip_config_get_dhcp_send_hostname(s_ip),
.send_hostname = _prop_get_ipvx_dhcp_send_hostname(self, AF_INET6),
.hostname = nm_setting_ip_config_get_dhcp_hostname(s_ip),
.hostname_flags = _prop_get_ipvx_dhcp_hostname_flags(self, AF_INET6),
.client_id = duid,

View file

@ -2022,11 +2022,6 @@ global:
nm_setting_ip_config_routed_dns_get_type;
nm_setting_ipvlan_get_mode;
nm_setting_ipvlan_get_parent;
nm_setting_ipvlan_get_private;
nm_setting_ipvlan_get_type;
nm_setting_ipvlan_get_vepa;
nm_setting_ipvlan_mode_get_type;
nm_setting_ipvlan_new;
nm_setting_gsm_get_initial_eps_password;
nm_setting_gsm_get_initial_eps_username;
nm_setting_gsm_get_initial_eps_noauth;
@ -2035,4 +2030,10 @@ global:
nm_setting_gsm_get_initial_eps_refuse_eap;
nm_setting_gsm_get_initial_eps_refuse_mschap;
nm_setting_gsm_get_initial_eps_refuse_mschapv2;
nm_setting_ipvlan_get_private;
nm_setting_ipvlan_get_type;
nm_setting_ipvlan_get_vepa;
nm_setting_ipvlan_mode_get_type;
nm_setting_ipvlan_new;
nm_setting_ip_config_get_dhcp_send_hostname_v2;
} libnm_1_50_0;

View file

@ -1660,6 +1660,10 @@
dbus-type="b"
gprop-type="gboolean"
/>
<property name="dhcp-send-hostname-v2"
dbus-type="i"
gprop-type="gint"
/>
<property name="dhcp-send-release"
dbus-type="i"
gprop-type="NMTernary"
@ -1807,6 +1811,10 @@
dbus-type="b"
gprop-type="gboolean"
/>
<property name="dhcp-send-hostname-v2"
dbus-type="i"
gprop-type="gint"
/>
<property name="dhcp-send-release"
dbus-type="i"
gprop-type="NMTernary"

View file

@ -1186,6 +1186,7 @@ _normalize_ip_config(NMConnection *self, GHashTable *parameters)
NMSetting *setting;
gboolean changed = FALSE;
guint num, i;
int dhcp_send_hostname_v2;
s_ip4 = nm_connection_get_setting_ip4_config(self);
s_ip6 = nm_connection_get_setting_ip6_config(self);
@ -1241,6 +1242,16 @@ _normalize_ip_config(NMConnection *self, GHashTable *parameters)
nm_setting_ip_config_remove_address(s_ip4, i);
changed = TRUE;
}
dhcp_send_hostname_v2 = nm_setting_ip_config_get_dhcp_send_hostname_v2(s_ip4);
if (dhcp_send_hostname_v2 != NM_TERNARY_DEFAULT
&& dhcp_send_hostname_v2 != nm_setting_ip_config_get_dhcp_send_hostname(s_ip4)) {
g_object_set(s_ip4,
NM_SETTING_IP_CONFIG_DHCP_SEND_HOSTNAME,
dhcp_send_hostname_v2,
NULL);
changed = TRUE;
}
}
} else {
if (s_ip4) {
@ -1315,6 +1326,16 @@ _normalize_ip_config(NMConnection *self, GHashTable *parameters)
g_object_set(s_ip6, NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE, NULL);
changed = TRUE;
}
dhcp_send_hostname_v2 = nm_setting_ip_config_get_dhcp_send_hostname_v2(s_ip6);
if (dhcp_send_hostname_v2 != NM_TERNARY_DEFAULT
&& dhcp_send_hostname_v2 != nm_setting_ip_config_get_dhcp_send_hostname(s_ip6)) {
g_object_set(s_ip6,
NM_SETTING_IP_CONFIG_DHCP_SEND_HOSTNAME,
dhcp_send_hostname_v2,
NULL);
changed = TRUE;
}
}
} else {
if (s_ip6) {

View file

@ -3548,6 +3548,62 @@ read_one_setting_value(KeyfileReaderInfo *info,
}
}
static void
_read_handle_renamed_properties(KeyfileReaderInfo *info)
{
GKeyFile *kf = info->keyfile;
const char *group = info->group;
gs_free_error GError *error = NULL;
if (NM_IN_STRSET(group, "ipv4", "ipv6")) {
/* dhcp-send-hostname is stored as dhcp-send-hostname-deprecated
* dhcp-send-hostname-v2 is stored as dhcp-send-hostname
* Do the conversion back. Also, accept boolean values for -v2 to
* maintain backwards compatibility with keyfiles written with the
* deprecated property in mind
*/
if (g_key_file_has_key(kf, group, "dhcp-send-hostname", NULL)) {
gboolean val_bool;
int val;
val = g_key_file_get_integer(kf, group, "dhcp-send-hostname", &error);
if (error) {
g_clear_error(&error);
val_bool = g_key_file_get_boolean(kf, group, "dhcp-send-hostname", &error);
if (!error)
val = val_bool ? 1 : 0;
else
read_handle_warn(info,
NULL,
NULL,
NM_KEYFILE_WARN_SEVERITY_WARN,
_("invalid value for '%s.dhcp-send-hostname'"),
info->group);
}
g_key_file_remove_key(kf, group, "dhcp-send-hostname", NULL);
if (!error)
g_key_file_set_integer(kf, group, "dhcp-send-hostname-v2", val);
}
if (g_key_file_has_key(kf, group, "dhcp-send-hostname-deprecated", NULL)) {
gs_free char *val = NULL;
val = g_key_file_get_value(kf, group, "dhcp-send-hostname-deprecated", NULL);
g_key_file_remove_key(kf, group, "dhcp-send-hostname-deprecated", NULL);
if (val)
g_key_file_set_value(kf, group, "dhcp-send-hostname", val);
else
read_handle_warn(info,
NULL,
NULL,
NM_KEYFILE_WARN_SEVERITY_WARN,
_("invalid value for '%s.dhcp-send-hostname-deprecated'"),
info->group);
}
}
}
static void
_read_setting(KeyfileReaderInfo *info)
{
@ -3576,6 +3632,8 @@ _read_setting(KeyfileReaderInfo *info)
info->setting = setting;
_read_handle_renamed_properties(info);
sett_info = _nm_setting_class_get_sett_info(NM_SETTING_GET_CLASS(setting));
if (sett_info->detail.gendata_info) {
@ -4089,6 +4147,18 @@ write_setting_value(KeyfileWriterInfo *info,
g_value_init(&value, G_PARAM_SPEC_VALUE_TYPE(property_info->param_spec));
g_object_get_property(G_OBJECT(setting), property_info->param_spec->name, &value);
/* To prevent any confusion from the user regarding the v2 suffix,
* dhcp-send-hostname is stored as dhcp-send-hostname-deprecated
* and dhcp-send-hostname-v2 is stored as dhcp-send-hostname
* in the keyfile.
*/
if (NM_IS_SETTING_IP4_CONFIG(setting) || NM_IS_SETTING_IP6_CONFIG(setting)) {
if (nm_streq(key, NM_SETTING_IP_CONFIG_DHCP_SEND_HOSTNAME_V2))
key = "dhcp-send-hostname";
else if (nm_streq(key, NM_SETTING_IP_CONFIG_DHCP_SEND_HOSTNAME))
key = "dhcp-send-hostname-deprecated";
}
if ((!pip || !pip->writer_persist_default)
&& g_param_value_defaults(property_info->param_spec, &value)) {
nm_assert(!g_key_file_has_key(info->keyfile, setting_info->setting_name, key, NULL));

View file

@ -3996,6 +3996,7 @@ NM_GOBJECT_PROPERTIES_DEFINE(NMSettingIPConfig,
PROP_DHCP_DSCP,
PROP_DHCP_HOSTNAME_FLAGS,
PROP_DHCP_SEND_HOSTNAME,
PROP_DHCP_SEND_HOSTNAME_V2,
PROP_NEVER_DEFAULT,
PROP_MAY_FAIL,
PROP_DAD_TIMEOUT,
@ -5194,6 +5195,8 @@ nm_setting_ip_config_get_dhcp_hostname(NMSettingIPConfig *setting)
* Returns: %TRUE if NetworkManager should send the machine hostname to the
* DHCP server when requesting addresses to allow the server to automatically
* update DNS information for this machine.
*
* Deprecated: 1.52. Use nm_setting_ip_config_get_dhcp_send_hostname_v2() instead.
**/
gboolean
nm_setting_ip_config_get_dhcp_send_hostname(NMSettingIPConfig *setting)
@ -5203,6 +5206,25 @@ nm_setting_ip_config_get_dhcp_send_hostname(NMSettingIPConfig *setting)
return NM_SETTING_IP_CONFIG_GET_PRIVATE(setting)->dhcp_send_hostname;
}
/**
* nm_setting_ip_config_get_dhcp_send_hostname_v2:
* @setting: the #NMSettingIPConfig
*
* Returns the value contained in the #NMSettingIPConfig:dhcp-send-hostname-v2
* property.
*
* Returns: the #NMSettingIPConfig:dhcp-send-hostname-v2 property of the setting
*
* Since: 1.52
**/
NMTernary
nm_setting_ip_config_get_dhcp_send_hostname_v2(NMSettingIPConfig *setting)
{
g_return_val_if_fail(NM_IS_SETTING_IP_CONFIG(setting), NM_TERNARY_DEFAULT);
return NM_SETTING_IP_CONFIG_GET_PRIVATE(setting)->dhcp_send_hostname_v2;
}
/**
* nm_setting_ip_config_get_dhcp_dscp:
* @setting: the #NMSettingIPConfig
@ -5807,6 +5829,20 @@ verify(NMSetting *setting, NMConnection *connection, GError **error)
return NM_SETTING_VERIFY_NORMALIZABLE_ERROR;
}
if (priv->dhcp_send_hostname_v2 != NM_TERNARY_DEFAULT
&& priv->dhcp_send_hostname != priv->dhcp_send_hostname_v2) {
g_set_error(error,
NM_CONNECTION_ERROR,
NM_CONNECTION_ERROR_INVALID_PROPERTY,
_("the value is inconsistent with '%s'"),
NM_SETTING_IP_CONFIG_DHCP_SEND_HOSTNAME_V2);
g_prefix_error(error,
"%s.%s: ",
nm_setting_get_name(setting),
NM_SETTING_IP_CONFIG_DHCP_SEND_HOSTNAME);
return NM_SETTING_VERIFY_NORMALIZABLE_ERROR;
}
return TRUE;
}
@ -6148,6 +6184,14 @@ _nm_sett_info_property_override_create_array_ip_config(int addr_family)
.direct_offset =
NM_STRUCT_OFFSET_ENSURE_TYPE(bool, NMSettingIPConfigPrivate, dhcp_send_hostname));
_nm_properties_override_gobj(
properties_override,
obj_properties[PROP_DHCP_SEND_HOSTNAME_V2],
&nm_sett_info_propert_type_direct_enum,
.direct_offset =
NM_STRUCT_OFFSET_ENSURE_TYPE(int, NMSettingIPConfigPrivate, dhcp_send_hostname_v2),
.direct_data.enum_gtype = NM_TYPE_TERNARY);
_nm_properties_override_gobj(
properties_override,
obj_properties[PROP_DHCP_HOSTNAME_FLAGS],
@ -6686,12 +6730,21 @@ nm_setting_ip_config_class_init(NMSettingIPConfigClass *klass)
/**
* NMSettingIPConfig:dhcp-send-hostname:
*
* If %TRUE, a hostname is sent to the DHCP server when acquiring a lease.
* Some DHCP servers use this hostname to update DNS databases, essentially
* providing a static hostname for the computer. If the
* #NMSettingIPConfig:dhcp-hostname property is %NULL and this property is
* %TRUE, the current persistent hostname of the computer is sent.
* Since 1.52 this property is deprecated and is only used as fallback value
* for #NMSettingIPConfig:dhcp-send-hostname-v2 if it's set to 'default'.
* This is only done to avoid breaking existing configurations, the new
* property should be used from now on.
*
* Deprecated: 1.52: use the new version of dhcp-send-hostname instead.
**/
/* ---nmcli---
* property: dhcp-send-hostname
* rename: dhcp-send-hostname-deprecated
* description: Since 1.52 this property is deprecated and is only used as fallback value
* for dhcp-send-hostname if it's set to 'default'. This is only done to avoid
* breaking existing configurations, the new property should be used from now on.
* ---end---
*/
obj_properties[PROP_DHCP_SEND_HOSTNAME] =
g_param_spec_boolean(NM_SETTING_IP_CONFIG_DHCP_SEND_HOSTNAME,
"",
@ -6991,5 +7044,47 @@ nm_setting_ip_config_class_init(NMSettingIPConfigClass *klass)
NM_SETTING_IP_CONFIG_ROUTED_DNS_DEFAULT,
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
/**
* NMSettingIPConfig:dhcp-send-hostname-v2:
*
* If %TRUE, a hostname is sent to the DHCP server when acquiring a lease.
* Some DHCP servers use this hostname to update DNS databases, essentially
* providing a static hostname for the computer. If the
* #NMSettingIPConfig:dhcp-hostname property is %NULL and this property is
* %TRUE, the current persistent hostname of the computer is sent.
*
* The default value is %NM_TERNARY_DEFAULT. In this case the global value
* from NetworkManager configuration is looked up. If it's not set, the value
* from #NMSettingIPConfig:dhcp-send-hostname, which defaults to %TRUE, is
* used for backwards compatibility. In the future this will change and, in
* absence of a global default, it will always fallback to %TRUE.
*
* Since: 1.52
**/
/* ---nmcli---
* property: dhcp-send-hostname-v2
* rename: dhcp-send-hostname
* description: If %TRUE, a hostname is sent to the DHCP server when acquiring a lease.
* Some DHCP servers use this hostname to update DNS databases, essentially
* providing a static hostname for the computer. If the dhcp-hostname
* property is %NULL and this property is %TRUE, the current persistent
* hostname of the computer is sent.
*
* The default value is %NM_TERNARY_DEFAULT. In this case the global value
* from NetworkManager configuration is looked up. If it's not set, the value
* from dhcp-send-hostname-deprecated, which defaults to %TRUE, is
* used for backwards compatibility. In the future this will change and, in
* absence of a global default, it will always fallback to %TRUE.
* ---end---
*/
obj_properties[PROP_DHCP_SEND_HOSTNAME_V2] =
g_param_spec_int(NM_SETTING_IP_CONFIG_DHCP_SEND_HOSTNAME_V2,
"",
"",
G_MININT,
G_MAXINT,
NM_TERNARY_DEFAULT,
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties);
}

View file

@ -191,6 +191,7 @@ typedef struct {
int replace_local_rule;
int dhcp_send_release;
int routed_dns;
int dhcp_send_hostname_v2;
gint32 required_timeout;
gint32 dad_timeout;
gint32 dhcp_timeout;

View file

@ -4075,6 +4075,7 @@ test_connection_diff_a_only(void)
{NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID, NM_SETTING_DIFF_RESULT_IN_A},
{NM_SETTING_IP_CONFIG_DHCP_TIMEOUT, NM_SETTING_DIFF_RESULT_IN_A},
{NM_SETTING_IP_CONFIG_DHCP_SEND_HOSTNAME, NM_SETTING_DIFF_RESULT_IN_A},
{NM_SETTING_IP_CONFIG_DHCP_SEND_HOSTNAME_V2, NM_SETTING_DIFF_RESULT_IN_A},
{NM_SETTING_IP_CONFIG_DHCP_HOSTNAME, NM_SETTING_DIFF_RESULT_IN_A},
{NM_SETTING_IP_CONFIG_DHCP_HOSTNAME_FLAGS, NM_SETTING_DIFF_RESULT_IN_A},
{NM_SETTING_IP4_CONFIG_DHCP_FQDN, NM_SETTING_DIFF_RESULT_IN_A},

View file

@ -334,33 +334,34 @@ char *nm_ip_routing_rule_to_string(const NMIPRoutingRule *self,
#define NM_SETTING_IP_CONFIG_DAD_TIMEOUT_MAX 30000
#define NM_SETTING_IP_CONFIG_METHOD "method"
#define NM_SETTING_IP_CONFIG_DNS "dns"
#define NM_SETTING_IP_CONFIG_DNS_SEARCH "dns-search"
#define NM_SETTING_IP_CONFIG_DNS_OPTIONS "dns-options"
#define NM_SETTING_IP_CONFIG_DNS_PRIORITY "dns-priority"
#define NM_SETTING_IP_CONFIG_ADDRESSES "addresses"
#define NM_SETTING_IP_CONFIG_GATEWAY "gateway"
#define NM_SETTING_IP_CONFIG_ROUTES "routes"
#define NM_SETTING_IP_CONFIG_ROUTE_METRIC "route-metric"
#define NM_SETTING_IP_CONFIG_ROUTE_TABLE "route-table"
#define NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES "ignore-auto-routes"
#define NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS "ignore-auto-dns"
#define NM_SETTING_IP_CONFIG_DHCP_HOSTNAME "dhcp-hostname"
#define NM_SETTING_IP_CONFIG_DHCP_SEND_HOSTNAME "dhcp-send-hostname"
#define NM_SETTING_IP_CONFIG_DHCP_HOSTNAME_FLAGS "dhcp-hostname-flags"
#define NM_SETTING_IP_CONFIG_DHCP_DSCP "dhcp-dscp"
#define NM_SETTING_IP_CONFIG_NEVER_DEFAULT "never-default"
#define NM_SETTING_IP_CONFIG_MAY_FAIL "may-fail"
#define NM_SETTING_IP_CONFIG_DAD_TIMEOUT "dad-timeout"
#define NM_SETTING_IP_CONFIG_DHCP_TIMEOUT "dhcp-timeout"
#define NM_SETTING_IP_CONFIG_REQUIRED_TIMEOUT "required-timeout"
#define NM_SETTING_IP_CONFIG_DHCP_IAID "dhcp-iaid"
#define NM_SETTING_IP_CONFIG_DHCP_REJECT_SERVERS "dhcp-reject-servers"
#define NM_SETTING_IP_CONFIG_AUTO_ROUTE_EXT_GW "auto-route-ext-gw"
#define NM_SETTING_IP_CONFIG_REPLACE_LOCAL_RULE "replace-local-rule"
#define NM_SETTING_IP_CONFIG_DHCP_SEND_RELEASE "dhcp-send-release"
#define NM_SETTING_IP_CONFIG_ROUTED_DNS "routed-dns"
#define NM_SETTING_IP_CONFIG_METHOD "method"
#define NM_SETTING_IP_CONFIG_DNS "dns"
#define NM_SETTING_IP_CONFIG_DNS_SEARCH "dns-search"
#define NM_SETTING_IP_CONFIG_DNS_OPTIONS "dns-options"
#define NM_SETTING_IP_CONFIG_DNS_PRIORITY "dns-priority"
#define NM_SETTING_IP_CONFIG_ADDRESSES "addresses"
#define NM_SETTING_IP_CONFIG_GATEWAY "gateway"
#define NM_SETTING_IP_CONFIG_ROUTES "routes"
#define NM_SETTING_IP_CONFIG_ROUTE_METRIC "route-metric"
#define NM_SETTING_IP_CONFIG_ROUTE_TABLE "route-table"
#define NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES "ignore-auto-routes"
#define NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS "ignore-auto-dns"
#define NM_SETTING_IP_CONFIG_DHCP_HOSTNAME "dhcp-hostname"
#define NM_SETTING_IP_CONFIG_DHCP_SEND_HOSTNAME "dhcp-send-hostname"
#define NM_SETTING_IP_CONFIG_DHCP_SEND_HOSTNAME_V2 "dhcp-send-hostname-v2"
#define NM_SETTING_IP_CONFIG_DHCP_HOSTNAME_FLAGS "dhcp-hostname-flags"
#define NM_SETTING_IP_CONFIG_DHCP_DSCP "dhcp-dscp"
#define NM_SETTING_IP_CONFIG_NEVER_DEFAULT "never-default"
#define NM_SETTING_IP_CONFIG_MAY_FAIL "may-fail"
#define NM_SETTING_IP_CONFIG_DAD_TIMEOUT "dad-timeout"
#define NM_SETTING_IP_CONFIG_DHCP_TIMEOUT "dhcp-timeout"
#define NM_SETTING_IP_CONFIG_REQUIRED_TIMEOUT "required-timeout"
#define NM_SETTING_IP_CONFIG_DHCP_IAID "dhcp-iaid"
#define NM_SETTING_IP_CONFIG_DHCP_REJECT_SERVERS "dhcp-reject-servers"
#define NM_SETTING_IP_CONFIG_AUTO_ROUTE_EXT_GW "auto-route-ext-gw"
#define NM_SETTING_IP_CONFIG_REPLACE_LOCAL_RULE "replace-local-rule"
#define NM_SETTING_IP_CONFIG_DHCP_SEND_RELEASE "dhcp-send-release"
#define NM_SETTING_IP_CONFIG_ROUTED_DNS "routed-dns"
/* these are not real GObject properties. */
#define NM_SETTING_IP_CONFIG_ROUTING_RULES "routing-rules"
@ -497,7 +498,8 @@ gboolean nm_setting_ip_config_get_ignore_auto_routes(NMSettingIPConfig *setting)
gboolean nm_setting_ip_config_get_ignore_auto_dns(NMSettingIPConfig *setting);
const char *nm_setting_ip_config_get_dhcp_hostname(NMSettingIPConfig *setting);
gboolean nm_setting_ip_config_get_dhcp_send_hostname(NMSettingIPConfig *setting);
NM_DEPRECATED_IN_1_52
gboolean nm_setting_ip_config_get_dhcp_send_hostname(NMSettingIPConfig *setting);
NM_AVAILABLE_IN_1_46
const char *nm_setting_ip_config_get_dhcp_dscp(NMSettingIPConfig *setting);
@ -532,6 +534,8 @@ NM_AVAILABLE_IN_1_48
NMTernary nm_setting_ip_config_get_dhcp_send_release(NMSettingIPConfig *setting);
NM_AVAILABLE_IN_1_52
NMSettingIPConfigRoutedDns nm_setting_ip_config_get_routed_dns(NMSettingIPConfig *setting);
NM_AVAILABLE_IN_1_52
NMTernary nm_setting_ip_config_get_dhcp_send_hostname_v2(NMSettingIPConfig *setting);
G_END_DECLS

View file

@ -6372,6 +6372,23 @@ static const NMMetaPropertyInfo *const property_infos_IP4_CONFIG[] = {
PROPERTY_INFO (NM_SETTING_IP_CONFIG_DHCP_SEND_HOSTNAME, DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DHCP_SEND_HOSTNAME,
.property_type = &_pt_gobject_bool,
),
PROPERTY_INFO (NM_SETTING_IP_CONFIG_DHCP_SEND_HOSTNAME_V2, DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DHCP_SEND_HOSTNAME_V2,
.property_type = &_pt_gobject_enum,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
PROPERTY_TYP_DATA_SUBTYPE (gobject_enum,
.value_infos = ENUM_VALUE_INFOS(
{
.value = 0,
.nick = "no",
},
{
.value = 1,
.nick = "yes",
},
),
),
),
),
PROPERTY_INFO (NM_SETTING_IP_CONFIG_DHCP_HOSTNAME, DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME,
.property_type = &_pt_gobject_string,
),
@ -6736,6 +6753,23 @@ static const NMMetaPropertyInfo *const property_infos_IP6_CONFIG[] = {
PROPERTY_INFO (NM_SETTING_IP_CONFIG_DHCP_SEND_HOSTNAME, DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_DHCP_SEND_HOSTNAME,
.property_type = &_pt_gobject_bool,
),
PROPERTY_INFO (NM_SETTING_IP_CONFIG_DHCP_SEND_HOSTNAME_V2, DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_DHCP_SEND_HOSTNAME_V2,
.property_type = &_pt_gobject_enum,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
PROPERTY_TYP_DATA_SUBTYPE (gobject_enum,
.value_infos = ENUM_VALUE_INFOS(
{
.value = 0,
.nick = "no",
},
{
.value = 1,
.nick = "yes",
},
),
),
),
),
PROPERTY_INFO (NM_SETTING_IP_CONFIG_DHCP_HOSTNAME, DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_DHCP_HOSTNAME,
.property_type = &_pt_gobject_string,
),

View file

@ -188,7 +188,8 @@
#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DHCP_IAID N_("A string containing the \"Identity Association Identifier\" (IAID) used by the DHCP client. The string can be a 32-bit number (either decimal, hexadecimal or as colon separated hexadecimal numbers). Alternatively it can be set to the special values \"mac\", \"perm-mac\", \"ifname\" or \"stable\". When set to \"mac\" (or \"perm-mac\"), the last 4 bytes of the current (or permanent) MAC address are used as IAID. When set to \"ifname\", the IAID is computed by hashing the interface name. The special value \"stable\" can be used to generate an IAID based on the stable-id (see connection.stable-id), a per-host key and the interface name. When the property is unset, the value from global configuration is used; if no global default is set then the IAID is assumed to be \"ifname\". For DHCPv4, the IAID is only used with \"ipv4.dhcp-client-id\" values \"duid\" and \"ipv6-duid\" to generate the client-id. For DHCPv6, note that at the moment this property is only supported by the \"internal\" DHCPv6 plugin. The \"dhclient\" DHCPv6 plugin always derives the IAID from the MAC address. The actually used DHCPv6 IAID for a currently activated interface is exposed in the lease information of the device.")
#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DHCP_IPV6_ONLY_PREFERRED N_("Controls the \"IPv6-Only Preferred\" DHCPv4 option (RFC 8925). When set to \"yes\" (1), the host adds the option to the parameter request list; if the DHCP server sends the option back, the host stops the DHCP client for the time interval specified in the option. Enable this feature if the host supports an IPv6-only mode, i.e. either all applications are IPv6-only capable or there is a form of 464XLAT deployed. When set to \"default\" (-1), the actual value is looked up in the global configuration; if not specified, it defaults to \"no\" (0). If the connection has IPv6 method set to \"disabled\", this property does not have effect and the \"IPv6-Only Preferred\" option is always disabled.")
#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DHCP_REJECT_SERVERS N_("Array of servers from which DHCP offers must be rejected. This property is useful to avoid getting a lease from misconfigured or rogue servers. For DHCPv4, each element must be an IPv4 address, optionally followed by a slash and a prefix length (e.g. \"192.168.122.0/24\"). This property is currently not implemented for DHCPv6.")
#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DHCP_SEND_HOSTNAME N_("If TRUE, a hostname is sent to the DHCP server when acquiring a lease. Some DHCP servers use this hostname to update DNS databases, essentially providing a static hostname for the computer. If the \"dhcp-hostname\" property is NULL and this property is TRUE, the current persistent hostname of the computer is sent.")
#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DHCP_SEND_HOSTNAME N_("Since 1.52 this property is deprecated and is only used as fallback value for dhcp-send-hostname if it's set to 'default'. This is only done to avoid breaking existing configurations, the new property should be used from now on.")
#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DHCP_SEND_HOSTNAME_V2 N_("If TRUE, a hostname is sent to the DHCP server when acquiring a lease. Some DHCP servers use this hostname to update DNS databases, essentially providing a static hostname for the computer. If the dhcp-hostname property is NULL and this property is TRUE, the current persistent hostname of the computer is sent. The default value is default (-1). In this case the global value from NetworkManager configuration is looked up. If it's not set, the value from dhcp-send-hostname-deprecated, which defaults to TRUE, is used for backwards compatibility. In the future this will change and, in absence of a global default, it will always fallback to TRUE.")
#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DHCP_SEND_RELEASE N_("Whether the DHCP client will send RELEASE message when bringing the connection down. The default value is \"default\" (-1). When the default value is specified, then the global value from NetworkManager configuration is looked up, if not set, it is considered as FALSE.")
#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DHCP_TIMEOUT N_("A timeout for a DHCP transaction in seconds. If zero (the default), a globally configured default is used. If still unspecified, a device specific timeout is used (usually 45 seconds). Set to 2147483647 (MAXINT32) for infinity.")
#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DHCP_VENDOR_CLASS_IDENTIFIER N_("The Vendor Class Identifier DHCP option (60). Special characters in the data string may be escaped using C-style escapes, nevertheless this property cannot contain nul bytes. If the per-profile value is unspecified (the default), a global connection default gets consulted. If still unspecified, the DHCP option is not sent to the server.")
@ -221,7 +222,8 @@
#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_DHCP_IAID N_("A string containing the \"Identity Association Identifier\" (IAID) used by the DHCP client. The string can be a 32-bit number (either decimal, hexadecimal or as colon separated hexadecimal numbers). Alternatively it can be set to the special values \"mac\", \"perm-mac\", \"ifname\" or \"stable\". When set to \"mac\" (or \"perm-mac\"), the last 4 bytes of the current (or permanent) MAC address are used as IAID. When set to \"ifname\", the IAID is computed by hashing the interface name. The special value \"stable\" can be used to generate an IAID based on the stable-id (see connection.stable-id), a per-host key and the interface name. When the property is unset, the value from global configuration is used; if no global default is set then the IAID is assumed to be \"ifname\". For DHCPv4, the IAID is only used with \"ipv4.dhcp-client-id\" values \"duid\" and \"ipv6-duid\" to generate the client-id. For DHCPv6, note that at the moment this property is only supported by the \"internal\" DHCPv6 plugin. The \"dhclient\" DHCPv6 plugin always derives the IAID from the MAC address. The actually used DHCPv6 IAID for a currently activated interface is exposed in the lease information of the device.")
#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_DHCP_PD_HINT N_("A IPv6 address followed by a slash and a prefix length. If set, the value is sent to the DHCPv6 server as hint indicating the prefix delegation (IA_PD) we want to receive. To only hint a prefix length without prefix, set the address part to the zero address (for example \"::/60\").")
#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_DHCP_REJECT_SERVERS N_("Array of servers from which DHCP offers must be rejected. This property is useful to avoid getting a lease from misconfigured or rogue servers. For DHCPv4, each element must be an IPv4 address, optionally followed by a slash and a prefix length (e.g. \"192.168.122.0/24\"). This property is currently not implemented for DHCPv6.")
#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_DHCP_SEND_HOSTNAME N_("If TRUE, a hostname is sent to the DHCP server when acquiring a lease. Some DHCP servers use this hostname to update DNS databases, essentially providing a static hostname for the computer. If the \"dhcp-hostname\" property is NULL and this property is TRUE, the current persistent hostname of the computer is sent.")
#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_DHCP_SEND_HOSTNAME N_("Since 1.52 this property is deprecated and is only used as fallback value for dhcp-send-hostname if it's set to 'default'. This is only done to avoid breaking existing configurations, the new property should be used from now on.")
#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_DHCP_SEND_HOSTNAME_V2 N_("If TRUE, a hostname is sent to the DHCP server when acquiring a lease. Some DHCP servers use this hostname to update DNS databases, essentially providing a static hostname for the computer. If the dhcp-hostname property is NULL and this property is TRUE, the current persistent hostname of the computer is sent. The default value is default (-1). In this case the global value from NetworkManager configuration is looked up. If it's not set, the value from dhcp-send-hostname-deprecated, which defaults to TRUE, is used for backwards compatibility. In the future this will change and, in absence of a global default, it will always fallback to TRUE.")
#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_DHCP_SEND_RELEASE N_("Whether the DHCP client will send RELEASE message when bringing the connection down. The default value is \"default\" (-1). When the default value is specified, then the global value from NetworkManager configuration is looked up, if not set, it is considered as FALSE.")
#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_DHCP_TIMEOUT N_("A timeout for a DHCP transaction in seconds. If zero (the default), a globally configured default is used. If still unspecified, a device specific timeout is used (usually 45 seconds). Set to 2147483647 (MAXINT32) for infinity.")
#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_DNS N_("Array of IP addresses of DNS servers. For DoT (DNS over TLS), the SNI server name can be specified by appending \"#example.com\" to the IP address of the DNS server. This currently only has effect when using systemd-resolved.")

View file

@ -1883,8 +1883,23 @@ split_required_fields_for_con_show(const char *input,
for (i = 0; i < _NM_META_SETTING_TYPE_NUM; i++) {
if (is_all || is_common
|| !g_ascii_strcasecmp(s_mutable, nm_meta_setting_infos[i].setting_name)) {
if (dot)
gs_free char *to_free = NULL;
if (dot) {
/* If there was a dot we have 'setting.property'. Some properties has different
* name for the user than internally in libnm and D-Bus. Make the conversion
* from user names to libnm names.
*/
const char *prop_user = dot + 1;
const char *prop_libnm =
nmc_setting_propname_user_to_libnm(s_mutable, prop_user);
if (prop_user != prop_libnm) {
to_free = g_strdup_printf("%s.%s", s_mutable, prop_libnm);
s_mutable = to_free;
}
*dot = '.';
}
g_string_append(str1, s_mutable);
g_string_append_c(str1, ',');
found = TRUE;
@ -4392,7 +4407,7 @@ set_property(NMClient *client,
}
/* Don't ask for this property in interactive mode. */
disable_options(setting_name, property_name);
disable_options(setting_name, nmc_setting_propname_user_to_libnm(setting_name, property_name));
return TRUE;
}

View file

@ -1380,9 +1380,13 @@
values="0 - 2147483647"
special-values="default (0), infinity (2147483647)" />
<property name="dhcp-send-hostname"
nmcli-description="If TRUE, a hostname is sent to the DHCP server when acquiring a lease. Some DHCP servers use this hostname to update DNS databases, essentially providing a static hostname for the computer. If the &quot;dhcp-hostname&quot; property is NULL and this property is TRUE, the current persistent hostname of the computer is sent."
nmcli-description="Since 1.52 this property is deprecated and is only used as fallback value for dhcp-send-hostname if it&apos;s set to &apos;default&apos;. This is only done to avoid breaking existing configurations, the new property should be used from now on."
format="boolean"
values="true/yes/on, false/no/off" />
<property name="dhcp-send-hostname-v2"
nmcli-description="If TRUE, a hostname is sent to the DHCP server when acquiring a lease. Some DHCP servers use this hostname to update DNS databases, essentially providing a static hostname for the computer. If the dhcp-hostname property is NULL and this property is TRUE, the current persistent hostname of the computer is sent. The default value is default (-1). In this case the global value from NetworkManager configuration is looked up. If it&apos;s not set, the value from dhcp-send-hostname-deprecated, which defaults to TRUE, is used for backwards compatibility. In the future this will change and, in absence of a global default, it will always fallback to TRUE."
format="choice (NMTernary)"
values="default (-1), false/no (0), true/yes (1)" />
<property name="dhcp-hostname"
nmcli-description="If the &quot;dhcp-send-hostname&quot; property is TRUE, then the specified name will be sent to the DHCP server when acquiring a lease. This property and &quot;dhcp-fqdn&quot; are mutually exclusive and cannot be set at the same time."
format="string" />
@ -1545,9 +1549,13 @@
values="0 - 2147483647"
special-values="default (0), infinity (2147483647)" />
<property name="dhcp-send-hostname"
nmcli-description="If TRUE, a hostname is sent to the DHCP server when acquiring a lease. Some DHCP servers use this hostname to update DNS databases, essentially providing a static hostname for the computer. If the &quot;dhcp-hostname&quot; property is NULL and this property is TRUE, the current persistent hostname of the computer is sent."
nmcli-description="Since 1.52 this property is deprecated and is only used as fallback value for dhcp-send-hostname if it&apos;s set to &apos;default&apos;. This is only done to avoid breaking existing configurations, the new property should be used from now on."
format="boolean"
values="true/yes/on, false/no/off" />
<property name="dhcp-send-hostname-v2"
nmcli-description="If TRUE, a hostname is sent to the DHCP server when acquiring a lease. Some DHCP servers use this hostname to update DNS databases, essentially providing a static hostname for the computer. If the dhcp-hostname property is NULL and this property is TRUE, the current persistent hostname of the computer is sent. The default value is default (-1). In this case the global value from NetworkManager configuration is looked up. If it&apos;s not set, the value from dhcp-send-hostname-deprecated, which defaults to TRUE, is used for backwards compatibility. In the future this will change and, in absence of a global default, it will always fallback to TRUE."
format="choice (NMTernary)"
values="default (-1), false/no (0), true/yes (1)" />
<property name="dhcp-hostname"
nmcli-description="If the &quot;dhcp-send-hostname&quot; property is TRUE, then the specified name will be sent to the DHCP server when acquiring a lease. This property and &quot;dhcp-fqdn&quot; are mutually exclusive and cannot be set at the same time."
format="string" />

View file

@ -525,6 +525,8 @@ get_property_val(NMSetting *setting,
NM_IN_SET(get_type, NM_META_ACCESSOR_GET_TYPE_PARSABLE, NM_META_ACCESSOR_GET_TYPE_PRETTY),
NULL);
prop = nmc_setting_propname_user_to_libnm(nm_setting_get_name(setting), prop);
if ((property_info = nm_meta_property_info_find_by_setting(setting, prop))) {
if (property_info->property_type->get_fcn) {
NMMetaAccessorGetOutFlags out_flags = NM_META_ACCESSOR_GET_OUT_FLAGS_NONE;
@ -593,8 +595,11 @@ nmc_setting_set_property(NMClient *client,
NM_META_ACCESSOR_MODIFIER_ADD),
FALSE);
prop = nmc_setting_propname_user_to_libnm(nm_setting_get_name(setting), prop);
if (!(property_info = nm_meta_property_info_find_by_setting(setting, prop)))
goto out_fail_read_only;
if (!property_info->property_type->set_fcn)
goto out_fail_read_only;
@ -661,8 +666,12 @@ nmc_setting_get_valid_properties(NMSetting *setting)
num = setting_info ? setting_info->properties_num : 0;
valid_props = g_new(char *, num + 1);
for (i = 0; i < num; i++)
valid_props[i] = g_strdup(setting_info->properties[i]->property_name);
for (i = 0; i < num; i++) {
const char *prop =
nmc_setting_propname_libnm_to_user(setting_info->general->setting_name,
setting_info->properties[i]->property_name);
valid_props[i] = g_strdup(prop);
}
valid_props[num] = NULL;
return valid_props;
@ -678,6 +687,8 @@ nmc_setting_get_property_allowed_values(NMSetting *setting, const char *prop, ch
*out_to_free = NULL;
prop = nmc_setting_propname_user_to_libnm(nm_setting_get_name(setting), prop);
if ((property_info = nm_meta_property_info_find_by_setting(setting, prop))) {
if (property_info->property_type->values_fcn) {
return property_info->property_type->values_fcn(property_info, out_to_free);
@ -711,6 +722,8 @@ nmc_setting_get_property_desc(NMSetting *setting, const char *prop)
g_return_val_if_fail(NM_IS_SETTING(setting), FALSE);
prop = nmc_setting_propname_user_to_libnm(nm_setting_get_name(setting), prop);
property_info = nm_meta_property_info_find_by_setting(setting, prop);
if (!property_info)
return NULL;
@ -774,3 +787,33 @@ setting_details(const NmcConfig *nmc_config, NMSetting *setting, const char *one
return TRUE;
}
const char *
nmc_setting_propname_user_to_libnm(const char *setting_name, const char *prop)
{
if (NM_IN_STRSET(setting_name,
NM_SETTING_IP4_CONFIG_SETTING_NAME,
NM_SETTING_IP6_CONFIG_SETTING_NAME)) {
if (nm_streq0(prop, "dhcp-send-hostname"))
return NM_SETTING_IP_CONFIG_DHCP_SEND_HOSTNAME_V2;
else if (nm_streq0(prop, "dhcp-send-hostname-deprecated"))
return NM_SETTING_IP_CONFIG_DHCP_SEND_HOSTNAME;
}
return prop;
}
const char *
nmc_setting_propname_libnm_to_user(const char *setting_name, const char *prop)
{
if (NM_IN_STRSET(setting_name,
NM_SETTING_IP4_CONFIG_SETTING_NAME,
NM_SETTING_IP6_CONFIG_SETTING_NAME)) {
if (nm_streq0(prop, NM_SETTING_IP_CONFIG_DHCP_SEND_HOSTNAME_V2))
return "dhcp-send-hostname";
else if (nm_streq0(prop, NM_SETTING_IP_CONFIG_DHCP_SEND_HOSTNAME))
return "dhcp-send-hostname-deprecated";
}
return prop;
}

View file

@ -34,4 +34,7 @@ gboolean nmc_setting_set_property(NMClient *client,
gboolean setting_details(const NmcConfig *nmc_config, NMSetting *setting, const char *one_prop);
const char *nmc_setting_propname_user_to_libnm(const char *setting_name, const char *prop);
const char *nmc_setting_propname_libnm_to_user(const char *setting_name, const char *prop);
#endif /* NMC_SETTINGS_H */

View file

@ -1016,6 +1016,8 @@ _print_fill(const NmcConfig *nmc_config,
PrintDataHeaderCell *header_cell;
guint col_idx;
const NMMetaAbstractInfo *info;
const char *setting_name;
gboolean is_prop;
col = &cols[i_col];
if (!col->is_leaf)
@ -1036,14 +1038,23 @@ _print_fill(const NmcConfig *nmc_config,
header_cell->to_print = FALSE;
header_cell->title = nm_meta_abstract_info_get_name(info, TRUE);
if (nmc_config->multiline_output && col->parent_col
&& NM_IN_SET(info->meta_type,
&nm_meta_type_property_info,
&nmc_meta_type_generic_info)) {
header_cell->title = g_strdup_printf(
"%s.%s",
nm_meta_abstract_info_get_name(col->parent_col->selection_item->info, FALSE),
header_cell->title);
is_prop =
col->parent_col
&& NM_IN_SET(info->meta_type, &nm_meta_type_property_info, &nmc_meta_type_generic_info);
if (is_prop) {
/* Some properties has different name for the user than internally in
* libnm and D-Bus. Make the conversion from libnm names to user names.
*/
setting_name =
nm_meta_abstract_info_get_name(col->parent_col->selection_item->info, FALSE);
header_cell->title =
nmc_setting_propname_libnm_to_user(setting_name, header_cell->title);
}
if (nmc_config->multiline_output && is_prop) {
header_cell->title = g_strdup_printf("%s.%s", setting_name, header_cell->title);
header_cell->title_to_free = TRUE;
}
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -164,6 +164,7 @@ KEYWORD_XML_TYPE_ATTR = "attr"
keywords = collections.OrderedDict(
[
("property", KEYWORD_XML_TYPE_ATTR),
("rename", KEYWORD_XML_TYPE_ATTR),
("variable", KEYWORD_XML_TYPE_ATTR),
("format", KEYWORD_XML_TYPE_ATTR),
("values", KEYWORD_XML_TYPE_ATTR),

View file

@ -300,6 +300,7 @@ for setting_name in iter_keys_of_dicts(settings_roots, key_fcn_setting_name):
node_set_attr(property_node, "special-values", properties_attrs)
node_set_attr(property_node, "default", properties_attrs)
node_set_attr(property_node, "alias", properties_attrs)
node_set_attr(property_node, "rename", properties_attrs)
if description_docbook is not None:
property_node.insert(0, description_docbook)