diff options
author | Reyk Floeter <reyk@cvs.openbsd.org> | 2017-04-19 15:38:33 +0000 |
---|---|---|
committer | Reyk Floeter <reyk@cvs.openbsd.org> | 2017-04-19 15:38:33 +0000 |
commit | 923ce6da9a97e870813201b5f5f266e32187d7ec (patch) | |
tree | 9492bf8f36f808d081b16405bf4a011e6d3726d0 /usr.sbin/vmctl/main.c | |
parent | 3c74bbd95f27b43502ef7e7923c49587fff96320 (diff) |
Add support for dynamic "NAT" interfaces (-L/local interface).
When a local interface is configured, vmd configures a /31 address on
the tap(4) interface of the host and provides another IP in the same
subnet via DHCP (BOOTP) to the VM. vmd runs an internal BOOTP server
that replies with IP, gateway, and DNS addresses to the VM. The
built-in server only ever responds to the VM on the inside and cannot
leak its DHCP responses to the outside.
Thanks to Uwe Werler, Josh Grosse, and some others for testing!
OK deraadt@
Diffstat (limited to 'usr.sbin/vmctl/main.c')
-rw-r--r-- | usr.sbin/vmctl/main.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/usr.sbin/vmctl/main.c b/usr.sbin/vmctl/main.c index da27fd6c913..20ced9884e7 100644 --- a/usr.sbin/vmctl/main.c +++ b/usr.sbin/vmctl/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.25 2017/04/06 18:07:13 reyk Exp $ */ +/* $OpenBSD: main.c,v 1.26 2017/04/19 15:38:32 reyk Exp $ */ /* * Copyright (c) 2015 Reyk Floeter <reyk@openbsd.org> @@ -65,7 +65,7 @@ struct ctl_command ctl_commands[] = { { "reload", CMD_RELOAD, ctl_reload, "" }, { "reset", CMD_RESET, ctl_reset, "[all|vms|switches]" }, { "start", CMD_START, ctl_start, "\"name\"" - " [-c] [-b image] [-m size]\n" + " [-Lc] [-b image] [-m size]\n" "\t\t[-n switch] [-i count] [-d disk]*" }, { "status", CMD_STATUS, ctl_status, "[id]" }, { "stop", CMD_STOP, ctl_stop, "id" }, @@ -539,7 +539,7 @@ ctl_start(struct parse_result *res, int argc, char *argv[]) argc--; argv++; - while ((ch = getopt(argc, argv, "b:cm:n:d:i:")) != -1) { + while ((ch = getopt(argc, argv, "b:cLm:n:d:i:")) != -1) { switch (ch) { case 'b': if (res->path) @@ -552,6 +552,10 @@ ctl_start(struct parse_result *res, int argc, char *argv[]) case 'c': tty_autoconnect = 1; break; + case 'L': + if (parse_network(res, ".") != 0) + errx(1, "invalid network: %s", optarg); + break; case 'm': if (res->size) errx(1, "memory specified multiple times"); |