mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
network: Allow adding DNS entries sharing hostname for multiple addreses
Having multiple addresses having same hostname is a common config either to have IPv4 and IPv6 address for the same hostname or even for DNS round robin. The validation in the network update code didn't allow adding such entries despite the fact that it is possible to define a network with them. Don't check hostname duplicity when adding a DNS entry. The update of the test case adds another entry for the 'pudding' hostname which is added in one of the networkxml2xmlupdate test cases. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
21ad1dcd32
commit
16cb11a66a
@ -3404,12 +3404,17 @@ virNetworkDefUpdateDNSHost(virNetworkDef *def,
|
|||||||
if (virSocketAddrEqual(&host.ip, &dns->hosts[i].ip))
|
if (virSocketAddrEqual(&host.ip, &dns->hosts[i].ip))
|
||||||
foundThisTime = true;
|
foundThisTime = true;
|
||||||
|
|
||||||
|
/* when adding we want to only check duplicates of address since having
|
||||||
|
* multiple addresses with the same hostname is a legitimate configuration */
|
||||||
|
if (!isAdd) {
|
||||||
for (j = 0; j < host.nnames && !foundThisTime; j++) {
|
for (j = 0; j < host.nnames && !foundThisTime; j++) {
|
||||||
for (k = 0; k < dns->hosts[i].nnames && !foundThisTime; k++) {
|
for (k = 0; k < dns->hosts[i].nnames && !foundThisTime; k++) {
|
||||||
if (STREQ(host.names[j], dns->hosts[i].names[k]))
|
if (STREQ(host.names[j], dns->hosts[i].names[k]))
|
||||||
foundThisTime = true;
|
foundThisTime = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (foundThisTime) {
|
if (foundThisTime) {
|
||||||
foundCt++;
|
foundCt++;
|
||||||
foundIdx = i;
|
foundIdx = i;
|
||||||
|
@ -4,6 +4,9 @@
|
|||||||
<forward dev='eth0' mode='nat'/>
|
<forward dev='eth0' mode='nat'/>
|
||||||
<bridge name='virbr0' stp='on' delay='0'/>
|
<bridge name='virbr0' stp='on' delay='0'/>
|
||||||
<dns forwardPlainNames='no'>
|
<dns forwardPlainNames='no'>
|
||||||
|
<host ip='192.168.122.122'>
|
||||||
|
<hostname>pudding</hostname>
|
||||||
|
</host>
|
||||||
<host ip='192.168.122.1'>
|
<host ip='192.168.122.1'>
|
||||||
<hostname>host</hostname>
|
<hostname>host</hostname>
|
||||||
<hostname>gateway</hostname>
|
<hostname>gateway</hostname>
|
||||||
|
@ -6,6 +6,9 @@
|
|||||||
</forward>
|
</forward>
|
||||||
<bridge name='virbr0' stp='on' delay='0'/>
|
<bridge name='virbr0' stp='on' delay='0'/>
|
||||||
<dns forwardPlainNames='no'>
|
<dns forwardPlainNames='no'>
|
||||||
|
<host ip='192.168.122.122'>
|
||||||
|
<hostname>pudding</hostname>
|
||||||
|
</host>
|
||||||
<host ip='192.168.122.1'>
|
<host ip='192.168.122.1'>
|
||||||
<hostname>host</hostname>
|
<hostname>host</hostname>
|
||||||
<hostname>gateway</hostname>
|
<hostname>gateway</hostname>
|
||||||
|
@ -9,6 +9,9 @@
|
|||||||
<host ip='f0:d::f0:d'>
|
<host ip='f0:d::f0:d'>
|
||||||
<hostname>pudding</hostname>
|
<hostname>pudding</hostname>
|
||||||
</host>
|
</host>
|
||||||
|
<host ip='192.168.122.122'>
|
||||||
|
<hostname>pudding</hostname>
|
||||||
|
</host>
|
||||||
<host ip='192.168.122.1'>
|
<host ip='192.168.122.1'>
|
||||||
<hostname>host</hostname>
|
<hostname>host</hostname>
|
||||||
<hostname>gateway</hostname>
|
<hostname>gateway</hostname>
|
||||||
|
@ -6,6 +6,9 @@
|
|||||||
</forward>
|
</forward>
|
||||||
<bridge name='virbr0' stp='on' delay='0'/>
|
<bridge name='virbr0' stp='on' delay='0'/>
|
||||||
<dns forwardPlainNames='no'>
|
<dns forwardPlainNames='no'>
|
||||||
|
<host ip='192.168.122.122'>
|
||||||
|
<hostname>pudding</hostname>
|
||||||
|
</host>
|
||||||
<host ip='192.168.122.2'>
|
<host ip='192.168.122.2'>
|
||||||
<hostname>shared</hostname>
|
<hostname>shared</hostname>
|
||||||
<hostname>names</hostname>
|
<hostname>names</hostname>
|
||||||
|
Loading…
Reference in New Issue
Block a user