networkd-util.c revision 85e070c2b3f66d838c11f8f008106b9e42c9afaf
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering This file is part of systemd.
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering Copyright 2013 Tom Gundersen <teg@jklm.no>
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering systemd is free software; you can redistribute it and/or modify it
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering under the terms of the GNU Lesser General Public License as published by
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering the Free Software Foundation; either version 2.1 of the License, or
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering (at your option) any later version.
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering systemd is distributed in the hope that it will be useful, but
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering WITHOUT ANY WARRANTY; without even the implied warranty of
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering Lesser General Public License for more details.
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering You should have received a copy of the GNU Lesser General Public License
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering along with systemd; If not, see <http://www.gnu.org/licenses/>.
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poetteringconst char *address_family_boolean_to_string(AddressFamilyBoolean b) {
a34286684ebb78dd3db0d7f34feb2c121c9d00ccMichal Sekletar return "ipv4";
3f6fd1ba65f962702753c4ad284b588e59689a23Lennart Poettering return "ipv6";
3f6fd1ba65f962702753c4ad284b588e59689a23Lennart PoetteringAddressFamilyBoolean address_family_boolean_from_string(const char *s) {
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering /* Make this a true superset of a boolean */
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart PoetteringDEFINE_CONFIG_PARSE_ENUM(config_parse_address_family_boolean, address_family_boolean, AddressFamilyBoolean, "Failed to parse option");
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poetteringint config_parse_address_family_boolean_with_kernel(
e7e55dbdc38f929805ab2407fbd50886043a9e7cDavid Herrmann s = address_family_boolean_from_string(rvalue);
e7e55dbdc38f929805ab2407fbd50886043a9e7cDavid Herrmann log_syntax(unit, LOG_ERR, filename, line, 0, "Failed to parse IPForward= option, ignoring: %s", rvalue);
a34286684ebb78dd3db0d7f34feb2c121c9d00ccMichal Sekletarstatic const char* const resolve_support_table[_RESOLVE_SUPPORT_MAX] = {
a34286684ebb78dd3db0d7f34feb2c121c9d00ccMichal SekletarDEFINE_STRING_TABLE_LOOKUP(resolve_support, ResolveSupport);
a34286684ebb78dd3db0d7f34feb2c121c9d00ccMichal Sekletar /* Our enum shall be a superset of booleans, hence first try
a34286684ebb78dd3db0d7f34feb2c121c9d00ccMichal Sekletar * to parse as boolean, and then as enum */
b344bcbbfda8fbe14dadc5aa4b5dfb3ced6d76e2Lennart Poettering else if (k == 0)
a34286684ebb78dd3db0d7f34feb2c121c9d00ccMichal Sekletar log_syntax(unit, LOG_ERR, filename, line, 0, "Failed to parse %s= option, ignoring: %s", lvalue, rvalue);