From a947803e282248a5e6c967f3546378ddfac1a0a3 Mon Sep 17 00:00:00 2001 From: Tobias Hachmer Date: Tue, 6 Feb 2018 06:00:01 +0100 Subject: [PATCH] Revert "Role network-routing: move interface specific routes to role network-meshbridge" This reverts commit d3298d4a3c547002f6d712941c4eb7f97b358013. --- roles/network-meshbridge/templates/bridge.j2 | 17 ----------------- .../templates/ffmwu-add-static-routes.sh.j2 | 15 +++++++++++++++ .../templates/ffmwu-del-static-routes.sh.j2 | 15 +++++++++++++++ 3 files changed, 30 insertions(+), 17 deletions(-) diff --git a/roles/network-meshbridge/templates/bridge.j2 b/roles/network-meshbridge/templates/bridge.j2 index f499491..984d3ac 100644 --- a/roles/network-meshbridge/templates/bridge.j2 +++ b/roles/network-meshbridge/templates/bridge.j2 @@ -14,20 +14,3 @@ iface {{ item.id }}br address {{ prefix | ipaddr('net') | ipsubnet(64, 0) | ipaddr(magic) | ipaddr('ip/prefix') }} {% endfor %} bridge-ports {{ item.id }}bat - # static routes for rt_table mwu - post-up /sbin/ip -4 route add {{ item.ipv4_network }} proto static dev $IFACE table mwu -{% for ula in item.ipv6_ula %} - post-up /sbin/ip -6 route add {{ ula | ipaddr('net') | ipsubnet(64, 0) | ipaddr('subnet') }} proto static dev $IFACE table mwu -{% endfor %} -{% for public in item.ipv6_public %} - post-up /sbin/ip -6 route add {{ public | ipaddr('net') | ipsubnet(64, 0) | ipaddr('subnet') }} proto static dev $IFACE table mwu - post-up /sbin/ip -6 route add {{ public | ipaddr('net') | ipsubnet(56, magic) | ipsubnet(64, 0) | ipaddr('subnet') }} proto static dev $IFACE table mwu -{% endfor %} - pre-down /sbin/ip -4 route del {{ item.ipv4_network }} proto static dev $IFACE table mwu -{% for ula in item.ipv6_ula %} - pre-down /sbin/ip -6 route del {{ ula | ipaddr('net') | ipsubnet(64, 0) | ipaddr('subnet') }} proto static dev $IFACE table mwu -{% endfor %} -{% for public in item.ipv6_public %} - pre-down /sbin/ip -6 route del {{ public | ipaddr('net') | ipsubnet(64, 0) | ipaddr('subnet') }} proto static dev $IFACE table mwu - pre-down /sbin/ip -6 route del {{ public | ipaddr('net') | ipsubnet(56, magic) | ipsubnet(64, 0) | ipaddr('subnet') }} proto static dev $IFACE table mwu -{% endfor %} diff --git a/roles/network-routing/templates/ffmwu-add-static-routes.sh.j2 b/roles/network-routing/templates/ffmwu-add-static-routes.sh.j2 index 02f37b9..07834e8 100644 --- a/roles/network-routing/templates/ffmwu-add-static-routes.sh.j2 +++ b/roles/network-routing/templates/ffmwu-add-static-routes.sh.j2 @@ -3,6 +3,21 @@ # {{ ansible_managed }} # +{% for mesh in meshes %} +# static {{ mesh.site_name }} routes for rt_table mwu +/sbin/ip -4 route add {{ mesh.ipv4_network }} proto static dev {{ mesh.id }}br table mwu +{% for ula in mesh.ipv6_ula %} +/sbin/ip -6 route add {{ ula | ipaddr('net') | ipsubnet(64, 0) | ipaddr('subnet') }} proto static dev {{ mesh.id }}br table mwu +{% endfor %} +{% for public in mesh.ipv6_public %} +/sbin/ip -6 route add {{ public | ipaddr('net') | ipsubnet(64, 0) | ipaddr('subnet') }} proto static dev {{ mesh.id }}br table mwu +/sbin/ip -6 route add {{ public | ipaddr('net') | ipsubnet(56, magic) | ipsubnet(64, 0) | ipaddr('subnet') }} proto static dev {{ mesh.id }}br table mwu +{% endfor %} +{% if not loop.last %} + +{% endif %} +{% endfor %} + # static blackhole routes for rt_table internet /sbin/ip -4 route add blackhole 0.0.0.0/8 table internet /sbin/ip -4 route add blackhole 10.0.0.0/8 table internet diff --git a/roles/network-routing/templates/ffmwu-del-static-routes.sh.j2 b/roles/network-routing/templates/ffmwu-del-static-routes.sh.j2 index 572f983..1a71a32 100644 --- a/roles/network-routing/templates/ffmwu-del-static-routes.sh.j2 +++ b/roles/network-routing/templates/ffmwu-del-static-routes.sh.j2 @@ -3,6 +3,21 @@ # {{ ansible_managed }} # +{% for mesh in meshes %} +# static {{ mesh.site_name }} routes for rt_table mwu +/sbin/ip -4 route del {{ mesh.ipv4_network }} proto static dev {{ mesh.id }}br table mwu +{% for ula in mesh.ipv6_ula %} +/sbin/ip -6 route del {{ ula | ipaddr('net') | ipsubnet(64, 0) }} proto static dev {{ mesh.id }}br table mwu +{% endfor %} +{% for public in mesh.ipv6_public %} +/sbin/ip -6 route del {{ public | ipaddr('net') | ipsubnet(64, 0) }} proto static dev {{ mesh.id }}br table mwu +/sbin/ip -6 route del {{ public | ipaddr('net') | ipsubnet(64, magic) }} proto static dev {{ mesh.id }}br table mwu +{% endfor %} +{% if not loop.last %} + +{% endif %} +{% endfor %} + # static blackhole routes for rt_table internet /sbin/ip -4 route del blackhole 0.0.0.0/8 table internet /sbin/ip -4 route del blackhole 10.0.0.0/8 table internet