mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-03 14:00:15 +01:00
core: fail connections if IP configuration expires
Need to mark these connections invalid too, otherwise they'll just be retried over and over and over. Ran into a problem with DHCPv6 where lease expiration (cached lease really) was *negative*, which caused the lease to expire immediately after being bound. Previously the policy wouldn't mark connections like this as invalid because they hadn't failed during activation. NetworkManager: <info> (eth0): carrier now ON (device state 2) NetworkManager: <info> (eth0): device state change: 2 -> 3 (reason 40) NetworkManager: <info> Activation (eth0) starting connection 'dhcp6 test' NetworkManager: <info> (eth0): device state change: 3 -> 4 (reason 0) NetworkManager: <info> Activation (eth0) Stage 1 of 5 (Device Prepare) scheduled... NetworkManager: <info> Activation (eth0) Stage 1 of 5 (Device Prepare) started... NetworkManager: <info> Activation (eth0) Stage 2 of 5 (Device Configure) scheduled... NetworkManager: <info> Activation (eth0) Stage 1 of 5 (Device Prepare) complete. NetworkManager: <info> Activation (eth0) Stage 2 of 5 (Device Configure) starting... NetworkManager: <info> (eth0): device state change: 4 -> 5 (reason 0) NetworkManager: <info> Activation (eth0) Stage 2 of 5 (Device Configure) successful. NetworkManager: <info> Activation (eth0) Stage 3 of 5 (IP Configure Start) scheduled. NetworkManager: <info> Activation (eth0) Stage 2 of 5 (Device Configure) complete. NetworkManager: <info> Activation (eth0) Stage 3 of 5 (IP Configure Start) started... NetworkManager: <info> (eth0): device state change: 5 -> 7 (reason 0) NetworkManager: <info> Activation (eth0) Beginning DHCPv6 transaction (timeout in 45 seconds) NetworkManager: <info> dhclient started with pid 6639 NetworkManager: <info> Activation (eth0) Stage 3 of 5 (IP Configure Start) complete. Internet Systems Consortium DHCP Client 4.1.1 Copyright 2004-2010 Internet Systems Consortium. All rights reserved. For info, please visit https://www.isc.org/software/dhcp/ NetworkManager: <info> (eth0): DHCPv6 state changed nbi -> preinit6 Bound to *:546 Listening on Socket/eth0 Sending on Socket/eth0 PRC: Confirming active lease (INIT-REBOOT). XMT: Forming Confirm, 0 ms elapsed. XMT: X-- IA_NA 5a:47:1f:71 XMT: | X-- Confirm Address 3ffe:501:ffff::4 XMT: V IA_NA appended. XMT: Confirm on eth0, interval 1090ms. send_packet6: Cannot assign requested address dhc6: sendpacket6() sent -1 of 80 bytes XMT: Forming Confirm, 1090 ms elapsed. XMT: X-- IA_NA 5a:47:1f:71 XMT: | X-- Confirm Address 3ffe:501:ffff::4 XMT: V IA_NA appended. XMT: Confirm on eth0, interval 2120ms. send_packet6: Cannot assign requested address dhc6: sendpacket6() sent -1 of 80 bytes XMT: Forming Confirm, 3210 ms elapsed. XMT: X-- IA_NA 5a:47:1f:71 XMT: | X-- Confirm Address 3ffe:501:ffff::4 XMT: V IA_NA appended. XMT: Confirm on eth0, interval 4320ms. XMT: Forming Confirm, 7530 ms elapsed. XMT: X-- IA_NA 5a:47:1f:71 XMT: | X-- Confirm Address 3ffe:501:ffff::4 XMT: V IA_NA appended. XMT: Confirm on eth0, interval 2470ms. Max retransmission duration exceeded. PRC: Bound to lease 00:01:00:01:12:e1:92:d9:00:14:22:fd:06:e7. PRC: Rebind event scheduled in -8604281 seconds, to run for 110 seconds. PRC: Depreference scheduled in -8604241 seconds. PRC: Expiration scheduled in -8604171 seconds. PRC: Rebinding lease on eth0. PRC: Depreference scheduled in -8604241 seconds. PRC: Expiration scheduled in -8604171 seconds. NetworkManager: <info> (eth0): DHCPv6 state changed preinit6 -> bound6 NetworkManager: <info> Activation (eth0) Stage 4 of 5 (IP6 Configure Get) scheduled... NetworkManager: <info> Activation (eth0) Stage 4 of 5 (IP6 Configure Get) started... NetworkManager: <info> address 3ffe:501:ffff::4 NetworkManager: <info> prefix 64 NetworkManager: <info> nameserver '2000::2' NetworkManager: <info> domain search 'ibm.com.' NetworkManager: <info> Activation (eth0) Stage 5 of 5 (IP Configure Commit) scheduled... NetworkManager: <info> Activation (eth0) Stage 4 of 5 (IP6 Configure Get) complete. NetworkManager: <info> Activation (eth0) Stage 5 of 5 (IP Configure Commit) started... PRC: Address 3ffe:501:ffff::4 depreferred. PRC: Expiration scheduled in -8604171 seconds. PRC: Address 3ffe:501:ffff::4 expired. PRC: Bound lease is devoid of active addresses. Re-initializing. PRC: Soliciting for leases (INIT). XMT: Forming Solicit, 0 ms elapsed. XMT: X-- IA_NA 5a:47:1f:71 XMT: | X-- Request renew in +3600 XMT: | X-- Request rebind in +5400 XMT: Solicit on eth0, interval 1040ms. Stopping nscd: [ OK ] Starting nscd: [ OK ] NetworkManager: <info> (eth0): device state change: 7 -> 8 (reason 0) NetworkManager: <info> Activation (eth0) successful, device activated. NetworkManager: <info> Activation (eth0) Stage 5 of 5 (IP Configure Commit) complete. NetworkManager: <info> (eth0): DHCPv6 state changed bound6 -> depref6 NetworkManager: <info> (eth0): DHCPv6 state changed depref6 -> expire6
This commit is contained in:
parent
eaa750dda9
commit
b172519045
2 changed files with 33 additions and 4 deletions
|
|
@ -1312,6 +1312,22 @@ dhcp_state_changed (NMDHCPClient *client,
|
|||
else if (nm_device_get_state (device) == NM_DEVICE_STATE_ACTIVATED)
|
||||
nm_device_state_changed (device, NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_REASON_IP_CONFIG_EXPIRED);
|
||||
break;
|
||||
case DHC_STOP:
|
||||
case DHC_STOP6:
|
||||
case DHC_EXPIRE:
|
||||
case DHC_EXPIRE6:
|
||||
if (dev_state == NM_DEVICE_STATE_ACTIVATED) {
|
||||
if (ipv6)
|
||||
nm_dhcp6_config_reset (priv->dhcp6_config);
|
||||
else
|
||||
nm_dhcp4_config_reset (priv->dhcp4_config);
|
||||
|
||||
/* dhclient quit and can't get/renew a lease; so kill the connection */
|
||||
nm_device_state_changed (device,
|
||||
NM_DEVICE_STATE_FAILED,
|
||||
NM_DEVICE_STATE_REASON_IP_CONFIG_EXPIRED);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -585,10 +585,23 @@ device_state_changed (NMDevice *device,
|
|||
/* Mark the connection invalid if it failed during activation so that
|
||||
* it doesn't get automatically chosen over and over and over again.
|
||||
*/
|
||||
if (connection && IS_ACTIVATING_STATE (old_state)) {
|
||||
g_object_set_data (G_OBJECT (connection), INVALID_TAG, GUINT_TO_POINTER (TRUE));
|
||||
nm_log_info (LOGD_DEVICE, "Marking connection '%s' invalid.", get_connection_id (connection));
|
||||
nm_connection_clear_secrets (connection);
|
||||
if (connection) {
|
||||
gboolean fail = FALSE;
|
||||
|
||||
if (IS_ACTIVATING_STATE (old_state)) {
|
||||
nm_log_info (LOGD_DEVICE, "Marking connection '%s' invalid.", get_connection_id (connection));
|
||||
fail = TRUE;
|
||||
} else if ( (old_state == NM_DEVICE_STATE_ACTIVATED)
|
||||
&& (reason == NM_DEVICE_STATE_REASON_IP_CONFIG_EXPIRED)) {
|
||||
nm_log_info (LOGD_DEVICE, "Marking connection '%s' invalid because IP configuration expired.",
|
||||
get_connection_id (connection));
|
||||
fail = TRUE;
|
||||
}
|
||||
|
||||
if (fail) {
|
||||
g_object_set_data (G_OBJECT (connection), INVALID_TAG, GUINT_TO_POINTER (TRUE));
|
||||
nm_connection_clear_secrets (connection);
|
||||
}
|
||||
}
|
||||
schedule_activate_check (policy, device, 3);
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue