[PATCH] Re: NM 0.7 Ignores ppp configuration



Patch to merge ip4config for ppp codepaths for -ethernet and -serial
device. Not sure if its worth to unify this in the parent class.

The patch works for me for mobile broadband. Have no setup to verify
pppoe part.

(If it doesnt apply cleanly its most likely because of the accessor
changes that were made on the trunk, but which i couldnt pull into
ubuntu for now (because of the late landing).)

=== modified file 'ChangeLog'
--- ChangeLog	2008-10-16 17:06:35 +0000
+++ ChangeLog	2008-10-29 12:47:37 +0000
@@ -1,8 +1,20 @@
+2008-10-29  Alexander Sack  <asac canonical com>
+
+	Fix "ppp connections don't honour ip4 connection settings"
+	
+	* src/nm-device-ethernet.c
+		- (real_act_stage4_get_ip4_config): merge ip4config settings
+			with results from ppp manager
+
+	* src/nm-serial-device.c
+		- (real_act_stage4_get_ip4_config): merge ip4config settings
+			with results from ppp manager
+
 2008-10-16  Dan Williams  <dcbw redhat com>
 
 	* src/nm-device-wifi.c
 		- (constructor): correctly determine encryption capabilities
 
 2008-10-15  Dan Williams  <dcbw redhat com>
 
 	* src/nm-device-wifi.c

=== modified file 'src/nm-device-ethernet.c'
--- src/nm-device-ethernet.c	2008-10-02 17:10:00 +0000
+++ src/nm-device-ethernet.c	2008-10-29 12:43:03 +0000
@@ -1309,16 +1309,17 @@ real_act_stage4_get_ip4_config (NMDevice
                                 NMDeviceStateReason *reason)
 {
 	NMDeviceEthernet *self = NM_DEVICE_ETHERNET (device);
 	NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (self);
 	NMActStageReturn ret;
 
 	g_return_val_if_fail (config != NULL, NM_ACT_STAGE_RETURN_FAILURE);
 	g_return_val_if_fail (*config == NULL, NM_ACT_STAGE_RETURN_FAILURE);
+	g_return_val_if_fail (reason != NULL, NM_ACT_STAGE_RETURN_FAILURE);
 
 	if (!priv->ppp_manager) {
 		/* Regular ethernet connection. */
 
 		/* Chain up to parent */
 		ret = NM_DEVICE_CLASS (nm_device_ethernet_parent_class)->act_stage4_get_ip4_config (device, config, reason);
 
 		if (ret == NM_ACT_STAGE_RETURN_SUCCESS) {
@@ -1330,19 +1331,27 @@ real_act_stage4_get_ip4_config (NMDevice
 			s_wired = NM_SETTING_WIRED (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRED));
 			g_assert (s_wired);
 
 			/* MTU override */
 			if (s_wired->mtu)
 				nm_ip4_config_set_mtu (*config, s_wired->mtu);
 		}
 	} else {
+        	NMConnection *connection;
+	        NMSettingIP4Config *s_ip4;
+
 		/* PPPoE */
+        	connection = nm_act_request_get_connection (nm_device_get_act_request (device));
+	        g_assert (connection);
+		s_ip4 = (NMSettingIP4Config *) nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG);
+
 		*config = priv->pending_ip4_config;
 		priv->pending_ip4_config = NULL;
+		nm_utils_merge_ip4_config (*config, s_ip4);
 		ret = NM_ACT_STAGE_RETURN_SUCCESS;
 	}
 
 	return ret;
 }
 
 static void
 real_deactivate_quickly (NMDevice *device)

=== modified file 'src/nm-serial-device.c'
--- src/nm-serial-device.c	2008-10-08 16:14:01 +0000
+++ src/nm-serial-device.c	2008-10-29 12:44:09 +0000
@@ -16,16 +16,17 @@
 #include "nm-serial-device.h"
 #include "nm-device-interface.h"
 #include "nm-device-private.h"
 #include "ppp-manager/nm-ppp-manager.h"
 #include "nm-setting-ppp.h"
 #include "nm-marshal.h"
 #include "nm-utils.h"
 #include "nm-serial-device-glue.h"
+#include "NetworkManagerUtils.h"
 
 static gboolean serial_debug = FALSE;
 
 #define SERIAL_BUF_SIZE 2048
 
 G_DEFINE_TYPE (NMSerialDevice, nm_serial_device, NM_TYPE_DEVICE)
 
 #define NM_SERIAL_DEVICE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_SERIAL_DEVICE, NMSerialDevicePrivate))
@@ -1050,20 +1051,33 @@ real_act_stage2_config (NMDevice *device
 }
 
 static NMActStageReturn
 real_act_stage4_get_ip4_config (NMDevice *device,
                                 NMIP4Config **config,
                                 NMDeviceStateReason *reason)
 {
 	NMSerialDevicePrivate *priv = NM_SERIAL_DEVICE_GET_PRIVATE (device);
+	NMConnection *connection;
+	NMSettingIP4Config *s_ip4;
+
+	g_return_val_if_fail (config != NULL, NM_ACT_STAGE_RETURN_FAILURE);
+	g_return_val_if_fail (*config == NULL, NM_ACT_STAGE_RETURN_FAILURE);
+	g_return_val_if_fail (reason != NULL, NM_ACT_STAGE_RETURN_FAILURE);
+
+	connection = nm_act_request_get_connection (nm_device_get_act_request (device));
+	g_assert (connection);
+
+	s_ip4 = (NMSettingIP4Config *) nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG);
 
 	*config = priv->pending_ip4_config;
 	priv->pending_ip4_config = NULL;
 
+	nm_utils_merge_ip4_config (*config, s_ip4);
+
 	return NM_ACT_STAGE_RETURN_SUCCESS;
 }
 
 static void
 cleanup_device (NMSerialDevice *device)
 {
 	NMSerialDevicePrivate *priv = NM_SERIAL_DEVICE_GET_PRIVATE (device);
 



 - Alexander



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