mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-09 01:18:00 +03:00
network: change default of forwardPlainNames to 'yes'
The previous patch fixed "forwardPlainNames" so that it really is doing only what is intended, but left the default to be "forwardPlainNames='no'". Discussion around the initial version of that patch led to the decision that the default should instead be "forwardPlainNames='yes'" (i.e. the original behavior before commit f3886825). This patch makes that change to the default.
This commit is contained in:
parent
f69a6b987d
commit
66f75925eb
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* network_conf.c: network XML handling
|
* network_conf.c: network XML handling
|
||||||
*
|
*
|
||||||
* Copyright (C) 2006-2013 Red Hat, Inc.
|
* Copyright (C) 2006-2014 Red Hat, Inc.
|
||||||
* Copyright (C) 2006-2008 Daniel P. Berrange
|
* Copyright (C) 2006-2008 Daniel P. Berrange
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
@ -66,6 +66,12 @@ VIR_ENUM_IMPL(virNetworkForwardDriverName,
|
|||||||
"kvm",
|
"kvm",
|
||||||
"vfio")
|
"vfio")
|
||||||
|
|
||||||
|
VIR_ENUM_IMPL(virNetworkDNSForwardPlainNames,
|
||||||
|
VIR_NETWORK_DNS_FORWARD_PLAIN_NAMES_LAST,
|
||||||
|
"default",
|
||||||
|
"yes",
|
||||||
|
"no")
|
||||||
|
|
||||||
virNetworkObjPtr virNetworkFindByUUID(virNetworkObjListPtr nets,
|
virNetworkObjPtr virNetworkFindByUUID(virNetworkObjListPtr nets,
|
||||||
const unsigned char *uuid)
|
const unsigned char *uuid)
|
||||||
{
|
{
|
||||||
@ -1053,9 +1059,9 @@ virNetworkDNSDefParseXML(const char *networkName,
|
|||||||
|
|
||||||
forwardPlainNames = virXPathString("string(./@forwardPlainNames)", ctxt);
|
forwardPlainNames = virXPathString("string(./@forwardPlainNames)", ctxt);
|
||||||
if (forwardPlainNames) {
|
if (forwardPlainNames) {
|
||||||
if (STREQ(forwardPlainNames, "yes")) {
|
def->forwardPlainNames
|
||||||
def->forwardPlainNames = true;
|
= virNetworkDNSForwardPlainNamesTypeFromString(forwardPlainNames);
|
||||||
} else if (STRNEQ(forwardPlainNames, "no")) {
|
if (def->forwardPlainNames <= 0) {
|
||||||
virReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
_("Invalid dns forwardPlainNames setting '%s' "
|
_("Invalid dns forwardPlainNames setting '%s' "
|
||||||
"in network '%s'"),
|
"in network '%s'"),
|
||||||
@ -2295,19 +2301,26 @@ static int
|
|||||||
virNetworkDNSDefFormat(virBufferPtr buf,
|
virNetworkDNSDefFormat(virBufferPtr buf,
|
||||||
const virNetworkDNSDef *def)
|
const virNetworkDNSDef *def)
|
||||||
{
|
{
|
||||||
int result = 0;
|
|
||||||
size_t i, j;
|
size_t i, j;
|
||||||
|
|
||||||
if (!(def->forwardPlainNames || def->forwarders || def->nhosts ||
|
if (!(def->forwardPlainNames || def->forwarders || def->nhosts ||
|
||||||
def->nsrvs || def->ntxts))
|
def->nsrvs || def->ntxts))
|
||||||
goto out;
|
return 0;
|
||||||
|
|
||||||
virBufferAddLit(buf, "<dns");
|
virBufferAddLit(buf, "<dns");
|
||||||
if (def->forwardPlainNames) {
|
if (def->forwardPlainNames) {
|
||||||
virBufferAddLit(buf, " forwardPlainNames='yes'");
|
const char *fwd = virNetworkDNSForwardPlainNamesTypeToString(def->forwardPlainNames);
|
||||||
|
|
||||||
|
if (!fwd) {
|
||||||
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
|
_("Unknown forwardPlainNames type %d in network"),
|
||||||
|
def->forwardPlainNames);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
virBufferAsprintf(buf, " forwardPlainNames='%s'", fwd);
|
||||||
if (!(def->forwarders || def->nhosts || def->nsrvs || def->ntxts)) {
|
if (!(def->forwarders || def->nhosts || def->nsrvs || def->ntxts)) {
|
||||||
virBufferAddLit(buf, "/>\n");
|
virBufferAddLit(buf, "/>\n");
|
||||||
goto out;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2363,8 +2376,7 @@ virNetworkDNSDefFormat(virBufferPtr buf,
|
|||||||
}
|
}
|
||||||
virBufferAdjustIndent(buf, -2);
|
virBufferAdjustIndent(buf, -2);
|
||||||
virBufferAddLit(buf, "</dns>\n");
|
virBufferAddLit(buf, "</dns>\n");
|
||||||
out:
|
return 0;
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* network_conf.h: network XML handling
|
* network_conf.h: network XML handling
|
||||||
*
|
*
|
||||||
* Copyright (C) 2006-2013 Red Hat, Inc.
|
* Copyright (C) 2006-2014 Red Hat, Inc.
|
||||||
* Copyright (C) 2006-2008 Daniel P. Berrange
|
* Copyright (C) 2006-2008 Daniel P. Berrange
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
@ -112,10 +112,23 @@ struct _virNetworkDNSHostDef {
|
|||||||
char **names;
|
char **names;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* If forwardPlainNames is 0 (default), that is equivalent to "yes",
|
||||||
|
* but won't be encoded in newly formatted XML.
|
||||||
|
*/
|
||||||
|
typedef enum {
|
||||||
|
VIR_NETWORK_DNS_FORWARD_PLAIN_NAMES_DEFAULT = 0, /* silent "yes" */
|
||||||
|
VIR_NETWORK_DNS_FORWARD_PLAIN_NAMES_YES,
|
||||||
|
VIR_NETWORK_DNS_FORWARD_PLAIN_NAMES_NO,
|
||||||
|
|
||||||
|
VIR_NETWORK_DNS_FORWARD_PLAIN_NAMES_LAST,
|
||||||
|
} virNetworkDNSForwardPlainNamesType;
|
||||||
|
|
||||||
|
VIR_ENUM_DECL(virNetworkDNSForwardPlainNames)
|
||||||
|
|
||||||
typedef struct _virNetworkDNSDef virNetworkDNSDef;
|
typedef struct _virNetworkDNSDef virNetworkDNSDef;
|
||||||
typedef virNetworkDNSDef *virNetworkDNSDefPtr;
|
typedef virNetworkDNSDef *virNetworkDNSDefPtr;
|
||||||
struct _virNetworkDNSDef {
|
struct _virNetworkDNSDef {
|
||||||
bool forwardPlainNames;
|
int forwardPlainNames; /* enum virNetworkDNSForwardPlainNamesType */
|
||||||
size_t ntxts;
|
size_t ntxts;
|
||||||
virNetworkDNSTxtDefPtr txts;
|
virNetworkDNSTxtDefPtr txts;
|
||||||
size_t nhosts;
|
size_t nhosts;
|
||||||
|
@ -725,7 +725,8 @@ networkDnsmasqConfContents(virNetworkObjPtr network,
|
|||||||
network->def->domain);
|
network->def->domain);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!network->def->dns.forwardPlainNames) {
|
if (network->def->dns.forwardPlainNames
|
||||||
|
== VIR_NETWORK_DNS_FORWARD_PLAIN_NAMES_NO) {
|
||||||
virBufferAddLit(&configbuf, "domain-needed\n");
|
virBufferAddLit(&configbuf, "domain-needed\n");
|
||||||
/* need to specify local=// whether or not a domain is
|
/* need to specify local=// whether or not a domain is
|
||||||
* specified, unless the config says we should forward "plain"
|
* specified, unless the config says we should forward "plain"
|
||||||
|
@ -5,8 +5,6 @@
|
|||||||
##
|
##
|
||||||
## dnsmasq conf file created by libvirt
|
## dnsmasq conf file created by libvirt
|
||||||
strict-order
|
strict-order
|
||||||
domain-needed
|
|
||||||
local=//
|
|
||||||
except-interface=lo
|
except-interface=lo
|
||||||
bind-dynamic
|
bind-dynamic
|
||||||
interface=virbr0
|
interface=virbr0
|
||||||
|
@ -7,8 +7,6 @@
|
|||||||
strict-order
|
strict-order
|
||||||
domain=mynet
|
domain=mynet
|
||||||
expand-hosts
|
expand-hosts
|
||||||
domain-needed
|
|
||||||
local=//
|
|
||||||
except-interface=lo
|
except-interface=lo
|
||||||
bind-dynamic
|
bind-dynamic
|
||||||
interface=virbr0
|
interface=virbr0
|
||||||
|
@ -5,8 +5,6 @@
|
|||||||
##
|
##
|
||||||
## dnsmasq conf file created by libvirt
|
## dnsmasq conf file created by libvirt
|
||||||
strict-order
|
strict-order
|
||||||
domain-needed
|
|
||||||
local=//
|
|
||||||
except-interface=lo
|
except-interface=lo
|
||||||
bind-dynamic
|
bind-dynamic
|
||||||
interface=virbr1
|
interface=virbr1
|
||||||
|
@ -5,8 +5,6 @@
|
|||||||
##
|
##
|
||||||
## dnsmasq conf file created by libvirt
|
## dnsmasq conf file created by libvirt
|
||||||
strict-order
|
strict-order
|
||||||
domain-needed
|
|
||||||
local=//
|
|
||||||
except-interface=lo
|
except-interface=lo
|
||||||
bind-interfaces
|
bind-interfaces
|
||||||
listen-address=192.168.152.1
|
listen-address=192.168.152.1
|
||||||
|
@ -8,8 +8,6 @@ strict-order
|
|||||||
no-resolv
|
no-resolv
|
||||||
server=8.8.8.8
|
server=8.8.8.8
|
||||||
server=8.8.4.4
|
server=8.8.4.4
|
||||||
domain-needed
|
|
||||||
local=//
|
|
||||||
except-interface=lo
|
except-interface=lo
|
||||||
bind-dynamic
|
bind-dynamic
|
||||||
interface=virbr0
|
interface=virbr0
|
||||||
|
@ -5,8 +5,6 @@
|
|||||||
##
|
##
|
||||||
## dnsmasq conf file created by libvirt
|
## dnsmasq conf file created by libvirt
|
||||||
strict-order
|
strict-order
|
||||||
domain-needed
|
|
||||||
local=//
|
|
||||||
except-interface=lo
|
except-interface=lo
|
||||||
bind-interfaces
|
bind-interfaces
|
||||||
listen-address=192.168.122.1
|
listen-address=192.168.122.1
|
||||||
|
@ -5,8 +5,6 @@
|
|||||||
##
|
##
|
||||||
## dnsmasq conf file created by libvirt
|
## dnsmasq conf file created by libvirt
|
||||||
strict-order
|
strict-order
|
||||||
domain-needed
|
|
||||||
local=//
|
|
||||||
except-interface=lo
|
except-interface=lo
|
||||||
bind-dynamic
|
bind-dynamic
|
||||||
interface=virbr0
|
interface=virbr0
|
||||||
|
@ -5,8 +5,6 @@
|
|||||||
##
|
##
|
||||||
## dnsmasq conf file created by libvirt
|
## dnsmasq conf file created by libvirt
|
||||||
strict-order
|
strict-order
|
||||||
domain-needed
|
|
||||||
local=//
|
|
||||||
except-interface=lo
|
except-interface=lo
|
||||||
bind-dynamic
|
bind-dynamic
|
||||||
interface=virbr0
|
interface=virbr0
|
||||||
|
@ -5,8 +5,6 @@
|
|||||||
##
|
##
|
||||||
## dnsmasq conf file created by libvirt
|
## dnsmasq conf file created by libvirt
|
||||||
strict-order
|
strict-order
|
||||||
domain-needed
|
|
||||||
local=//
|
|
||||||
except-interface=lo
|
except-interface=lo
|
||||||
bind-dynamic
|
bind-dynamic
|
||||||
interface=virbr0
|
interface=virbr0
|
||||||
|
@ -7,8 +7,6 @@
|
|||||||
strict-order
|
strict-order
|
||||||
domain=example.com
|
domain=example.com
|
||||||
expand-hosts
|
expand-hosts
|
||||||
domain-needed
|
|
||||||
local=//
|
|
||||||
except-interface=lo
|
except-interface=lo
|
||||||
bind-interfaces
|
bind-interfaces
|
||||||
listen-address=192.168.122.1
|
listen-address=192.168.122.1
|
||||||
|
@ -7,8 +7,6 @@
|
|||||||
strict-order
|
strict-order
|
||||||
domain=example.com
|
domain=example.com
|
||||||
expand-hosts
|
expand-hosts
|
||||||
domain-needed
|
|
||||||
local=//
|
|
||||||
except-interface=lo
|
except-interface=lo
|
||||||
bind-interfaces
|
bind-interfaces
|
||||||
listen-address=192.168.122.1
|
listen-address=192.168.122.1
|
||||||
|
@ -5,8 +5,6 @@
|
|||||||
##
|
##
|
||||||
## dnsmasq conf file created by libvirt
|
## dnsmasq conf file created by libvirt
|
||||||
strict-order
|
strict-order
|
||||||
domain-needed
|
|
||||||
local=//
|
|
||||||
except-interface=lo
|
except-interface=lo
|
||||||
bind-dynamic
|
bind-dynamic
|
||||||
interface=virbr1
|
interface=virbr1
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<interface dev='eth0'/>
|
<interface dev='eth0'/>
|
||||||
</forward>
|
</forward>
|
||||||
<bridge name='virbr0' stp='on' delay='0'/>
|
<bridge name='virbr0' stp='on' delay='0'/>
|
||||||
<dns>
|
<dns forwardPlainNames='no'>
|
||||||
<host ip='192.168.122.1'>
|
<host ip='192.168.122.1'>
|
||||||
<hostname>host</hostname>
|
<hostname>host</hostname>
|
||||||
<hostname>gateway</hostname>
|
<hostname>gateway</hostname>
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<interface dev='eth0'/>
|
<interface dev='eth0'/>
|
||||||
</forward>
|
</forward>
|
||||||
<bridge name='virbr0' stp='on' delay='0'/>
|
<bridge name='virbr0' stp='on' delay='0'/>
|
||||||
<dns>
|
<dns forwardPlainNames='no'>
|
||||||
<host ip='f0:d::f0:d'>
|
<host ip='f0:d::f0:d'>
|
||||||
<hostname>pudding</hostname>
|
<hostname>pudding</hostname>
|
||||||
</host>
|
</host>
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
<interface dev='eth0'/>
|
<interface dev='eth0'/>
|
||||||
</forward>
|
</forward>
|
||||||
<bridge name='virbr0' stp='on' delay='0'/>
|
<bridge name='virbr0' stp='on' delay='0'/>
|
||||||
|
<dns forwardPlainNames='no'/>
|
||||||
<ip address='192.168.122.1' netmask='255.255.255.0'>
|
<ip address='192.168.122.1' netmask='255.255.255.0'>
|
||||||
</ip>
|
</ip>
|
||||||
</network>
|
</network>
|
||||||
|
Loading…
Reference in New Issue
Block a user