bhyve maintains a schema of supported configuration options.
Currently, this schema is only used to implement bhyve -o help.
However, configuration options accessed by bhyve are not validated
against this schema.
Address that by adding configuration option validation:
- In main(), install a path validator using set_config_path_validator().
- Introduce config_schema_path_valid() which searches the schema for an exact or patterned match, such as memory.size or pci.B.S.F.path.
- Update get_config_value() and get_config_value_node() to call validate_config_path() which invokes config_schema_path_valid().
- When a path is not supported, exit with an error. Otherwise, it works as before.
Track the full paths of configuration nvlist nodes so node-relative
accesses can also be validated.
Keep raw lookups used for variable expansion unvalidated so custom
variables remain supported.
To make this work, update callers of nvlist_get_string()
to call get_config_value_node() instead.
For the slirp helper, retrieve the "mtu" value before cloning nvlist
to retain access to the configuration parent node.
Add missing machine-dependent options to the schema.
For the deprecated options, introduce config_compat_options.
These options are accepted, but not printed out in -o help.
MFC after: 1 month
MFC to: stable/15
Sponsored by: The FreeBSD Foundation