summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpd <pd@openbsd.org>2017-08-15 15:10:35 +0000
committerpd <pd@openbsd.org>2017-08-15 15:10:35 +0000
commit661d00507bf1e4f1f48f0c87343e3ecfc8fcbc2c (patch)
tree77fdaac39bfc34b7cb1309e62b5ef25680eb287f
parents/DEF_STD/DEF_STRONG/ to match namespace.h differences between librthread (diff)
downloadwireguard-openbsd-661d00507bf1e4f1f48f0c87343e3ecfc8fcbc2c.tar.xz
wireguard-openbsd-661d00507bf1e4f1f48f0c87343e3ecfc8fcbc2c.zip
vmd: fix vm id displayed by vmctl when receiving a vm
Also fix two debug messages and an IMSG type.
-rw-r--r--usr.sbin/vmd/vmd.c8
-rw-r--r--usr.sbin/vmd/vmm.c5
2 files changed, 8 insertions, 5 deletions
diff --git a/usr.sbin/vmd/vmd.c b/usr.sbin/vmd/vmd.c
index 0349834d1c8..4fefc3f0420 100644
--- a/usr.sbin/vmd/vmd.c
+++ b/usr.sbin/vmd/vmd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vmd.c,v 1.66 2017/08/14 17:20:59 jasper Exp $ */
+/* $OpenBSD: vmd.c,v 1.67 2017/08/15 15:10:35 pd Exp $ */
/*
* Copyright (c) 2015 Reyk Floeter <reyk@openbsd.org>
@@ -206,7 +206,7 @@ vmd_dispatch_control(int fd, struct privsep_proc *p, struct imsg *imsg)
} else {
}
vmr.vmr_id = vid.vid_id;
- log_debug("%s: sending fd to vmctl", __func__);
+ log_debug("%s: sending fd to vmm", __func__);
proc_compose_imsg(ps, PROC_VMM, -1, imsg->hdr.type,
imsg->hdr.peerid, imsg->fd, &vid, sizeof(vid));
break;
@@ -231,7 +231,7 @@ vmd_dispatch_control(int fd, struct privsep_proc *p, struct imsg *imsg)
__func__);
res = ENOENT;
close(imsg->fd);
- cmd = IMSG_VMDOP_SEND_VM_RESPONSE;
+ cmd = IMSG_VMDOP_START_VM_RESPONSE;
break;
}
if (atomicio(read, imsg->fd, &vmc, sizeof(vmc)) !=
@@ -255,7 +255,7 @@ vmd_dispatch_control(int fd, struct privsep_proc *p, struct imsg *imsg)
} else {
vm->vm_received = 1;
config_setvm(ps, vm, imsg->hdr.peerid, vmc.vmc_uid);
- log_debug("%s: sending fd to vmctl", __func__);
+ log_debug("%s: sending fd to vmm", __func__);
proc_compose_imsg(ps, PROC_VMM, -1,
IMSG_VMDOP_RECEIVE_VM_END, vm->vm_vmid, imsg->fd,
NULL, 0);
diff --git a/usr.sbin/vmd/vmm.c b/usr.sbin/vmd/vmm.c
index c852ff1ac65..73a895f726e 100644
--- a/usr.sbin/vmd/vmm.c
+++ b/usr.sbin/vmd/vmm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vmm.c,v 1.71 2017/07/15 05:05:36 pd Exp $ */
+/* $OpenBSD: vmm.c,v 1.72 2017/08/15 15:10:35 pd Exp $ */
/*
* Copyright (c) 2015 Mike Larkin <mlarkin@openbsd.org>
@@ -263,6 +263,9 @@ vmm_dispatch_parent(int fd, struct privsep_proc *p, struct imsg *imsg)
}
vm->vm_receive_fd = imsg->fd;
res = vmm_start_vm(imsg, &id);
+ /* Check if the ID can be mapped correctly */
+ if ((id = vm_id2vmid(id, NULL)) == 0)
+ res = ENOENT;
cmd = IMSG_VMDOP_START_VM_RESPONSE;
break;
default: