summaryrefslogtreecommitdiff
path: root/usr.sbin/vmd/virtio.h
diff options
context:
space:
mode:
authorReyk Floeter <reyk@cvs.openbsd.org>2017-04-19 15:38:33 +0000
committerReyk Floeter <reyk@cvs.openbsd.org>2017-04-19 15:38:33 +0000
commit923ce6da9a97e870813201b5f5f266e32187d7ec (patch)
tree9492bf8f36f808d081b16405bf4a011e6d3726d0 /usr.sbin/vmd/virtio.h
parent3c74bbd95f27b43502ef7e7923c49587fff96320 (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/vmd/virtio.h')
-rw-r--r--usr.sbin/vmd/virtio.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/usr.sbin/vmd/virtio.h b/usr.sbin/vmd/virtio.h
index 04b81ea472d..a830d1738d0 100644
--- a/usr.sbin/vmd/virtio.h
+++ b/usr.sbin/vmd/virtio.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: virtio.h,v 1.14 2017/03/27 00:28:04 deraadt Exp $ */
+/* $OpenBSD: virtio.h,v 1.15 2017/04/19 15:38:32 reyk Exp $ */
/*
* Copyright (c) 2015 Mike Larkin <mlarkin@openbsd.org>
@@ -118,9 +118,13 @@ struct vionet_dev {
int fd, rx_added;
int rx_pending;
uint32_t vm_id;
+ uint32_t vm_vmid;
int irq;
uint8_t mac[6];
+
+ int idx;
int lockedmac;
+ int local;
};
struct virtio_net_hdr {
@@ -154,7 +158,8 @@ struct vmmci_dev {
int irq;
};
-void virtio_init(struct vmop_create_params *, int *, int *);
+/* virtio.c */
+void virtio_init(struct vmd_vm *, int *, int *);
uint32_t vring_size(uint32_t);
int virtio_rnd_io(int, uint16_t, uint32_t *, uint8_t *, void *, uint8_t);
@@ -181,3 +186,6 @@ void vmmci_ack(unsigned int);
void vmmci_timeout(int, short, void *);
const char *vioblk_cmd_name(uint32_t);
+
+/* dhcp.c */
+ssize_t dhcp_request(struct vionet_dev *, char *, size_t, char **);