Skip to content

Commit

Permalink
Adding netmask to dnsmasq argument --dhcp-range
Browse files Browse the repository at this point in the history
By default, dnsmasq will try to guess the proper subnet size but
sometimes it will fail. This patch provides the network netmask
to dnsmasq via the --dhcp-range argument.

Fixes: bug #1154929

Change-Id: I74d62c837b5310004b9151851697e3ea3b475f92
(cherry picked from commit fb151b5)
  • Loading branch information
david-hill authored and vishvananda committed Mar 28, 2013
1 parent 1fa7879 commit 34a321f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion nova/network/linux_net.py
Expand Up @@ -1019,9 +1019,10 @@ def restart_dhcp(context, dev, network_ref):
'--pid-file=%s' % _dhcp_file(dev, 'pid'),
'--listen-address=%s' % network_ref['dhcp_server'],
'--except-interface=lo',
'--dhcp-range=set:%s,%s,static,%ss' %
'--dhcp-range=set:%s,%s,static,%s,%ss' %
(network_ref['label'],
network_ref['dhcp_start'],
network_ref['netmask'],
CONF.dhcp_lease_time),
'--dhcp-lease-max=%s' % len(netaddr.IPNetwork(network_ref['cidr'])),
'--dhcp-hostsfile=%s' % _dhcp_file(dev, 'conf'),
Expand Down
4 changes: 3 additions & 1 deletion nova/tests/network/test_linux_net.py
Expand Up @@ -480,6 +480,7 @@ def _test_dnsmasq_execute(self, extra_expected=None):
'label': 'fake',
'multi_host': False,
'cidr': '10.0.0.0/24',
'netmask': '255.255.255.0',
'dns1': '8.8.4.4',
'dhcp_start': '1.0.0.2',
'dhcp_server': '10.0.0.1'}
Expand Down Expand Up @@ -507,8 +508,9 @@ def fake_execute(*args, **kwargs):
'--pid-file=%s' % linux_net._dhcp_file(dev, 'pid'),
'--listen-address=%s' % network_ref['dhcp_server'],
'--except-interface=lo',
"--dhcp-range=set:%s,%s,static,%ss" % (network_ref['label'],
"--dhcp-range=set:%s,%s,static,%s,%ss" % (network_ref['label'],
network_ref['dhcp_start'],
network_ref['netmask'],
CONF.dhcp_lease_time),
'--dhcp-lease-max=256',
'--dhcp-hostsfile=%s' % linux_net._dhcp_file(dev, 'conf'),
Expand Down

0 comments on commit 34a321f

Please sign in to comment.