From c63bbb0badfe9cecef2d47c36609fd5b66ebc38a Mon Sep 17 00:00:00 2001 From: Itzik Brown Date: Tue, 2 Sep 2014 10:02:22 +0300 Subject: [PATCH] Adds an option to enable broadcast replies to Dnsmasq Adds a flag for DHCP agent configuration to add dhcp-broadcast flag to Dnsmasq process In order to support virtual network on top of Infiniband Fabric, there is a requirement to receive DHCP response via broadcast message (according to IB Spec). DocImpact Change-Id: I95329e535bacf14b650a8f37179ecd020b5bfafe Closes-Bug: #1293953 --- etc/dhcp_agent.ini | 3 +++ neutron/agent/linux/dhcp.py | 5 +++++ neutron/tests/unit/test_linux_dhcp.py | 5 +++++ 3 files changed, 13 insertions(+) diff --git a/etc/dhcp_agent.ini b/etc/dhcp_agent.ini index 9836d35000..0f99878944 100644 --- a/etc/dhcp_agent.ini +++ b/etc/dhcp_agent.ini @@ -72,6 +72,9 @@ # Location to DHCP lease relay UNIX domain socket # dhcp_lease_relay_socket = $state_path/dhcp/lease_relay +# Use broadcast in DHCP replies +# dhcp_broadcast_reply = False + # Location of Metadata Proxy UNIX domain socket # metadata_proxy_socket = $state_path/metadata_proxy diff --git a/neutron/agent/linux/dhcp.py b/neutron/agent/linux/dhcp.py index 51e89913d4..67e498d2dd 100644 --- a/neutron/agent/linux/dhcp.py +++ b/neutron/agent/linux/dhcp.py @@ -57,6 +57,8 @@ OPTS = [ 'dnsmasq_lease_max', default=(2 ** 24), help=_('Limit number of leases to prevent a denial-of-service.')), + cfg.BoolOpt('dhcp_broadcast_reply', default=False, + help=_("Use broadcast in DHCP replies")), ] IPV4 = 4 @@ -414,6 +416,9 @@ class Dnsmasq(DhcpLocalProcess): if self.conf.dhcp_domain: cmd.append('--domain=%s' % self.conf.dhcp_domain) + if self.conf.dhcp_broadcast_reply: + cmd.append('--dhcp-broadcast') + ip_wrapper = ip_lib.IPWrapper(self.root_helper, self.network.namespace) ip_wrapper.netns.execute(cmd, addl_env=env) diff --git a/neutron/tests/unit/test_linux_dhcp.py b/neutron/tests/unit/test_linux_dhcp.py index a0187369b8..39edd30a8f 100644 --- a/neutron/tests/unit/test_linux_dhcp.py +++ b/neutron/tests/unit/test_linux_dhcp.py @@ -856,6 +856,11 @@ class TestDnsmasq(TestBase): network=FakeV4Network(), max_leases=256) + def test_spawn_cfg_broadcast(self): + self.conf.set_override('dhcp_broadcast_reply', True) + self._test_spawn(['--conf-file=', '--domain=openstacklocal', + '--dhcp-broadcast']) + def test_output_opts_file(self): fake_v6 = '2001:0200:feed:7ac0::1' expected = (