dhcp: gracefully recover from failed DHCP BOUND state transitions (bgo #743700)

First, configure.ac's grep was wrong and wasn't setting DHCPCD_SUPPORTS_IPV6,
which caused dhcpcd to acquire a DHCPv6 address when NM didn't think that
was going to happen, and thus DHCP options couldn't be parsed.

Second, even if that does happen, don't just assert and quit, but set the
DHCP state to failed.

https://bugzilla.gnome.org/show_bug.cgi?id=743700
(cherry picked from commit 511a7395bf)
This commit is contained in:
Dan Williams 2015-01-29 13:02:59 -06:00
parent 530efb3882
commit 7daf63461d
2 changed files with 9 additions and 3 deletions

View file

@ -685,10 +685,10 @@ fi
if test "$with_dhcpcd" = "yes"; then
AC_PATH_PROGS(with_dhcpcd, dhcpcd, no, /sbin:/usr/sbin:/usr/local/sbin)
if test "$with_dhcpcd" != "no"; then
if ! $with_dhcpcd --version 2>&1 | grep -q "^dhcpcd [[456789]]\."; 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
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

View file

@ -767,7 +767,13 @@ nm_dhcp_client_handle_event (gpointer unused,
str_options,
priv->priority);
}
g_warn_if_fail (ip_config != NULL);
/* Fail if no valid IP config was received */
if (ip_config == NULL) {
nm_log_warn (LOGD_DHCP, "(%s): DHCP client bound but IP config not received", iface);
new_state = NM_DHCP_STATE_FAIL;
g_clear_pointer (&str_options, g_hash_table_unref);
}
}
}