core: slaves should have empty captured IP configuration

This commit is contained in:
Dan Williams 2013-11-06 14:13:59 -06:00
parent b54a9868fd
commit 60b88d526c
3 changed files with 30 additions and 9 deletions

View file

@ -1653,8 +1653,6 @@ nm_device_generate_connection (NMDevice *device)
connection = nm_connection_new ();
s_con = nm_setting_connection_new ();
s_ip4 = nm_setting_ip4_config_new ();
s_ip6 = nm_setting_ip6_config_new ();
uuid = nm_utils_uuid_generate ();
name = g_strdup_printf ("%s", ifname);
@ -1666,12 +1664,21 @@ nm_device_generate_connection (NMDevice *device)
NULL);
if (klass->connection_type)
g_object_set (s_con, NM_SETTING_CONNECTION_TYPE, klass->connection_type, NULL);
nm_ip4_config_update_setting (priv->ip4_config, (NMSettingIP4Config *) s_ip4);
nm_ip6_config_update_setting (priv->ip6_config, (NMSettingIP6Config *) s_ip6);
nm_connection_add_setting (connection, s_con);
s_ip4 = nm_setting_ip4_config_new ();
nm_connection_add_setting (connection, s_ip4);
if (priv->ip4_config)
nm_ip4_config_update_setting (priv->ip4_config, (NMSettingIP4Config *) s_ip4);
else
g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_DISABLED, NULL);
s_ip6 = nm_setting_ip6_config_new ();
nm_connection_add_setting (connection, s_ip6);
if (priv->ip6_config)
nm_ip6_config_update_setting (priv->ip6_config, (NMSettingIP6Config *) s_ip6);
else
g_object_set (s_ip6, NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, NULL);
klass->update_connection (device, connection);

View file

@ -127,8 +127,15 @@ routes_are_duplicate (const NMPlatformIP4Route *a, const NMPlatformIP4Route *b,
NMIP4Config *
nm_ip4_config_capture (int ifindex)
{
NMIP4Config *config = nm_ip4_config_new ();
NMIP4ConfigPrivate *priv = NM_IP4_CONFIG_GET_PRIVATE (config);
NMIP4Config *config;
NMIP4ConfigPrivate *priv;
/* Slaves have no IP configuration */
if (nm_platform_link_get_master (ifindex) > 0)
return NULL;
config = nm_ip4_config_new ();
priv = NM_IP4_CONFIG_GET_PRIVATE (config);
g_array_unref (priv->addresses);
g_array_unref (priv->routes);

View file

@ -127,8 +127,15 @@ routes_are_duplicate (const NMPlatformIP6Route *a, const NMPlatformIP6Route *b,
NMIP6Config *
nm_ip6_config_capture (int ifindex)
{
NMIP6Config *config = nm_ip6_config_new ();
NMIP6ConfigPrivate *priv = NM_IP6_CONFIG_GET_PRIVATE (config);
NMIP6Config *config;
NMIP6ConfigPrivate *priv;
/* Slaves have no IP configuration */
if (nm_platform_link_get_master (ifindex) > 0)
return NULL;
config = nm_ip6_config_new ();
priv = NM_IP6_CONFIG_GET_PRIVATE (config);
g_array_unref (priv->addresses);
g_array_unref (priv->routes);