← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1943930] Re: [DHCP] new line symbol in opt_name of extra_dhcp_opt causes dnsmasq to fail

 

Reviewed:  https://review.opendev.org/c/openstack/neutron/+/809580
Committed: https://opendev.org/openstack/neutron/commit/5abd1fb61018e497b369712a0952bb1a18022142
Submitter: "Zuul (22348)"
Branch:    master

commit 5abd1fb61018e497b369712a0952bb1a18022142
Author: Slawek Kaplonski <skaplons@xxxxxxxxxx>
Date:   Fri Sep 17 10:57:18 2021 +0200

    Remove dhcp_extra_opt name after first newline character
    
    Passing newline as extra dhcp option name to the DHCP agent causes
    issues with configuration of the dnsmasq process for the network.
    This patch removes everything what is after first newline character
    in the dhcp_extra_opt's name before building dnsmasq's config.
    
    Closes-bug: #1943930
    Change-Id: Iab2832e750ff5ef09c5dcacae4dbff4f9e62bc2d


** Changed in: neutron
       Status: In Progress => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1943930

Title:
  [DHCP] new line symbol in opt_name of extra_dhcp_opt causes dnsmasq to
  fail

Status in neutron:
  Fix Released

Bug description:
  Bug originally reported by Alex Katz in Bugzilla:
  https://bugzilla.redhat.com/show_bug.cgi?id=2001626

  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";

To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/1943930/+subscriptions



References