From ca24797261225e615e9e88745460649f32427983 Mon Sep 17 00:00:00 2001 From: Kevin Carter Date: Mon, 8 Oct 2018 11:59:24 -0500 Subject: [PATCH] Correct host only routes The host only route was adding the cidr twice which is wrong. This change adds the missing network filter to correct the issue. Change-Id: Ic280db301ce44b98ac35c8911999dec5fa263a29 Signed-off-by: Kevin Carter --- tasks/nspawn_networking.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/nspawn_networking.yml b/tasks/nspawn_networking.yml index b9c5bd6..30b5db7 100644 --- a/tasks/nspawn_networking.yml +++ b/tasks/nspawn_networking.yml @@ -106,7 +106,7 @@ {% elif (value.address is defined) and ((interface_data['ipv4'] | default({'address': none}))['address'] != value.address) and ((value.host_only | default(false)) | bool) %} {% set net_cidr = (value.address ~ '/' ~ (value.netmask | default('32'))) %} {% set _ = start_commands.append('-/sbin/ip address add ' ~ net_cidr ~ ' dev ' ~ mv_interface ~ ' scope host noprefixroute') %} - {% set _ = start_commands.append('-/sbin/ip route add ' ~ net_cidr ~ '/' ~ (value.netmask | default('32')) ~ ' dev ' ~ mv_interface ~ ' metric 100 proto kernel scope link table local') %} + {% set _ = start_commands.append('-/sbin/ip route add ' ~ (net_cidr | ipaddr('network')) ~ '/' ~ (value.netmask | default('32')) ~ ' dev ' ~ mv_interface ~ ' metric 100 proto kernel scope link table local') %} {%- endif %} {%- endif %} {%- endif %}