[patch] use link-local on dhcp failure.



Yo!

Attached patch implements (working) fallback to link-local IP generation
in the case that DHCP fails on a wired or unencrypted wireless network.

Same behavior as Hadess's patch.

The problem with the previous approach is that DHCP timeout is caught in
the "other" Stage 4, "IP Configure Timeout", which lives in a different
function.

It works.  I am giddy.  May I commit?

	Robert Love

 src/NetworkManagerDevice.c |   20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 deletions(-)

Index: src/NetworkManagerDevice.c
===================================================================
RCS file: /cvs/gnome/NetworkManager/src/NetworkManagerDevice.c,v
retrieving revision 1.145
diff -u -u -p -r1.145 NetworkManagerDevice.c
--- src/NetworkManagerDevice.c	30 Jun 2005 14:28:52 -0000	1.145
+++ src/NetworkManagerDevice.c	1 Jul 2005 18:52:14 -0000
@@ -2845,7 +2845,11 @@ static gboolean nm_device_activate_stage
 	}
 
 	if (nm_device_is_wired (dev))
-		nm_policy_schedule_activation_failed (req);
+	{
+		/* Wired network, no DHCP reply.  Let's get an IP via Zeroconf. */
+		nm_info ("No DHCP reply received.  Automatically obtaining IP via Zeroconf.");
+		ip4_config = nm_device_new_ip4_autoip_config (dev);
+	}
 	else if (nm_device_is_wireless (dev))
 	{
 		NMAccessPoint *ap = nm_act_request_get_ap (req);
@@ -2873,9 +2877,19 @@ static gboolean nm_device_activate_stage
 		}
 		else
 		{
-			/* If DHCP fails on an unencrypted access point, we're done */
-			nm_policy_schedule_activation_failed (req);
+			/*
+			 * Wireless, not encrypted, no DHCP Reply.  Try Zeroconf.  We do not do this in
+			 * the encrypted case, because the problem could be (and more likely is) a bad key.
+			 */
+			nm_info ("No DHCP reply received.  Automatically obtaining IP via Zeroconf.");
+			ip4_config = nm_device_new_ip4_autoip_config (dev);
 		}
+	}
+
+	if (ip4_config)
+	{
+		nm_act_request_set_ip4_config (req, ip4_config);
+		nm_device_activate_schedule_stage5_ip_config_commit (req);
 	}
 
 out:


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