networkd-network.c revision e9f3d2d508bfd9fb5b54e82994bda365a71eb864
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
/***
This file is part of systemd.
Copyright 2013 Tom Gundersen <teg@jklm.no>
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <ctype.h>
#include "networkd.h"
#include "networkd-netdev.h"
#include "network-internal.h"
#include "path-util.h"
#include "conf-files.h"
#include "conf-parser.h"
#include "util.h"
int r;
if (!file) {
return 0;
else
return -errno;
}
if (null_or_empty_path(filename)) {
return 0;
}
if (!network)
return log_oom();
return log_oom();
return log_oom();
return log_oom();
if (!network->addresses_by_section)
return log_oom();
if (!network->routes_by_section)
return log_oom();
return log_oom();
network->dhcp_hostname = true;
network->dhcp_domainname = true;
network->dhcp_routes = true;
network->dhcp_sendhost = true;
"Match\0Network\0Address\0Route\0DHCP\0DHCPv4\0",
false, false, network);
if (r < 0) {
return r;
}
log_warning("Route section without Gateway field configured in %s. "
"Ignoring", filename);
return 0;
}
}
log_warning("Address section without Address field configured in %s. "
"Ignoring", filename);
return 0;
}
}
return 0;
}
char **f;
int r;
if (r < 0) {
return r;
}
STRV_FOREACH_BACKWARDS(f, files) {
r = network_load_one(manager, *f);
if (r < 0)
return r;
}
return 0;
}
Iterator i;
if (!network)
return;
}
}
}
ifname)) {
return 0;
}
}
return -ENOENT;
}
int r;
if (r < 0)
return r;
}
return 0;
}
int config_parse_netdev(const char *unit,
const char *filename,
unsigned line,
const char *section,
unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
void *data,
void *userdata) {
char *p;
int r;
if (!kind_string)
return log_oom();
/* the keys are CamelCase versions of the kind */
for (p = kind_string; *p; p++)
*p = tolower(*p);
if (kind == _NETDEV_KIND_INVALID) {
"Invalid NetDev kind: %s", lvalue);
return 0;
}
if (r < 0) {
return 0;
}
return 0;
}
switch (kind) {
case NETDEV_KIND_BRIDGE:
break;
case NETDEV_KIND_BOND:
break;
case NETDEV_KIND_VLAN:
if (r < 0) {
"Can not add VLAN to network: %s", rvalue);
return 0;
}
break;
case NETDEV_KIND_MACVLAN:
if (r < 0) {
"Can not add MACVLAN to network: %s", rvalue);
return 0;
}
break;
case NETDEV_KIND_VXLAN:
if (r < 0) {
"Can not add VXLAN to network: %s", rvalue);
return 0;
}
break;
default:
assert_not_reached("Can not parse NetDev");
}
return 0;
}
int config_parse_tunnel(const char *unit,
const char *filename,
unsigned line,
const char *section,
unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
void *data,
void *userdata) {
int r;
if (r < 0) {
"Tunnel is invalid, ignoring assignment: %s", rvalue);
return 0;
}
"NetDev is not a tunnel, ignoring assignment: %s", rvalue);
return 0;
}
return 0;
}