OpenBSD CVS

CVS log for src/usr.sbin/vmd/priv.c


[BACK] Up to [local] / src / usr.sbin / vmd

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.24 / (download) - annotate - [select for diffs], Thu Jan 18 14:49:59 2024 UTC (4 months, 1 week ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, HEAD
Changes since 1.23: +5 -3 lines
Diff to previous 1.23 (colored)

Use imsg_get_fd() in vmd.

vmd uses a lot of fd passing and does it sometimes via extra abstraction
so this just tries to convert the code without any optimisations.

ok dv@

Revision 1.23 / (download) - annotate - [select for diffs], Thu Jul 13 18:31:59 2023 UTC (10 months, 2 weeks ago) by dv
Branch: MAIN
CVS Tags: OPENBSD_7_4_BASE, OPENBSD_7_4
Changes since 1.22: +22 -37 lines
Diff to previous 1.22 (colored)

vmd(8): pull validation into local prefix parser.

Validation for local prefixes, both inet and inet6, was scattered
around. To make it even more confusing, vmd was using generic address
parsing logic from prior network daemons. vmd doesn't need to parse
addresses other than when parsing the local prefix settings in
vm.conf and no runtime parsing is needed.

This change merges parsing and validation based on vmd's specific
needs for local prefixes (e.g. reserving enough bits for vm id and
network interface id encoding in an ipv4 address). In addition, it
simplifies the struct from a generic address struct to one focused
on just storing the v4 and v6 prefixes and masks. This cleans up an
unused TAILQ struct member that isn't used by vmd and was leftover
copy-pasta from those prior daemons.

The address parsing that vmd uses is also updated to using the
latest logic in bgpd(8).

ok mlarkin@

Revision 1.22 / (download) - annotate - [select for diffs], Sat Jan 28 14:40:53 2023 UTC (16 months ago) by dv
Branch: MAIN
CVS Tags: OPENBSD_7_3_BASE, OPENBSD_7_3
Changes since 1.21: +2 -2 lines
Diff to previous 1.21 (colored)

Move some header definitions from vmm(4) to vmd(8).

Part of an ongoing effort to move userland-specific information out
of a kernel header and directly into vmd(8). No functional change.

ok mlarkin@

Revision 1.21 / (download) - annotate - [select for diffs], Thu Dec 15 19:36:45 2022 UTC (17 months, 2 weeks ago) by millert
Branch: MAIN
Changes since 1.20: +5 -3 lines
Diff to previous 1.20 (colored)

priv_validgroup: do not read more than IF_NAMESIZE chars of name
Store the length locally instead of computing it multiple times.
OK dv@, previous version OK deraadt@

Revision 1.20 / (download) - annotate - [select for diffs], Thu Dec 15 16:01:40 2022 UTC (17 months, 2 weeks ago) by dv
Branch: MAIN
Changes since 1.19: +2 -2 lines
Diff to previous 1.19 (colored)

Add explicit casts to ctype functions in vmd(8).

OK millert@

Revision 1.19 / (download) - annotate - [select for diffs], Mon Nov 29 05:17:35 2021 UTC (2 years, 6 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_7_2_BASE, OPENBSD_7_2, OPENBSD_7_1_BASE, OPENBSD_7_1
Changes since 1.18: +2 -2 lines
Diff to previous 1.18 (colored)

mostly avoid sys/param.h with a local nitems()
ok mlarkin

Revision 1.18 / (download) - annotate - [select for diffs], Wed Nov 10 20:49:04 2021 UTC (2 years, 6 months ago) by sthen
Branch: MAIN
Changes since 1.17: +5 -6 lines
Diff to previous 1.17 (colored)

Remove switch(4) pieces, feedback/missing piece millert@ ok claudio@ mlarkin@

Revision 1.17 / (download) - annotate - [select for diffs], Mon Mar 29 23:37:01 2021 UTC (3 years, 2 months ago) by dv
Branch: MAIN
CVS Tags: OPENBSD_7_0_BASE, OPENBSD_7_0, OPENBSD_6_9_BASE, OPENBSD_6_9
Changes since 1.16: +20 -1 lines
Diff to previous 1.16 (colored)

Propagate host-side tap(4) lladdr to guest vm process to allow unicast dhcp
and bootp renewals with vmd(8)'s built-in dhcp server. Previous behavior
ignored did not intercept these packets and instead transmitted them.

This should make vmd(8)'s dhcp behave more as a true dhcp server should and
allows it to work properly with the new dhcpleased(8) attempting a renewal.

OK mlarkin@

Revision 1.16 / (download) - annotate - [select for diffs], Sun Feb 28 22:56:09 2021 UTC (3 years, 3 months ago) by dlg
Branch: MAIN
Changes since 1.15: +3 -2 lines
Diff to previous 1.15 (colored)

add veb(4) to the list of supported bridges/switches you can configure.

tested by josh rickmar
ok kn@

Revision 1.15 / (download) - annotate - [select for diffs], Fri Jun 28 13:32:51 2019 UTC (4 years, 11 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_6_8_BASE, OPENBSD_6_8, OPENBSD_6_7_BASE, OPENBSD_6_7, OPENBSD_6_6_BASE, OPENBSD_6_6
Changes since 1.14: +12 -12 lines
Diff to previous 1.14 (colored)

When system calls indicate an error they return -1, not some arbitrary
value < 0.  errno is only updated in this case.  Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.

Revision 1.14 / (download) - annotate - [select for diffs], Wed Nov 21 12:31:47 2018 UTC (5 years, 6 months ago) by reyk
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE, OPENBSD_6_5
Changes since 1.13: +139 -17 lines
Diff to previous 1.13 (colored)

Add support for "local inet6" interfaces.

ok & test ccardenas@, additional review from kn@

Revision 1.13 / (download) - annotate - [select for diffs], Sat Nov 11 02:50:07 2017 UTC (6 years, 6 months ago) by mlarkin
Branch: MAIN
CVS Tags: OPENBSD_6_4_BASE, OPENBSD_6_4, OPENBSD_6_3_BASE, OPENBSD_6_3
Changes since 1.12: +55 -39 lines
Diff to previous 1.12 (colored)

update switch handling in vmd(8). vmd now gets switch information (rdomain,
etc) from underlying switch interface instead of handling this on its
own.

Diff from carlos cardenas, Thanks!

ok reyk@

Revision 1.12 / (download) - annotate - [select for diffs], Mon Oct 30 03:37:33 2017 UTC (6 years, 7 months ago) by mlarkin
Branch: MAIN
Changes since 1.11: +11 -14 lines
Diff to previous 1.11 (colored)

vmd no longer creates bridges by default. users should create bridges in
/etc/hostname.bridge* files, and specify which bridge to use for a given
virtual switch in vm.conf.

diff from Carlos Cardenas, thanks

Revision 1.11 / (download) - annotate - [select for diffs], Thu Aug 31 09:00:46 2017 UTC (6 years, 9 months ago) by mlarkin
Branch: MAIN
CVS Tags: OPENBSD_6_2_BASE, OPENBSD_6_2
Changes since 1.10: +3 -3 lines
Diff to previous 1.10 (colored)

vmd: fix two wrong comments I stumbled across while updating the vmctl(8)
man page

Revision 1.10 / (download) - annotate - [select for diffs], Fri Aug 11 16:33:01 2017 UTC (6 years, 9 months ago) by reyk
Branch: MAIN
Changes since 1.9: +24 -16 lines
Diff to previous 1.9 (colored)

Use vmd's process rdomain via getrtable() instead of 0 by default.

This allows to run "route -T 1 exec vmd" to get rdomain 1 tap(4) and
bridge interfaces by default.

ok mlarkin@

Revision 1.9 / (download) - annotate - [select for diffs], Thu May 4 08:26:06 2017 UTC (7 years, 1 month ago) by reyk
Branch: MAIN
Changes since 1.8: +34 -1 lines
Diff to previous 1.8 (colored)

Add support for rdomains.

This allows to configure VM interfaces and switches in individual rdomains.

OK mlarkin@

Revision 1.8 / (download) - annotate - [select for diffs], Fri Apr 21 07:03:26 2017 UTC (7 years, 1 month ago) by reyk
Branch: MAIN
Changes since 1.7: +20 -7 lines
Diff to previous 1.7 (colored)

Add global configuration option "local prefix" to change prefix for -L.

The default prefix is 100.64.0.0/10 from RFC6598.

Requested by sthen@ chris@
OK mlarkin@

Revision 1.7 / (download) - annotate - [select for diffs], Wed Apr 19 15:38:32 2017 UTC (7 years, 1 month ago) by reyk
Branch: MAIN
Changes since 1.6: +89 -1 lines
Diff to previous 1.6 (colored)

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@

Revision 1.6 / (download) - annotate - [select for diffs], Thu Mar 2 07:33:37 2017 UTC (7 years, 3 months ago) by reyk
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.5: +3 -3 lines
Diff to previous 1.5 (colored)

Add "locked lladdr" option to prevent VMs from spoofing MAC addresses.

This is especially useful when multiple VMs share a switch, the
implementation is independent from the underlying switch or bridge.

no objections mlarkin@

Revision 1.5 / (download) - annotate - [select for diffs], Sat Oct 29 14:56:05 2016 UTC (7 years, 7 months ago) by edd
Branch: MAIN
Changes since 1.4: +3 -2 lines
Diff to previous 1.4 (colored)

Separate parsing vms and switches from starting them in vmd(8).

Brings us one step closer to having disabled by default vms is vm.conf(5),
which can be started with vmctl(8).

Input, testing and OK reyk@. Thanks.

Revision 1.4 / (download) - annotate - [select for diffs], Mon Oct 17 16:26:20 2016 UTC (7 years, 7 months ago) by reyk
Branch: MAIN
Changes since 1.3: +28 -13 lines
Diff to previous 1.3 (colored)

Add the option to specify an interface group per virtual switch as well;
this group will be added to all VM tap(4) interfaces in the switch.

Tested by martijn@

Revision 1.3 / (download) - annotate - [select for diffs], Sat Oct 15 14:02:11 2016 UTC (7 years, 7 months ago) by reyk
Branch: MAIN
Changes since 1.2: +41 -1 lines
Diff to previous 1.2 (colored)

Allow to add an interface to an interface group; with the group keyword.

Requested and tested by martijn@

Revision 1.2 / (download) - annotate - [select for diffs], Wed Oct 5 17:30:13 2016 UTC (7 years, 7 months ago) by reyk
Branch: MAIN
Changes since 1.1: +129 -10 lines
Diff to previous 1.1 (colored)

Add support for enhanced networking configuration and virtual switches.
See vm.conf(5) for more details.

OK mlarkin@

Revision 1.1 / (download) - annotate - [select for diffs], Tue Oct 4 17:17:30 2016 UTC (7 years, 7 months ago) by reyk
Branch: MAIN

Add a new "priv" process that is responsible for ioctls and restricted
operations that aren't allowed under pledge.  This is a companion to
the "vmd" process that runs as root but with pledge.

With the "priv" process, each new tap(4) interface now gets a
description to indicate the vm, eg. "vm1-if0-myvm".  For network
configuration will be done by vmd/priv later.

OK mlarkin@

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.