nspawn: add helper settings_network_configured()

The new helper returns whether the settings file had *any* networking
setting configured at all. We already have a similar helper
settings_private_network() which returns a similar result. The
difference is that the new helper will return true when the private
network was explicitly turned off, while the old one will only return
true if configured and enabled.

We'll reuse the helper a 2nd time later on, but even without it it makes
things a bit more readable.
This commit is contained in:
Lennart Poettering
2021-11-09 18:32:10 +01:00
parent 8c1e088ac9
commit a1dfd585c4
3 changed files with 24 additions and 9 deletions
+1 -9
View File
@@ -4407,15 +4407,7 @@ static int merge_settings(Settings *settings, const char *path) {
}
if ((arg_settings_mask & SETTING_NETWORK) == 0 &&
(settings->private_network >= 0 ||
settings->network_veth >= 0 ||
settings->network_bridge ||
settings->network_zone ||
settings->network_interfaces ||
settings->network_macvlan ||
settings->network_ipvlan ||
settings->network_veth_extra ||
settings->network_namespace_path)) {
settings_network_configured(settings)) {
if (!arg_settings_trusted)
log_warning("Ignoring network settings, file %s is not trusted.", path);