gnome-main-menu r544 - in trunk: . main-menu/src



Author: sreeves
Date: Tue Jan  6 18:46:46 2009
New Revision: 544
URL: http://svn.gnome.org/viewvc/gnome-main-menu?rev=544&view=rev

Log:
fix network status on resume from suspend

Modified:
   trunk/ChangeLog
   trunk/main-menu/src/network-status-agent.c

Modified: trunk/main-menu/src/network-status-agent.c
==============================================================================
--- trunk/main-menu/src/network-status-agent.c	(original)
+++ trunk/main-menu/src/network-status-agent.c	Tue Jan  6 18:46:46 2009
@@ -210,34 +210,35 @@
 	if (! info->active)
 		return info;
 	NMIP4Config * cfg = nm_device_get_ip4_config (device);
-	if(! cfg)
-		return info;
+	//According to the documentation this should not be NULL if the device is active but on resume from suspend it is (BNC#463712), so check for now
+	if(cfg)
+	{
+		addresses = nm_ip4_config_get_addresses (cfg);
+		if (addresses) {
+			def_addr = addresses->data;
+
+			address = nm_ip4_address_get_address (def_addr);
+			netmask = nm_utils_ip4_prefix_to_netmask (nm_ip4_address_get_prefix (def_addr));
+			network = ntohl (address) & ntohl (netmask);
+			hostmask = ~ntohl (netmask);
+			bcast = htonl (network | hostmask);
+
+			info->ip4_addr = ip4_address_as_string (address);
+			info->subnet_mask = ip4_address_as_string (netmask);
+			info->route = ip4_address_as_string (nm_ip4_address_get_gateway (def_addr));
+					info->broadcast = ip4_address_as_string (bcast);
+		}
 
-	addresses = nm_ip4_config_get_addresses (cfg);
-	if (addresses) {
-		def_addr = addresses->data;
-
-		address = nm_ip4_address_get_address (def_addr);
-		netmask = nm_utils_ip4_prefix_to_netmask (nm_ip4_address_get_prefix (def_addr));
-		network = ntohl (address) & ntohl (netmask);
-		hostmask = ~ntohl (netmask);
-		bcast = htonl (network | hostmask);
-
-		info->ip4_addr = ip4_address_as_string (address);
-		info->subnet_mask = ip4_address_as_string (netmask);
-		info->route = ip4_address_as_string (nm_ip4_address_get_gateway (def_addr));
-                info->broadcast = ip4_address_as_string (bcast);
-	}
-
-	info->primary_dns = NULL;
-	info->secondary_dns = NULL;
-	array = nm_ip4_config_get_nameservers (cfg);
-	if (array)
-	{
-		if (array->len > 0)
-			info->primary_dns = ip4_address_as_string (g_array_index (array, guint32, 0));
-		if (array->len > 1)
-			info->secondary_dns = ip4_address_as_string (g_array_index (array, guint32, 1));
+		info->primary_dns = NULL;
+		info->secondary_dns = NULL;
+		array = nm_ip4_config_get_nameservers (cfg);
+		if (array)
+		{
+			if (array->len > 0)
+				info->primary_dns = ip4_address_as_string (g_array_index (array, guint32, 0));
+			if (array->len > 1)
+				info->secondary_dns = ip4_address_as_string (g_array_index (array, guint32, 1));
+		}
 	}
 
 	if (NM_IS_DEVICE_WIFI(device))



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