← Back to team overview

yahoo-eng-team team mailing list archive

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

 

Public bug reported:

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

** Affects: neutron
     Importance: High
     Assignee: Slawek Kaplonski (slaweq)
         Status: Confirmed


** Tags: l3-ipam-dhcp

-- 
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:
  Confirmed

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



Follow ups