Fix load balancers using IPv6 for the VIP subnet

Fixes the PBR commands used when an IPv6 subnet is used for the VIP subnet.

Change-Id: I8f4b07ec8ad8f6a78e26acb18a10120f212d65d3
Story: 2001544
Task: 6358
This commit is contained in:
Michael Johnson 2018-02-15 09:54:53 -08:00
parent 26b0802ace
commit 8cca5deab3
2 changed files with 20 additions and 20 deletions

View File

@ -42,12 +42,12 @@ broadcast {{ broadcast }}
netmask {{ netmask }}
# Add a source routing table to allow members to access the VIP
{%- if gateway %}
post-up /sbin/ip route add default via {{ gateway }} dev {{ interface }} onlink table 1
post-down /sbin/ip route del default via {{ gateway }} dev {{ interface }} onlink table 1
post-up /sbin/ip {{ '-6 ' if vip_ipv6 }}route add default via {{ gateway }} dev {{ interface }} onlink table 1
post-down /sbin/ip {{ '-6 ' if vip_ipv6 }}route del default via {{ gateway }} dev {{ interface }} onlink table 1
{%- endif %}
{%- for hr in host_routes %}
post-up /sbin/ip route add {{ hr.network }} via {{ hr.gw }} dev {{ interface }} onlink table 1
post-down /sbin/ip route del {{ hr.network }} via {{ hr.gw }} dev {{ interface }} onlink table 1
post-up /sbin/ip {{ '-6 ' if vip_ipv6 }}route add {{ hr.network }} via {{ hr.gw }} dev {{ interface }} onlink table 1
post-down /sbin/ip {{ '-6 ' if vip_ipv6 }}route del {{ hr.network }} via {{ hr.gw }} dev {{ interface }} onlink table 1
{%- endfor %}
post-up /sbin/ip rule add from {{ vip }}/32 table 1 priority 100
post-down /sbin/ip rule del from {{ vip }}/32 table 1 priority 100
post-up /sbin/ip {{ '-6 ' if vip_ipv6 }}rule add from {{ vip }}/32 table 1 priority 100
post-down /sbin/ip {{ '-6 ' if vip_ipv6 }}rule del from {{ vip }}/32 table 1 priority 100

View File

@ -2037,22 +2037,22 @@ class TestServerTestCase(base.TestCase):
'netmask 32\n'
'# Add a source routing table to allow members to access '
'the VIP\n'
'post-up /sbin/ip route add default via 2001:db8::1 '
'post-up /sbin/ip -6 route add default via 2001:db8::1 '
'dev eth1 onlink table 1\n'
'post-down /sbin/ip route del default via 2001:db8::1 '
'post-down /sbin/ip -6 route del default via 2001:db8::1 '
'dev eth1 onlink table 1\n'
'post-up /sbin/ip route add 2001:db9::/32 via 2001:db8::5 '
'dev eth1 onlink table 1\n'
'post-down /sbin/ip route del 2001:db9::/32 '
'post-up /sbin/ip -6 route add 2001:db9::/32 via '
'2001:db8::5 dev eth1 onlink table 1\n'
'post-down /sbin/ip -6 route del 2001:db9::/32 '
'via 2001:db8::5 dev eth1 onlink table 1\n'
'post-up /sbin/ip route add 2001:db9::/32 via 2001:db8::5 '
'dev eth1 onlink table 1\n'
'post-down /sbin/ip route del 2001:db9::/32 '
'post-up /sbin/ip -6 route add 2001:db9::/32 via '
'2001:db8::5 dev eth1 onlink table 1\n'
'post-down /sbin/ip -6 route del 2001:db9::/32 '
'via 2001:db8::5 dev eth1 onlink table 1\n'
'post-up /sbin/ip rule add from '
'post-up /sbin/ip -6 rule add from '
'2001:0db8:0000:0000:0000:0000:0000:0002/32 table 1 '
'priority 100\n'
'post-down /sbin/ip rule del from '
'post-down /sbin/ip -6 rule del from '
'2001:0db8:0000:0000:0000:0000:0000:0002/32 table 1 '
'priority 100'.format(
netns_int=consts.NETNS_PRIMARY_INTERFACE))
@ -2137,14 +2137,14 @@ class TestServerTestCase(base.TestCase):
'netmask 32\n'
'# Add a source routing table to allow members to access '
'the VIP\n'
'post-up /sbin/ip route add default via 2001:db8::1 '
'post-up /sbin/ip -6 route add default via 2001:db8::1 '
'dev eth1 onlink table 1\n'
'post-down /sbin/ip route del default via 2001:db8::1 '
'post-down /sbin/ip -6 route del default via 2001:db8::1 '
'dev eth1 onlink table 1\n'
'post-up /sbin/ip rule add from '
'post-up /sbin/ip -6 rule add from '
'2001:0db8:0000:0000:0000:0000:0000:0002/32 table 1 '
'priority 100\n'
'post-down /sbin/ip rule del from '
'post-down /sbin/ip -6 rule del from '
'2001:0db8:0000:0000:0000:0000:0000:0002/32 table 1 '
'priority 100'.format(
netns_int=consts.NETNS_PRIMARY_INTERFACE))