merge: branch 'lr/deprecate-dhclient'

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1988
This commit is contained in:
Lubomir Rintel
2024-07-11 15:46:23 +02:00
10 changed files with 52 additions and 26 deletions

View File

@@ -157,6 +157,7 @@ DISTCHECK_CONFIGURE_FLAGS = \
--with-udev-dir=$$dc_install_base/lib/udev \ --with-udev-dir=$$dc_install_base/lib/udev \
--with-wext=no \ --with-wext=no \
--enable-ifcfg-rh \ --enable-ifcfg-rh \
--with-dhclient=yes \
--enable-ifupdown \ --enable-ifupdown \
--disable-dependency-tracking \ --disable-dependency-tracking \
--disable-autotools-deprecation \ --disable-autotools-deprecation \

4
NEWS
View File

@@ -8,6 +8,10 @@ subject to change and not guaranteed to be compatible with
the later release. the later release.
USE AT YOUR OWN RISK. NOT RECOMMENDED FOR PRODUCTION USE! USE AT YOUR OWN RISK. NOT RECOMMENDED FOR PRODUCTION USE!
* The support for "dhclient" has been deprecated, not built unless
explicitely enabled, and will be removed in a future release.
The internal DHCP client should be used instead and has been
the default since version 1.20 (1.12 when built with meson).
* Support matching a OVS system interface by MAC address. * Support matching a OVS system interface by MAC address.
* Add a timeout option to connectivity checking. * Add a timeout option to connectivity checking.
* Support configuring veth interfaces in nmtui. * Support configuring veth interfaces in nmtui.

View File

@@ -915,18 +915,18 @@ fi
# DHCP client support # DHCP client support
AC_ARG_WITH([dhclient], AC_ARG_WITH([dhclient],
AS_HELP_STRING([--with-dhclient=yes|no|path], [Enable dhclient support])) AS_HELP_STRING([--with-dhclient=yes|no|path], [Enable dhclient support (deprecated)]),
if test "$with_dhclient" != "no"; then with_dhclient="$withval",
with_dhclient_="$with_dhclient" with_dhclient="no")
if test "$with_dhclient" = yes; then
AC_PATH_PROGS(with_dhclient, dhclient, no, /sbin:/usr/sbin:/usr/local/sbin) AC_PATH_PROGS(with_dhclient, dhclient, no, /sbin:/usr/sbin:/usr/local/sbin)
if test "$with_dhclient" = "no"; then if test "$with_dhclient" = "no"; then
if test "$with_dhclient_" = yes; then
AC_MSG_WARN([dhclient not found, assume path /usr/sbin/dhclient]) AC_MSG_WARN([dhclient not found, assume path /usr/sbin/dhclient])
with_dhclient=/usr/sbin/dhclient with_dhclient=/usr/sbin/dhclient
fi fi
fi fi
fi
if test "$with_dhclient" != "no"; then if test "$with_dhclient" != "no"; then
AC_MSG_WARN([dhclient is unmaintained and support for it is deprecated])
AC_DEFINE(WITH_DHCLIENT, 1, [Define if you have dhclient]) AC_DEFINE(WITH_DHCLIENT, 1, [Define if you have dhclient])
AC_DEFINE_UNQUOTED(DHCLIENT_PATH, "$with_dhclient", [Define path to dhclient]) AC_DEFINE_UNQUOTED(DHCLIENT_PATH, "$with_dhclient", [Define path to dhclient])
else else
@@ -1477,7 +1477,7 @@ echo
echo "DHCP clients (default $config_dhcp_default):" echo "DHCP clients (default $config_dhcp_default):"
echo " dhcpcanon: $with_dhcpcanon" echo " dhcpcanon: $with_dhcpcanon"
echo " dhclient: $with_dhclient" echo " dhclient: $with_dhclient (deprecated)"
echo " dhcpcd: $with_dhcpcd" echo " dhcpcd: $with_dhcpcd"
echo echo

View File

