summaryrefslogtreecommitdiffstats
path: root/usr.sbin/vmd/control.c
diff options
context:
space:
mode:
authorreyk <reyk@openbsd.org>2017-05-04 16:54:41 +0000
committerreyk <reyk@openbsd.org>2017-05-04 16:54:41 +0000
commitb55cbc1d207326ae9d0454d138ec80d9a2e1b7d7 (patch)
tree9ebb5c95b63bcdaa38bd8bba37df7890e690106d /usr.sbin/vmd/control.c
parentDocument that -u wants to read from /dev/mem, so it needs kern.allowkmem=1. (diff)
downloadwireguard-openbsd-b55cbc1d207326ae9d0454d138ec80d9a2e1b7d7.tar.xz
wireguard-openbsd-b55cbc1d207326ae9d0454d138ec80d9a2e1b7d7.zip
Report error for vmctl commands that need root privileges.
specifically: vmctl (load|reload|reset|log) Reported by Christian Barthel
Diffstat (limited to 'usr.sbin/vmd/control.c')
-rw-r--r--usr.sbin/vmd/control.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/usr.sbin/vmd/control.c b/usr.sbin/vmd/control.c
index cb890ca6826..d67b19001ed 100644
--- a/usr.sbin/vmd/control.c
+++ b/usr.sbin/vmd/control.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: control.c,v 1.17 2017/04/21 07:03:26 reyk Exp $ */
+/* $OpenBSD: control.c,v 1.18 2017/05/04 16:54:41 reyk Exp $ */
/*
* Copyright (c) 2010-2015 Reyk Floeter <reyk@openbsd.org>
@@ -363,7 +363,15 @@ control_dispatch_imsg(int fd, short event, void *arg)
memcpy(&v, imsg.data, sizeof(v));
log_setverbose(v);
+ /* FALLTHROUGH */
+ case IMSG_VMDOP_LOAD:
+ case IMSG_VMDOP_RELOAD:
+ case IMSG_CTL_RESET:
proc_forward_imsg(ps, &imsg, PROC_PARENT, -1);
+
+ /* Report success to the control client */
+ imsg_compose_event(&c->iev, IMSG_CTL_OK,
+ 0, 0, -1, NULL, 0);
break;
case IMSG_VMDOP_START_VM_REQUEST:
if (IMSG_DATA_SIZE(&imsg) < sizeof(vmc))
@@ -399,11 +407,6 @@ control_dispatch_imsg(int fd, short event, void *arg)
return;
}
break;
- case IMSG_VMDOP_LOAD:
- case IMSG_VMDOP_RELOAD:
- case IMSG_CTL_RESET:
- proc_forward_imsg(ps, &imsg, PROC_PARENT, -1);
- break;
default:
log_debug("%s: error handling imsg %d",
__func__, imsg.hdr.type);