networkd-link.c revision a70ec7f19f3375c9eeda9f9a2f4181ca008239fc
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync This file is part of systemd.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Copyright 2013 Tom Gundersen <teg@jklm.no>
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync systemd is free software; you can redistribute it and/or modify it
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync under the terms of the GNU Lesser General Public License as published by
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync the Free Software Foundation; either version 2.1 of the License, or
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync (at your option) any later version.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync systemd is distributed in the hope that it will be useful, but
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync WITHOUT ANY WARRANTY; without even the implied warranty of
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Lesser General Public License for more details.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync You should have received a copy of the GNU Lesser General Public License
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync along with systemd; If not, see <http://www.gnu.org/licenses/>.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync return false;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync return false;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync return IN_SET(link->network->dhcp, ADDRESS_FAMILY_IPV6, ADDRESS_FAMILY_YES);
if (unknown_flags_added)
const char *ifname;
int r, ifindex;
return -EINVAL;
else if (ifindex <= 0)
return -EINVAL;
if (!link)
return -ENOMEM;
return -ENOMEM;
return -ENOMEM;
return -ENOMEM;
return -ENOMEM;
Iterator i;
if (!link)
return NULL;
if (link)
return link;
assert(m);
if (!link)
return -ENODEV;
return address;
return address;
return NULL;
r = sd_rtnl_message_get_errno(m);
if (r < 0 && r != -EEXIST)
assert(m);
r = sd_rtnl_message_get_errno(m);
if (r < 0 && r != -ESRCH)
assert(m);
r = sd_rtnl_message_get_errno(m);
if (r < 0 && r != -EEXIST)
if (!address) {
assert(m);
r = sd_rtnl_message_get_errno(m);
if (r < 0 && r != -EADDRNOTAVAIL)
r = sd_rtnl_message_get_errno(m);
if (r < 0 && r != -EEXIST) {
assert(m);
r = sd_bus_message_get_errno(m);
"org.freedesktop.hostname1",
"/org/freedesktop/hostname1",
"org.freedesktop.hostname1",
link, 0);
assert(m);
r = sd_rtnl_message_get_errno(m);
/* see Documentation/networking/operstates.txt in the kernel sources */
r = sd_rtnl_message_get_errno(m);
if (socket_ipv6_is_supported()) {
r = sd_rtnl_message_get_errno(m);
log_link_warning_errno(link, r, "%-*s: could not bring down interface: %m", IFNAMSIZ, link->ifname);
Link *l;
Iterator i;
bool required_up = false;
bool link_is_up = false;
link_is_up = true;
if (link_has_carrier(l)) {
required_up = true;
Iterator i;
Link *l;
r = link_handle_bound_to_list(l);
Manager *m;
Iterator i;
bool list_updated = false;
list_updated = true;
if (list_updated)
Manager *m;
Iterator i;
bool list_updated = false;
list_updated = true;
if (list_updated)
Iterator i;
Iterator i;
bool list_updated = false;
list_updated = true;
list_updated = true;
if (list_updated)
void *userdata) {
r = sd_rtnl_message_get_errno(m);
if (r < 0 && r != -EEXIST) {
Iterator i;
NULL);
NULL);
NULL);
NULL),
NULL);
NULL);
const char *p = NULL;
log_link_warning_errno(link, r, "Cannot configure IPv4 forwarding for interface %s: %m", link->ifname);
const char *p = NULL;
if (!socket_ipv6_is_supported())
void *userdata) {
if (r == -ENOENT) {
Address *i;
return NULL;
unsigned char flags;
int r, ifindex;
assert(m);
} else if (ifindex <= 0) {
if (r < 0 || !link) {
if (!m->enumerating)
case AF_INET:
case AF_INET6:
switch (type) {
case RTM_NEWADDR:
if (existing) {
case RTM_DELADDR:
if (existing) {
log_link_warning(link, "Removing non-existent address: %s/%u (valid for %s)", buf, address->prefixlen, valid_str);
assert(m);
if (!device)
const char *ifname;
assert(m);
return -ENOMEM;
if (r >= 0 && mtu > 0) {
ETH_ALEN)) {
ETH_ALEN);
if (carrier_gained) {
} else if (carrier_lost) {
goto fail;
fprintf(f,
bool space;
space = false;
if (space)
space = true;
if (space)
space = false;
if (space)
space = true;
if (space)
space = false;
if (space)
space = true;
const char *domainname;
if (space)
Iterator i;
bool space = false;
if (space)
space = true;
Iterator i;
bool space = false;
if (space)
space = true;
goto fail;
fprintf(f,
goto fail;
fprintf(f,
r = fflush_and_check(f);
goto fail;
r = -errno;
goto fail;
fail:
if (temp_path)