summaryrefslogtreecommitdiff
path: root/src/network
diff options
context:
space:
mode:
Diffstat (limited to 'src/network')
-rw-r--r--src/network/networkd-address.c39
-rw-r--r--src/network/networkd-manager.c3
-rw-r--r--src/network/networkd-netdev-tuntap.c8
-rw-r--r--src/network/networkd.c9
4 files changed, 21 insertions, 38 deletions
diff --git a/src/network/networkd-address.c b/src/network/networkd-address.c
index e95184b8ff..9502fa8caa 100644
--- a/src/network/networkd-address.c
+++ b/src/network/networkd-address.c
@@ -118,8 +118,7 @@ int address_drop(Address *address, Link *link,
r = sd_rtnl_message_new_addr(link->manager->rtnl, &req, RTM_DELADDR,
link->ifindex, address->family);
if (r < 0) {
- log_error("Could not allocate RTM_DELADDR message: %s",
- strerror(-r));
+ log_error_errno(r, "Could not allocate RTM_DELADDR message: %m");
return r;
}
@@ -134,8 +133,7 @@ int address_drop(Address *address, Link *link,
else if (address->family == AF_INET6)
r = sd_rtnl_message_append_in6_addr(req, IFA_LOCAL, &address->in_addr.in6);
if (r < 0) {
- log_error("Could not append IFA_LOCAL attribute: %s",
- strerror(-r));
+ log_error_errno(r, "Could not append IFA_LOCAL attribute: %m");
return r;
}
@@ -164,8 +162,7 @@ int address_update(Address *address, Link *link,
r = sd_rtnl_message_new_addr_update(link->manager->rtnl, &req,
link->ifindex, address->family);
if (r < 0) {
- log_error("Could not allocate RTM_NEWADDR message: %s",
- strerror(-r));
+ log_error_errno(r, "Could not allocate RTM_NEWADDR message: %m");
return r;
}
@@ -192,16 +189,14 @@ int address_update(Address *address, Link *link,
else if (address->family == AF_INET6)
r = sd_rtnl_message_append_in6_addr(req, IFA_LOCAL, &address->in_addr.in6);
if (r < 0) {
- log_error("Could not append IFA_LOCAL attribute: %s",
- strerror(-r));
+ log_error_errno(r, "Could not append IFA_LOCAL attribute: %m");
return r;
}
if (address->family == AF_INET) {
r = sd_rtnl_message_append_in_addr(req, IFA_BROADCAST, &address->broadcast);
if (r < 0) {
- log_error("Could not append IFA_BROADCAST attribute: %s",
- strerror(-r));
+ log_error_errno(r, "Could not append IFA_BROADCAST attribute: %m");
return r;
}
}
@@ -209,16 +204,14 @@ int address_update(Address *address, Link *link,
if (address->label) {
r = sd_rtnl_message_append_string(req, IFA_LABEL, address->label);
if (r < 0) {
- log_error("Could not append IFA_LABEL attribute: %s",
- strerror(-r));
+ log_error_errno(r, "Could not append IFA_LABEL attribute: %m");
return r;
}
}
r = sd_rtnl_message_append_cache_info(req, IFA_CACHEINFO, &address->cinfo);
if (r < 0) {
- log_error("Could not append IFA_CACHEINFO attribute: %s",
- strerror(-r));
+ log_error_errno(r, "Could not append IFA_CACHEINFO attribute: %m");
return r;
}
@@ -313,8 +306,7 @@ int address_configure(Address *address, Link *link,
r = sd_rtnl_message_new_addr(link->manager->rtnl, &req, RTM_NEWADDR,
link->ifindex, address->family);
if (r < 0) {
- log_error("Could not allocate RTM_NEWADDR message: %s",
- strerror(-r));
+ log_error_errno(r, "Could not allocate RTM_NEWADDR message: %m");
return r;
}
@@ -341,8 +333,7 @@ int address_configure(Address *address, Link *link,
else if (address->family == AF_INET6)
r = sd_rtnl_message_append_in6_addr(req, IFA_LOCAL, &address->in_addr.in6);
if (r < 0) {
- log_error("Could not append IFA_LOCAL attribute: %s",
- strerror(-r));
+ log_error_errno(r, "Could not append IFA_LOCAL attribute: %m");
return r;
}
@@ -352,16 +343,14 @@ int address_configure(Address *address, Link *link,
else if (address->family == AF_INET6)
r = sd_rtnl_message_append_in6_addr(req, IFA_ADDRESS, &address->in_addr_peer.in6);
if (r < 0) {
- log_error("Could not append IFA_ADDRESS attribute: %s",
- strerror(-r));
+ log_error_errno(r, "Could not append IFA_ADDRESS attribute: %m");
return r;
}
} else {
if (address->family == AF_INET) {
r = sd_rtnl_message_append_in_addr(req, IFA_BROADCAST, &address->broadcast);
if (r < 0) {
- log_error("Could not append IFA_BROADCAST attribute: %s",
- strerror(-r));
+ log_error_errno(r, "Could not append IFA_BROADCAST attribute: %m");
return r;
}
}
@@ -370,8 +359,7 @@ int address_configure(Address *address, Link *link,
if (address->label) {
r = sd_rtnl_message_append_string(req, IFA_LABEL, address->label);
if (r < 0) {
- log_error("Could not append IFA_LABEL attribute: %s",
- strerror(-r));
+ log_error_errno(r, "Could not append IFA_LABEL attribute: %m");
return r;
}
}
@@ -379,8 +367,7 @@ int address_configure(Address *address, Link *link,
r = sd_rtnl_message_append_cache_info(req, IFA_CACHEINFO,
&address->cinfo);
if (r < 0) {
- log_error("Could not append IFA_CACHEINFO attribute: %s",
- strerror(-r));
+ log_error_errno(r, "Could not append IFA_CACHEINFO attribute: %m");
return r;
}
diff --git a/src/network/networkd-manager.c b/src/network/networkd-manager.c
index 98a12c277a..3a1d565e7b 100644
--- a/src/network/networkd-manager.c
+++ b/src/network/networkd-manager.c
@@ -262,8 +262,7 @@ static int manager_rtnl_process_link(sd_rtnl *rtnl, sd_rtnl_message *message, vo
/* link is new, so add it */
r = link_add(m, message, &link);
if (r < 0) {
- log_debug("could not add new link: %s",
- strerror(-r));
+ log_debug_errno(r, "could not add new link: %m");
return 0;
}
}
diff --git a/src/network/networkd-netdev-tuntap.c b/src/network/networkd-netdev-tuntap.c
index 7767d75507..57cc77c555 100644
--- a/src/network/networkd-netdev-tuntap.c
+++ b/src/network/networkd-netdev-tuntap.c
@@ -95,8 +95,8 @@ static int netdev_tuntap_add(NetDev *netdev, struct ifreq *ifr) {
r = get_user_creds(&user, &uid, NULL, NULL, NULL);
if (r < 0) {
- log_error("Cannot resolve user name %s: %s",
- t->user_name, strerror(-r));
+ log_error_errno(r, "Cannot resolve user name %s: %m",
+ t->user_name);
return 0;
}
@@ -114,8 +114,8 @@ static int netdev_tuntap_add(NetDev *netdev, struct ifreq *ifr) {
r = get_group_creds(&group, &gid);
if (r < 0) {
- log_error("Cannot resolve group name %s: %s",
- t->group_name, strerror(-r));
+ log_error_errno(r, "Cannot resolve group name %s: %m",
+ t->group_name);
return 0;
}
diff --git a/src/network/networkd.c b/src/network/networkd.c
index fe5860411d..430d615f90 100644
--- a/src/network/networkd.c
+++ b/src/network/networkd.c
@@ -54,18 +54,15 @@ int main(int argc, char *argv[]) {
* watches in. */
r = mkdir_safe_label("/run/systemd/netif", 0755, uid, gid);
if (r < 0)
- log_error("Could not create runtime directory: %s",
- strerror(-r));
+ log_error_errno(r, "Could not create runtime directory: %m");
r = mkdir_safe_label("/run/systemd/netif/links", 0755, uid, gid);
if (r < 0)
- log_error("Could not create runtime directory 'links': %s",
- strerror(-r));
+ log_error_errno(r, "Could not create runtime directory 'links': %m");
r = mkdir_safe_label("/run/systemd/netif/leases", 0755, uid, gid);
if (r < 0)
- log_error("Could not create runtime directory 'leases': %s",
- strerror(-r));
+ log_error_errno(r, "Could not create runtime directory 'leases': %m");
r = drop_privileges(uid, gid,
(1ULL << CAP_NET_ADMIN) |