summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--nova/network/linux_net.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/nova/network/linux_net.py b/nova/network/linux_net.py
index ea09f69b2..e6abde609 100644
--- a/nova/network/linux_net.py
+++ b/nova/network/linux_net.py
@@ -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):