summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2017-07-28 10:37:23 +0200
committerBeniamino Galvani <bgalvani@redhat.com>2017-07-28 10:37:23 +0200
commit565adb4df25639c75af858c26515c69e85348be3 (patch)
tree1a74c898db226521fcd963ed1077d2e612b2e725
parent1b09fba19ef0b9cc704009a3b6f84d2372c2162e (diff)
ppp: fix generation of IP config received from pppd
Since commit 22edeb5b691b ("core: track addresses for NMIP4Config/NMIP6Config via NMDedupMultiIndex"), addresses can be added to a IP config only after the ifindex has been set. Fixes: 22edeb5b691befd796c534cf71901b32f0b7945b
-rw-r--r--src/ppp/nm-ppp-manager.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/ppp/nm-ppp-manager.c b/src/ppp/nm-ppp-manager.c
index 104adf5475..fec7ce375f 100644
--- a/src/ppp/nm-ppp-manager.c
+++ b/src/ppp/nm-ppp-manager.c
@@ -400,18 +400,24 @@ impl_ppp_manager_set_ip4_config (NMPPPManager *manager,
GVariant *config_dict)
{
NMPPPManagerPrivate *priv = NM_PPP_MANAGER_GET_PRIVATE (manager);
- NMIP4Config *config;
+ gs_unref_object NMIP4Config *config = NULL;
NMPlatformIP4Address address;
- guint32 u32;
+ guint32 u32, mtu;
GVariantIter *iter;
_LOGI ("(IPv4 Config Get) reply received.");
nm_clear_g_source (&priv->ppp_timeout_handler);
+ if (!set_ip_config_common (manager, config_dict, NM_PPP_IP4_CONFIG_INTERFACE, &mtu))
+ goto out;
+
config = nm_ip4_config_new (nm_platform_get_multi_idx (NM_PLATFORM_GET),
nm_platform_link_get_ifindex (NM_PLATFORM_GET, priv->ip_iface));
+ if (mtu)
+ nm_ip4_config_set_mtu (config, mtu, NM_IP_CONFIG_SOURCE_PPP);
+
memset (&address, 0, sizeof (address));
address.plen = 32;
@@ -447,17 +453,10 @@ impl_ppp_manager_set_ip4_config (NMPPPManager *manager,
g_variant_iter_free (iter);
}
- if (!set_ip_config_common (manager, config_dict, NM_PPP_IP4_CONFIG_INTERFACE, &u32))
- goto out;
-
- if (u32)
- nm_ip4_config_set_mtu (config, u32, NM_IP_CONFIG_SOURCE_PPP);
-
/* Push the IP4 config up to the device */
g_signal_emit (manager, signals[IP4_CONFIG], 0, priv->ip_iface, config);
out:
- g_object_unref (config);
g_dbus_method_invocation_return_value (context, NULL);
}
@@ -496,7 +495,7 @@ impl_ppp_manager_set_ip6_config (NMPPPManager *manager,
GVariant *config_dict)
{
NMPPPManagerPrivate *priv = NM_PPP_MANAGER_GET_PRIVATE (manager);
- NMIP6Config *config;
+ gs_unref_object NMIP6Config *config = NULL;
NMPlatformIP6Address addr;
struct in6_addr a;
NMUtilsIPv6IfaceId iid = NM_UTILS_IPV6_IFACE_ID_INIT;
@@ -506,6 +505,9 @@ impl_ppp_manager_set_ip6_config (NMPPPManager *manager,
nm_clear_g_source (&priv->ppp_timeout_handler);
+ if (!set_ip_config_common (manager, config_dict, NM_PPP_IP6_CONFIG_INTERFACE, NULL))
+ goto out;
+
config = nm_ip6_config_new (nm_platform_get_multi_idx (NM_PLATFORM_GET),
nm_platform_link_get_ifindex (NM_PLATFORM_GET, priv->ip_iface));
@@ -523,14 +525,12 @@ impl_ppp_manager_set_ip6_config (NMPPPManager *manager,
addr.peer_address = addr.address;
nm_ip6_config_add_address (config, &addr);
- if (set_ip_config_common (manager, config_dict, NM_PPP_IP6_CONFIG_INTERFACE, NULL)) {
- /* Push the IPv6 config and interface identifier up to the device */
- g_signal_emit (manager, signals[IP6_CONFIG], 0, priv->ip_iface, &iid, config);
- }
+ /* Push the IPv6 config and interface identifier up to the device */
+ g_signal_emit (manager, signals[IP6_CONFIG], 0, priv->ip_iface, &iid, config);
} else
_LOGE ("invalid IPv6 address received!");
- g_object_unref (config);
+out:
g_dbus_method_invocation_return_value (context, NULL);
}