Description of problem: The new line symbol (`\n`) can be passed into the opt_name of extra-dhcp-opt with the direct API call. It will cause the dnsmasq process to be in a restart loop. There is the following stack trace appear in the dhcp-agent.log [-] Unable to enable dhcp for ee4beb3e-89e8-4d32-ba99-97f3c7a092e7.: AttributeError: 'NoneType' object has no attribute 'groups' Traceback (most recent call last): File "/usr/lib/python3.6/site-packages/neutron/agent/dhcp/agent.py", line 208, in call_driver getattr(driver, action)(**action_kwargs) File "/usr/lib/python3.6/site-packages/neutron/agent/linux/dhcp.py", line 235, in enable common_utils.wait_until_true(self._enable, timeout=300) File "/usr/lib/python3.6/site-packages/neutron/common/utils.py", line 703, in wait_until_true while not predicate(): File "/usr/lib/python3.6/site-packages/neutron/agent/linux/dhcp.py", line 248, in _enable self.spawn_process() File "/usr/lib/python3.6/site-packages/neutron/agent/linux/dhcp.py", line 475, in spawn_process self._spawn_or_reload_process(reload_with_HUP=False) File "/usr/lib/python3.6/site-packages/neutron/agent/linux/dhcp.py", line 484, in _spawn_or_reload_process self._output_config_files() File "/usr/lib/python3.6/site-packages/neutron/agent/linux/dhcp.py", line 534, in _output_config_files self._output_opts_file() File "/usr/lib/python3.6/site-packages/neutron/agent/linux/dhcp.py", line 1062, in _output_opts_file options += self._generate_opts_per_port(subnet_index_map) File "/usr/lib/python3.6/site-packages/neutron/agent/linux/dhcp.py", line 1194, in _generate_opts_per_port opt.opt_name, opt.opt_value)) File "/usr/lib/python3.6/site-packages/neutron/agent/linux/dhcp.py", line 1247, in _format_option extra_tag = matches.groups()[0] AttributeError: 'NoneType' object has no attribute 'groups'
Example of the API request: TOK=`openstack token issue -f value -c id` curl -v -s -X PUT \ -H "X-Auth-Token: $TOK" \ -H "Content-Type: application/json" \ -d '{ "port": { "extra_dhcp_opts": [{ "opt_name": "yyy:test\nanother", "opt_value":"xxx" }]}}' \ "http://10.0.0.120:9696/v2.0/ports/acf0c1ca-56f8-452c-8b31-51ac25e54ac5"
Verified in RHOS-16.1-RHEL-8-20220210.n.1 Anything starting '\n' is removed from the DHCP option value.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory (Moderate: Red Hat OpenStack Platform 16.1 (openstack-neutron) security update), and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHSA-2022:0990