Bug 2001626 - new line symbol in opt_name of extra_dhcp_opt causes dnsmasq to fail
Summary: new line symbol in opt_name of extra_dhcp_opt causes dnsmasq to fail
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat OpenStack
Classification: Red Hat
Component: openstack-neutron
Version: 16.1 (Train)
Hardware: Unspecified
OS: Unspecified
high
urgent
Target Milestone: ---
: ---
Assignee: Slawek Kaplonski
QA Contact: Alex Katz
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-09-06 15:04 UTC by Alex Katz
Modified: 2022-03-24 10:56 UTC (History)
3 users (show)

Fixed In Version: openstack-neutron-15.2.1-1.20211115153405.40d217c.el8ost
Doc Type: No Doc Update
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-03-24 10:56:13 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
OpenStack gerrit 810878 0 None NEW Remove dhcp_extra_opt name after first newline character 2021-10-25 14:17:50 UTC
Red Hat Issue Tracker OSP-8224 0 None None None 2021-11-15 12:51:40 UTC
Red Hat Product Errata RHSA-2022:0990 0 None None None 2022-03-24 10:56:43 UTC

Description Alex Katz 2021-09-06 15:04:11 UTC
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'

Comment 1 Alex Katz 2021-09-06 15:08:07 UTC
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"

Comment 4 Alex Katz 2022-02-16 15:15:53 UTC
Verified in RHOS-16.1-RHEL-8-20220210.n.1

Anything starting '\n' is removed from the DHCP option value.

Comment 9 errata-xmlrpc 2022-03-24 10:56:13 UTC
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


Note You need to log in before you can comment on or make changes to this bug.