Skip to content

Commit 3b0e6ac

Browse files
VR: fix dnmasq misconfiguration if there are multiple IP ranges in a shared network (#8741)
1 parent 5f6acca commit 3b0e6ac

3 files changed

Lines changed: 8 additions & 10 deletions

File tree

systemvm/debian/opt/cloud/bin/cs/CsDhcp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def configure_server(self):
127127
line = "dhcp-option=%s,26,%s" % (device, i['mtu'])
128128
self.conf.search(sline, line)
129129

130-
# Netmask
130+
# Netmask
131131
netmask = ''
132132
if self.config.is_vpc():
133133
netmask = gn.get_netmask()

systemvm/debian/opt/cloud/bin/cs/CsHelper.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -113,22 +113,20 @@ def bool_to_yn(val):
113113
def get_device_info():
114114
""" Returns all devices on system with their ipv4 ip netmask """
115115
list = []
116+
mtu = None
116117
for i in execute("ip addr show |grep -v secondary"):
117118
vals = i.strip().lstrip().rstrip().split()
118-
if re.search('[0-9]:',vals[0]):
119-
to={}
120-
to['mtu'] = vals[4]
121-
list.append(to)
119+
if re.search('[0-9]:', vals[0]):
120+
mtu = vals[4]
122121

123122
if vals[0] == "inet":
124-
if len(list) > 0:
125-
to = list.pop(len(list)-1)
126-
else:
127-
to={}
123+
to = {}
128124
to['ip'] = vals[1]
129125
to['dev'] = vals[-1]
130126
to['network'] = IPNetwork(to['ip'])
131127
to['dnsmasq'] = False
128+
if mtu:
129+
to['mtu'] = mtu
132130
list.append(to)
133131
return list
134132

ui/src/views/compute/wizard/NetworkConfiguration.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ export default {
241241
return Promise.resolve()
242242
} else if (!this.ipV4Regex.test(value)) {
243243
return Promise.reject(this.$t('message.error.ipv4.address'))
244-
} else if (rule.networkType !== 'L2' && !this.isIp4InCidr(value, rule.cidr)) {
244+
} else if (rule.networkType === 'Isolated' && !this.isIp4InCidr(value, rule.cidr)) {
245245
const rangeIps = this.calculateCidrRange(rule.cidr)
246246
const message = `${this.$t('message.error.ip.range')} ${this.$t('label.from')} ${rangeIps[0]} ${this.$t('label.to')} ${rangeIps[1]}`
247247
return Promise.reject(message)

0 commit comments

Comments
 (0)