networkd-network.c revision 4f882b2a5007e51032459e29d15a86df6b5ea9f4
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering/***
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering This file is part of systemd.
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering Copyright 2013 Tom Gundersen <teg@jklm.no>
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering systemd is free software; you can redistribute it and/or modify it
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering under the terms of the GNU Lesser General Public License as published by
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering the Free Software Foundation; either version 2.1 of the License, or
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering (at your option) any later version.
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering systemd is distributed in the hope that it will be useful, but
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering WITHOUT ANY WARRANTY; without even the implied warranty of
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering Lesser General Public License for more details.
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering You should have received a copy of the GNU Lesser General Public License
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering along with systemd; If not, see <http://www.gnu.org/licenses/>.
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering***/
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
1e02e182f1e06fcbe389474175de228103be39cbLennart Poettering#include "networkd.h"
1e02e182f1e06fcbe389474175de228103be39cbLennart Poettering#include "net-util.h"
b5efdb8af40ea759a1ea584c1bc44ecc81dd00ceLennart Poettering#include "path-util.h"
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering#include "conf-files.h"
f2f1dbe50fea13abadc9c1e845a29031b90b40f3Lennart Poettering#include "conf-parser.h"
b5efdb8af40ea759a1ea584c1bc44ecc81dd00ceLennart Poettering#include "util.h"
be808ea083fa07271116b4519c3c27fd20c5f077Tom Gundersen
f2f1dbe50fea13abadc9c1e845a29031b90b40f3Lennart Poetteringstatic int network_load_one(Manager *manager, const char *filename) {
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering _cleanup_network_free_ Network *network = NULL;
9df3ba6c6cb65eecec06f39dfe85a3596cedac4eTom Gundersen _cleanup_fclose_ FILE *file = NULL;
9df3ba6c6cb65eecec06f39dfe85a3596cedac4eTom Gundersen Route *route;
9df3ba6c6cb65eecec06f39dfe85a3596cedac4eTom Gundersen Address *address;
9df3ba6c6cb65eecec06f39dfe85a3596cedac4eTom Gundersen int r;
be808ea083fa07271116b4519c3c27fd20c5f077Tom Gundersen
be808ea083fa07271116b4519c3c27fd20c5f077Tom Gundersen assert(manager);
be808ea083fa07271116b4519c3c27fd20c5f077Tom Gundersen assert(filename);
be808ea083fa07271116b4519c3c27fd20c5f077Tom Gundersen
be808ea083fa07271116b4519c3c27fd20c5f077Tom Gundersen file = fopen(filename, "re");
be808ea083fa07271116b4519c3c27fd20c5f077Tom Gundersen if (!file) {
be808ea083fa07271116b4519c3c27fd20c5f077Tom Gundersen if (errno == ENOENT)
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering return 0;
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering else
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering return errno;
4e945a6f7971fd7d1f6b2c62ee3afdaff3c95ce4Lennart Poettering }
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
0dd25fb9f005d8ab7ac4bc10a609d00569f8c56aLennart Poettering network = new0(Network, 1);
3c0cf502796be355431d4a64d738e75f543aa51dLennart Poettering if (!network)
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering return log_oom();
eed857b71702f8551b46b66b31fa0d08583cf23cLennart Poettering
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering network->manager = manager;
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
4e945a6f7971fd7d1f6b2c62ee3afdaff3c95ce4Lennart Poettering LIST_HEAD_INIT(network->static_addresses);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering LIST_HEAD_INIT(network->static_routes);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
eed857b71702f8551b46b66b31fa0d08583cf23cLennart Poettering network->addresses_by_section = hashmap_new(uint64_hash_func, uint64_compare_func);
eed857b71702f8551b46b66b31fa0d08583cf23cLennart Poettering if (!network->addresses_by_section)
eed857b71702f8551b46b66b31fa0d08583cf23cLennart Poettering return log_oom();
eed857b71702f8551b46b66b31fa0d08583cf23cLennart Poettering
eed857b71702f8551b46b66b31fa0d08583cf23cLennart Poettering network->routes_by_section = hashmap_new(uint64_hash_func, uint64_compare_func);
eed857b71702f8551b46b66b31fa0d08583cf23cLennart Poettering if (!network->routes_by_section)
eed857b71702f8551b46b66b31fa0d08583cf23cLennart Poettering return log_oom();
eed857b71702f8551b46b66b31fa0d08583cf23cLennart Poettering
eed857b71702f8551b46b66b31fa0d08583cf23cLennart Poettering network->filename = strdup(filename);
eed857b71702f8551b46b66b31fa0d08583cf23cLennart Poettering if (!network->filename)
eed857b71702f8551b46b66b31fa0d08583cf23cLennart Poettering return log_oom();
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering network->dhcp_dns = true;
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering network->dhcp_mtu = true;
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
91b14d6ff362b938a72db17b095ee9903d07381bTom Gundersen r = config_parse(NULL, filename, file, "Match\0Network\0Address\0Route\0DHCPv4\0", config_item_perf_lookup,
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poettering (void*) network_gperf_lookup, false, false, network);
f4461e5641d53f27d6e76e0607bdaa9c0c58c1f6Lennart Poettering if (r < 0) {
f4461e5641d53f27d6e76e0607bdaa9c0c58c1f6Lennart Poettering log_warning("Could not parse config file %s: %s", filename, strerror(-r));
be808ea083fa07271116b4519c3c27fd20c5f077Tom Gundersen return r;
d74fb368b18f0fbd9a4fe6f15691bbea7f3c4a01Tom Gundersen }
4e945a6f7971fd7d1f6b2c62ee3afdaff3c95ce4Lennart Poettering
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering LIST_PREPEND(networks, manager->networks, network);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
9df3ba6c6cb65eecec06f39dfe85a3596cedac4eTom Gundersen LIST_FOREACH(static_routes, route, network->static_routes) {
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering if (!route->family) {
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poettering log_warning("Route section without Gateway field configured in %s. "
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poettering "Ignoring", filename);
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poettering return 0;
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poettering }
eed857b71702f8551b46b66b31fa0d08583cf23cLennart Poettering
eed857b71702f8551b46b66b31fa0d08583cf23cLennart Poettering if (route->dst_family && route->family != route->dst_family) {
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poettering log_warning("Route section with conflicting Gateway and Destination address "
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poettering "family configured in %s. Ignoring", filename);
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poettering return 0;
eed857b71702f8551b46b66b31fa0d08583cf23cLennart Poettering }
eed857b71702f8551b46b66b31fa0d08583cf23cLennart Poettering }
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poettering
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poettering LIST_FOREACH(static_addresses, address, network->static_addresses) {
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poettering if (!address->family) {
eed857b71702f8551b46b66b31fa0d08583cf23cLennart Poettering log_warning("Address section without Address field configured in %s. "
eed857b71702f8551b46b66b31fa0d08583cf23cLennart Poettering "Ignoring", filename);
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poettering return 0;
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poettering }
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poettering }
4e945a6f7971fd7d1f6b2c62ee3afdaff3c95ce4Lennart Poettering
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poettering network = NULL;
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
0eac462399c8e87bcce252cf058eba9f2678f2bdLennart Poettering return 0;
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering}
4e945a6f7971fd7d1f6b2c62ee3afdaff3c95ce4Lennart Poettering
4e945a6f7971fd7d1f6b2c62ee3afdaff3c95ce4Lennart Poetteringint network_load(Manager *manager) {
4e945a6f7971fd7d1f6b2c62ee3afdaff3c95ce4Lennart Poettering Network *network;
4e945a6f7971fd7d1f6b2c62ee3afdaff3c95ce4Lennart Poettering _cleanup_strv_free_ char **files = NULL;
3e684349c2cead2e6fd2f816c34eb17daba23a49Lennart Poettering char **f;
3e684349c2cead2e6fd2f816c34eb17daba23a49Lennart Poettering int r;
3e684349c2cead2e6fd2f816c34eb17daba23a49Lennart Poettering
4e945a6f7971fd7d1f6b2c62ee3afdaff3c95ce4Lennart Poettering assert(manager);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering while ((network = manager->networks))
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering network_free(network);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering r = conf_files_list_strv(&files, ".network", NULL, network_dirs);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering if (r < 0) {
91b14d6ff362b938a72db17b095ee9903d07381bTom Gundersen log_error("Failed to enumerate network files: %s", strerror(-r));
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering return r;
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering }
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
91b14d6ff362b938a72db17b095ee9903d07381bTom Gundersen STRV_FOREACH_BACKWARDS(f, files) {
91b14d6ff362b938a72db17b095ee9903d07381bTom Gundersen r = network_load_one(manager, *f);
cab5b05903096e1c9cf5575ccc73f89d15c8db69Lennart Poettering if (r < 0)
91b14d6ff362b938a72db17b095ee9903d07381bTom Gundersen return r;
91b14d6ff362b938a72db17b095ee9903d07381bTom Gundersen }
91b14d6ff362b938a72db17b095ee9903d07381bTom Gundersen
0eac462399c8e87bcce252cf058eba9f2678f2bdLennart Poettering return 0;
91b14d6ff362b938a72db17b095ee9903d07381bTom Gundersen}
91b14d6ff362b938a72db17b095ee9903d07381bTom Gundersen
3e684349c2cead2e6fd2f816c34eb17daba23a49Lennart Poetteringvoid network_free(Network *network) {
0eac462399c8e87bcce252cf058eba9f2678f2bdLennart Poettering Route *route;
0eac462399c8e87bcce252cf058eba9f2678f2bdLennart Poettering Address *address;
91b14d6ff362b938a72db17b095ee9903d07381bTom Gundersen
0eac462399c8e87bcce252cf058eba9f2678f2bdLennart Poettering if (!network)
0eac462399c8e87bcce252cf058eba9f2678f2bdLennart Poettering return;
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
6cb08a8930bdaca950b152b1e8b82466ed59511cLennart Poettering free(network->filename);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering free(network->match_mac);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering free(network->match_path);
87f5a19343acf8ba697acc5a62bdb1a2b8c9eda3Lennart Poettering free(network->match_driver);
0eac462399c8e87bcce252cf058eba9f2678f2bdLennart Poettering free(network->match_type);
0eac462399c8e87bcce252cf058eba9f2678f2bdLennart Poettering free(network->match_name);
0eac462399c8e87bcce252cf058eba9f2678f2bdLennart Poettering
91b14d6ff362b938a72db17b095ee9903d07381bTom Gundersen free(network->description);
0eac462399c8e87bcce252cf058eba9f2678f2bdLennart Poettering
0eac462399c8e87bcce252cf058eba9f2678f2bdLennart Poettering address_free(network->dns);
0eac462399c8e87bcce252cf058eba9f2678f2bdLennart Poettering
91b14d6ff362b938a72db17b095ee9903d07381bTom Gundersen while ((route = network->static_routes))
0eac462399c8e87bcce252cf058eba9f2678f2bdLennart Poettering route_free(route);
0eac462399c8e87bcce252cf058eba9f2678f2bdLennart Poettering
91b14d6ff362b938a72db17b095ee9903d07381bTom Gundersen while ((address = network->static_addresses))
0eac462399c8e87bcce252cf058eba9f2678f2bdLennart Poettering address_free(address);
0eac462399c8e87bcce252cf058eba9f2678f2bdLennart Poettering
0eac462399c8e87bcce252cf058eba9f2678f2bdLennart Poettering hashmap_free(network->addresses_by_section);
0eac462399c8e87bcce252cf058eba9f2678f2bdLennart Poettering hashmap_free(network->routes_by_section);
eed857b71702f8551b46b66b31fa0d08583cf23cLennart Poettering
0eac462399c8e87bcce252cf058eba9f2678f2bdLennart Poettering if (network->manager && network->manager->networks)
0eac462399c8e87bcce252cf058eba9f2678f2bdLennart Poettering LIST_REMOVE(networks, network->manager->networks, network);
0eac462399c8e87bcce252cf058eba9f2678f2bdLennart Poettering
0eac462399c8e87bcce252cf058eba9f2678f2bdLennart Poettering free(network);
eed857b71702f8551b46b66b31fa0d08583cf23cLennart Poettering}
0eac462399c8e87bcce252cf058eba9f2678f2bdLennart Poettering
eed857b71702f8551b46b66b31fa0d08583cf23cLennart Poetteringint network_get(Manager *manager, struct udev_device *device, Network **ret) {
0eac462399c8e87bcce252cf058eba9f2678f2bdLennart Poettering Network *network;
0eac462399c8e87bcce252cf058eba9f2678f2bdLennart Poettering
0eac462399c8e87bcce252cf058eba9f2678f2bdLennart Poettering assert(manager);
eed857b71702f8551b46b66b31fa0d08583cf23cLennart Poettering assert(device);
0eac462399c8e87bcce252cf058eba9f2678f2bdLennart Poettering assert(ret);
eed857b71702f8551b46b66b31fa0d08583cf23cLennart Poettering
0eac462399c8e87bcce252cf058eba9f2678f2bdLennart Poettering LIST_FOREACH(networks, network, manager->networks) {
0eac462399c8e87bcce252cf058eba9f2678f2bdLennart Poettering if (net_match_config(network->match_mac, network->match_path,
0eac462399c8e87bcce252cf058eba9f2678f2bdLennart Poettering network->match_driver, network->match_type,
0eac462399c8e87bcce252cf058eba9f2678f2bdLennart Poettering network->match_name,
0eac462399c8e87bcce252cf058eba9f2678f2bdLennart Poettering udev_device_get_sysattr_value(device, "address"),
0eac462399c8e87bcce252cf058eba9f2678f2bdLennart Poettering udev_device_get_property_value(device, "ID_PATH"),
0eac462399c8e87bcce252cf058eba9f2678f2bdLennart Poettering udev_device_get_driver(device),
0eac462399c8e87bcce252cf058eba9f2678f2bdLennart Poettering udev_device_get_devtype(device),
0eac462399c8e87bcce252cf058eba9f2678f2bdLennart Poettering udev_device_get_sysname(device))) {
0eac462399c8e87bcce252cf058eba9f2678f2bdLennart Poettering log_debug("%s: found matching network '%s'",
0eac462399c8e87bcce252cf058eba9f2678f2bdLennart Poettering udev_device_get_sysname(device),
0eac462399c8e87bcce252cf058eba9f2678f2bdLennart Poettering network->filename);
91b14d6ff362b938a72db17b095ee9903d07381bTom Gundersen *ret = network;
91b14d6ff362b938a72db17b095ee9903d07381bTom Gundersen return 0;
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poettering }
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poettering }
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poettering
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poettering *ret = NULL;
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poettering
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poettering return -ENOENT;
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poettering}
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poettering
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poetteringint network_apply(Manager *manager, Network *network, Link *link) {
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poettering int r;
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poettering
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poettering link->network = network;
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poettering
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poettering r = link_configure(link);
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poettering if (r < 0)
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poettering return r;
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poettering
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poettering if (network->dns) {
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poettering r = manager_update_resolv_conf(manager);
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poettering if (r < 0)
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poettering return r;
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poettering }
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poettering
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poettering return 0;
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poettering}
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poettering
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poetteringint config_parse_bridge(const char *unit,
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poettering const char *filename,
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poettering unsigned line,
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poettering const char *section,
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poettering unsigned section_line,
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poettering const char *lvalue,
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poettering int ltype,
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poettering const char *rvalue,
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poettering void *data,
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poettering void *userdata) {
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poettering Network *network = userdata;
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poettering Bridge *bridge;
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poettering int r;
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poettering
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poettering assert(filename);
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poettering assert(lvalue);
6bb2c08597c999c429e889cd2403b2fef5f3e1a0Lennart Poettering assert(rvalue);
9df3ba6c6cb65eecec06f39dfe85a3596cedac4eTom Gundersen assert(data);
9df3ba6c6cb65eecec06f39dfe85a3596cedac4eTom Gundersen
6bb2c08597c999c429e889cd2403b2fef5f3e1a0Lennart Poettering r = bridge_get(network->manager, rvalue, &bridge);
6bb2c08597c999c429e889cd2403b2fef5f3e1a0Lennart Poettering if (r < 0) {
b652d4a2099d1c167584dcc1d179d47c58dc38a2Lennart Poettering log_syntax(unit, LOG_ERR, filename, line, EINVAL,
6bb2c08597c999c429e889cd2403b2fef5f3e1a0Lennart Poettering "Bridge is invalid, ignoring assignment: %s", rvalue);
de54e62b4bd7856fb897c9a2ee93cc228adb2135Lennart Poettering return 0;
de54e62b4bd7856fb897c9a2ee93cc228adb2135Lennart Poettering }
de54e62b4bd7856fb897c9a2ee93cc228adb2135Lennart Poettering
f4461e5641d53f27d6e76e0607bdaa9c0c58c1f6Lennart Poettering network->bridge = bridge;
be808ea083fa07271116b4519c3c27fd20c5f077Tom Gundersen
be808ea083fa07271116b4519c3c27fd20c5f077Tom Gundersen return 0;
6bb2c08597c999c429e889cd2403b2fef5f3e1a0Lennart Poettering}
6bb2c08597c999c429e889cd2403b2fef5f3e1a0Lennart Poettering