aboutsummaryrefslogtreecommitdiffstats
path: root/os_net_config/impl_eni.py
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2014-12-16 17:15:52 +0000
committerGerrit Code Review <review@openstack.org>2014-12-16 17:15:52 +0000
commit2c589f4b51ddd9992c5e4c000dbe8219d4060758 (patch)
tree908106fdac878c197b4a4100a84aebea957ba050 /os_net_config/impl_eni.py
parent36d24771ea64e47203735aa417fe3904609ab89d (diff)
parent35faddb8cdec69b2ffb66e2369c7550fa9342c1e (diff)
Merge "If setting a default route, use default netmask"
Diffstat (limited to 'os_net_config/impl_eni.py')
-rw-r--r--os_net_config/impl_eni.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/os_net_config/impl_eni.py b/os_net_config/impl_eni.py
index d38932f..5f4f727 100644
--- a/os_net_config/impl_eni.py
+++ b/os_net_config/impl_eni.py
@@ -1,4 +1,4 @@
-# -*- coding: utf-8 -*-
+# -*- Coding: utf-8 -*-
# Copyright 2014 Red Hat, Inc.
#
@@ -174,7 +174,10 @@ class ENINetConfig(os_net_config.NetConfig):
logger.info('adding custom route for interface: %s' % interface_name)
data = ""
for route in routes:
- rt = netaddr.IPNetwork(route.ip_netmask)
+ if route.default and not route.ip_netmask:
+ rt = netaddr.IPNetwork("0.0.0.0/0")
+ else:
+ rt = netaddr.IPNetwork(route.ip_netmask)
data += "up route add -net %s netmask %s gw %s\n" % (
str(rt.ip), str(rt.netmask), route.next_hop)
data += "down route del -net %s netmask %s gw %s\n" % (