summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2015-01-19 18:33:10 +0100
committerLubomir Rintel <lkundrak@v3.sk>2015-02-27 16:48:27 +0100
commit747292a4c3c9c7de700a9527e8de2a01816f50fd (patch)
tree83c24955f49e0e0a45474b5b9e87080e669dd55c
parent874e4a7595ac11e53e333dcdd0ad988a47391cc9 (diff)
downloadNetworkManager-747292a4c3c9c7de700a9527e8de2a01816f50fd.tar.gz
ip4-config: keep track of ifindex
No functional change, a cosmetic thing for now. We want it set before any routes are added and ensure routes have a valid ifindex before we pass it to the platform. In a future NMRouteManager will need to look up the route for a device in its cache thus we'll need to make sure routes passed to the it have an appropriate ifindex set.
-rw-r--r--src/devices/bluetooth/nm-device-bt.c4
-rw-r--r--src/devices/nm-device.c8
-rw-r--r--src/devices/wwan/nm-device-modem.c1
-rw-r--r--src/dhcp-manager/nm-dhcp-client.c3
-rw-r--r--src/dhcp-manager/nm-dhcp-systemd.c8
-rw-r--r--src/dhcp-manager/nm-dhcp-utils.c4
-rw-r--r--src/dhcp-manager/nm-dhcp-utils.h3
-rw-r--r--src/dhcp-manager/tests/test-dhcp-utils.c34
-rw-r--r--src/nm-iface-helper.c1
-rw-r--r--src/nm-ip4-config.c23
-rw-r--r--src/nm-ip4-config.h1
-rw-r--r--src/ppp-manager/nm-ppp-manager.c1
-rw-r--r--src/tests/test-ip4-config.c5
-rw-r--r--src/vpn-manager/nm-vpn-connection.c5
14 files changed, 74 insertions, 27 deletions
diff --git a/src/devices/bluetooth/nm-device-bt.c b/src/devices/bluetooth/nm-device-bt.c
index 61371dddec..af466e5347 100644
--- a/src/devices/bluetooth/nm-device-bt.c
+++ b/src/devices/bluetooth/nm-device-bt.c
@@ -498,8 +498,10 @@ modem_ip4_config_result (NMModem *modem,
error->code, error->message ? error->message : "(unknown)");
nm_device_state_changed (device, NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_REASON_IP_CONFIG_UNAVAILABLE);
- } else
+ } else {
+ nm_ip4_config_set_ifindex (config, nm_device_get_ifindex (device));
nm_device_activate_schedule_ip4_config_result (device, config);
+ }
}
static void
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index a54a141fa2..2ab5a3b33d 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -2614,6 +2614,7 @@ aipd_get_ip4_config (NMDevice *self, guint32 lla)
NMPlatformIP4Route route;
config = nm_ip4_config_new ();
+ nm_ip4_config_set_ifindex (config, nm_device_get_ifindex (self));
g_assert (config);
memset (&address, 0, sizeof (address));
@@ -2875,6 +2876,8 @@ ensure_con_ipx_config (NMDevice *self)
priv->con_ip4_config = nm_ip4_config_new ();
priv->con_ip6_config = nm_ip6_config_new ();
+ nm_ip4_config_set_ifindex (priv->con_ip4_config, nm_device_get_ifindex (self));
+
nm_ip4_config_merge_setting (priv->con_ip4_config,
nm_connection_get_setting_ip4_config (connection),
nm_device_get_ip4_route_metric (self));
@@ -2942,6 +2945,7 @@ ip4_config_merge_and_apply (NMDevice *self,
}
composite = nm_ip4_config_new ();
+ nm_ip4_config_set_ifindex (composite, nm_device_get_ifindex (self));
ensure_con_ipx_config (self);
@@ -3296,6 +3300,7 @@ shared4_new_config (NMDevice *self, NMConnection *connection, NMDeviceStateReaso
}
config = nm_ip4_config_new ();
+ nm_ip4_config_set_ifindex (config, nm_device_get_ifindex (self));
address.source = NM_IP_CONFIG_SOURCE_SHARED;
nm_ip4_config_add_address (config, &address);
@@ -3456,6 +3461,7 @@ act_stage3_ip4_config_start (NMDevice *self,
else if (strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_MANUAL) == 0) {
/* Use only IPv4 config from the connection data */
*out_config = nm_ip4_config_new ();
+ nm_ip4_config_set_ifindex (*out_config, nm_device_get_ifindex (self));
g_assert (*out_config);
ret = NM_ACT_STAGE_RETURN_SUCCESS;
} else if (strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_SHARED) == 0) {
@@ -6565,6 +6571,7 @@ find_ip4_lease_config (NMDevice *self,
NMIP4Config *ext_ip4_config)
{
const char *ip_iface = nm_device_get_ip_iface (self);
+ int ifindex = nm_device_get_ifindex (self);
GSList *leases, *liter;
NMIP4Config *found = NULL;
@@ -6587,6 +6594,7 @@ find_ip4_lease_config (NMDevice *self,
if (gateway != nm_ip4_config_get_gateway (ext_ip4_config))
continue;
found = g_object_ref (lease_config);
+ nm_ip4_config_set_ifindex (found, ifindex);
}
g_slist_free_full (leases, g_object_unref);
diff --git a/src/devices/wwan/nm-device-modem.c b/src/devices/wwan/nm-device-modem.c
index f819d1d774..ebf6fc3fe9 100644
--- a/src/devices/wwan/nm-device-modem.c
+++ b/src/devices/wwan/nm-device-modem.c
@@ -165,6 +165,7 @@ modem_ip4_config_result (NMModem *modem,
nm_device_state_changed (device, NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_REASON_IP_CONFIG_UNAVAILABLE);
} else {
+ nm_ip4_config_set_ifindex (config, nm_device_get_ifindex (device));
nm_device_set_wwan_ip4_config (device, config);
nm_device_activate_schedule_ip4_config_result (device, NULL);
}
diff --git a/src/dhcp-manager/nm-dhcp-client.c b/src/dhcp-manager/nm-dhcp-client.c
index a39ffcca0d..f33369bb38 100644
--- a/src/dhcp-manager/nm-dhcp-client.c
+++ b/src/dhcp-manager/nm-dhcp-client.c
@@ -763,7 +763,8 @@ nm_dhcp_client_handle_event (gpointer unused,
priv->priority,
priv->info_only);
} else {
- ip_config = (GObject *) nm_dhcp_utils_ip4_config_from_options (priv->iface,
+ ip_config = (GObject *) nm_dhcp_utils_ip4_config_from_options (priv->ifindex,
+ priv->iface,
str_options,
priv->priority);
}
diff --git a/src/dhcp-manager/nm-dhcp-systemd.c b/src/dhcp-manager/nm-dhcp-systemd.c
index 12dc03cc84..f3669bf8d4 100644
--- a/src/dhcp-manager/nm-dhcp-systemd.c
+++ b/src/dhcp-manager/nm-dhcp-systemd.c
@@ -206,7 +206,8 @@ G_STMT_START { \
} G_STMT_END
static NMIP4Config *
-lease_to_ip4_config (sd_dhcp_lease *lease,
+lease_to_ip4_config (const char *iface,
+ sd_dhcp_lease *lease,
GHashTable *options,
guint32 default_priority,
gboolean log_lease,
@@ -387,7 +388,7 @@ nm_dhcp_systemd_get_lease_ip_configs (const char *iface,
path = get_leasefile_path (iface, uuid, FALSE);
r = sd_dhcp_lease_load (&lease, path);
if (r == 0 && lease) {
- ip4_config = lease_to_ip4_config (lease, NULL, default_route_metric, FALSE, NULL);
+ ip4_config = lease_to_ip4_config (iface, lease, NULL, default_route_metric, FALSE, NULL);
if (ip4_config)
leases = g_slist_append (leases, ip4_config);
}
@@ -440,7 +441,8 @@ bound4_handle (NMDhcpSystemd *self)
}
options = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_free);
- ip4_config = lease_to_ip4_config (lease,
+ ip4_config = lease_to_ip4_config (iface,
+ lease,
options,
nm_dhcp_client_get_priority (NM_DHCP_CLIENT (self)),
TRUE,
diff --git a/src/dhcp-manager/nm-dhcp-utils.c b/src/dhcp-manager/nm-dhcp-utils.c
index 8cd4359abb..b245bb98f1 100644
--- a/src/dhcp-manager/nm-dhcp-utils.c
+++ b/src/dhcp-manager/nm-dhcp-utils.c
@@ -374,7 +374,8 @@ ip4_add_domain_search (gpointer data, gpointer user_data)
}
NMIP4Config *
-nm_dhcp_utils_ip4_config_from_options (const char *iface,
+nm_dhcp_utils_ip4_config_from_options (int ifindex,
+ const char *iface,
GHashTable *options,
guint32 priority)
{
@@ -387,6 +388,7 @@ nm_dhcp_utils_ip4_config_from_options (const char *iface,
g_return_val_if_fail (options != NULL, NULL);
ip4_config = nm_ip4_config_new ();
+ nm_ip4_config_set_ifindex (ip4_config, ifindex);
memset (&address, 0, sizeof (address));
address.timestamp = nm_utils_get_monotonic_timestamp_s ();
diff --git a/src/dhcp-manager/nm-dhcp-utils.h b/src/dhcp-manager/nm-dhcp-utils.h
index a01cf4c267..d9af46a58a 100644
--- a/src/dhcp-manager/nm-dhcp-utils.h
+++ b/src/dhcp-manager/nm-dhcp-utils.h
@@ -24,7 +24,8 @@
#include <nm-ip4-config.h>
#include <nm-ip6-config.h>
-NMIP4Config *nm_dhcp_utils_ip4_config_from_options (const char *iface,
+NMIP4Config *nm_dhcp_utils_ip4_config_from_options (int ifindex,
+ const char *iface,
GHashTable *options,
guint priority);
diff --git a/src/dhcp-manager/tests/test-dhcp-utils.c b/src/dhcp-manager/tests/test-dhcp-utils.c
index 4ff8caad77..961bd8a2ed 100644
--- a/src/dhcp-manager/tests/test-dhcp-utils.c
+++ b/src/dhcp-manager/tests/test-dhcp-utils.c
@@ -88,7 +88,7 @@ test_generic_options (void)
const char *expected_route2_gw = "10.1.1.1";
options = fill_table (generic_options, NULL);
- ip4_config = nm_dhcp_utils_ip4_config_from_options ("eth0", options, 0);
+ ip4_config = nm_dhcp_utils_ip4_config_from_options (1, "eth0", options, 0);
g_assert (ip4_config);
/* IP4 address */
@@ -159,7 +159,7 @@ test_wins_options (void)
options = fill_table (generic_options, NULL);
options = fill_table (data, options);
- ip4_config = nm_dhcp_utils_ip4_config_from_options ("eth0", options, 0);
+ ip4_config = nm_dhcp_utils_ip4_config_from_options (1, "eth0", options, 0);
g_assert (ip4_config);
/* IP4 address */
@@ -221,7 +221,7 @@ test_classless_static_routes_1 (void)
options = fill_table (generic_options, NULL);
options = fill_table (data, options);
- ip4_config = nm_dhcp_utils_ip4_config_from_options ("eth0", options, 0);
+ ip4_config = nm_dhcp_utils_ip4_config_from_options (1, "eth0", options, 0);
g_assert (ip4_config);
/* IP4 routes */
@@ -249,7 +249,7 @@ test_classless_static_routes_2 (void)
options = fill_table (generic_options, NULL);
options = fill_table (data, options);
- ip4_config = nm_dhcp_utils_ip4_config_from_options ("eth0", options, 0);
+ ip4_config = nm_dhcp_utils_ip4_config_from_options (1, "eth0", options, 0);
g_assert (ip4_config);
/* IP4 routes */
@@ -278,7 +278,7 @@ test_fedora_dhclient_classless_static_routes (void)
options = fill_table (generic_options, NULL);
options = fill_table (data, options);
- ip4_config = nm_dhcp_utils_ip4_config_from_options ("eth0", options, 0);
+ ip4_config = nm_dhcp_utils_ip4_config_from_options (1, "eth0", options, 0);
g_assert (ip4_config);
/* IP4 routes */
@@ -310,7 +310,7 @@ test_dhclient_invalid_classless_routes_1 (void)
g_test_expect_message ("NetworkManager", G_LOG_LEVEL_WARNING,
"*ignoring invalid classless static routes*");
- ip4_config = nm_dhcp_utils_ip4_config_from_options ("eth0", options, 0);
+ ip4_config = nm_dhcp_utils_ip4_config_from_options (1, "eth0", options, 0);
g_assert (ip4_config);
g_test_assert_expected_messages ();
@@ -341,7 +341,7 @@ test_dhcpcd_invalid_classless_routes_1 (void)
g_test_expect_message ("NetworkManager", G_LOG_LEVEL_WARNING,
"*ignoring invalid classless static routes*");
- ip4_config = nm_dhcp_utils_ip4_config_from_options ("eth0", options, 0);
+ ip4_config = nm_dhcp_utils_ip4_config_from_options (1, "eth0", options, 0);
g_assert (ip4_config);
g_test_assert_expected_messages ();
@@ -374,7 +374,7 @@ test_dhclient_invalid_classless_routes_2 (void)
g_test_expect_message ("NetworkManager", G_LOG_LEVEL_WARNING,
"*ignoring invalid classless static routes*");
- ip4_config = nm_dhcp_utils_ip4_config_from_options ("eth0", options, 0);
+ ip4_config = nm_dhcp_utils_ip4_config_from_options (1, "eth0", options, 0);
g_assert (ip4_config);
g_test_assert_expected_messages ();
@@ -407,7 +407,7 @@ test_dhcpcd_invalid_classless_routes_2 (void)
g_test_expect_message ("NetworkManager", G_LOG_LEVEL_WARNING,
"*ignoring invalid classless static routes*");
- ip4_config = nm_dhcp_utils_ip4_config_from_options ("eth0", options, 0);
+ ip4_config = nm_dhcp_utils_ip4_config_from_options (1, "eth0", options, 0);
g_assert (ip4_config);
g_test_assert_expected_messages ();
@@ -440,7 +440,7 @@ test_dhclient_invalid_classless_routes_3 (void)
g_test_expect_message ("NetworkManager", G_LOG_LEVEL_WARNING,
"*ignoring invalid classless static routes*");
- ip4_config = nm_dhcp_utils_ip4_config_from_options ("eth0", options, 0);
+ ip4_config = nm_dhcp_utils_ip4_config_from_options (1, "eth0", options, 0);
g_assert (ip4_config);
g_test_assert_expected_messages ();
@@ -468,7 +468,7 @@ test_dhcpcd_invalid_classless_routes_3 (void)
g_test_expect_message ("NetworkManager", G_LOG_LEVEL_WARNING,
"*DHCP provided invalid classless static route*");
- ip4_config = nm_dhcp_utils_ip4_config_from_options ("eth0", options, 0);
+ ip4_config = nm_dhcp_utils_ip4_config_from_options (1, "eth0", options, 0);
g_assert (ip4_config);
g_test_assert_expected_messages ();
@@ -494,7 +494,7 @@ test_dhclient_gw_in_classless_routes (void)
options = fill_table (generic_options, NULL);
options = fill_table (data, options);
- ip4_config = nm_dhcp_utils_ip4_config_from_options ("eth0", options, 0);
+ ip4_config = nm_dhcp_utils_ip4_config_from_options (1, "eth0", options, 0);
g_assert (ip4_config);
/* IP4 routes */
@@ -522,7 +522,7 @@ test_dhcpcd_gw_in_classless_routes (void)
options = fill_table (generic_options, NULL);
options = fill_table (data, options);
- ip4_config = nm_dhcp_utils_ip4_config_from_options ("eth0", options, 0);
+ ip4_config = nm_dhcp_utils_ip4_config_from_options (1, "eth0", options, 0);
g_assert (ip4_config);
/* IP4 routes */
@@ -550,7 +550,7 @@ test_escaped_domain_searches (void)
options = fill_table (generic_options, NULL);
options = fill_table (data, options);
- ip4_config = nm_dhcp_utils_ip4_config_from_options ("eth0", options, 0);
+ ip4_config = nm_dhcp_utils_ip4_config_from_options (1, "eth0", options, 0);
g_assert (ip4_config);
/* domain searches */
@@ -577,7 +577,7 @@ test_invalid_escaped_domain_searches (void)
g_test_expect_message ("NetworkManager", G_LOG_LEVEL_WARNING,
"*invalid domain search*");
- ip4_config = nm_dhcp_utils_ip4_config_from_options ("eth0", options, 0);
+ ip4_config = nm_dhcp_utils_ip4_config_from_options (1, "eth0", options, 0);
g_assert (ip4_config);
g_test_assert_expected_messages ();
@@ -598,7 +598,7 @@ test_ip4_missing_prefix (const char *ip, guint32 expected_prefix)
g_hash_table_insert (options, "ip_address", (gpointer) ip);
g_hash_table_remove (options, "subnet_mask");
- ip4_config = nm_dhcp_utils_ip4_config_from_options ("eth0", options, 0);
+ ip4_config = nm_dhcp_utils_ip4_config_from_options (1, "eth0", options, 0);
g_assert (ip4_config);
g_assert_cmpint (nm_ip4_config_get_num_addresses (ip4_config), ==, 1);
@@ -643,7 +643,7 @@ test_ip4_prefix_classless (void)
g_hash_table_insert (options, "ip_address", "172.16.54.22");
g_hash_table_insert (options, "subnet_mask", "255.255.252.0");
- ip4_config = nm_dhcp_utils_ip4_config_from_options ("eth0", options, 0);
+ ip4_config = nm_dhcp_utils_ip4_config_from_options (1, "eth0", options, 0);
g_assert (ip4_config);
g_assert_cmpint (nm_ip4_config_get_num_addresses (ip4_config), ==, 1);
diff --git a/src/nm-iface-helper.c b/src/nm-iface-helper.c
index 97678aa1e8..9590dda522 100644
--- a/src/nm-iface-helper.c
+++ b/src/nm-iface-helper.c
@@ -87,6 +87,7 @@ dhcp4_state_changed (NMDhcpClient *client,
if (last_config) {
g_object_unref (last_config);
last_config = nm_ip4_config_new ();
+ nm_ip4_config_set_ifindex (last_config, nm_dhcp_client_get_ifindex (client));
nm_ip4_config_replace (last_config, ip4_config, NULL);
}
break;
diff --git a/src/nm-ip4-config.c b/src/nm-ip4-config.c
index 771086851e..77bbe223e8 100644
--- a/src/nm-ip4-config.c
+++ b/src/nm-ip4-config.c
@@ -55,6 +55,7 @@ typedef struct {
GArray *wins;
guint32 mtu;
NMIPConfigSource mtu_source;
+ int ifindex;
} NMIP4ConfigPrivate;
/* internal guint32 are assigned to gobject properties of type uint. Ensure, that uint is large enough */
@@ -78,13 +79,22 @@ enum {
static GParamSpec *obj_properties[LAST_PROP] = { NULL, };
#define _NOTIFY(config, prop) G_STMT_START { g_object_notify_by_pspec (G_OBJECT (config), obj_properties[prop]); } G_STMT_END
-
NMIP4Config *
-nm_ip4_config_new (void)
+nm_ip4_config_new ()
{
return (NMIP4Config *) g_object_new (NM_TYPE_IP4_CONFIG, NULL);
}
+void
+nm_ip4_config_set_ifindex (NMIP4Config *config, int ifindex)
+{
+ NMIP4ConfigPrivate *priv = NM_IP4_CONFIG_GET_PRIVATE (config);
+
+ g_return_if_fail (priv->ifindex == 0);
+ g_assert (priv->routes->len == 0);
+
+ priv->ifindex = ifindex;
+}
void
nm_ip4_config_export (NMIP4Config *config)
@@ -191,6 +201,7 @@ nm_ip4_config_capture (int ifindex, gboolean capture_resolv_conf)
return NULL;
config = nm_ip4_config_new ();
+ nm_ip4_config_set_ifindex (config, ifindex);
priv = NM_IP4_CONFIG_GET_PRIVATE (config);
g_array_unref (priv->addresses);
@@ -825,6 +836,12 @@ nm_ip4_config_replace (NMIP4Config *dst, const NMIP4Config *src, gboolean *relev
g_object_freeze_notify (G_OBJECT (dst));
+ /* ifindex */
+ if (src_priv->ifindex != dst_priv->ifindex) {
+ nm_ip4_config_set_ifindex (dst, src_priv->ifindex);
+ has_minor_changes = TRUE;
+ }
+
/* never_default */
if (src_priv->never_default != dst_priv->never_default) {
dst_priv->never_default = src_priv->never_default;
@@ -1266,6 +1283,7 @@ nm_ip4_config_add_route (NMIP4Config *config, const NMPlatformIP4Route *new)
g_return_if_fail (new != NULL);
g_return_if_fail (new->plen > 0);
+ g_assert (priv->ifindex);
for (i = 0; i < priv->routes->len; i++ ) {
NMPlatformIP4Route *item = &g_array_index (priv->routes, NMPlatformIP4Route, i);
@@ -1282,6 +1300,7 @@ nm_ip4_config_add_route (NMIP4Config *config, const NMPlatformIP4Route *new)
}
g_array_append_val (priv->routes, *new);
+ g_array_index (priv->routes, NMPlatformIP4Route, priv->routes->len - 1).ifindex = priv->ifindex;
NOTIFY:
_NOTIFY (config, PROP_ROUTE_DATA);
_NOTIFY (config, PROP_ROUTES);
diff --git a/src/nm-ip4-config.h b/src/nm-ip4-config.h
index 2b3b24e6af..d2a1c1ffca 100644
--- a/src/nm-ip4-config.h
+++ b/src/nm-ip4-config.h
@@ -57,6 +57,7 @@ GType nm_ip4_config_get_type (void);
NMIP4Config * nm_ip4_config_new (void);
+void nm_ip4_config_set_ifindex (NMIP4Config *config, int ifindex);
/* D-Bus integration */
void nm_ip4_config_export (NMIP4Config *config);
diff --git a/src/ppp-manager/nm-ppp-manager.c b/src/ppp-manager/nm-ppp-manager.c
index f0b8bbcb93..9efb95e452 100644
--- a/src/ppp-manager/nm-ppp-manager.c
+++ b/src/ppp-manager/nm-ppp-manager.c
@@ -547,6 +547,7 @@ impl_ppp_manager_set_ip4_config (NMPPPManager *manager,
remove_timeout_handler (manager);
config = nm_ip4_config_new ();
+ nm_ip4_config_set_ifindex (config, nm_platform_link_get_ifindex (priv->ip_iface));
memset (&address, 0, sizeof (address));
address.plen = 32;
diff --git a/src/tests/test-ip4-config.c b/src/tests/test-ip4-config.c
index 657f7e05b9..be13422063 100644
--- a/src/tests/test-ip4-config.c
+++ b/src/tests/test-ip4-config.c
@@ -72,6 +72,7 @@ build_test_config (void)
/* Build up the config to subtract */
config = nm_ip4_config_new ();
+ nm_ip4_config_set_ifindex (config, 1);
addr_init (&addr, "192.168.1.10", "1.2.3.4", 24);
nm_ip4_config_add_address (config, &addr);
@@ -192,7 +193,9 @@ test_compare_with_source (void)
NMPlatformIP4Route route;
a = nm_ip4_config_new ();
+ nm_ip4_config_set_ifindex (a, 1);
b = nm_ip4_config_new ();
+ nm_ip4_config_set_ifindex (b, 2);
/* Address */
addr_init (&addr, "1.2.3.4", NULL, 24);
@@ -225,6 +228,7 @@ test_add_address_with_source (void)
const NMPlatformIP4Address *test_addr;
a = nm_ip4_config_new ();
+ nm_ip4_config_set_ifindex (a, 1);
/* Test that a higher priority source is not overwritten */
addr_init (&addr, "1.2.3.4", NULL, 24);
@@ -265,6 +269,7 @@ test_add_route_with_source (void)
const NMPlatformIP4Route *test_route;
a = nm_ip4_config_new ();
+ nm_ip4_config_set_ifindex (a, 1);
/* Test that a higher priority source is not overwritten */
route_new (&route, "1.2.3.4", 24, "1.2.3.1");
diff --git a/src/vpn-manager/nm-vpn-connection.c b/src/vpn-manager/nm-vpn-connection.c
index c13191ef0c..fc2738ad90 100644
--- a/src/vpn-manager/nm-vpn-connection.c
+++ b/src/vpn-manager/nm-vpn-connection.c
@@ -893,8 +893,10 @@ apply_parent_device_config (NMVpnConnection *connection)
NMIP4Config *vpn4_parent_config = NULL;
NMIP6Config *vpn6_parent_config = NULL;
- if (priv->ip4_config)
+ if (priv->ip4_config) {
vpn4_parent_config = nm_ip4_config_new ();
+ nm_ip4_config_set_ifindex (vpn4_parent_config, priv->ip_ifindex);
+ }
if (priv->ip6_config)
vpn6_parent_config = nm_ip6_config_new ();
@@ -1191,6 +1193,7 @@ nm_vpn_connection_ip4_config_get (DBusGProxy *proxy,
}
config = nm_ip4_config_new ();
+ nm_ip4_config_set_ifindex (config, priv->ip_ifindex);
memset (&address, 0, sizeof (address));
address.plen = 24;