networkd-link.c revision bcb7a07e0a785bda1eed658e984ff6b4a11cba9a
1556N/A along with systemd; If not, see <http://www.gnu.org/licenses/>.
5680N/A#include "networkd.h"
5680N/A#include "libudev-private.h"
1556N/A#include "udev-util.h"
1556N/A#include "bus-util.h"
1556N/A#include "network-internal.h"
7286N/A#include "network-util.h"
1556N/A#include "dhcp-lease-internal.h"
else if (ifindex <= 0)
return -EINVAL;
if (!link)
return -ENOMEM;
return -ENOMEM;
return -ENOMEM;
return -ENOMEM;
if (!link)
return NULL;
if (link)
return link;
assert(m);
if (!link)
return -ENODEV;
r = sd_rtnl_message_get_errno(m);
if (r < 0 && r != -EEXIST)
NULL);
if (r < 0 && r != -ENOENT) {
strerror(-r));
if (r != -ENOENT) {
strerror(-r));
if (r < 0 && r != -ENOENT) {
strerror(-r));
strerror(-r));
assert(m);
r = sd_rtnl_message_get_errno(m);
if (r < 0 && r != -ESRCH)
NULL);
assert(m);
r = sd_rtnl_message_get_errno(m);
if (r < 0 && r != -EEXIST)
NULL);
if (r < 0 && r != -ENOENT) {
strerror(-r));
if (r != -ENOENT) {
unsigned prefixlen;
strerror(-r));
strerror(-r));
strerror(-r));
assert(m);
r = sd_rtnl_message_get_errno(m);
if (r < 0 && r != -ENOENT)
NULL);
assert(m);
r = sd_rtnl_message_get_errno(m);
if (r < 0 && r != -EADDRNOTAVAIL)
NULL);
static int set_hostname_handler(sd_bus *bus, sd_bus_message *m, void *userdata, sd_bus_error *ret_error) {
r = sd_bus_message_get_errno(m);
"org.freedesktop.hostname1",
"/org/freedesktop/hostname1",
"org.freedesktop.hostname1",
assert(m);
r = sd_rtnl_message_get_errno(m);
NULL);
unsigned prefixlen;
if (r >= 0 && hostname) {
unsigned prefixlen;
strerror(-r));
strerror(-r));
strerror(-r));
if (r < 0 && r != -ENOENT) {
NULL);
NULL);
const char *hostname;
switch (event) {
case DHCP_EVENT_NO_LEASE:
case DHCP_EVENT_EXPIRED:
case DHCP_EVENT_STOP:
case DHCP_EVENT_IP_CHANGE:
case DHCP_EVENT_IP_ACQUIRE:
if (event < 0)
strerror(-r));
NULL);
switch(event) {
case IPV4LL_EVENT_STOP:
case IPV4LL_EVENT_CONFLICT:
case IPV4LL_EVENT_BIND:
if (event < 0)
/* see Documentation/networking/operstates.txt in the kernel sources */
if (unknown_flags_added)
if (carrier_gained) {
} else if (carrier_lost) {
r = sd_rtnl_message_get_errno(m);
NULL);
r = sd_rtnl_message_get_errno(m);
NULL);
Iterator i;
NULL);
NULL);
NULL);
NULL);
NULL);
NULL);
if (device)
if (r == -ENOENT) {
bool address_dropped = false;
int r, ifindex;
assert(m);
if (r < 0 || ifindex <= 0) {
if (r < 0 || !link) {
case AF_INET:
case AF_INET6:
address_dropped = true;
switch (type) {
case RTM_NEWADDR:
if (!address_dropped)
case RTM_DELADDR:
if (address_dropped)
assert(m);
for (; m; m = sd_rtnl_message_next(m)) {
r = sd_rtnl_message_get_errno(m);
assert(m);
if (!device) {
return -errno;
char *ifname;
assert(m);
return -ENOMEM;
strerror(-r));
strerror(-r));
assert(f);
if (!address)
goto finish;
fprintf(f,
goto finish;
fprintf(f,
fflush(f);
r = -errno;