@@ -50,8 +50,10 @@
############################################################################### ###############################################################################
%if 0%{?fedora} > 40 || 0%{?rhel} >= 10 %if 0%{?fedora} > 40 || 0%{?rhel} >= 10
%bcond_without meson %bcond_without meson
%bcond_with dhclient
%else %else
%bcond_with meson %bcond_with meson
%bcond_without dhclient
%endif %endif
%bcond_without adsl %bcond_without adsl
%bcond_without bluetooth %bcond_without bluetooth
@@ -593,7 +595,11 @@ Preferably use nmcli instead.
%endif %endif
-Dnft=%{_sbindir}/nft \ -Dnft=%{_sbindir}/nft \
-Diptables=%{_sbindir}/iptables \ -Diptables=%{_sbindir}/iptables \
%if %{with dhclient}
-Ddhclient=%{_sbindir}/dhclient \ -Ddhclient=%{_sbindir}/dhclient \
%else
-Ddhclient=no \
%endif
-Ddhcpcanon=no \ -Ddhcpcanon=no \
-Ddhcpcd=no \ -Ddhcpcd=no \
-Dcrypto=gnutls \ -Dcrypto=gnutls \
@@ -725,7 +731,11 @@ autoreconf --install --force
--enable-static=no \ --enable-static=no \
--with-nft=%{_sbindir}/nft \ --with-nft=%{_sbindir}/nft \
--with-iptables=%{_sbindir}/iptables \ --with-iptables=%{_sbindir}/iptables \
%if %{with dhclient}
--with-dhclient=%{_sbindir}/dhclient \ --with-dhclient=%{_sbindir}/dhclient \
%else
--with-dhclient=no \
%endif
--with-dhcpcd=no \ --with-dhcpcd=no \
--with-dhcpcanon=no \ --with-dhcpcanon=no \
--with-crypto=gnutls \ --with-crypto=gnutls \

View File

@@ -226,6 +226,7 @@ if [[ $NO_DIST != 1 ]]; then
-Dlibaudit=yes-disabled-by-default \ -Dlibaudit=yes-disabled-by-default \
-Dpolkit=true \ -Dpolkit=true \
-Dnm_cloud_setup=true \ -Dnm_cloud_setup=true \
-Ddhclient=/usr/sbin/dhclient \
-Dconfig_dhcp_default=internal \ -Dconfig_dhcp_default=internal \
-Dconfig_dns_rc_manager_default=auto \ -Dconfig_dns_rc_manager_default=auto \
-Diptables=/usr/sbin/iptables \ -Diptables=/usr/sbin/iptables \
@@ -267,6 +268,7 @@ if [[ $NO_DIST != 1 ]]; then
--with-libaudit=yes-disabled-by-default \ --with-libaudit=yes-disabled-by-default \
--enable-polkit=yes \ --enable-polkit=yes \
--with-nm-cloud-setup=yes \ --with-nm-cloud-setup=yes \
--with-dhclient=yes \
--with-config-dhcp-default=internal \ --with-config-dhcp-default=internal \
--with-config-dns-rc-manager-default=auto \ --with-config-dns-rc-manager-default=auto \
\ \

View File

@@ -168,17 +168,16 @@ plugins-=remove-me
<varlistentry> <varlistentry>
<term><varname>dhcp</varname></term> <term><varname>dhcp</varname></term>
<listitem><para>This key sets up what DHCP client <listitem><para>This key sets up what DHCP client
NetworkManager will use. Allowed values are NetworkManager will use. Allowed values depend on build configuration and
<literal>dhclient</literal>, <literal>dhcpcd</literal>, and typically include <literal>internal</literal> and <literal>dhcpcd</literal>.
<literal>internal</literal>. The <literal>dhclient</literal> Support for unmaintained <literal>dhclient</literal> client has been deprecated
and <literal>dhcpcd</literal> options require the indicated and disabled by default.</para>
clients to be installed. The <literal>internal</literal> <para>The <literal>internal</literal> client is built-in, while other options
option uses a built-in DHCP client which is not currently as may require an external DHCP client to be installed.</para>
featureful as the external clients.</para> <para>If this key is missing, <literal>&NM_CONFIG_DEFAULT_MAIN_DHCP;</literal>
<para>If this key is missing, it defaults to <literal>&NM_CONFIG_DEFAULT_MAIN_DHCP;</literal>. is used with a fallback to other suppored clients in this order:
If the chosen plugin is not available, clients are looked for <literal>internal</literal>, <literal>dhcpcd</literal>,
in this order: <literal>dhclient</literal>, <literal>dhcpcd</literal>, <literal>dhclient</literal>.</para></listitem>
<literal>internal</literal>.</para></listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><varname>no-auto-default</varname></term> <term><varname>no-auto-default</varname></term>

View File

@@ -657,6 +657,9 @@ foreach client : [ 'dhclient', 'dhcpcd', 'dhcpcanon' ]
if (client_enable) if (client_enable)
dhcp_summary += (' ' + client_path) dhcp_summary += (' ' + client_path)
endif endif
if (client == 'dhclient')
dhcp_summary += ' (deprecated)'
endif
dhcp_summary += '\n' dhcp_summary += '\n'
endforeach endforeach

View File

@@ -57,7 +57,7 @@ option('netconfig', type: 'string', value: '', description: 'Enable SUSE netconf
option('config_dns_rc_manager_default', type: 'combo', choices: ['auto', 'symlink', 'file', 'netconfig', 'resolvconf'], value: 'auto', description: 'Configure default value for main.rc-manager setting') option('config_dns_rc_manager_default', type: 'combo', choices: ['auto', 'symlink', 'file', 'netconfig', 'resolvconf'], value: 'auto', description: 'Configure default value for main.rc-manager setting')
# dhcp clients # dhcp clients
option('dhclient', type: 'string', value: '', description: 'Enable dhclient support') option('dhclient', type: 'string', value: 'no', description: 'Enable dhclient support (deprecated)')
option('dhcpcanon', type: 'string', value: '', description: 'Enable dhcpcanon support (experimental)') option('dhcpcanon', type: 'string', value: '', description: 'Enable dhcpcanon support (experimental)')
option('dhcpcd', type: 'string', value: '', description: 'Enable dhcpcd support') option('dhcpcd', type: 'string', value: '', description: 'Enable dhcpcd support')
option('config_dhcp_default', type: 'combo', choices: ['dhcpcanon', 'dhclient', 'dhcpcd', 'internal', 'nettools'], value: 'internal', description: 'Default configuration option for main.dhcp setting, used as fallback if the configuration option is unset') option('config_dhcp_default', type: 'combo', choices: ['dhcpcanon', 'dhclient', 'dhcpcd', 'internal', 'nettools'], value: 'internal', description: 'Default configuration option for main.dhcp setting, used as fallback if the configuration option is unset')

View File

@@ -30,18 +30,18 @@ const NMDhcpClientFactory *const _nm_dhcp_manager_factories[6] = {
/* the order here matters, as we will try the plugins in this order to find /* the order here matters, as we will try the plugins in this order to find
* the first available plugin. */ * the first available plugin. */
&_nm_dhcp_client_factory_internal,
#if WITH_DHCPCANON #if WITH_DHCPCANON
&_nm_dhcp_client_factory_dhcpcanon, &_nm_dhcp_client_factory_dhcpcanon,
#endif #endif
#if WITH_DHCLIENT
&_nm_dhcp_client_factory_dhclient,
#endif
#if WITH_DHCPCD #if WITH_DHCPCD
&_nm_dhcp_client_factory_dhcpcd, &_nm_dhcp_client_factory_dhcpcd,
#endif #endif
&_nm_dhcp_client_factory_internal,
&_nm_dhcp_client_factory_systemd, &_nm_dhcp_client_factory_systemd,
&_nm_dhcp_client_factory_nettools, &_nm_dhcp_client_factory_nettools,
#if WITH_DHCLIENT
&_nm_dhcp_client_factory_dhclient,
#endif
}; };
/*****************************************************************************/ /*****************************************************************************/

View File

@@ -90,8 +90,15 @@ _client_factory_find_by_name(const char *name)
static const NMDhcpClientFactory * static const NMDhcpClientFactory *
_client_factory_available(const NMDhcpClientFactory *client_factory) _client_factory_available(const NMDhcpClientFactory *client_factory)
{ {
if (client_factory && (!client_factory->get_path || client_factory->get_path())) if (client_factory) {
if (nm_streq(client_factory->name, "dhclient")) {
_LOGW(AF_UNSPEC,
"attempting to used a deprecated DHCP client '%s' ",
client_factory->name);
}
if (!client_factory->get_path || client_factory->get_path())
return client_factory; return client_factory;
}
return NULL; return NULL;
} }