diff --git a/configure.ac b/configure.ac
index 30364a4c0d..d589227430 100644
--- a/configure.ac
+++ b/configure.ac
@@ -808,6 +808,16 @@ else
AC_DEFINE(WITH_DHCPCD, 0, [Define if you have dhcpcd])
fi
+AC_ARG_WITH(config-dhcp-default, AS_HELP_STRING([--with-config-dhcp-default=dhclient|dhcpcd|internal], [Default configuration option for main.dhcp setting, used as fallback if the configuration option is unset]), [config_dhcp_default="$withval"], [config_dhcp_default=""])
+if test "$config_dhcp_default" = yes -o "$config_dhcp_default" = no; then
+ config_dhcp_default=''
+fi
+test -z "$config_dhcp_default" -a "$with_dhclient" != "no" && config_dhcp_default='dhclient'
+test -z "$config_dhcp_default" -a "$with_dhcpcd" != "no" && config_dhcp_default='dhcpcd'
+test -z "$config_dhcp_default" && config_dhcp_default='internal'
+AC_DEFINE_UNQUOTED(NM_CONFIG_DEFAULT_DHCP, "$config_dhcp_default", [Default configuration option for main.dhcp setting])
+AC_SUBST(NM_CONFIG_DEFAULT_DHCP, $config_dhcp_default)
+
# resolvconf and netconfig support
AC_ARG_WITH(resolvconf, AS_HELP_STRING([--with-resolvconf=yes|no|path], [Enable resolvconf support]))
AC_ARG_WITH(netconfig, AS_HELP_STRING([--with-netconfig=yes|no], [Enable SUSE netconfig support]))
@@ -1213,7 +1223,7 @@ echo " netconfig: ${with_netconfig}"
echo " config-dns-rc-manager-default: ${config_dns_rc_manager_default}"
echo
-echo "DHCP clients:"
+echo "DHCP clients (default $config_dhcp_default):"
echo " dhclient: $with_dhclient"
echo " dhcpcd: $with_dhcpcd"
echo " dhcpcd-supports-ipv6: $with_dhcpcd_supports_ipv6"
diff --git a/man/NetworkManager.conf.xml b/man/NetworkManager.conf.xml
index e662d43a82..c2bd02c4a4 100644
--- a/man/NetworkManager.conf.xml
+++ b/man/NetworkManager.conf.xml
@@ -189,9 +189,9 @@ plugins-=remove-me
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, available DHCP clients are
- looked for in this order: dhclient,
- dhcpcd,
+ If this key is missing, it defaults to &NM_CONFIG_DEFAULT_DHCP;.
+ It the chosen plugin is not available, clients are looked for
+ in this order: dhclient, dhcpcd,
internal.
diff --git a/man/common.ent.in b/man/common.ent.in
index ec91e8a6a2..bb9adad248 100644
--- a/man/common.ent.in
+++ b/man/common.ent.in
@@ -5,3 +5,4 @@
+
diff --git a/src/dhcp-manager/nm-dhcp-manager.c b/src/dhcp-manager/nm-dhcp-manager.c
index cc0289c9ab..dee4039a5c 100644
--- a/src/dhcp-manager/nm-dhcp-manager.c
+++ b/src/dhcp-manager/nm-dhcp-manager.c
@@ -349,13 +349,23 @@ nm_dhcp_manager_init (NMDhcpManager *self)
if (nm_config_get_configure_and_quit (config)) {
client_factory = &_nm_dhcp_client_factory_internal;
if (client && !nm_streq (client, client_factory->name))
- nm_log_warn (LOGD_DHCP, "dhcp-init: Using internal DHCP client since configure-and-quit is set.");
+ nm_log_info (LOGD_DHCP, "dhcp-init: Using internal DHCP client since configure-and-quit is set.");
} else {
if (client) {
client_factory = _client_factory_available (_client_factory_find_by_name (client));
if (!client_factory)
nm_log_warn (LOGD_DHCP, "dhcp-init: DHCP client '%s' not available", client);
}
+ if (!client_factory) {
+ client_factory = _client_factory_find_by_name (""NM_CONFIG_DEFAULT_DHCP);
+ if (!client_factory)
+ nm_log_err (LOGD_DHCP, "dhcp-init: default DHCP client '%s' is not installed", NM_CONFIG_DEFAULT_DHCP);
+ else {
+ client_factory = _client_factory_available (client_factory);
+ if (!client_factory)
+ nm_log_info (LOGD_DHCP, "dhcp-init: default DHCP client '%s' is not available", NM_CONFIG_DEFAULT_DHCP);
+ }
+ }
if (!client_factory) {
for (i = 0; i < G_N_ELEMENTS (_nm_dhcp_manager_factories); i++) {
client_factory = _client_factory_available (_nm_dhcp_manager_factories[i]);