networkd-link.c revision 23da66bb402cc6d9bca2eb34e090ccc24dfbf3f5
842ae4bd224140319ae7feec1872b93dfd491143fielding/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
842ae4bd224140319ae7feec1872b93dfd491143fielding This file is part of systemd.
842ae4bd224140319ae7feec1872b93dfd491143fielding Copyright 2013 Tom Gundersen <teg@jklm.no>
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd systemd is free software; you can redistribute it and/or modify it
059f354a6b7b116e4469ff7fe99c1142affa0ad6fielding under the terms of the GNU Lesser General Public License as published by
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd the Free Software Foundation; either version 2.1 of the License, or
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd (at your option) any later version.
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd systemd is distributed in the hope that it will be useful, but
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd WITHOUT ANY WARRANTY; without even the implied warranty of
059f354a6b7b116e4469ff7fe99c1142affa0ad6fielding MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
059f354a6b7b116e4469ff7fe99c1142affa0ad6fielding Lesser General Public License for more details.
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh You should have received a copy of the GNU Lesser General Public License
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh along with systemd; If not, see <http://www.gnu.org/licenses/>.
#include "networkd-netdev.h"
return _IPV6_PRIVACY_EXTENSIONS_INVALID;
return _IPV6_PRIVACY_EXTENSIONS_INVALID;
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_netlink_message_get_errno(m);
if (r < 0 && r != -EEXIST)
assert(m);
r = sd_netlink_message_get_errno(m);
if (r < 0 && r != -ESRCH)
assert(m);
r = sd_netlink_message_get_errno(m);
if (r < 0 && r != -EEXIST)
if (!address) {
assert(m);
r = sd_netlink_message_get_errno(m);
if (r < 0 && r != -EADDRNOTAVAIL)
r = sd_netlink_message_get_errno(m);
if (r < 0 && r != -EEXIST) {
assert(m);
r = sd_bus_message_get_errno(m);
NULL,
"org.freedesktop.hostname1",
"/org/freedesktop/hostname1",
"org.freedesktop.hostname1",
link,
assert(m);
r = sd_netlink_message_get_errno(m);
/* see Documentation/networking/operstates.txt in the kernel sources */
r = sd_netlink_message_get_errno(m);
if (socket_ipv6_is_supported()) {
r = sd_netlink_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)
r = sd_netlink_message_get_errno(m);
if (r < 0 && r != -EEXIST) {
Iterator i;
NULL);
NULL);
NULL);
NULL),
NULL);
NULL);
const char *p = NULL, *v;
r = write_string_file(p, v, 0);
if (verify_one_line_file(p, v) > 0)
log_link_warning_errno(link, r, "Cannot configure IPv4 forwarding for interface %s: %m", link->ifname);
if (!socket_ipv6_is_supported())
r = write_string_file(p, v, 0);
if (verify_one_line_file(p, v) > 0)
const char *p = NULL;
if (!socket_ipv6_is_supported())
if (s == _IPV6_PRIVACY_EXTENSIONS_INVALID)
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)