networkd-link.c revision 39032b87779323a244dd89f4832949d462b2ac68
/*-*- 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 "libudev-private.h"
#include "util.h"
const char *mac;
struct ether_addr *mac_addr;
const char *ifname;
int r;
if (!link)
return -ENOMEM;
return -EINVAL;
if (mac) {
if (mac_addr)
}
if (r < 0)
return r;
return 0;
}
if (!link)
return;
}
int r;
const char *devtype;
assert(m);
if (link) {
return -EEXIST;
}
if (r < 0)
return r;
r = bridge_set_link(m, link);
if (r < 0 && r != -ENOENT)
return r;
}
if (r < 0)
return r == -ENOENT ? 0 : r;
if (r < 0)
return r;
return 0;
}
return 0;
}
}
int r;
link->route_messages --;
return 1;
r = sd_rtnl_message_get_errno(m);
if (r < 0 && r != -EEXIST)
/* we might have received an old reply after moving back to SETTING_ADDRESSES,
* ignore it */
}
return 1;
}
int r;
return link_enter_configured(link);
if (r < 0) {
"could not set routes: %s", strerror(-r));
return r;
}
link->route_messages ++;
}
if (link->dhcp_route) {
if (r < 0) {
"could not set routes: %s", strerror(-r));
return r;
}
link->route_messages ++;
}
return 0;
}
int r;
assert(m);
link->addr_messages --;
return 1;
r = sd_rtnl_message_get_errno(m);
if (r < 0 && r != -EEXIST)
"MESSAGE=%s: could not set address: %s",
"ERRNO=%d", -r,
NULL);
if (link->addr_messages == 0) {
}
return 1;
}
int r;
return link_enter_set_routes(link);
if (r < 0) {
"could not set addresses: %s", strerror(-r));
return r;
}
link->addr_messages ++;
}
if (link->dhcp_address) {
if (r < 0) {
"could not set addresses: %s", strerror(-r));
return r;
}
link->addr_messages ++;
}
return 0;
}
int r;
assert(m);
return 1;
r = sd_rtnl_message_get_errno(m);
if (r < 0 && r != -EEXIST)
return 1;
}
int prefixlen;
int r;
return;
if (event < 0) {
return;
}
if (event == DHCP_EVENT_NO_LEASE)
event == DHCP_EVENT_STOP) {
if (link->dhcp_address) {
}
if (link->dhcp_route) {
}
}
if (r < 0) {
return;
}
if (r < 0) {
return;
}
if (prefixlen < 0) {
return;
}
if (r < 0) {
return;
}
"MESSAGE=%s: DHCPv4 address %u.%u.%u.%u/%u via %u.%u.%u.%u",
"ADDRESS=%u.%u.%u.%u",
"PREFIXLEN=%u",
"GATEWAY=%u.%u.%u.%u",
NULL);
r = address_new_dynamic(&addr);
if (r < 0) {
return;
}
r = route_new_dynamic(&rt);
if (r < 0) {
return;
}
}
return;
}
int r;
return -ENOMEM;
if (r < 0)
return r;
if (r < 0)
return r;
if (r < 0)
return r;
}
if (r < 0)
return r;
return 0;
}
int r;
return 0;
return 0;
}
if (flags & IFF_LOWER_UP) {
r = link_acquire_conf(link);
if (r < 0) {
return r;
}
}
} else {
if (r < 0) {
return r;
}
}
}
}
return 0;
}
int r;
return 1;
r = sd_rtnl_message_get_errno(m);
if (r < 0) {
"could not bring up interface: %s", strerror(-r));
}
return 1;
}
int r;
if (r < 0) {
return r;
}
if (r < 0) {
return r;
}
if (r < 0) {
"Could not send rtnetlink message: %s", strerror(-r));
return r;
}
return 0;
}
int r;
if (r < 0) {
return r;
}
return link_enter_set_addresses(link);
return 0;
}
int r;
return 1;
r = sd_rtnl_message_get_errno(m);
if (r < 0) {
"MESSAGE=%s: could not join bridge '%s': %s",
NULL);
return 1;
}
"MESSAGE=%s: joined bridge '%s'",
NULL);
return 1;
}
int r;
return link_bridge_joined(link);
"MESSAGE=%s: joining bridge '%s'",
NULL);
if (r < 0) {
"MESSAGE=%s: could not join bridge '%s': %s",
NULL);
return r;
}
return 0;
}
int r;
return 1;
r = sd_rtnl_message_get_errno(m);
if (r < 0) {
}
link_update(link, m);
return 1;
}
int r;
if (r < 0) {
return r;
}
if (r < 0) {
"Could not send rtnetlink message: %s", strerror(-r));
return r;
}
return 0;
}
int r;
if (r < 0) {
return r;
}
return link_enter_join_bridge(link);
}
unsigned flags;
int r;
assert(m);
return 0;
r = sd_rtnl_message_link_get_flags(m, &flags);
if (r < 0) {
return r;
}
}