networkd-network.c revision 54abf461d6b10dc270c4bb2aeac65f240ff1c5cd
/*-*- 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 "networkd.h"
#include "net-util.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 (!network)
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;
r = config_parse(NULL, filename, file, "Match\0Network\0Address\0Route\0DHCPv4\0", config_item_perf_lookup,
(void*) network_gperf_lookup, false, false, network);
if (r < 0) {
return r;
}
log_warning("Route section without Gateway field configured in %s. "
"Ignoring", filename);
return 0;
}
log_warning("Route section with conflicting Gateway and Destination address "
"family 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;
}
if (!network)
return;
}
log_debug("%s: found matching network '%s'",
return 0;
}
}
return -ENOENT;
}
int r;
r = link_configure(link);
if (r < 0)
return r;
if (r < 0)
return r;
}
return 0;
}
int config_parse_bridge(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) {
"Bridge is invalid, ignoring assignment: %s", rvalue);
return 0;
}
"Netdev is not a bridge, ignoring assignment: %s", rvalue);
return 0;
}
return 0;
}
int config_parse_bond(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) {
"Bond is invalid, ignoring assignment: %s", rvalue);
return 0;
}
"Netdev is not a bond, ignoring assignment: %s", rvalue);
return 0;
}
return 0;
}
int config_parse_vlan(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) {
"VLAN is invalid, ignoring assignment: %s", rvalue);
return 0;
}
"Netdev is not a VLAN, ignoring assignment: %s", rvalue);
return 0;
}
return 0;
}