diff options
| author | Iain Lane <iain.lane@canonical.com> | 2018-10-03 09:30:23 +0100 |
|---|---|---|
| committer | Iain Lane <iain.lane@canonical.com> | 2018-10-03 09:33:16 +0100 |
| commit | 898733d427e7b640bab0ea0fa578b3224102fde2 (patch) | |
| tree | 91c16e4d9d2c363858d1c9ea8a937e0f2c25373a /src/nm-ip4-config.c | |
| parent | 9ba7891e6e49755ef4f3c9e3ef424a9ef06cf58c (diff) | |
| parent | eca0cfe89a2a7ec88abe9c03075160f46b338137 (diff) | |
Merge tag 'debian/1.12.4-1' into cosmic
network-manager Debian release 1.12.4-1
Diffstat (limited to 'src/nm-ip4-config.c')
| -rw-r--r-- | src/nm-ip4-config.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/nm-ip4-config.c b/src/nm-ip4-config.c index 6ae81b57..657ebfc0 100644 --- a/src/nm-ip4-config.c +++ b/src/nm-ip4-config.c @@ -646,6 +646,37 @@ nm_ip4_config_capture (NMDedupMultiIndex *multi_idx, NMPlatform *platform, int i } void +nm_ip4_config_update_routes_metric (NMIP4Config *self, gint64 metric) +{ + gs_free NMPlatformIP4Route *routes = NULL; + gboolean need_update = FALSE; + const NMPlatformIP4Route *r; + NMDedupMultiIter iter; + guint num = 0, i = 0; + + nm_ip_config_iter_ip4_route_for_each (&iter, self, &r) { + if (r->metric != metric) + need_update = TRUE; + num++; + } + if (!need_update) + return; + + routes = g_new (NMPlatformIP4Route, num); + nm_ip_config_iter_ip4_route_for_each (&iter, self, &r) { + routes[i] = *r; + routes[i].metric = metric; + i++; + } + + g_object_freeze_notify (G_OBJECT (self)); + nm_ip4_config_reset_routes (self); + for (i = 0; i < num; i++) + nm_ip4_config_add_route (self, &routes[i], NULL); + g_object_thaw_notify (G_OBJECT (self)); +} + +void nm_ip4_config_add_dependent_routes (NMIP4Config *self, guint32 route_table, guint32 route_metric, |