diff options
| author | Michael Biebl <biebl@debian.org> | 2017-07-12 17:58:09 +0200 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2017-07-12 17:58:09 +0200 |
| commit | 1c106aa806930113c6773992fa4ddce13e295ead (patch) | |
| tree | 2242b717e4060d33794b94d9c45f81e4007e3a3f /src/nm-ip4-config.c | |
| parent | eb2473a843f46fae54f981c822fcace18d8f6fdf (diff) | |
| parent | b9f0451fa35393ceedf6d9d20b78c43578ebea5d (diff) | |
Updated version 1.8.2 from 'upstream/1.8.2'
with Debian dir 0d04ce142632bf08356d8d906289b6fc2de9e7c1
Diffstat (limited to 'src/nm-ip4-config.c')
| -rw-r--r-- | src/nm-ip4-config.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/nm-ip4-config.c b/src/nm-ip4-config.c index 20532e86..ae6af9c3 100644 --- a/src/nm-ip4-config.c +++ b/src/nm-ip4-config.c @@ -248,6 +248,16 @@ notify_addresses (NMIP4Config *self) _notify (self, PROP_ADDRESSES); } +static gint +sort_captured_addresses (gconstpointer a, gconstpointer b) +{ + const NMPlatformIP4Address *addr_a = a, *addr_b = b; + + /* Primary addresses first */ + return NM_FLAGS_HAS (addr_a->n_ifa_flags, IFA_F_SECONDARY) - + NM_FLAGS_HAS (addr_b->n_ifa_flags, IFA_F_SECONDARY); +} + NMIP4Config * nm_ip4_config_capture (NMPlatform *platform, int ifindex, gboolean capture_resolv_conf) { @@ -269,6 +279,8 @@ nm_ip4_config_capture (NMPlatform *platform, int ifindex, gboolean capture_resol g_array_unref (priv->routes); priv->addresses = nm_platform_ip4_address_get_all (platform, ifindex); + g_array_sort (priv->addresses, sort_captured_addresses); + priv->routes = nm_platform_ip4_route_get_all (platform, ifindex, NM_PLATFORM_GET_ROUTE_FLAGS_WITH_DEFAULT | NM_PLATFORM_GET_ROUTE_FLAGS_WITH_NON_DEFAULT); /* Extract gateway from default route */ |