Set prefix on floating_ip_mangle rules

Set the /32 prefix that iptables will automatically do internally
so our format matches the iptables-save format and we don't
unnecessarily re-apply rules.

Testing for this is provided by enabling the IPTables convergence
check in I6bee1d51155488e91857ee8bc45470d6a224fa37

Closes-Bug: #1607699
Change-Id: I0088636d2f8409f0f6f17b3ed2288f6edfac1e68
This commit is contained in:
Kevin Benton
2016-07-27 17:43:17 -07:00
parent 414f2ffc8d
commit 244ef910d5
2 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -77,10 +77,10 @@ class DvrLocalRouter(dvr_router_base.DvrRouterBase):
rtr_2_fip_name = self.fip_ns.get_rtr_ext_device_name(self.router_id)
mark_traffic_to_floating_ip = (
'floatingip', '-d %s -i %s -j MARK --set-xmark %s' % (
'floatingip', '-d %s/32 -i %s -j MARK --set-xmark %s' % (
floating_ip, rtr_2_fip_name, internal_mark))
mark_traffic_from_fixed_ip = (
'FORWARD', '-s %s -j $float-snat' % fixed_ip)
'FORWARD', '-s %s/32 -j $float-snat' % fixed_ip)
return [mark_traffic_to_floating_ip, mark_traffic_from_fixed_ip]
def floating_ip_added_dist(self, fip, fip_cidr):
+2 -2
View File
@@ -155,10 +155,10 @@ class RouterInfo(object):
def floating_mangle_rules(self, floating_ip, fixed_ip, internal_mark):
mark_traffic_to_floating_ip = (
'floatingip', '-d %s -j MARK --set-xmark %s' % (
'floatingip', '-d %s/32 -j MARK --set-xmark %s' % (
floating_ip, internal_mark))
mark_traffic_from_fixed_ip = (
'FORWARD', '-s %s -j $float-snat' % fixed_ip)
'FORWARD', '-s %s/32 -j $float-snat' % fixed_ip)
return [mark_traffic_to_floating_ip, mark_traffic_from_fixed_ip]
def get_address_scope_mark_mask(self, address_scope=None):