gsm/bt: fix merge of user-defined IPv4 settings

This commit is contained in:
Dan Williams
2009-08-17 19:48:42 -05:00
parent 3e221833da
commit c2fb1f850a
4 changed files with 29 additions and 7 deletions

View File

@@ -14,6 +14,7 @@
#include "nm-modem-types.h" #include "nm-modem-types.h"
#include "nm-utils.h" #include "nm-utils.h"
#include "nm-serial-device-glue.h" #include "nm-serial-device-glue.h"
#include "NetworkManagerUtils.h"
G_DEFINE_TYPE (NMModem, nm_modem, NM_TYPE_DEVICE) G_DEFINE_TYPE (NMModem, nm_modem, NM_TYPE_DEVICE)
@@ -196,12 +197,19 @@ ppp_stage3_ip4_config_start (NMDevice *device, NMDeviceStateReason *reason)
static NMActStageReturn static NMActStageReturn
ppp_stage4 (NMDevice *device, NMIP4Config **config, NMDeviceStateReason *reason) ppp_stage4 (NMDevice *device, NMIP4Config **config, NMDeviceStateReason *reason)
{ {
NMModemPrivate *priv = NM_MODEM_GET_PRIVATE (device); NMModemPrivate *priv = NM_MODEM_GET_PRIVATE (device);
NMConnection *connection;
NMSettingIP4Config *s_ip4;
*config = priv->pending_ip4_config; *config = priv->pending_ip4_config;
priv->pending_ip4_config = NULL; priv->pending_ip4_config = NULL;
/* Merge user-defined overrides into the IP4Config to be applied */
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);
nm_utils_merge_ip4_config (*config, s_ip4);
return NM_ACT_STAGE_RETURN_SUCCESS; return NM_ACT_STAGE_RETURN_SUCCESS;
} }

View File

@@ -37,6 +37,7 @@
#include "nm-setting-cdma.h" #include "nm-setting-cdma.h"
#include "nm-setting-gsm.h" #include "nm-setting-gsm.h"
#include "nm-device-bt-glue.h" #include "nm-device-bt-glue.h"
#include "NetworkManagerUtils.h"
#define BLUETOOTH_DUN_UUID "dun" #define BLUETOOTH_DUN_UUID "dun"
#define BLUETOOTH_NAP_UUID "nap" #define BLUETOOTH_NAP_UUID "nap"
@@ -455,10 +456,18 @@ static NMActStageReturn
ppp_stage4 (NMDevice *device, NMIP4Config **config, NMDeviceStateReason *reason) ppp_stage4 (NMDevice *device, NMIP4Config **config, NMDeviceStateReason *reason)
{ {
NMDeviceBtPrivate *priv = NM_DEVICE_BT_GET_PRIVATE (device); NMDeviceBtPrivate *priv = NM_DEVICE_BT_GET_PRIVATE (device);
NMConnection *connection;
NMSettingIP4Config *s_ip4;
*config = priv->pending_ip4_config; *config = priv->pending_ip4_config;
priv->pending_ip4_config = NULL; priv->pending_ip4_config = NULL;
/* Merge user-defined overrides into the IP4Config to be applied */
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);
nm_utils_merge_ip4_config (*config, s_ip4);
return NM_ACT_STAGE_RETURN_SUCCESS; return NM_ACT_STAGE_RETURN_SUCCESS;
} }

View File

@@ -1384,14 +1384,16 @@ real_act_stage4_get_ip4_config (NMDevice *device,
NMConnection *connection; NMConnection *connection;
NMSettingIP4Config *s_ip4; NMSettingIP4Config *s_ip4;
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);
/* PPPoE */ /* PPPoE */
*config = priv->pending_ip4_config; *config = priv->pending_ip4_config;
priv->pending_ip4_config = NULL; priv->pending_ip4_config = NULL;
/* Merge user-defined overrides into the IP4Config to be applied */
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);
nm_utils_merge_ip4_config (*config, s_ip4); nm_utils_merge_ip4_config (*config, s_ip4);
ret = NM_ACT_STAGE_RETURN_SUCCESS; ret = NM_ACT_STAGE_RETURN_SUCCESS;
} }

View File

@@ -1223,6 +1223,7 @@ real_act_stage4_get_ip4_config (NMDevice *self,
if (nm_device_get_use_dhcp (self)) { if (nm_device_get_use_dhcp (self)) {
*config = nm_dhcp_manager_get_ip4_config (priv->dhcp_manager, ip_iface); *config = nm_dhcp_manager_get_ip4_config (priv->dhcp_manager, ip_iface);
if (*config) { if (*config) {
/* Merge user-defined overrides into the IP4Config to be applied */
nm_utils_merge_ip4_config (*config, s_ip4); nm_utils_merge_ip4_config (*config, s_ip4);
nm_dhcp4_config_reset (priv->dhcp4_config); nm_dhcp4_config_reset (priv->dhcp4_config);
@@ -1247,9 +1248,10 @@ real_act_stage4_get_ip4_config (NMDevice *self,
*config = aipd_get_ip4_config (self, reason); *config = aipd_get_ip4_config (self, reason);
} else if (!strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_MANUAL)) { } else if (!strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_MANUAL)) {
*config = nm_ip4_config_new (); *config = nm_ip4_config_new ();
if (*config) if (*config) {
/* Merge user-defined overrides into the IP4Config to be applied */
nm_utils_merge_ip4_config (*config, s_ip4); nm_utils_merge_ip4_config (*config, s_ip4);
else } else
*reason = NM_DEVICE_STATE_REASON_IP_CONFIG_UNAVAILABLE; *reason = NM_DEVICE_STATE_REASON_IP_CONFIG_UNAVAILABLE;
} else if (!strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_SHARED)) { } else if (!strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_SHARED)) {
*config = nm_device_new_ip4_shared_config (self, reason); *config = nm_device_new_ip4_shared_config (self, reason);
@@ -1448,6 +1450,7 @@ real_act_stage4_get_ip6_config (NMDevice *self,
return NM_ACT_STAGE_RETURN_FAILURE; return NM_ACT_STAGE_RETURN_FAILURE;
} }
/* Merge user-defined overrides into the IP6Config to be applied */
if (!strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_MANUAL)) if (!strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_MANUAL))
nm_utils_merge_ip6_config (*config, s_ip6); nm_utils_merge_ip6_config (*config, s_ip6);