networkd-network.c revision 60c35566600f45350c37f152c1093018972bd9a5
cc08604ef06281d6375ed35ea3076ab65f3a0c3bwrowe/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
cc08604ef06281d6375ed35ea3076ab65f3a0c3bwrowe This file is part of systemd.
cc08604ef06281d6375ed35ea3076ab65f3a0c3bwrowe Copyright 2013 Tom Gundersen <teg@jklm.no>
cc08604ef06281d6375ed35ea3076ab65f3a0c3bwrowe systemd is free software; you can redistribute it and/or modify it
cc08604ef06281d6375ed35ea3076ab65f3a0c3bwrowe under the terms of the GNU Lesser General Public License as published by
cc08604ef06281d6375ed35ea3076ab65f3a0c3bwrowe the Free Software Foundation; either version 2.1 of the License, or
cc08604ef06281d6375ed35ea3076ab65f3a0c3bwrowe (at your option) any later version.
cc08604ef06281d6375ed35ea3076ab65f3a0c3bwrowe systemd is distributed in the hope that it will be useful, but
cc08604ef06281d6375ed35ea3076ab65f3a0c3bwrowe WITHOUT ANY WARRANTY; without even the implied warranty of
cc08604ef06281d6375ed35ea3076ab65f3a0c3bwrowe MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
cc08604ef06281d6375ed35ea3076ab65f3a0c3bwrowe Lesser General Public License for more details.
cc08604ef06281d6375ed35ea3076ab65f3a0c3bwrowe You should have received a copy of the GNU Lesser General Public License
cc08604ef06281d6375ed35ea3076ab65f3a0c3bwrowe along with systemd; If not, see <http://www.gnu.org/licenses/>.
cc08604ef06281d6375ed35ea3076ab65f3a0c3bwrowestatic int network_load_one(Manager *manager, const char *filename) {
cc08604ef06281d6375ed35ea3076ab65f3a0c3bwrowe network->stacked_netdevs = hashmap_new(&string_hash_ops);
cc08604ef06281d6375ed35ea3076ab65f3a0c3bwrowe "Network\0"
cc08604ef06281d6375ed35ea3076ab65f3a0c3bwrowe "Address\0"
cc08604ef06281d6375ed35ea3076ab65f3a0c3bwrowe "BridgeFDB\0",
cc08604ef06281d6375ed35ea3076ab65f3a0c3bwrowe config_item_perf_lookup, network_network_gperf_lookup,
cc08604ef06281d6375ed35ea3076ab65f3a0c3bwrowe false, false, true, network);
cc08604ef06281d6375ed35ea3076ab65f3a0c3bwrowe /* IPMasquerade=yes implies IPForward=yes */
cc08604ef06281d6375ed35ea3076ab65f3a0c3bwrowe r = hashmap_ensure_allocated(&manager->networks_by_name, &string_hash_ops);
cc08604ef06281d6375ed35ea3076ab65f3a0c3bwrowe r = hashmap_put(manager->networks_by_name, network->name, network);
cc08604ef06281d6375ed35ea3076ab65f3a0c3bwrowe log_warning("Route section without Gateway field configured in %s. "
Iterator i;
if (!network)
if (!network)
return -ENOENT;
ifname)) {
const char *attr;
if (attr)
return -ENOENT;
return -EINVAL;
return -errno;
const char *filename,
unsigned line,
const char *section,
unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
void *data,
void *userdata) {
if (!kind_string)
return log_oom();
for (p = kind_string; *p; p++)
*p = tolower(*p);
switch (kind) {
case NETDEV_KIND_BRIDGE:
case NETDEV_KIND_BOND:
case NETDEV_KIND_VLAN:
case NETDEV_KIND_MACVLAN:
case NETDEV_KIND_IPVLAN:
case NETDEV_KIND_VXLAN:
const char *filename,
unsigned line,
const char *section,
unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
void *data,
void *userdata) {
char **domain;
log_syntax(unit, LOG_ERR, filename, line, EINVAL, "'localhost' domain names may not be configured, ignoring assignment: %s", *domain);
log_syntax(unit, LOG_ERR, filename, line, EINVAL, "domain name is not valid, ignoring assignment: %s", *domain);
domain--;
const char *filename,
unsigned line,
const char *section,
unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
void *data,
void *userdata) {
int config_parse_ipv4ll(
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 config_parse_dhcp(
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) {
s = ADDRESS_FAMILY_NO;
s = ADDRESS_FAMILY_IPV4;
s = ADDRESS_FAMILY_IPV6;
s = ADDRESS_FAMILY_YES;
*dhcp = s;
int config_parse_llmnr(
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) {
LLMNRSupport s;
log_syntax(unit, LOG_ERR, filename, line, -s, "Failed to parse LLMNR option, ignoring: %s", rvalue);
*llmnr = s;
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) {
log_syntax(unit, LOG_ERR, filename, line, -r, "IPv6 token can not be the ANY address, ignoring: %s", rvalue);