Merge "Remove dhcp_extra_opt name after first newline character" into stable/wallaby

This commit is contained in:
Zuul 2021-10-04 18:50:39 +00:00 committed by Gerrit Code Review
commit 57a47ce3da
2 changed files with 2 additions and 1 deletions

View File

@ -1307,6 +1307,7 @@ class Dnsmasq(DhcpLocalProcess):
def _format_option(self, ip_version, tag, option, *args):
"""Format DHCP option by option name or code."""
option = str(option)
option = option.split("\n", 1)[0]
pattern = "(tag:(.*),)?(.*)$"
matches = re.match(pattern, option)
extra_tag = matches.groups()[0]

View File

@ -231,7 +231,7 @@ class FakeV6PortExtraOpt(object):
DhcpOpt(opt_name='dns-server',
opt_value='ffea:3ba5:a17a:4ba3::100',
ip_version=constants.IP_VERSION_6),
DhcpOpt(opt_name='malicious-option',
DhcpOpt(opt_name='malicious-option\nwith-new-line',
opt_value='aaa\nbbb.ccc\n',
ip_version=constants.IP_VERSION_6)]