Bug 1151942

Summary: virsh net-edit should check commas in DNS TXT record name.
Product: Red Hat Enterprise Linux 7 Reporter: lcheng
Component: libvirtAssignee: Michal Privoznik <mprivozn>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: low Docs Contact:
Priority: unspecified    
Version: 7.1CC: dyuan, honzhang, mzhan, rbalakri
Target Milestone: rcKeywords: Upstream
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-1.2.13-1.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-11-19 05:53:50 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description lcheng 2014-10-13 07:06:57 UTC
Description of problem:
virsh net-edit should check commas in DNS TXT record name.

Version-Release number of selected component (if applicable):
libvirt-1.2.8-5.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
[root@localhost ~]# firefox file:///usr/share/doc/libvirt-docs-1.2.8/html/formatnetwork.html#elementsAddress
...
dns
    txt
        ...names cannot contain embedded spaces or commas.


[root@localhost dnsmasq]# virsh net-edit default
error: prohibited space character in DNS TXT record name 'example redhat' of network default
Failed. Try again? [y,n,f,?]:
Network default XML configuration edited.

[root@localhost dnsmasq]# virsh net-dumpxml default
<network>
  <name>default</name>
  <uuid>31662273-8ae2-4443-85f0-6f46000e95fa</uuid>
  <forward mode='nat'/>
  <bridge name='virbr0' stp='on' delay='0'/>
  <mac address='52:54:00:93a:52'/>
  <dns>
    <forwarder addr='8.8.4.4'/>
    <txt name='example,redhat' value='test'/>
  </dns>
  <ip address='192.168.122.1' netmask='255.255.255.0'>
    <dhcp>
      <range start='192.168.122.2' end='192.168.122.254'/>
    </dhcp>
  </ip>
</network>

Actual results:
As description.

Expect result:
virsh net-edit should also check commas in DNS TXT record name.

Comment 2 Michal Privoznik 2015-02-23 12:41:06 UTC
Patch proposed upstream:

https://www.redhat.com/archives/libvir-list/2015-February/msg00875.html

Comment 3 Michal Privoznik 2015-02-24 14:04:47 UTC
And moving to POST:

commit 39df9d2f12829a8f1e50d78d5952ba367d6c3343
Author:     Michal Privoznik <mprivozn>
AuthorDate: Mon Feb 23 13:19:16 2015 +0100
Commit:     Michal Privoznik <mprivozn>
CommitDate: Tue Feb 24 10:07:47 2015 +0100

    network_conf: Forbid commas in DNS TXT
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1151942
    
    While the restriction doesn't have origin in any RFC, it matters
    to us while constructing the dnsmasq config file (or command line
    previously). For better picture, this is how the corresponding
    part of network XML look like:
    
      <dns>
        <forwarder addr='8.8.4.4'/>
        <txt name='example' value='example value'/>
      </dns>
    
    And this is how the config file looks like then:
    
      server=8.8.4.4
      txt-record=example,example value
    
    Now we can see why there can't be any commas in the TXT name.
    They are used by dnsmasq to separate @name and @value.
    
    Funny, we have it in the documentation, but the code (which was
    pushed back in 2011) didn't reflect that.
    
    Signed-off-by: Michal Privoznik <mprivozn>

v1.2.13-rc1-1-g39df9d2

Comment 5 hongming 2015-04-10 09:39:59 UTC
Verify it as follows.The result is expected. Move its status to VERIFIED. 

# rpm -q libvirt
libvirt-1.2.14-1.el7.x86_64

# virsh net-edit default

<network ipv6='yes'>
  <name>default</name>
  <uuid>771dc61a-0632-4ab3-b2cb-d1dc8fe5029c</uuid>
  <forward mode='nat'/>
  <bridge name='virbr0' stp='on' delay='0' macTableManager='libvirt'/>
  <mac address='52:54:00:7b:90:55'/>
  <dns>
    <forwarder addr='8.8.4.4'/>
    <txt name='example,redhat' value='redhat,test'/>
  </dns>
  <ip address='192.168.122.1' netmask='255.255.255.0'>
    <dhcp>
      <range start='192.168.122.2' end='192.168.122.254'/>
    </dhcp>
  </ip>
</network>
~                      

error: prohibited character in DNS TXT record name 'example,redhat' of network default
Failed. Try again? [y,n,f,?]: 


# virsh net-edit default

<network ipv6='yes'>
  <name>default</name>
  <uuid>771dc61a-0632-4ab3-b2cb-d1dc8fe5029c</uuid>
  <forward mode='nat'/>
  <bridge name='virbr0' stp='on' delay='0' macTableManager='libvirt'/>
  <mac address='52:54:00:7b:90:55'/>
  <dns>
    <forwarder addr='8.8.4.4'/>
    <txt name='example ' value='redhat,test'/>
  </dns>
  <ip address='192.168.122.1' netmask='255.255.255.0'>
    <dhcp>
      <range start='192.168.122.2' end='192.168.122.254'/>
    </dhcp>
  </ip>
</network>

error: prohibited character in DNS TXT record name 'example ' of network default
Failed. Try again? [y,n,f,?]:

Comment 7 errata-xmlrpc 2015-11-19 05:53:50 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, 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://rhn.redhat.com/errata/RHBA-2015-2202.html