| author | Dan Williams <dcbw@redhat.com> | 2012-05-16 03:45:27 (GMT) |
|---|---|---|
| committer | Dan Williams <dcbw@redhat.com> | 2012-05-16 03:54:42 (GMT) |
| commit | a531f0d4ea07f033c1603213e58db1df0145ba53 (patch) (side-by-side diff) | |
| tree | 03af520bf0fbfd323f138f6918cbfdd781f5e2e9 | |
| parent | a84343123619ff8710b8b3b18e8220b64176cef6 (diff) | |
| download | NetworkManager-master.zip NetworkManager-master.tar.gz | |
The DHCP code usually ignores dhclient state transitions to the
same state it's currently in. This turns out to be wrong, since
dhclient will use the same reason code (which NM uses for the
state value) for operations like RENEW and REBIND. i.e. you'll
see states like this:
BOUND
RENEW (first renew)
RENEW (second renew)
RENEW (third renew)
etc
Therefore to ensure we trigger dispatcher scripts and internal
housekeeping code for renewals we need to make sure we process
these events even though they use the same state as the previous
event.
| -rw-r--r-- | src/dhcp-manager/nm-dhcp-client.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/dhcp-manager/nm-dhcp-client.c b/src/dhcp-manager/nm-dhcp-client.c index 16c6dd7..f6fec0a 100644 --- a/src/dhcp-manager/nm-dhcp-client.c +++ b/src/dhcp-manager/nm-dhcp-client.c @@ -570,8 +570,20 @@ nm_dhcp_client_new_options (NMDHCPClient *self, g_hash_table_remove_all (priv->options); g_hash_table_foreach (options, copy_option, priv->options); - if (old_state == new_state) - return; + if (old_state == new_state) { + /* dhclient will stay in the same state (or, really, provide the same + * reason) for operations like RENEW and REBIND. We need to ensure + * that triggers various DHCP lease change code, so we need to pass + * along same-state transitions for these states. + */ + if ( new_state != DHC_BOUND4 + && new_state != DHC_RENEW4 + && new_state != DHC_REBIND4 + && new_state != DHC_BOUND6 + && new_state != DHC_RENEW6 + && new_state != DHC_REBIND6) + return; + } /* Handle changed device state */ if (state_is_bound (new_state)) { |
