Re: Get a link-local IP when wired and DHCP fails



On Thu, 2005-06-30 at 20:14 +0100, Bastien Nocera wrote:

> Any comments?

When I don't have a DHCP server, I get failure on Stage 3 (start of DHCP
transaction) and never make it to Stage 4.  So, this isn't working for
me.  Debugging ...

And, attached patch fixes the typo that Dan pointed out and adds an
nm_info for verbosity.

	Robert Love

Index: src/NetworkManagerDevice.c
===================================================================
RCS file: /cvs/gnome/NetworkManager/src/NetworkManagerDevice.c,v
retrieving revision 1.145
diff -u -u -r1.145 NetworkManagerDevice.c
--- src/NetworkManagerDevice.c	30 Jun 2005 14:28:52 -0000	1.145
+++ src/NetworkManagerDevice.c	30 Jun 2005 21:02:38 -0000
@@ -2752,7 +2752,23 @@
 	if (ap && nm_ap_get_user_created (ap))
 		ip4_config = nm_device_new_ip4_autoip_config (dev);
 	else if (nm_device_get_use_dhcp (dev))
+	{
+		/*
+		 * Could not get a DHCP address, so we'll try link-local for
+		 * for wired, and wireless non-encrypted networks, because
+		 * if we have encryption on wireless, it could be a wrong
+		 * WEP key causing the failure.
+		 */
 		ip4_config = nm_dhcp_manager_get_ip4_config (data->dhcp_manager, req);
+		if (ip4_config == NULL)
+		{
+			if (nm_device_is_wired (dev) || (nm_device_is_wireless (dev) == TRUE && nm_ap_get_encrypted (ap) == FALSE))
+			{
+				nm_info ("No DHCP reply received.  Automatically obtaining IP.");
+				ip4_config = nm_device_new_ip4_autoip_config (dev);
+			}
+		}
+	}
 	else
 		ip4_config = nm_system_device_new_ip4_system_config (dev);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]