summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkn <kn@openbsd.org>2020-06-29 17:58:58 +0000
committerkn <kn@openbsd.org>2020-06-29 17:58:58 +0000
commitae0acb2343ffa8ca7596fe2245fd43b2d96421bd (patch)
tree5a92e00c4d1e2a01406dbbf8425ffb6053c6a8ce
parentpowerpc64 (diff)
downloadwireguard-openbsd-ae0acb2343ffa8ca7596fe2245fd43b2d96421bd.tar.xz
wireguard-openbsd-ae0acb2343ffa8ca7596fe2245fd43b2d96421bd.zip
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
-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)