core: fix matching of default metric value for static routes
authorBeniamino Galvani <bgalvani@redhat.com>
Mon, 1 Feb 2016 13:16:30 +0000 (14:16 +0100)
committerBeniamino Galvani <bgalvani@redhat.com>
Thu, 11 Feb 2016 20:57:45 +0000 (21:57 +0100)
commit08c3378f6499c7c1d863f70d06938a765b466daf
tree353d2f440dfd4544a9a1d55e8bdf073e29747995
parent8682bb7f5f59824a46f36f9ea6ab36fd5e02ca74
core: fix matching of default metric value for static routes

When NM tries to match a generated connection to a persistent one, it
considers also the metric of static routes. However, if the field is
set to -1 (use default value for the device) on the persistent
connection, the comparison will always fail because the generated
connection contains the actual value read from kernel.

To fix the issue, modify check_possible_match() to deal correctly with
-1 and translate it to the expected value for the current device when
performing the comparison.

This allows connections with static routes and default metric to
properly be re-assumed when NM is restarted.

https://bugzilla.redhat.com/show_bug.cgi?id=1302532
src/NetworkManagerUtils.c
src/NetworkManagerUtils.h
src/nm-manager.c
src/tests/test-general.c