summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkettenis <kettenis@openbsd.org>2013-02-26 23:03:39 +0000
committerkettenis <kettenis@openbsd.org>2013-02-26 23:03:39 +0000
commit61b754187518e2acb4b7ecef6701e57f29b6ba5c (patch)
treedf196ff898cc54ea70eb244212763233f7e9c42b
parentEncoding conversion buffer size is one stream block, not one device (diff)
downloadwireguard-openbsd-61b754187518e2acb4b7ecef6701e57f29b6ba5c.tar.xz
wireguard-openbsd-61b754187518e2acb4b7ecef6701e57f29b6ba5c.zip
Some firmware revisions provide a factory-default configuration that contains
duplication arcs in the hvmd. Add a workaround for this problem. ok deraadt@
-rw-r--r--usr.sbin/ldomctl/config.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/usr.sbin/ldomctl/config.c b/usr.sbin/ldomctl/config.c
index d94a3fbd0a0..e32170a340b 100644
--- a/usr.sbin/ldomctl/config.c
+++ b/usr.sbin/ldomctl/config.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: config.c,v 1.14 2012/12/08 18:45:26 kettenis Exp $ */
+/* $OpenBSD: config.c,v 1.15 2013/02/26 23:03:39 kettenis Exp $ */
/*
* Copyright (c) 2012 Mark Kettenis
@@ -592,8 +592,16 @@ hvmd_init_endpoint(struct md *md, struct md_node *node)
if (resource_id >= max_guest_ldcs)
errx(1, "resource_id larger than max_guest_ldcs");
- if (ldc_endpoints[resource_id])
+ if (ldc_endpoints[resource_id]) {
+ /*
+ * Some machine descriptions seem to have duplicate
+ * arcs. Fortunately, these can be easily detected
+ * and ignored.
+ */
+ if (ldc_endpoints[resource_id]->hv_node == node)
+ return;
errx(1, "duplicate resource_id");
+ }
endpoint = xzalloc(sizeof(*endpoint));
endpoint->target_guest = -1;