mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-11 12:10:17 +01:00
be less racy with dhcdbd's change to bound state
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@972 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
parent
71b1632ad2
commit
394abb5977
1 changed files with 15 additions and 0 deletions
|
|
@ -24,6 +24,7 @@
|
|||
#include "nm-dhcp-manager.h"
|
||||
#include "NetworkManagerDevice.h"
|
||||
#include "NetworkManagerPolicy.h"
|
||||
#include "NetworkManagerUtils.h"
|
||||
#include "nm-activation-request.h"
|
||||
#include "nm-utils.h"
|
||||
#include <sys/socket.h>
|
||||
|
|
@ -439,6 +440,16 @@ 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];
|
||||
|
||||
if (state_is_bound (nm_act_request_get_dhcp_state (req)))
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* nm_dhcp_manager_get_ip4_config
|
||||
*
|
||||
|
|
@ -459,6 +470,7 @@ NMIP4Config * nm_dhcp_manager_get_ip4_config (NMDHCPManager *manager, NMActReque
|
|||
guint32 num_ip4_nameservers = 0;
|
||||
char * domain_names = NULL;
|
||||
struct in_addr temp_addr;
|
||||
nm_completion_args args;
|
||||
|
||||
g_return_val_if_fail (manager != NULL, NULL);
|
||||
g_return_val_if_fail (req != NULL, NULL);
|
||||
|
|
@ -469,6 +481,9 @@ NMIP4Config * nm_dhcp_manager_get_ip4_config (NMDHCPManager *manager, NMActReque
|
|||
dev = nm_act_request_get_dev (req);
|
||||
g_assert (dev);
|
||||
|
||||
args[0] = req;
|
||||
nm_wait_for_completion (30, G_USEC_PER_SEC / 10,
|
||||
nm_completion_dhcp_bound_test, NULL, args);
|
||||
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!");
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue