networkd-link.c revision a9bc6d2df16c1d9f8a99d2cc9be2babf62bd173f
/*-*- 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;
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;
assert(m);
if (link)
return 0;
if (r < 0) {
return r;
}
if (r < 0)
return r == -ENOENT ? 0 : r;
if (r < 0)
return r;
return 0;
}
log_info("Link configured successfully.");
return 0;
}
log_warning("Could not configure link.");
return 0;
}
}
if (link_is_up(link))
return link_enter_configured(link);
return 0;
}
int r;
link->rtnl_messages --;
return 1;
r = sd_rtnl_message_get_errno(m);
if (r < 0 && r != -EEXIST) {
log_warning("Could not set route on interface %ju: %s",
return link_enter_failed(link);
}
if (link->rtnl_messages == 0)
return link_enter_routes_set(link);
return 1;
}
int r;
return link_enter_routes_set(link);
if (r < 0)
}
return 0;
}
return link_enter_set_routes(link);
}
int r;
link->rtnl_messages --;
return 1;
r = sd_rtnl_message_get_errno(m);
if (r < 0 && r != -EEXIST) {
log_warning("Could not set address on interface %ju: %s",
}
if (link->rtnl_messages == 0)
return 1;
}
int r;
return link_enter_addresses_set(link);
if (r < 0)
}
return 0;
}
int r;
r = sd_rtnl_message_get_errno(m);
if (r < 0) {
log_warning("Could not bring up interface %ju: %s",
return link_enter_failed(link);
}
log_info("Link is UP.");
return link_enter_configured(link);
return 1;
}
int r;
if (r < 0) {
log_error("Could not allocate RTM_NEWLINK message");
return r;
}
if (r < 0) {
return r;
}
return 0;
}
int r;
if (r < 0)
return link_enter_failed(link);
r = link_enter_set_addresses(link);
if (r < 0)
return link_enter_failed(link);
return 0;
}