route-manager: refactor route-manager and route_sync()

System Internals / NetworkManager - Thomas Haller [redhat.com] - 8 April 2015 07:50 UTC

Refactor the implementation of nm_route_manager_ip4_route_sync() and nm_route_manager_ip6_route_sync().

- merge the implementations for IPv4 and IPv6.

- pre-sort the routes and iterate them in a way that we don't need to lookup a route in other lists. Do this by iterating two sorted lists at a time in a merge-sort way. The runtime complexity of sync is now O(n*ln(n)).

- previously, the algorithm would merge routes it found in platform to priv->ipx_routes. That was wrong, because then we loose the information which routes we wanted to configure internally and which are present externally. Instead, priv->ipx_routes now contains all the routes that were explicitly configured via sync(). Hence, it knows what should be configured (@ipx_routes) and can compare to what is configured (@plat_routes).

https://bugzilla.gnome.org/show_bug.cgi?id=740064

62c652c route-manager: refactor route-manager and route_sync()
src/nm-route-manager.c | 779 ++++++++++++++++++++++++++++------------
src/tests/test-route-manager.c | 32 +-
2 files changed, 546 insertions(+), 265 deletions(-)

Upstream: cgit.freedesktop.org


  • Share