Merge "Allow pinging own float when using fixed gateway"

This commit is contained in:
Jenkins 2013-01-12 10:25:40 +00:00 committed by Gerrit Code Review
commit acbf4ea118
1 changed files with 10 additions and 4 deletions

View File

@ -647,12 +647,18 @@ def remove_floating_forward(floating_ip, fixed_ip, device):
def floating_forward_rules(floating_ip, fixed_ip, device):
rules = []
rule = '-s %s -j SNAT --to %s' % (fixed_ip, floating_ip)
if device:
rule += ' -o %s' % device
return [('PREROUTING', '-d %s -j DNAT --to %s' % (floating_ip, fixed_ip)),
('OUTPUT', '-d %s -j DNAT --to %s' % (floating_ip, fixed_ip)),
('float-snat', rule)]
rules.append(('float-snat', rule + ' -d %s' % fixed_ip))
rules.append(('float-snat', rule + ' -o %s' % device))
else:
rules.append(('float-snat', rule))
rules.append(
('PREROUTING', '-d %s -j DNAT --to %s' % (floating_ip, fixed_ip)))
rules.append(
('OUTPUT', '-d %s -j DNAT --to %s' % (floating_ip, fixed_ip)))
return rules
def initialize_gateway_device(dev, network_ref):