From c678775fd7e36250be2c036e4746d8af0164fea9 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Wed, 24 Nov 2010 14:53:35 +0100 Subject: [PATCH] Return to mainloop before starting DHCP procedure Just before starting the DHCP procedure return to mainloop first. This fixes some cases where the interface is not yet up. This happens mainly when using Bluetooth PAN connections where the network interface will be newly created every single time. --- plugins/dhcp.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/plugins/dhcp.c b/plugins/dhcp.c index 73c975d..e4dff18 100644 --- a/plugins/dhcp.c +++ b/plugins/dhcp.c @@ -111,6 +111,15 @@ static void lease_available_cb(GDHCPClient *dhcp_client, gpointer user_data) connman_dhcp_bound(dhcp); } +static gboolean start_dhcp(gpointer user_data) +{ + GDHCPClient *dhcp_client = user_data; + + g_dhcp_client_start(dhcp_client); + + return FALSE; +} + static int dhcp_request(struct connman_dhcp *dhcp) { GDHCPClient *dhcp_client; @@ -155,7 +164,9 @@ static int dhcp_request(struct connman_dhcp *dhcp) g_dhcp_client_ref(dhcp_client); - return g_dhcp_client_start(dhcp_client); + g_timeout_add_seconds(0, start_dhcp, dhcp_client); + + return 0; } static int dhcp_release(struct connman_dhcp *dhcp) -- 2.7.4