Set a route metric when static routes are used

When using a static route we need to set a route metric to ensure the
priority of the routes being passed in. This change ensures we maintain
our expected interface and functionality should any static routes be
passed into the container.

Before the implementation of networkd, EIN would amend the main table
with the defined routes in the order they were written. However
systemd-networkd inserts the defined routes at the top of the default
table which can cause confusion and conflict. This change simply adds
a route metric to all defined routes and increments the metric integer
based on the list index which explicitly ensures all defined routes
are prioritized in the order in which they were written.

Change-Id: I13768580fbd926033fde4a74cbbf90b9eda24658
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
This commit is contained in:
Kevin Carter 2018-03-02 23:17:30 -06:00
parent dde887a2e1
commit aee117fc09
No known key found for this signature in database
GPG Key ID: 9443251A787B9FB3
1 changed files with 1 additions and 0 deletions

View File

@ -16,6 +16,7 @@ RouteMetric=20
[Route]
Source={{ route['cidr'] }}
Gateway={{ route['gateway'] }}
Metric={{ 20 + loop.index }}
{% endfor %}