dhcp: force IPv4-only for dhcpcd

dhcpcd v5.99 and later automatically enabled IPv6 behavior unless
specifically disabled.  This is undesirable for two reason:

1) dhcpcd sends IPv4 Router Solicitations, which NetworkManager
handles itself, so there's no need to do it twice.  NetworkManager
knows better than dhcpcd whether IPv6 is supposed to be used for
that interface or not.

2) Some devices don't react well to IPv6 when they aren't expecting
it.  For example, older Qualcomm Gobi-based devices will listen
for Router Solicitations and attempt to set up IPv6, but if other
settings are not done correctly, or the firmware doesn't actually
support it, the firmware will then crash.  So simply upgrading your
dhcpcd from 5.x to 6.x magically stops WWAN working for these
devices.
This commit is contained in:
Dan Williams 2013-11-27 17:14:32 -06:00
parent f43586fc17
commit b11aec3f15
2 changed files with 11 additions and 0 deletions

View file

@ -541,6 +541,8 @@ if test "$with_dhcpcd" = "yes"; then
if ! $with_dhcpcd --version 2>&1 | grep -q "^dhcpcd [[456789]]\."; then
AC_MSG_WARN([Cannot use dhcpcd, version 4.x or higher is required])
with_dhcpcd=no
elif $with_dhcpcd --version 2>&1 | grep -q "^dhcpcd [[6789]]\."; then
AC_DEFINE(DHCPCD_SUPPORTS_IPV6, 1, [Define if dhcpcd supports IPv6 (6.x+)])
fi
fi
fi

View file

@ -21,6 +21,7 @@
*/
#include <config.h>
#include <glib.h>
#include <glib/gi18n.h>
#include <dbus/dbus.h>
@ -128,6 +129,14 @@ ip4_start (NMDHCPClient *client,
g_ptr_array_add (argv, (gpointer) "-c"); /* Set script file */
g_ptr_array_add (argv, (gpointer) nm_dhcp_helper_path);
#ifdef DHCPCD_SUPPORTS_IPV6
/* IPv4-only for now. NetworkManager knows better than dhcpcd when to
* run IPv6, and dhcpcd's automatic Router Solicitations cause problems
* with devices that don't expect them.
*/
g_ptr_array_add (argv, (gpointer) "-4");
#endif
if (hostname && strlen (hostname)) {
g_ptr_array_add (argv, (gpointer) "-h"); /* Send hostname to DHCP server */
g_ptr_array_add (argv, (gpointer) hostname );