device: Support configuring dhcp-send-hostname globally

The user does not want to send machine hostname to the DHCP server
globally by default to avoid ddns record getting created in IPAM.
otherwise, IPAM creates ddns records which might interfere with user's
regular host record. Thus, introduce the ternary property
dhcp_send_hostname_v2 to warrant this behavior.

Notice that we set the GSpec of dhcp-send-hostname-v2 to int, because
defining it as enum would make that it cannot be expanded in a backwards
compatible way if we need to add more values: old clients using libnm
would reject it due to the new value being unknown. Follow the same
strategy than _nm_setting_property_define_direct_enum, defining the
NMSettInfoPropertType as enum, but the glib's GSpec as int.

Resolves: https://issues.redhat.com/browse/RHEL-56565
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2029
https://gitlab.freedesktop.org/NetworkManager/NetworkManager-ci/-/merge_requests/1765
This commit is contained in:
Wen Liang 2024-09-18 11:56:03 -04:00 committed by Wen Liang
parent 2bbedbcf7d
commit 51ea910cc2
14 changed files with 1176 additions and 708 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

@ -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

@ -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,11 +6730,12 @@ 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.
**/
obj_properties[PROP_DHCP_SEND_HOSTNAME] =
g_param_spec_boolean(NM_SETTING_IP_CONFIG_DHCP_SEND_HOSTNAME,
@ -6991,5 +7036,31 @@ 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
**/
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-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.")
#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\", 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-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.")
#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\", 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

@ -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 &quot;dhcp-send-hostname-v2&quot; 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 &quot;dhcp-hostname&quot; property is NULL and this property is TRUE, the current persistent hostname of the computer is sent. The default value is &quot;default&quot; (-1). In this case the global value from NetworkManager configuration is looked up. If it&apos;s not set, the value from &quot;dhcp-send-hostname&quot;, 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 &quot;dhcp-send-hostname-v2&quot; 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 &quot;dhcp-hostname&quot; property is NULL and this property is TRUE, the current persistent hostname of the computer is sent. The default value is &quot;default&quot; (-1). In this case the global value from NetworkManager configuration is looked up. If it&apos;s not set, the value from &quot;dhcp-send-hostname&quot;, 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" />

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff