Re: [PATCH] device: allow for applying IPv4 and IPv6 settings in parallel



* Mathieu Trudel-Lapierre

> See attached, a respin of the patch.

Hi Mathieu,

I attempted to give this patch a try on top of NM 0.9.0 on F15, but I
fail to get it to compile.

Problem #1:
nm-device.c: In function 'handle_dhcp_lease_change':
nm-device.c:1450:22: error: unused variable 's_ip6' [-Werror=unused-variable]
cc1: all warnings being treated as errors

Problem #2:
nm-device.c: In function 'dhcp_state_changed':
nm-device.c:1477:36: error: 'ip6_config' may be used uninitialized in this function [-Werror=uninitialized]
nm-device.c:1449:15: note: 'ip6_config' was declared here

The attached patch is my attempt to fix these. The first chunk fixes
problem #1 easily enough, but I fail to understand why the second chunk
doesn't fix problem #2. I also don't understand why gcc is claiming the
problem is in dhcp_state_changed() when the line numbers clearly point
to the following line in handle_dhcp_lease_change():

if (!update_ip6_config_with_dhcp (device, ip6_config, &reason)) {

I also tried something like this:

if (!ip6_config) {
  nm_device_state_changed(blah blah IP_CONFIG_UNAVAILABLE);
  return;
} else if (!update_ip6_config_with_dhcp (device, ip6_config, blah blah))

But it *still* complains about ip6_config being used uninitialized on
that line. I'm stumped. Any suggestions?

Best regards,
-- 
Tore Anderson
nm-device.c: In function 'handle_dhcp_lease_change':
nm-device.c:1450:22: error: unused variable 's_ip6' [-Werror=unused-variable]
cc1: all warnings being treated as errors

nm-device.c: In function 'dhcp_state_changed':
nm-device.c:1481:36: error: 'ip6_config' may be used uninitialized in this function [-Werror=uninitialized]
nm-device.c:1449:15: note: 'ip6_config' was declared here
cc1: all warnings being treated as errors

diff -ruN NetworkManager-0.9.0/src/nm-device.c NetworkManager-0.9.0-fix/src/nm-device.c
--- NetworkManager-0.9.0/src/nm-device.c	2011-09-17 10:08:52.185084959 +0200
+++ NetworkManager-0.9.0-fix/src/nm-device.c	2011-09-17 10:43:26.776337076 +0200
@@ -1447,7 +1447,6 @@
 	NMIP4Config *ip4_config;
 	NMSettingIP4Config *s_ip4;
 	NMIP6Config *ip6_config;
-	NMSettingIP6Config *s_ip6;
 	NMConnection *connection;
 	NMActRequest *req;
 	NMDeviceStateReason reason = NM_DEVICE_STATE_REASON_NONE;
@@ -1461,24 +1460,20 @@
 
 	if (ipv6) {
 		if (   ip6_method_matches (connection, NM_SETTING_IP6_CONFIG_METHOD_AUTO)
-		    || ip6_method_matches (connection, NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL)) {
+		    || ip6_method_matches (connection, NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL))
 			ip6_config = nm_ip6_manager_get_ip6_config (priv->ip6_manager,
 			                                         nm_device_get_ip_ifindex (device));
-			if (!ip6_config) {
-				nm_device_state_changed (device, NM_DEVICE_STATE_FAILED,
-				                         NM_DEVICE_STATE_REASON_IP_CONFIG_UNAVAILABLE);
-				return;
-			}
-		} else if (ip6_method_matches (connection, NM_SETTING_IP6_CONFIG_METHOD_MANUAL)) {
+		else if (ip6_method_matches (connection, NM_SETTING_IP6_CONFIG_METHOD_MANUAL))
 			ip6_config = nm_ip6_config_new ();
-			if (!ip6_config) {
-				nm_device_state_changed (device, NM_DEVICE_STATE_FAILED,
-				                         NM_DEVICE_STATE_REASON_IP_CONFIG_UNAVAILABLE);
-				return;
-			}
-		} else if (ip6_method_matches (connection, NM_SETTING_IP6_CONFIG_METHOD_DHCP))
+		else if (ip6_method_matches (connection, NM_SETTING_IP6_CONFIG_METHOD_DHCP))
 			g_assert (priv->dhcp6_client);  /* sanity check */
 
+		if (!ip6_config) {
+			nm_device_state_changed (device, NM_DEVICE_STATE_FAILED,
+						 NM_DEVICE_STATE_REASON_IP_CONFIG_UNAVAILABLE);
+			return;
+		}
+
 		if (!update_ip6_config_with_dhcp (device, ip6_config, &reason)) {
 			nm_log_warn (LOGD_DHCP6, "(%s): failed to get DHCPv6 config for rebind",
 			             nm_device_get_ip_iface (device));


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