nspawn-settings.c revision b5efdb8af40ea759a1ea584c1bc44ecc81dd00ce
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering/***
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering This file is part of systemd.
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering Copyright 2015 Lennart Poettering
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering systemd is free software; you can redistribute it and/or modify it
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering under the terms of the GNU Lesser General Public License as published by
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering the Free Software Foundation; either version 2.1 of the License, or
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering (at your option) any later version.
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering systemd is distributed in the hope that it will be useful, but
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering WITHOUT ANY WARRANTY; without even the implied warranty of
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering Lesser General Public License for more details.
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering You should have received a copy of the GNU Lesser General Public License
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering along with systemd; If not, see <http://www.gnu.org/licenses/>.
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering***/
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering
4871690d9e32608bbd9b18505b5326c2079c9690Allin Cottrell#include "alloc-util.h"
07630cea1f3a845c09309f197ac7c4f11edd3b62Lennart Poettering#include "util.h"
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering#include "conf-parser.h"
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering#include "strv.h"
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering#include "cap-list.h"
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering#include "nspawn-settings.h"
13790add4bf648fed816361794d8277a75253410Lennart Poettering
4f5dd3943bef8a04be7e3b838b822bb9a7ad6cb3Lennart Poetteringint settings_load(FILE *f, const char *path, Settings **ret) {
4f5dd3943bef8a04be7e3b838b822bb9a7ad6cb3Lennart Poettering _cleanup_(settings_freep) Settings *s = NULL;
b5efdb8af40ea759a1ea584c1bc44ecc81dd00ceLennart Poettering int r;
a09561746f15b84da9471b5c4be74e53d19e4f3fLennart Poettering
4f5dd3943bef8a04be7e3b838b822bb9a7ad6cb3Lennart Poettering assert(path);
3ffd4af22052963e7a29431721ee204e634bea75Lennart Poettering assert(ret);
13790add4bf648fed816361794d8277a75253410Lennart Poettering
afc5dbf37fd2399d37976388d9dd9ab470ecf446Lennart Poettering s = new0(Settings, 1);
4f5dd3943bef8a04be7e3b838b822bb9a7ad6cb3Lennart Poettering if (!s)
4f5dd3943bef8a04be7e3b838b822bb9a7ad6cb3Lennart Poettering return -ENOMEM;
d025f1e4dca8fc1436aff76f9e6185fe3e728daaZbigniew Jędrzejewski-Szmek
3ffd4af22052963e7a29431721ee204e634bea75Lennart Poettering s->boot = -1;
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering s->personality = PERSONALITY_INVALID;
40b71e89bae4e51768db4dc50ec64c1e9c96eec4Sebastian Thorarensen
4f5dd3943bef8a04be7e3b838b822bb9a7ad6cb3Lennart Poettering s->read_only = -1;
6bedfcbb2970e06a4d3280c8fb62083d252ede73Lennart Poettering s->volatile_mode = _VOLATILE_MODE_INVALID;
4f5dd3943bef8a04be7e3b838b822bb9a7ad6cb3Lennart Poettering
4f5dd3943bef8a04be7e3b838b822bb9a7ad6cb3Lennart Poettering s->private_network = -1;
15a5e95075a7f6007dd97b2a165c8ed16fe683dfLennart Poettering s->network_veth = -1;
07630cea1f3a845c09309f197ac7c4f11edd3b62Lennart Poettering
7ccbd1ae843d77275f2c542582a9a80e5e058a70Lennart Poettering r = config_parse(NULL, path, f,
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering "Exec\0"
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering "Network\0"
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering "Files\0",
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering config_item_perf_lookup, nspawn_gperf_lookup,
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering false,
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering false,
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering true,
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering s);
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering if (r < 0)
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering return r;
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering *ret = s;
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering s = NULL;
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering return 0;
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering}
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart PoetteringSettings* settings_free(Settings *s) {
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering if (!s)
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering return NULL;
2de56f70941eaf91a4520bf33de47a87ebd8b2cbZbigniew Jędrzejewski-Szmek
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering strv_free(s->parameters);
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering strv_free(s->environment);
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering free(s->user);
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering strv_free(s->network_interfaces);
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering strv_free(s->network_macvlan);
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering strv_free(s->network_ipvlan);
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering free(s->network_bridge);
13790add4bf648fed816361794d8277a75253410Lennart Poettering expose_port_free_all(s->expose_ports);
e22aa3d3284709234f086ebebc13a905a295b7a7Lennart Poettering
13790add4bf648fed816361794d8277a75253410Lennart Poettering custom_mount_free_all(s->custom_mounts, s->n_custom_mounts);
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering free(s);
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering return NULL;
f9a810bedacf1da7c505c1786a2416d592665926Lennart Poettering}
f9a810bedacf1da7c505c1786a2416d592665926Lennart Poettering
13790add4bf648fed816361794d8277a75253410Lennart Poetteringbool settings_private_network(Settings *s) {
13790add4bf648fed816361794d8277a75253410Lennart Poettering assert(s);
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering
e22aa3d3284709234f086ebebc13a905a295b7a7Lennart Poettering return
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering s->private_network > 0 ||
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering s->network_veth > 0 ||
13790add4bf648fed816361794d8277a75253410Lennart Poettering s->network_bridge ||
13790add4bf648fed816361794d8277a75253410Lennart Poettering s->network_interfaces ||
13790add4bf648fed816361794d8277a75253410Lennart Poettering s->network_macvlan ||
13790add4bf648fed816361794d8277a75253410Lennart Poettering s->network_ipvlan;
13790add4bf648fed816361794d8277a75253410Lennart Poettering}
13790add4bf648fed816361794d8277a75253410Lennart Poettering
13790add4bf648fed816361794d8277a75253410Lennart Poetteringbool settings_network_veth(Settings *s) {
13790add4bf648fed816361794d8277a75253410Lennart Poettering assert(s);
e22aa3d3284709234f086ebebc13a905a295b7a7Lennart Poettering
e22aa3d3284709234f086ebebc13a905a295b7a7Lennart Poettering return
e22aa3d3284709234f086ebebc13a905a295b7a7Lennart Poettering s->network_veth > 0 ||
13790add4bf648fed816361794d8277a75253410Lennart Poettering s->network_bridge;
13790add4bf648fed816361794d8277a75253410Lennart Poettering}
13790add4bf648fed816361794d8277a75253410Lennart Poettering
13790add4bf648fed816361794d8277a75253410Lennart PoetteringDEFINE_CONFIG_PARSE_ENUM(config_parse_volatile_mode, volatile_mode, VolatileMode, "Failed to parse volatile mode");
13790add4bf648fed816361794d8277a75253410Lennart Poettering
13790add4bf648fed816361794d8277a75253410Lennart Poetteringint config_parse_expose_port(
13790add4bf648fed816361794d8277a75253410Lennart Poettering const char *unit,
13790add4bf648fed816361794d8277a75253410Lennart Poettering const char *filename,
2de56f70941eaf91a4520bf33de47a87ebd8b2cbZbigniew Jędrzejewski-Szmek unsigned line,
13790add4bf648fed816361794d8277a75253410Lennart Poettering const char *section,
13790add4bf648fed816361794d8277a75253410Lennart Poettering unsigned section_line,
13790add4bf648fed816361794d8277a75253410Lennart Poettering const char *lvalue,
13790add4bf648fed816361794d8277a75253410Lennart Poettering int ltype,
13790add4bf648fed816361794d8277a75253410Lennart Poettering const char *rvalue,
13790add4bf648fed816361794d8277a75253410Lennart Poettering void *data,
13790add4bf648fed816361794d8277a75253410Lennart Poettering void *userdata) {
13790add4bf648fed816361794d8277a75253410Lennart Poettering
13790add4bf648fed816361794d8277a75253410Lennart Poettering Settings *s = data;
13790add4bf648fed816361794d8277a75253410Lennart Poettering int r;
13790add4bf648fed816361794d8277a75253410Lennart Poettering
13790add4bf648fed816361794d8277a75253410Lennart Poettering assert(filename);
13790add4bf648fed816361794d8277a75253410Lennart Poettering assert(lvalue);
13790add4bf648fed816361794d8277a75253410Lennart Poettering assert(rvalue);
e22aa3d3284709234f086ebebc13a905a295b7a7Lennart Poettering
13790add4bf648fed816361794d8277a75253410Lennart Poettering r = expose_port_parse(&s->expose_ports, rvalue);
13790add4bf648fed816361794d8277a75253410Lennart Poettering if (r == -EEXIST) {
13790add4bf648fed816361794d8277a75253410Lennart Poettering log_syntax(unit, LOG_ERR, filename, line, r, "Duplicate port specification, ignoring: %s", rvalue);
13790add4bf648fed816361794d8277a75253410Lennart Poettering return 0;
13790add4bf648fed816361794d8277a75253410Lennart Poettering }
13790add4bf648fed816361794d8277a75253410Lennart Poettering if (r < 0) {
13790add4bf648fed816361794d8277a75253410Lennart Poettering log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse host port %s: %m", rvalue);
13790add4bf648fed816361794d8277a75253410Lennart Poettering return 0;
13790add4bf648fed816361794d8277a75253410Lennart Poettering }
13790add4bf648fed816361794d8277a75253410Lennart Poettering
13790add4bf648fed816361794d8277a75253410Lennart Poettering return 0;
13790add4bf648fed816361794d8277a75253410Lennart Poettering}
13790add4bf648fed816361794d8277a75253410Lennart Poettering
13790add4bf648fed816361794d8277a75253410Lennart Poetteringint config_parse_capability(
13790add4bf648fed816361794d8277a75253410Lennart Poettering const char *unit,
13790add4bf648fed816361794d8277a75253410Lennart Poettering const char *filename,
13790add4bf648fed816361794d8277a75253410Lennart Poettering unsigned line,
13790add4bf648fed816361794d8277a75253410Lennart Poettering const char *section,
13790add4bf648fed816361794d8277a75253410Lennart Poettering unsigned section_line,
13790add4bf648fed816361794d8277a75253410Lennart Poettering const char *lvalue,
13790add4bf648fed816361794d8277a75253410Lennart Poettering int ltype,
13790add4bf648fed816361794d8277a75253410Lennart Poettering const char *rvalue,
13790add4bf648fed816361794d8277a75253410Lennart Poettering void *data,
13790add4bf648fed816361794d8277a75253410Lennart Poettering void *userdata) {
13790add4bf648fed816361794d8277a75253410Lennart Poettering
13790add4bf648fed816361794d8277a75253410Lennart Poettering uint64_t u = 0, *result = data;
13790add4bf648fed816361794d8277a75253410Lennart Poettering int r;
13790add4bf648fed816361794d8277a75253410Lennart Poettering
13790add4bf648fed816361794d8277a75253410Lennart Poettering assert(filename);
13790add4bf648fed816361794d8277a75253410Lennart Poettering assert(lvalue);
dacd6cee76a08331b8c8616c5f30f70ee49aa2f9Lennart Poettering assert(rvalue);
13790add4bf648fed816361794d8277a75253410Lennart Poettering
13790add4bf648fed816361794d8277a75253410Lennart Poettering for (;;) {
13790add4bf648fed816361794d8277a75253410Lennart Poettering _cleanup_free_ char *word = NULL;
13790add4bf648fed816361794d8277a75253410Lennart Poettering int cap;
13790add4bf648fed816361794d8277a75253410Lennart Poettering
13790add4bf648fed816361794d8277a75253410Lennart Poettering r = extract_first_word(&rvalue, &word, NULL, 0);
13790add4bf648fed816361794d8277a75253410Lennart Poettering if (r < 0) {
13790add4bf648fed816361794d8277a75253410Lennart Poettering log_syntax(unit, LOG_ERR, filename, line, r, "Failed to extract capability string, ignoring: %s", rvalue);
13790add4bf648fed816361794d8277a75253410Lennart Poettering return 0;
13790add4bf648fed816361794d8277a75253410Lennart Poettering }
13790add4bf648fed816361794d8277a75253410Lennart Poettering if (r == 0)
13790add4bf648fed816361794d8277a75253410Lennart Poettering break;
13790add4bf648fed816361794d8277a75253410Lennart Poettering
13790add4bf648fed816361794d8277a75253410Lennart Poettering cap = capability_from_name(word);
13790add4bf648fed816361794d8277a75253410Lennart Poettering if (cap < 0) {
13790add4bf648fed816361794d8277a75253410Lennart Poettering log_syntax(unit, LOG_ERR, filename, line, 0, "Failed to parse capability, ignoring: %s", word);
13790add4bf648fed816361794d8277a75253410Lennart Poettering continue;
13790add4bf648fed816361794d8277a75253410Lennart Poettering }
13790add4bf648fed816361794d8277a75253410Lennart Poettering
13790add4bf648fed816361794d8277a75253410Lennart Poettering u |= 1 << ((uint64_t) cap);
dacd6cee76a08331b8c8616c5f30f70ee49aa2f9Lennart Poettering }
13790add4bf648fed816361794d8277a75253410Lennart Poettering
13790add4bf648fed816361794d8277a75253410Lennart Poettering if (u == 0)
13790add4bf648fed816361794d8277a75253410Lennart Poettering return 0;
13790add4bf648fed816361794d8277a75253410Lennart Poettering
13790add4bf648fed816361794d8277a75253410Lennart Poettering *result |= u;
13790add4bf648fed816361794d8277a75253410Lennart Poettering return 0;
13790add4bf648fed816361794d8277a75253410Lennart Poettering}
13790add4bf648fed816361794d8277a75253410Lennart Poettering
13790add4bf648fed816361794d8277a75253410Lennart Poetteringint config_parse_id128(
13790add4bf648fed816361794d8277a75253410Lennart Poettering const char *unit,
13790add4bf648fed816361794d8277a75253410Lennart Poettering const char *filename,
dacd6cee76a08331b8c8616c5f30f70ee49aa2f9Lennart Poettering unsigned line,
13790add4bf648fed816361794d8277a75253410Lennart Poettering const char *section,
13790add4bf648fed816361794d8277a75253410Lennart Poettering unsigned section_line,
13790add4bf648fed816361794d8277a75253410Lennart Poettering const char *lvalue,
13790add4bf648fed816361794d8277a75253410Lennart Poettering int ltype,
13790add4bf648fed816361794d8277a75253410Lennart Poettering const char *rvalue,
13790add4bf648fed816361794d8277a75253410Lennart Poettering void *data,
13790add4bf648fed816361794d8277a75253410Lennart Poettering void *userdata) {
dacd6cee76a08331b8c8616c5f30f70ee49aa2f9Lennart Poettering
13790add4bf648fed816361794d8277a75253410Lennart Poettering sd_id128_t t, *result = data;
13790add4bf648fed816361794d8277a75253410Lennart Poettering int r;
13790add4bf648fed816361794d8277a75253410Lennart Poettering
dacd6cee76a08331b8c8616c5f30f70ee49aa2f9Lennart Poettering assert(filename);
13790add4bf648fed816361794d8277a75253410Lennart Poettering assert(lvalue);
13790add4bf648fed816361794d8277a75253410Lennart Poettering assert(rvalue);
e22aa3d3284709234f086ebebc13a905a295b7a7Lennart Poettering
e22aa3d3284709234f086ebebc13a905a295b7a7Lennart Poettering r = sd_id128_from_string(rvalue, &t);
e22aa3d3284709234f086ebebc13a905a295b7a7Lennart Poettering if (r < 0) {
e22aa3d3284709234f086ebebc13a905a295b7a7Lennart Poettering log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse 128bit ID/UUID, ignoring: %s", rvalue);
e22aa3d3284709234f086ebebc13a905a295b7a7Lennart Poettering return 0;
e22aa3d3284709234f086ebebc13a905a295b7a7Lennart Poettering }
e22aa3d3284709234f086ebebc13a905a295b7a7Lennart Poettering
e22aa3d3284709234f086ebebc13a905a295b7a7Lennart Poettering *result = t;
e22aa3d3284709234f086ebebc13a905a295b7a7Lennart Poettering return 0;
13790add4bf648fed816361794d8277a75253410Lennart Poettering}
13790add4bf648fed816361794d8277a75253410Lennart Poettering
dacd6cee76a08331b8c8616c5f30f70ee49aa2f9Lennart Poetteringint config_parse_bind(
13790add4bf648fed816361794d8277a75253410Lennart Poettering const char *unit,
dacd6cee76a08331b8c8616c5f30f70ee49aa2f9Lennart Poettering const char *filename,
dacd6cee76a08331b8c8616c5f30f70ee49aa2f9Lennart Poettering unsigned line,
dacd6cee76a08331b8c8616c5f30f70ee49aa2f9Lennart Poettering const char *section,
dacd6cee76a08331b8c8616c5f30f70ee49aa2f9Lennart Poettering unsigned section_line,
dacd6cee76a08331b8c8616c5f30f70ee49aa2f9Lennart Poettering const char *lvalue,
13790add4bf648fed816361794d8277a75253410Lennart Poettering int ltype,
dacd6cee76a08331b8c8616c5f30f70ee49aa2f9Lennart Poettering const char *rvalue,
13790add4bf648fed816361794d8277a75253410Lennart Poettering void *data,
13790add4bf648fed816361794d8277a75253410Lennart Poettering void *userdata) {
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering Settings *settings = data;
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering int r;
e3bfb7be07d9b1f4ebb12eb22c4c8bcd2a988d51Zbigniew Jędrzejewski-Szmek
5ffa8c818120e35c89becd938d160235c069dd12Zbigniew Jędrzejewski-Szmek assert(filename);
e3bfb7be07d9b1f4ebb12eb22c4c8bcd2a988d51Zbigniew Jędrzejewski-Szmek assert(lvalue);
e3bfb7be07d9b1f4ebb12eb22c4c8bcd2a988d51Zbigniew Jędrzejewski-Szmek assert(rvalue);
2de56f70941eaf91a4520bf33de47a87ebd8b2cbZbigniew Jędrzejewski-Szmek
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering r = bind_mount_parse(&settings->custom_mounts, &settings->n_custom_mounts, rvalue, ltype);
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering if (r < 0) {
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering log_syntax(unit, LOG_ERR, filename, line, r, "Invalid bind mount specification %s: %m", rvalue);
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering return 0;
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering }
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering return 0;
e3bfb7be07d9b1f4ebb12eb22c4c8bcd2a988d51Zbigniew Jędrzejewski-Szmek}
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering
6f526243e6a638c2ea7bbdd07b963f57e110d120Evgeny Vereshchaginint config_parse_tmpfs(
6f526243e6a638c2ea7bbdd07b963f57e110d120Evgeny Vereshchagin const char *unit,
6f526243e6a638c2ea7bbdd07b963f57e110d120Evgeny Vereshchagin const char *filename,
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering unsigned line,
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering const char *section,
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering unsigned section_line,
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering const char *lvalue,
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering int ltype,
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering const char *rvalue,
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering void *data,
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering void *userdata) {
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering
40b71e89bae4e51768db4dc50ec64c1e9c96eec4Sebastian Thorarensen Settings *settings = data;
40b71e89bae4e51768db4dc50ec64c1e9c96eec4Sebastian Thorarensen int r;
40b71e89bae4e51768db4dc50ec64c1e9c96eec4Sebastian Thorarensen
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering assert(filename);
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering assert(lvalue);
e3bfb7be07d9b1f4ebb12eb22c4c8bcd2a988d51Zbigniew Jędrzejewski-Szmek assert(rvalue);
e3bfb7be07d9b1f4ebb12eb22c4c8bcd2a988d51Zbigniew Jędrzejewski-Szmek
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering r = tmpfs_mount_parse(&settings->custom_mounts, &settings->n_custom_mounts, rvalue);
e3bfb7be07d9b1f4ebb12eb22c4c8bcd2a988d51Zbigniew Jędrzejewski-Szmek if (r < 0) {
5ffa8c818120e35c89becd938d160235c069dd12Zbigniew Jędrzejewski-Szmek log_syntax(unit, LOG_ERR, filename, line, r, "Invalid temporary file system specification %s: %m", rvalue);
e3bfb7be07d9b1f4ebb12eb22c4c8bcd2a988d51Zbigniew Jędrzejewski-Szmek return 0;
e3bfb7be07d9b1f4ebb12eb22c4c8bcd2a988d51Zbigniew Jędrzejewski-Szmek }
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering if (settings->network_bridge)
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering settings->network_veth = true;
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering if (settings->network_interfaces ||
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering settings->network_macvlan ||
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering settings->network_ipvlan ||
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering settings->network_bridge ||
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering settings->network_veth)
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering settings->private_network = true;
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering
2de56f70941eaf91a4520bf33de47a87ebd8b2cbZbigniew Jędrzejewski-Szmek return 0;
2de56f70941eaf91a4520bf33de47a87ebd8b2cbZbigniew Jędrzejewski-Szmek}
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering