From 1c5f300910c766e5d250190ed2c332a9e21283ff Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Tue, 3 Jan 2006 18:18:05 +0000 Subject: [PATCH] 2006-01-03 Dan Williams * src/dhcp-manager/nm-dhcp-manager.c - Recognize activation cancellation when waiting for DHCP configuration from dhcdbd - Ignore non-dhcdbd messages * src/nm-device.c - (real_act_stage3_ip_config_start): return to correct behavior of letting the dhcp-manager notify us of failure or success rather than incorrectly doing that ourselves - (nm_device_activate_stage4_ip_config_get): deal with activation cancellation a bit earlier git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1253 4912f4e0-d625-0410-9fb7-b9a5a253dbdc --- ChangeLog | 14 ++++++++++++++ src/dhcp-manager/nm-dhcp-manager.c | 12 +++++++++++- src/nm-device.c | 12 ++++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 286bcda47e..15ea7a4c12 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2006-01-03 Dan Williams + + * src/dhcp-manager/nm-dhcp-manager.c + - Recognize activation cancellation when waiting for DHCP + configuration from dhcdbd + - Ignore non-dhcdbd messages + + * src/nm-device.c + - (real_act_stage3_ip_config_start): return to correct behavior + of letting the dhcp-manager notify us of failure or + success rather than incorrectly doing that ourselves + - (nm_device_activate_stage4_ip_config_get): deal with + activation cancellation a bit earlier + 2006-01-03 Dan Williams * src/nm-device-802-11-wireless.c diff --git a/src/dhcp-manager/nm-dhcp-manager.c b/src/dhcp-manager/nm-dhcp-manager.c index 3b36478f33..ce58933950 100644 --- a/src/dhcp-manager/nm-dhcp-manager.c +++ b/src/dhcp-manager/nm-dhcp-manager.c @@ -451,10 +451,13 @@ static gboolean get_ip4_string (NMDHCPManager *manager, NMDevice *dev, const cha static gboolean nm_completion_dhcp_bound_test(int tries, nm_completion_args args) { - NMActRequest *req = args[0]; + NMActRequest * req = args[0]; + NMDevice * dev = args[1]; if (state_is_bound (nm_act_request_get_dhcp_state (req))) return TRUE; + if (nm_device_activation_should_cancel (dev)) + return TRUE; return FALSE; } @@ -493,8 +496,12 @@ NMIP4Config * nm_dhcp_manager_get_ip4_config (NMDHCPManager *manager, NMActReque g_assert (dev); args[0] = req; + args[1] = dev; nm_wait_for_completion (30, G_USEC_PER_SEC / 10, nm_completion_dhcp_bound_test, NULL, args); + if (nm_device_activation_should_cancel (dev)) + return NULL; + if (!state_is_bound (nm_act_request_get_dhcp_state (req))) { nm_warning ("Tried to get IP4 Config for a device when dhcdbd wasn't in a BOUND state!"); @@ -605,6 +612,9 @@ gboolean nm_dhcp_manager_process_signal (NMDHCPManager *manager, DBusMessage *me return FALSE; if (!(interface = dbus_message_get_interface (message))) return FALSE; + /* Ignore non-DHCP related messages */ + if (strncmp (interface, "com.redhat.dhcp", 15)) + return FALSE; #if 0 signature = dbus_message_get_signature (message); diff --git a/src/nm-device.c b/src/nm-device.c index 40e266d2b7..2454df4f13 100644 --- a/src/nm-device.c +++ b/src/nm-device.c @@ -827,6 +827,11 @@ real_act_stage3_ip_config_start (NMDevice *self, /* Begin a DHCP transaction on the interface */ if (!nm_dhcp_manager_begin_transaction (data->dhcp_manager, req)) ret = NM_ACT_STAGE_RETURN_FAILURE; + + /* DHCP devices will be notified by the DHCP manager when + * stuff happens. + */ + ret = NM_ACT_STAGE_RETURN_POSTPONE; } return ret; @@ -1012,6 +1017,13 @@ nm_device_activate_stage4_ip_config_get (NMActRequest *req) } ret = NM_DEVICE_GET_CLASS (self)->act_stage4_get_ip4_config (self, req, &ip4_config); + + if (nm_device_activation_should_cancel (self)) + { + nm_device_schedule_activation_handle_cancel (req); + goto out; + } + if (ret == NM_ACT_STAGE_RETURN_POSTPONE) goto out; else if (!ip4_config || (ret == NM_ACT_STAGE_RETURN_FAILURE))