diff --git a/Makefile.am b/Makefile.am index 27e5db21fc..8113000040 100644 --- a/Makefile.am +++ b/Makefile.am @@ -157,6 +157,7 @@ DISTCHECK_CONFIGURE_FLAGS = \ --with-udev-dir=$$dc_install_base/lib/udev \ --with-wext=no \ --enable-ifcfg-rh \ + --with-dhclient=yes \ --enable-ifupdown \ --disable-dependency-tracking \ --disable-autotools-deprecation \ diff --git a/NEWS b/NEWS index 102f521a5e..48b2a387c1 100644 --- a/NEWS +++ b/NEWS @@ -8,6 +8,10 @@ subject to change and not guaranteed to be compatible with the later release. 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. * Add a timeout option to connectivity checking. * Support configuring veth interfaces in nmtui. diff --git a/configure.ac b/configure.ac index 796c2d7735..7398410242 100644 --- a/configure.ac +++ b/configure.ac @@ -915,18 +915,18 @@ fi # DHCP client support AC_ARG_WITH([dhclient], - AS_HELP_STRING([--with-dhclient=yes|no|path], [Enable dhclient support])) -if test "$with_dhclient" != "no"; then - with_dhclient_="$with_dhclient" + AS_HELP_STRING([--with-dhclient=yes|no|path], [Enable dhclient support (deprecated)]), + with_dhclient="$withval", + with_dhclient="no") +if test "$with_dhclient" = yes; then AC_PATH_PROGS(with_dhclient, dhclient, no, /sbin:/usr/sbin:/usr/local/sbin) if test "$with_dhclient" = "no"; then - if test "$with_dhclient_" = yes; then - AC_MSG_WARN([dhclient not found, assume path /usr/sbin/dhclient]) - with_dhclient=/usr/sbin/dhclient - fi + AC_MSG_WARN([dhclient not found, assume path /usr/sbin/dhclient]) + with_dhclient=/usr/sbin/dhclient fi fi 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_UNQUOTED(DHCLIENT_PATH, "$with_dhclient", [Define path to dhclient]) else @@ -1477,7 +1477,7 @@ echo echo "DHCP clients (default $config_dhcp_default):" echo " dhcpcanon: $with_dhcpcanon" -echo " dhclient: $with_dhclient" +echo " dhclient: $with_dhclient (deprecated)" echo " dhcpcd: $with_dhcpcd" echo diff --git a/contrib/fedora/rpm/NetworkManager.spec b/contrib/fedora/rpm/NetworkManager.spec index efbf53d777..a34ab48aac 100644 --- a/contrib/fedora/rpm/NetworkManager.spec +++ b/contrib/fedora/rpm/NetworkManager.spec @@ -50,8 +50,10 @@ ############################################################################### %if 0%{?fedora} > 40 || 0%{?rhel} >= 10 %bcond_without meson +%bcond_with dhclient %else %bcond_with meson +%bcond_without dhclient %endif %bcond_without adsl %bcond_without bluetooth @@ -593,7 +595,11 @@ Preferably use nmcli instead. %endif -Dnft=%{_sbindir}/nft \ -Diptables=%{_sbindir}/iptables \ +%if %{with dhclient} -Ddhclient=%{_sbindir}/dhclient \ +%else + -Ddhclient=no \ +%endif -Ddhcpcanon=no \ -Ddhcpcd=no \ -Dcrypto=gnutls \ @@ -725,7 +731,11 @@ autoreconf --install --force --enable-static=no \ --with-nft=%{_sbindir}/nft \ --with-iptables=%{_sbindir}/iptables \ +%if %{with dhclient} --with-dhclient=%{_sbindir}/dhclient \ +%else + --with-dhclient=no \ +%endif --with-dhcpcd=no \ --with-dhcpcanon=no \ --with-crypto=gnutls \ diff --git a/contrib/fedora/rpm/build_clean.sh b/contrib/fedora/rpm/build_clean.sh index c1b0f408f6..37436c1b63 100755 --- a/contrib/fedora/rpm/build_clean.sh +++ b/contrib/fedora/rpm/build_clean.sh @@ -226,6 +226,7 @@ if [[ $NO_DIST != 1 ]]; then -Dlibaudit=yes-disabled-by-default \ -Dpolkit=true \ -Dnm_cloud_setup=true \ + -Ddhclient=/usr/sbin/dhclient \ -Dconfig_dhcp_default=internal \ -Dconfig_dns_rc_manager_default=auto \ -Diptables=/usr/sbin/iptables \ @@ -267,6 +268,7 @@ if [[ $NO_DIST != 1 ]]; then --with-libaudit=yes-disabled-by-default \ --enable-polkit=yes \ --with-nm-cloud-setup=yes \ + --with-dhclient=yes \ --with-config-dhcp-default=internal \ --with-config-dns-rc-manager-default=auto \ \ diff --git a/man/NetworkManager.conf.xml b/man/NetworkManager.conf.xml index e368cf8fdb..aec49569b1 100644 --- a/man/NetworkManager.conf.xml +++ b/man/NetworkManager.conf.xml @@ -168,17 +168,16 @@ plugins-=remove-me dhcp This key sets up what DHCP client - NetworkManager will use. Allowed values are - dhclient, dhcpcd, and - internal. The dhclient - and dhcpcd options require the indicated - clients to be installed. The internal - option uses a built-in DHCP client which is not currently as - featureful as the external clients. - If this key is missing, it defaults to &NM_CONFIG_DEFAULT_MAIN_DHCP;. - If the chosen plugin is not available, clients are looked for - in this order: dhclient, dhcpcd, - internal. + NetworkManager will use. Allowed values depend on build configuration and + typically include internal and dhcpcd. + Support for unmaintained dhclient client has been deprecated + and disabled by default. + The internal client is built-in, while other options + may require an external DHCP client to be installed. + If this key is missing, &NM_CONFIG_DEFAULT_MAIN_DHCP; + is used with a fallback to other suppored clients in this order: + internal, dhcpcd, + dhclient. no-auto-default diff --git a/meson.build b/meson.build index 3a35164461..4ec49fcd31 100644 --- a/meson.build +++ b/meson.build @@ -657,6 +657,9 @@ foreach client : [ 'dhclient', 'dhcpcd', 'dhcpcanon' ] if (client_enable) dhcp_summary += (' ' + client_path) endif + if (client == 'dhclient') + dhcp_summary += ' (deprecated)' + endif dhcp_summary += '\n' endforeach diff --git a/meson_options.txt b/meson_options.txt index 75cf183d71..93eeac86bb 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -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') # 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('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') diff --git a/src/core/dhcp/nm-dhcp-listener.c b/src/core/dhcp/nm-dhcp-listener.c index 0854c1dcbe..1ae4ad02c6 100644 --- a/src/core/dhcp/nm-dhcp-listener.c +++ b/src/core/dhcp/nm-dhcp-listener.c @@ -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 first available plugin. */ + &_nm_dhcp_client_factory_internal, #if WITH_DHCPCANON &_nm_dhcp_client_factory_dhcpcanon, #endif -#if WITH_DHCLIENT - &_nm_dhcp_client_factory_dhclient, -#endif #if WITH_DHCPCD &_nm_dhcp_client_factory_dhcpcd, #endif - &_nm_dhcp_client_factory_internal, &_nm_dhcp_client_factory_systemd, &_nm_dhcp_client_factory_nettools, +#if WITH_DHCLIENT + &_nm_dhcp_client_factory_dhclient, +#endif }; /*****************************************************************************/ diff --git a/src/core/dhcp/nm-dhcp-manager.c b/src/core/dhcp/nm-dhcp-manager.c index cfff23f8d3..68bb327b52 100644 --- a/src/core/dhcp/nm-dhcp-manager.c +++ b/src/core/dhcp/nm-dhcp-manager.c @@ -90,8 +90,15 @@ _client_factory_find_by_name(const char *name) static const NMDhcpClientFactory * _client_factory_available(const NMDhcpClientFactory *client_factory) { - if (client_factory && (!client_factory->get_path || client_factory->get_path())) - return client_factory; + 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 NULL; }