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.
This commit is contained in:
Lubomir Rintel
2015-01-19 18:33:10 +01:00
parent 874e4a7595
commit 747292a4c3
14 changed files with 74 additions and 27 deletions

View File

@@ -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,