summaryrefslogtreecommitdiff
path: root/usr.sbin/ldomctl
diff options
context:
space:
mode:
authorkn <kn@cvs.openbsd.org>2020-06-29 17:58:59 +0000
committerkn <kn@cvs.openbsd.org>2020-06-29 17:58:59 +0000
commitc442f359f7b55c67a55676ce5d31ed4a55855dc4 (patch)
treef4f13537c7d475fd9c036e76c0f3a049c6403ca1 /usr.sbin/ldomctl
parent2d7e0979e21fdc26b17814b2071500739ae727e4 (diff)
Reject vdisk, vnet and iodevice parameters for primary domain
In analogy to guest domains requiring vcpu, memory and at least one bootable device (vdisk, vnet or iodevice), the primary domain must not be configured with vdisk, vnet or iodevice parameters; it does not make sense to provide virtual disks or interfaces to it and PCIe devices not assigned to guest domains automatically end up in the primary domain. ldom.conf(5) also documents those explicitly for guest domains only. OK tracey
Diffstat (limited to 'usr.sbin/ldomctl')
-rw-r--r--usr.sbin/ldomctl/parse.y17
1 files changed, 16 insertions, 1 deletions
diff --git a/usr.sbin/ldomctl/parse.y b/usr.sbin/ldomctl/parse.y
index b688fcbf930..dfe97a7af66 100644
--- a/usr.sbin/ldomctl/parse.y
+++ b/usr.sbin/ldomctl/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.20 2020/05/23 13:19:13 kn Exp $ */
+/* $OpenBSD: parse.y,v 1.21 2020/06/29 17:58:58 kn Exp $ */
/*
* Copyright (c) 2012 Mark Kettenis <kettenis@openbsd.org>
@@ -181,12 +181,22 @@ domainopts : VCPU vcpu {
domain->memory = $2;
}
| VDISK STRING vdisk_opts {
+ if (strcmp(domain->name, "primary") == 0) {
+ yyerror("vdisk option invalid for primary"
+ " domain");
+ YYERROR;
+ }
struct vdisk *vdisk = xmalloc(sizeof(struct vdisk));
vdisk->path = $2;
vdisk->devalias = $3.devalias;
SIMPLEQ_INSERT_TAIL(&domain->vdisk_list, vdisk, entry);
}
| VNET vnet_opts {
+ if (strcmp(domain->name, "primary") == 0) {
+ yyerror("vnet option invalid for primary"
+ " domain");
+ YYERROR;
+ }
struct vnet *vnet = xmalloc(sizeof(struct vnet));
vnet->mac_addr = $2.mac_addr;
vnet->mtu = $2.mtu;
@@ -200,6 +210,11 @@ domainopts : VCPU vcpu {
SIMPLEQ_INSERT_TAIL(&domain->var_list, var, entry);
}
| IODEVICE STRING {
+ if (strcmp(domain->name, "primary") == 0) {
+ yyerror("iodevice option invalid for primary"
+ " domain");
+ YYERROR;
+ }
struct domain *odomain;
struct iodev *iodev;
SIMPLEQ_FOREACH(odomain, &conf->domain_list, entry)