1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-22 17:34:18 +03:00

add domain name in network configurations suport and on OpenVZ config bugfix

* src/network_conf.c src/network_conf.h src/qemu_driver.c: add
  support for a domain name in network configurations, patch by
  JJ Reynolds with bugfix raised by Dan
* src/openvz_conf.c: fix to small bug in openvzReadConfigParam
  by Evgeniy Sokolov
Daniel
This commit is contained in:
Daniel Veillard 2008-09-08 12:45:29 +00:00
parent 3aa7c4639d
commit 58686c3dd8
5 changed files with 26 additions and 4 deletions

View File

@ -1,3 +1,11 @@
Mon Sep 8 14:42:23 CEST 2008 Daniel Veillard <veillard@redhat.com>
* src/network_conf.c src/network_conf.h src/qemu_driver.c: add
support for a domain name in network configurations, patch by
JJ Reynolds with bugfix raised by Dan
* src/openvz_conf.c: fix to small bug in openvzReadConfigParam
by Evgeniy Sokolov
Mon Sep 8 13:14:17 BST 2008 Daniel P. Berrange <berrange@redhat.com>
* src/openvz_driver.c: Fix potential NULL dereference

View File

@ -109,6 +109,7 @@ void virNetworkDefFree(virNetworkDefPtr def)
VIR_FREE(def->ipAddress);
VIR_FREE(def->network);
VIR_FREE(def->netmask);
VIR_FREE(def->domain);
for (i = 0 ; i < def->nranges && def->ranges ; i++) {
VIR_FREE(def->ranges[i].start);
@ -326,6 +327,9 @@ virNetworkDefParseXML(virConnectPtr conn,
VIR_FREE(tmp);
}
/* Parse network domain information */
def->domain = virXPathString(conn, "string(./domain[1]/@name)", ctxt);
/* Parse bridge information */
def->bridge = virXPathString(conn, "string(./bridge[1]/@name)", ctxt);
tmp = virXPathString(conn, "string(./bridge[1]/@stp)", ctxt);

View File

@ -57,6 +57,7 @@ struct _virNetworkDef {
char *name;
char *bridge; /* Name of bridge device */
char *domain;
unsigned long delay; /* Bridge forward delay (ms) */
int stp : 1; /* Spanning tree protocol */

View File

@ -298,10 +298,13 @@ openvzReadConfigParam(int vpsid ,const char * param, char *value, int maxlen)
if (STREQLEN(line, param, strlen(param))) {
sf = line;
sf += strlen(param);
if (sf[0] == '=' && (token = strtok_r(sf,"\"\t=\n", &saveptr)) != NULL) {
strncpy(value, token, maxlen) ;
value[maxlen-1] = '\0';
found = 1;
if (sf[0] == '=' && sf[1] != '\0' ) {
sf ++;
if ((token = strtok_r(sf,"\"\t\n", &saveptr)) != NULL) {
strncpy(value, token, maxlen) ;
value[maxlen-1] = '\0';
found = 1;
}
}
}
}

View File

@ -1113,6 +1113,7 @@ qemudBuildDnsmasqArgv(virConnectPtr conn,
1 + /* --keep-in-foreground */
1 + /* --strict-order */
1 + /* --bind-interfaces */
(network->def->domain?2:0) + /* --domain name */
2 + /* --pid-file "" */
2 + /* --conf-file "" */
/*2 + *//* --interface virbr0 */
@ -1144,6 +1145,11 @@ qemudBuildDnsmasqArgv(virConnectPtr conn,
APPEND_ARG(*argv, i++, "--strict-order");
APPEND_ARG(*argv, i++, "--bind-interfaces");
if (network->def->domain) {
APPEND_ARG(*argv, i++, "--domain");
APPEND_ARG(*argv, i++, network->def->domain);
}
APPEND_ARG(*argv, i++, "--pid-file");
APPEND_ARG(*argv, i++, "");