summaryrefslogtreecommitdiffstats
path: root/src/network/netdev
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2022-01-04 19:16:01 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2022-01-05 11:36:04 +0100
commit5b80ecea55c4bce3534ed75abf9cef437850aefb (patch)
tree14e9b87a651c2dc29eece8b508ed839816446a61 /src/network/netdev
parentfuzz: no longer skip empty files (diff)
downloadsystemd-5b80ecea55c4bce3534ed75abf9cef437850aefb.tar.xz
systemd-5b80ecea55c4bce3534ed75abf9cef437850aefb.zip
network: replace detailed netlink append messages with a single generic message
This commit is the first in the series, and they generally follow the same idea: we had very detailed logging for message append operations which would only fail either with some type error or intrinsic limit (and then they would fail everywhere, so this would be noticed during development or in CI), or they would fail with ENOMEM, in which case the exact location is not very interesting since this is not repeatable. I am in general in favour of detailed logging messages, because it helps with diagnosis of errors, but I think case is an exception. Despite not being very useful, those messages required a lot of effort, because they were customized for each and every append operation. In fact some of the messages contained copy errors. The text of the messages (since they are generally unique) also added up to a considerable size. This removes the log messages after each sd_netlink_message_append_*() in fill_message_create() with a single line in netdev_create(). As described above, we are just appending fields to a message, so those calls would almost never fail. A forgotten 'return' was added in one place. $ size build/systemd-networkd{.0,} text data bss dec hex filename 1878634 394016 36 2272686 22adae build/systemd-networkd.0 1842450 394080 36 2236566 222096 build/systemd-networkd … so we save 30k too.
Diffstat (limited to 'src/network/netdev')
-rw-r--r--src/network/netdev/bareudp.c4
-rw-r--r--src/network/netdev/batadv.c4
-rw-r--r--src/network/netdev/bond.c50
-rw-r--r--src/network/netdev/geneve.c22
-rw-r--r--src/network/netdev/ipoib.c6
-rw-r--r--src/network/netdev/ipvlan.c4
-rw-r--r--src/network/netdev/macsec.c8
-rw-r--r--src/network/netdev/macvlan.c14
-rw-r--r--src/network/netdev/netdev.c2
-rw-r--r--src/network/netdev/tunnel.c106
-rw-r--r--src/network/netdev/veth.c12
-rw-r--r--src/network/netdev/vlan.c18
-rw-r--r--src/network/netdev/vrf.c4
-rw-r--r--src/network/netdev/vxcan.c8
-rw-r--r--src/network/netdev/vxlan.c56
-rw-r--r--src/network/netdev/xfrm.c4
16 files changed, 161 insertions, 161 deletions
diff --git a/src/network/netdev/bareudp.c b/src/network/netdev/bareudp.c
index 8ff0eb1360..24d3afb877 100644
--- a/src/network/netdev/bareudp.c
+++ b/src/network/netdev/bareudp.c
@@ -33,11 +33,11 @@ static int netdev_bare_udp_fill_message_create(NetDev *netdev, Link *link, sd_ne
r = sd_netlink_message_append_u16(m, IFLA_BAREUDP_ETHERTYPE, htobe16(u->iftype));
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_BAREUDP_ETHERTYPE attribute: %m");
+ return r;
r = sd_netlink_message_append_u16(m, IFLA_BAREUDP_PORT, htobe16(u->dest_port));
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_BAREUDP_PORT attribute: %m");
+ return r;
return 0;
}
diff --git a/src/network/netdev/batadv.c b/src/network/netdev/batadv.c
index 15f3aee3a6..b67fc8cb6e 100644
--- a/src/network/netdev/batadv.c
+++ b/src/network/netdev/batadv.c
@@ -190,9 +190,9 @@ static int netdev_batadv_fill_message_create(NetDev *netdev, Link *link, sd_netl
r = sd_netlink_message_append_string(m, IFLA_BATADV_ALGO_NAME, batadv_routing_algorithm_kernel_to_string(b->routing_algorithm));
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_BATADV_ALGO_NAME attribute: %m");
+ return r;
- return r;
+ return 0;
}
const NetDevVTable batadv_vtable = {
diff --git a/src/network/netdev/bond.c b/src/network/netdev/bond.c
index 5d94aa1d68..b0af12c8e2 100644
--- a/src/network/netdev/bond.c
+++ b/src/network/netdev/bond.c
@@ -71,50 +71,50 @@ static int netdev_bond_fill_message_create(NetDev *netdev, Link *link, sd_netlin
if (b->mode != _NETDEV_BOND_MODE_INVALID) {
r = sd_netlink_message_append_u8(m, IFLA_BOND_MODE, b->mode);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_MODE attribute: %m");
+ return r;
}
if (b->xmit_hash_policy != _NETDEV_BOND_XMIT_HASH_POLICY_INVALID) {
r = sd_netlink_message_append_u8(m, IFLA_BOND_XMIT_HASH_POLICY, b->xmit_hash_policy);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_XMIT_HASH_POLICY attribute: %m");
+ return r;
}
if (b->lacp_rate != _NETDEV_BOND_LACP_RATE_INVALID &&
b->mode == NETDEV_BOND_MODE_802_3AD) {
r = sd_netlink_message_append_u8(m, IFLA_BOND_AD_LACP_RATE, b->lacp_rate);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_AD_LACP_RATE attribute: %m");
+ return r;
}
if (b->miimon != 0) {
r = sd_netlink_message_append_u32(m, IFLA_BOND_MIIMON, b->miimon / USEC_PER_MSEC);
if (r < 0)
- log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_BOND_MIIMON attribute: %m");
+ return r;
}
if (b->downdelay != 0) {
r = sd_netlink_message_append_u32(m, IFLA_BOND_DOWNDELAY, b->downdelay / USEC_PER_MSEC);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_DOWNDELAY attribute: %m");
+ return r;
}
if (b->updelay != 0) {
r = sd_netlink_message_append_u32(m, IFLA_BOND_UPDELAY, b->updelay / USEC_PER_MSEC);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_UPDELAY attribute: %m");
+ return r;
}
if (b->arp_interval != 0) {
r = sd_netlink_message_append_u32(m, IFLA_BOND_ARP_INTERVAL, b->arp_interval / USEC_PER_MSEC);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_ARP_INTERVAL attribute: %m");
+ return r;
if (b->lp_interval >= LEARNING_PACKETS_INTERVAL_MIN_SEC &&
b->lp_interval <= LEARNING_PACKETS_INTERVAL_MAX_SEC) {
r = sd_netlink_message_append_u32(m, IFLA_BOND_LP_INTERVAL, b->lp_interval / USEC_PER_SEC);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_LP_INTERVAL attribute: %m");
+ return r;
}
}
@@ -122,85 +122,85 @@ static int netdev_bond_fill_message_create(NetDev *netdev, Link *link, sd_netlin
b->mode == NETDEV_BOND_MODE_802_3AD) {
r = sd_netlink_message_append_u8(m, IFLA_BOND_AD_SELECT, b->ad_select);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_AD_SELECT attribute: %m");
+ return r;
}
if (b->fail_over_mac != _NETDEV_BOND_FAIL_OVER_MAC_INVALID &&
b->mode == NETDEV_BOND_MODE_ACTIVE_BACKUP) {
r = sd_netlink_message_append_u8(m, IFLA_BOND_FAIL_OVER_MAC, b->fail_over_mac);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_FAIL_OVER_MAC attribute: %m");
+ return r;
}
if (b->arp_validate != _NETDEV_BOND_ARP_VALIDATE_INVALID) {
r = sd_netlink_message_append_u32(m, IFLA_BOND_ARP_VALIDATE, b->arp_validate);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_ARP_VALIDATE attribute: %m");
+ return r;
}
if (b->arp_all_targets != _NETDEV_BOND_ARP_ALL_TARGETS_INVALID) {
r = sd_netlink_message_append_u32(m, IFLA_BOND_ARP_ALL_TARGETS, b->arp_all_targets);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_ARP_ALL_TARGETS attribute: %m");
+ return r;
}
if (b->primary_reselect != _NETDEV_BOND_PRIMARY_RESELECT_INVALID) {
r = sd_netlink_message_append_u8(m, IFLA_BOND_PRIMARY_RESELECT, b->primary_reselect);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_PRIMARY_RESELECT attribute: %m");
+ return r;
}
if (b->resend_igmp <= RESEND_IGMP_MAX) {
r = sd_netlink_message_append_u32(m, IFLA_BOND_RESEND_IGMP, b->resend_igmp);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_RESEND_IGMP attribute: %m");
+ return r;
}
if (b->packets_per_slave <= PACKETS_PER_SLAVE_MAX &&
b->mode == NETDEV_BOND_MODE_BALANCE_RR) {
r = sd_netlink_message_append_u32(m, IFLA_BOND_PACKETS_PER_SLAVE, b->packets_per_slave);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_PACKETS_PER_SLAVE attribute: %m");
+ return r;
}
if (b->num_grat_arp <= GRATUITOUS_ARP_MAX) {
r = sd_netlink_message_append_u8(m, IFLA_BOND_NUM_PEER_NOTIF, b->num_grat_arp);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_NUM_PEER_NOTIF attribute: %m");
+ return r;
}
if (b->min_links != 0) {
r = sd_netlink_message_append_u32(m, IFLA_BOND_MIN_LINKS, b->min_links);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_MIN_LINKS attribute: %m");
+ return r;
}
if (b->ad_actor_sys_prio != 0) {
r = sd_netlink_message_append_u16(m, IFLA_BOND_AD_ACTOR_SYS_PRIO, b->ad_actor_sys_prio);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_AD_ACTOR_SYS_PRIO attribute: %m");
+ return r;
}
if (b->ad_user_port_key != 0) {
r = sd_netlink_message_append_u16(m, IFLA_BOND_AD_USER_PORT_KEY, b->ad_user_port_key);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_AD_USER_PORT_KEY attribute: %m");
+ return r;
}
if (!ether_addr_is_null(&b->ad_actor_system)) {
r = sd_netlink_message_append_ether_addr(m, IFLA_BOND_AD_ACTOR_SYSTEM, &b->ad_actor_system);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_AD_ACTOR_SYSTEM attribute: %m");
+ return r;
}
r = sd_netlink_message_append_u8(m, IFLA_BOND_ALL_SLAVES_ACTIVE, b->all_slaves_active);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_ALL_SLAVES_ACTIVE attribute: %m");
+ return r;
if (b->tlb_dynamic_lb >= 0) {
r = sd_netlink_message_append_u8(m, IFLA_BOND_TLB_DYNAMIC_LB, b->tlb_dynamic_lb);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_TLB_DYNAMIC_LB attribute: %m");
+ return r;
}
if (b->arp_interval > 0 && !ordered_set_isempty(b->arp_ip_targets)) {
@@ -209,17 +209,17 @@ static int netdev_bond_fill_message_create(NetDev *netdev, Link *link, sd_netlin
r = sd_netlink_message_open_container(m, IFLA_BOND_ARP_IP_TARGET);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not open contaniner IFLA_BOND_ARP_IP_TARGET : %m");
+ return r;
ORDERED_SET_FOREACH(val, b->arp_ip_targets) {
r = sd_netlink_message_append_u32(m, n++, PTR_TO_UINT32(val));
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_ARP_ALL_TARGETS attribute: %m");
+ return r;
}
r = sd_netlink_message_close_container(m);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not close contaniner IFLA_BOND_ARP_IP_TARGET : %m");
+ return r;
}
return 0;
diff --git a/src/network/netdev/geneve.c b/src/network/netdev/geneve.c
index 224c17e979..777a32d75c 100644
--- a/src/network/netdev/geneve.c
+++ b/src/network/netdev/geneve.c
@@ -39,7 +39,7 @@ static int netdev_geneve_fill_message_create(NetDev *netdev, Link *link, sd_netl
if (v->id <= GENEVE_VID_MAX) {
r = sd_netlink_message_append_u32(m, IFLA_GENEVE_ID, v->id);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_GENEVE_ID attribute: %m");
+ return r;
}
if (in_addr_is_set(v->remote_family, &v->remote)) {
@@ -48,51 +48,51 @@ static int netdev_geneve_fill_message_create(NetDev *netdev, Link *link, sd_netl
else
r = sd_netlink_message_append_in6_addr(m, IFLA_GENEVE_REMOTE6, &v->remote.in6);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_GENEVE_REMOTE/IFLA_GENEVE_REMOTE6 attribute: %m");
+ return r;
}
if (v->inherit) {
r = sd_netlink_message_append_u8(m, IFLA_GENEVE_TTL_INHERIT, 1);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_GENEVE_TTL_INHERIT attribute: %m");
+ return r;
} else {
r = sd_netlink_message_append_u8(m, IFLA_GENEVE_TTL, v->ttl);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_GENEVE_TTL attribute: %m");
+ return r;
}
r = sd_netlink_message_append_u8(m, IFLA_GENEVE_TOS, v->tos);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_GENEVE_TOS attribute: %m");
+ return r;
r = sd_netlink_message_append_u8(m, IFLA_GENEVE_UDP_CSUM, v->udpcsum);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_GENEVE_UDP_CSUM attribute: %m");
+ return r;
r = sd_netlink_message_append_u8(m, IFLA_GENEVE_UDP_ZERO_CSUM6_TX, v->udp6zerocsumtx);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_GENEVE_UDP_ZERO_CSUM6_TX attribute: %m");
+ return r;
r = sd_netlink_message_append_u8(m, IFLA_GENEVE_UDP_ZERO_CSUM6_RX, v->udp6zerocsumrx);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_GENEVE_UDP_ZERO_CSUM6_RX attribute: %m");
+ return r;
if (v->dest_port != DEFAULT_GENEVE_DESTINATION_PORT) {
r = sd_netlink_message_append_u16(m, IFLA_GENEVE_PORT, htobe16(v->dest_port));
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_GENEVE_PORT attribute: %m");
+ return r;
}
if (v->flow_label > 0) {
r = sd_netlink_message_append_u32(m, IFLA_GENEVE_LABEL, htobe32(v->flow_label));
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_GENEVE_LABEL attribute: %m");
+ return r;
}
if (v->geneve_df != _NETDEV_GENEVE_DF_INVALID) {
r = sd_netlink_message_append_u8(m, IFLA_GENEVE_DF, v->geneve_df);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_GENEVE_DF attribute: %m");
+ return r;
}
return 0;
diff --git a/src/network/netdev/ipoib.c b/src/network/netdev/ipoib.c
index e0ff9e8c62..630488cda9 100644
--- a/src/network/netdev/ipoib.c
+++ b/src/network/netdev/ipoib.c
@@ -39,19 +39,19 @@ static int netdev_ipoib_fill_message_create(NetDev *netdev, Link *link, sd_netli
if (ipoib->pkey > 0) {
r = sd_netlink_message_append_u16(m, IFLA_IPOIB_PKEY, ipoib->pkey);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPOIB_PKEY attribute: %m");
+ return r;
}
if (ipoib->mode >= 0) {
r = sd_netlink_message_append_u16(m, IFLA_IPOIB_MODE, ipoib->mode);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPOIB_MODE attribute: %m");
+ return r;
}
if (ipoib->umcast >= 0) {
r = sd_netlink_message_append_u16(m, IFLA_IPOIB_UMCAST, ipoib->umcast);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPOIB_UMCAST attribute: %m");
+ return r;
}
return 0;
diff --git a/src/network/netdev/ipvlan.c b/src/network/netdev/ipvlan.c
index d15766cd7b..727e46085b 100644
--- a/src/network/netdev/ipvlan.c
+++ b/src/network/netdev/ipvlan.c
@@ -31,13 +31,13 @@ static int netdev_ipvlan_fill_message_create(NetDev *netdev, Link *link, sd_netl
if (m->mode != _NETDEV_IPVLAN_MODE_INVALID) {
r = sd_netlink_message_append_u16(req, IFLA_IPVLAN_MODE, m->mode);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPVLAN_MODE attribute: %m");
+ return r;
}
if (m->flags != _NETDEV_IPVLAN_FLAGS_INVALID) {
r = sd_netlink_message_append_u16(req, IFLA_IPVLAN_FLAGS, m->flags);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPVLAN_FLAGS attribute: %m");
+ return r;
}
return 0;
diff --git a/src/network/netdev/macsec.c b/src/network/netdev/macsec.c
index f1a566a9ca..f70cde7177 100644
--- a/src/network/netdev/macsec.c
+++ b/src/network/netdev/macsec.c
@@ -516,20 +516,20 @@ static int netdev_macsec_fill_message_create(NetDev *netdev, Link *link, sd_netl
if (v->port > 0) {
r = sd_netlink_message_append_u16(m, IFLA_MACSEC_PORT, v->port);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_MACSEC_PORT attribute: %m");
+ return r;
}
if (v->encrypt >= 0) {
r = sd_netlink_message_append_u8(m, IFLA_MACSEC_ENCRYPT, v->encrypt);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_MACSEC_ENCRYPT attribute: %m");
+ return r;
}
r = sd_netlink_message_append_u8(m, IFLA_MACSEC_ENCODING_SA, v->encoding_an);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_MACSEC_ENCODING_SA attribute: %m");
+ return r;
- return r;
+ return 0;
}
int config_parse_macsec_port(
diff --git a/src/network/netdev/macvlan.c b/src/network/netdev/macvlan.c
index c41be6e78f..aca05f0f77 100644
--- a/src/network/netdev/macvlan.c
+++ b/src/network/netdev/macvlan.c
@@ -33,40 +33,40 @@ static int netdev_macvlan_fill_message_create(NetDev *netdev, Link *link, sd_net
r = sd_netlink_message_append_u32(req, IFLA_MACVLAN_MACADDR_MODE, MACVLAN_MACADDR_SET);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_MACVLAN_MACADDR_MODE attribute: %m");
+ return r;
r = sd_netlink_message_open_container(req, IFLA_MACVLAN_MACADDR_DATA);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not open IFLA_MACVLAN_MACADDR_DATA container: %m");
+ return r;
SET_FOREACH(mac_addr, m->match_source_mac) {
r = sd_netlink_message_append_ether_addr(req, IFLA_MACVLAN_MACADDR, mac_addr);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_MACVLAN_MACADDR attribute: %m");
+ return r;
}
r = sd_netlink_message_close_container(req);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not close IFLA_MACVLAN_MACADDR_DATA container: %m");
+ return r;
}
if (m->mode != _NETDEV_MACVLAN_MODE_INVALID) {
r = sd_netlink_message_append_u32(req, IFLA_MACVLAN_MODE, m->mode);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_MACVLAN_MODE attribute: %m");
+ return r;
}
/* set the nopromisc flag if Promiscuous= of the link is explicitly set to false */
if (m->mode == NETDEV_MACVLAN_MODE_PASSTHRU && link->network->promiscuous == 0) {
r = sd_netlink_message_append_u16(req, IFLA_MACVLAN_FLAGS, MACVLAN_FLAG_NOPROMISC);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_MACVLAN_FLAGS attribute: %m");
+ return r;
}
if (m->bc_queue_length != UINT32_MAX) {
r = sd_netlink_message_append_u32(req, IFLA_MACVLAN_BC_QUEUE_LEN, m->bc_queue_length);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_MACVLAN_BC_QUEUE_LEN attribute: %m");
+ return r;
}
return 0;
diff --git a/src/network/netdev/netdev.c b/src/network/netdev/netdev.c
index 97d06a0d16..f93694e469 100644
--- a/src/network/netdev/netdev.c
+++ b/src/network/netdev/netdev.c
@@ -540,7 +540,7 @@ static int netdev_create(NetDev *netdev, Link *link, link_netlink_message_handle
r = NETDEV_VTABLE(netdev)->fill_message_create(netdev, link, m);
if (r < 0)
- return r;
+ return log_netdev_error_errno(netdev, r, "Could not create netlink message: %m");
r = sd_netlink_message_close_container(m);
if (r < 0)
diff --git a/src/network/netdev/tunnel.c b/src/network/netdev/tunnel.c
index b2e88eaa2f..ca24272ea4 100644
--- a/src/network/netdev/tunnel.c
+++ b/src/network/netdev/tunnel.c
@@ -198,7 +198,7 @@ static int netdev_ipip_sit_fill_message_create(NetDev *netdev, Link *link, sd_ne
if (link || t->assign_to_loopback) {
r = sd_netlink_message_append_u32(m, IFLA_IPTUN_LINK, link ? link->ifindex : LOOPBACK_IFINDEX);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_LINK attribute: %m");
+ return r;
}
r = tunnel_get_local_address(t, link, &local);
@@ -207,46 +207,46 @@ static int netdev_ipip_sit_fill_message_create(NetDev *netdev, Link *link, sd_ne
r = sd_netlink_message_append_in_addr(m, IFLA_IPTUN_LOCAL, &local.in);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_LOCAL attribute: %m");
+ return r;
r = sd_netlink_message_append_in_addr(m, IFLA_IPTUN_REMOTE, &t->remote.in);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_REMOTE attribute: %m");
+ return r;
r = sd_netlink_message_append_u8(m, IFLA_IPTUN_TTL, t->ttl);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_TTL attribute: %m");
+ return r;
r = sd_netlink_message_append_u8(m, IFLA_IPTUN_PMTUDISC, t->pmtudisc);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_PMTUDISC attribute: %m");
+ return r;
if (t->fou_tunnel) {
r = sd_netlink_message_append_u16(m, IFLA_IPTUN_ENCAP_TYPE, t->fou_encap_type);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_ENCAP_TYPE attribute: %m");
+ return r;
r = sd_netlink_message_append_u16(m, IFLA_IPTUN_ENCAP_SPORT, htobe16(t->encap_src_port));
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_ENCAP_SPORT attribute: %m");
+ return r;
r = sd_netlink_message_append_u16(m, IFLA_IPTUN_ENCAP_DPORT, htobe16(t->fou_destination_port));
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_ENCAP_DPORT attribute: %m");
+ return r;
}
if (netdev->kind == NETDEV_KIND_SIT) {
if (t->sixrd_prefixlen > 0) {
r = sd_netlink_message_append_in6_addr(m, IFLA_IPTUN_6RD_PREFIX, &t->sixrd_prefix);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_6RD_PREFIX attribute: %m");
+ return r;
/* u16 is deliberate here, even though we're passing a netmask that can never be >128. The kernel is
* expecting to receive the prefixlen as a u16.
*/
r = sd_netlink_message_append_u16(m, IFLA_IPTUN_6RD_PREFIXLEN, t->sixrd_prefixlen);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_6RD_PREFIXLEN attribute: %m");
+ return r;
}
if (t->isatap >= 0) {
@@ -256,11 +256,11 @@ static int netdev_ipip_sit_fill_message_create(NetDev *netdev, Link *link, sd_ne
r = sd_netlink_message_append_u16(m, IFLA_IPTUN_FLAGS, flags);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_FLAGS attribute: %m");
+ return r;
}
}
- return r;
+ return 0;
}
static int netdev_gre_erspan_fill_message_create(NetDev *netdev, Link *link, sd_netlink_message *m) {
@@ -294,13 +294,13 @@ static int netdev_gre_erspan_fill_message_create(NetDev *netdev, Link *link, sd_
if (link || t->assign_to_loopback) {
r = sd_netlink_message_append_u32(m, IFLA_GRE_LINK, link ? link->ifindex : LOOPBACK_IFINDEX);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_GRE_LINK attribute: %m");
+ return r;
}
if (netdev->kind == NETDEV_KIND_ERSPAN) {
r = sd_netlink_message_append_u32(m, IFLA_GRE_ERSPAN_INDEX, t->erspan_index);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_GRE_ERSPAN_INDEX attribute: %m");
+ return r;
}
r = tunnel_get_local_address(t, link, &local);
@@ -309,23 +309,23 @@ static int netdev_gre_erspan_fill_message_create(NetDev *netdev, Link *link, sd_
r = sd_netlink_message_append_in_addr(m, IFLA_GRE_LOCAL, &local.in);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_GRE_LOCAL attribute: %m");
+ return r;
r = sd_netlink_message_append_in_addr(m, IFLA_GRE_REMOTE, &t->remote.in);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_GRE_REMOTE attribute: %m");
+ return r;
r = sd_netlink_message_append_u8(m, IFLA_GRE_TTL, t->ttl);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_GRE_TTL attribute: %m");
+ return r;
r = sd_netlink_message_append_u8(m, IFLA_GRE_TOS, t->tos);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_GRE_TOS attribute: %m");
+ return r;
r = sd_netlink_message_append_u8(m, IFLA_GRE_PMTUDISC, t->pmtudisc);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_GRE_PMTUDISC attribute: %m");
+ return r;
if (t->key != 0) {
ikey = okey = htobe32(t->key);
@@ -353,35 +353,35 @@ static int netdev_gre_erspan_fill_message_create(NetDev *netdev, Link *link, sd_
r = sd_netlink_message_append_u32(m, IFLA_GRE_IKEY, ikey);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_GRE_IKEY attribute: %m");
+ return r;
r = sd_netlink_message_append_u32(m, IFLA_GRE_OKEY, okey);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_GRE_OKEY attribute: %m");
+ return r;
r = sd_netlink_message_append_u16(m, IFLA_GRE_IFLAGS, iflags);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_GRE_IFLAGS attribute: %m");
+ return r;
r = sd_netlink_message_append_u16(m, IFLA_GRE_OFLAGS, oflags);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_GRE_OFLAGS, attribute: %m");
+ return r;
if (t->fou_tunnel) {
r = sd_netlink_message_append_u16(m, IFLA_GRE_ENCAP_TYPE, t->fou_encap_type);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_GRE_ENCAP_TYPE attribute: %m");
+ return r;
r = sd_netlink_message_append_u16(m, IFLA_GRE_ENCAP_SPORT, htobe16(t->encap_src_port));
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_GRE_ENCAP_SPORT attribute: %m");
+ return r;
r = sd_netlink_message_append_u16(m, IFLA_GRE_ENCAP_DPORT, htobe16(t->fou_destination_port));
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_GRE_ENCAP_DPORT attribute: %m");
+ return r;
}
- return r;
+ return 0;
}
static int netdev_ip6gre_fill_message_create(NetDev *netdev, Link *link, sd_netlink_message *m) {
@@ -406,7 +406,7 @@ static int netdev_ip6gre_fill_message_create(NetDev *netdev, Link *link, sd_netl
if (link || t->assign_to_loopback) {
r = sd_netlink_message_append_u32(m, IFLA_GRE_LINK, link ? link->ifindex : LOOPBACK_IFINDEX);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_GRE_LINK attribute: %m");
+ return r;
}
r = tunnel_get_local_address(t, link, &local);
@@ -415,25 +415,25 @@ static int netdev_ip6gre_fill_message_create(NetDev *netdev, Link *link, sd_netl
r = sd_netlink_message_append_in6_addr(m, IFLA_GRE_LOCAL, &local.in6);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_GRE_LOCAL attribute: %m");
+ return r;
r = sd_netlink_message_append_in6_addr(m, IFLA_GRE_REMOTE, &t->remote.in6);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_GRE_REMOTE attribute: %m");
+ return r;
r = sd_netlink_message_append_u8(m, IFLA_GRE_TTL, t->ttl);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_GRE_TTL attribute: %m");
+ return r;
if (t->ipv6_flowlabel != _NETDEV_IPV6_FLOWLABEL_INVALID) {
r = sd_netlink_message_append_u32(m, IFLA_GRE_FLOWINFO, t->ipv6_flowlabel);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_GRE_FLOWINFO attribute: %m");
+ return r;
}
r = sd_netlink_message_append_u32(m, IFLA_GRE_FLAGS, t->flags);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_GRE_FLAGS attribute: %m");
+ return r;
if (t->key != 0) {
ikey = okey = htobe32(t->key);
@@ -453,21 +453,21 @@ static int netdev_ip6gre_fill_message_create(NetDev *netdev, Link *link, sd_netl
r = sd_netlink_message_append_u32(m, IFLA_GRE_IKEY, ikey);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_GRE_IKEY attribute: %m");
+ return r;
r = sd_netlink_message_append_u32(m, IFLA_GRE_OKEY, okey);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_GRE_OKEY attribute: %m");
+ return r;
r = sd_netlink_message_append_u16(m, IFLA_GRE_IFLAGS, iflags);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_GRE_IFLAGS attribute: %m");
+ return r;
r = sd_netlink_message_append_u16(m, IFLA_GRE_OFLAGS, oflags);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_GRE_OFLAGS, attribute: %m");
+ return r;
- return r;
+ return 0;
}
static int netdev_vti_fill_message_create(NetDev *netdev, Link *link, sd_netlink_message *m) {
@@ -489,7 +489,7 @@ static int netdev_vti_fill_message_create(NetDev *netdev, Link *link, sd_netlink
if (link || t->assign_to_loopback) {
r = sd_netlink_message_append_u32(m, IFLA_VTI_LINK, link ? link->ifindex : LOOPBACK_IFINDEX);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_VTI_LINK attribute: %m");
+ return r;
}
if (t->key != 0)
@@ -501,11 +501,11 @@ static int netdev_vti_fill_message_create(NetDev *netdev, Link *link, sd_netlink
r = sd_netlink_message_append_u32(m, IFLA_VTI_IKEY, ikey);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_VTI_IKEY attribute: %m");
+ return r;
r = sd_netlink_message_append_u32(m, IFLA_VTI_OKEY, okey);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_VTI_OKEY attribute: %m");
+ return r;
r = tunnel_get_local_address(t, link, &local);
if (r < 0)
@@ -513,13 +513,13 @@ static int netdev_vti_fill_message_create(NetDev *netdev, Link *link, sd_netlink
r = netlink_message_append_in_addr_union(m, IFLA_VTI_LOCAL, t->family, &local);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_VTI_LOCAL attribute: %m");
+ return r;
r = netlink_message_append_in_addr_union(m, IFLA_VTI_REMOTE, t->family, &t->remote);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_VTI_REMOTE attribute: %m");
+ return r;
- return r;
+ return 0;
}
static int netdev_ip6tnl_fill_message_create(NetDev *netdev, Link *link, sd_netlink_message *m) {
@@ -538,7 +538,7 @@ static int netdev_ip6tnl_fill_message_create(NetDev *netdev, Link *link, sd_netl
if (link || t->assign_to_loopback) {
r = sd_netlink_message_append_u32(m, IFLA_IPTUN_LINK, link ? link->ifindex : LOOPBACK_IFINDEX);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_LINK attribute: %m");
+ return r;
}
r = tunnel_get_local_address(t, link, &local);
@@ -547,20 +547,20 @@ static int netdev_ip6tnl_fill_message_create(NetDev *netdev, Link *link, sd_netl
r = sd_netlink_message_append_in6_addr(m, IFLA_IPTUN_LOCAL, &local.in6);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_LOCAL attribute: %m");
+ return r;
r = sd_netlink_message_append_in6_addr(m, IFLA_IPTUN_REMOTE, &t->remote.in6);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_REMOTE attribute: %m");
+ return r;
r = sd_netlink_message_append_u8(m, IFLA_IPTUN_TTL, t->ttl);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_TTL attribute: %m");
+ return r;
if (t->ipv6_flowlabel != _NETDEV_IPV6_FLOWLABEL_INVALID) {
r = sd_netlink_message_append_u32(m, IFLA_IPTUN_FLOWINFO, t->ipv6_flowlabel);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_FLOWINFO attribute: %m");
+ return r;
}
if (t->copy_dscp)
@@ -572,12 +572,12 @@ static int netdev_ip6tnl_fill_message_create(NetDev *netdev, Link *link, sd_netl
if (t->encap_limit != 0) {
r = sd_netlink_message_append_u8(m, IFLA_IPTUN_ENCAP_LIMIT, t->encap_limit);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_ENCAP_LIMIT attribute: %m");
+ return r;
}
r = sd_netlink_message_append_u32(m, IFLA_IPTUN_FLAGS, t->flags);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_FLAGS attribute: %m");
+ return r;
switch (t->ip6tnl_mode) {
case NETDEV_IP6_TNL_MODE_IP6IP6:
@@ -594,9 +594,9 @@ static int netdev_ip6tnl_fill_message_create(NetDev *netdev, Link *link, sd_netl
r = sd_netlink_message_append_u8(m, IFLA_IPTUN_PROTO, proto);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_PROTO attribute: %m");
+ return r;
- return r;
+ return 0;
}
static int netdev_tunnel_is_ready_to_create(NetDev *netdev, Link *link) {
diff --git a/src/network/netdev/veth.c b/src/network/netdev/veth.c
index c946e81fc0..fb00e6667f 100644
--- a/src/network/netdev/veth.c
+++ b/src/network/netdev/veth.c
@@ -24,12 +24,12 @@ static int netdev_veth_fill_message_create(NetDev *netdev, Link *link, sd_netlin
r = sd_netlink_message_open_container(m, VETH_INFO_PEER);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append VETH_INFO_PEER attribute: %m");
+ return r;
if (v->ifname_peer) {
r = sd_netlink_message_append_string(m, IFLA_IFNAME, v->ifname_peer);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Failed to add netlink interface name: %m");
+ return r;
}
r = netdev_generate_hw_addr(netdev, NULL, v->ifname_peer, &v->hw_addr_peer, &hw_addr);
@@ -40,20 +40,20 @@ static int netdev_veth_fill_message_create(NetDev *netdev, Link *link, sd_netlin
log_netdev_debug(netdev, "Using MAC address for peer: %s", HW_ADDR_TO_STR(&hw_addr));
r = netlink_message_append_hw_addr(m, IFLA_ADDRESS, &hw_addr);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_ADDRESS attribute: %m");
+ return r;
}
if (netdev->mtu != 0) {
r = sd_netlink_message_append_u32(m, IFLA_MTU, netdev->mtu);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_MTU attribute: %m");
+ return r;
}
r = sd_netlink_message_close_container(m);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_INFO_DATA attribute: %m");
+ return r;
- return r;
+ return 0;
}
static int netdev_veth_verify(NetDev *netdev, const char *filename) {
diff --git a/src/network/netdev/vlan.c b/src/network/netdev/vlan.c
index af3e77963e..3f9f594759 100644
--- a/src/network/netdev/vlan.c
+++ b/src/network/netdev/vlan.c
@@ -24,12 +24,12 @@ static int netdev_vlan_fill_message_create(NetDev *netdev, Link *link, sd_netlin
r = sd_netlink_message_append_u16(req, IFLA_VLAN_ID, v->id);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_VLAN_ID attribute: %m");
+ return r;
if (v->protocol >= 0) {
r = sd_netlink_message_append_u16(req, IFLA_VLAN_PROTOCOL, htobe16(v->protocol));
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_VLAN_PROTOCOL attribute: %m");
+ return r;
}
if (v->gvrp != -1) {
@@ -54,24 +54,24 @@ static int netdev_vlan_fill_message_create(NetDev *netdev, Link *link, sd_netlin
r = sd_netlink_message_append_data(req, IFLA_VLAN_FLAGS, &flags, sizeof(struct ifla_vlan_flags));
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_VLAN_FLAGS attribute: %m");
+ return r;
if (!set_isempty(v->egress_qos_maps)) {
struct ifla_vlan_qos_mapping *m;
r = sd_netlink_message_open_container(req, IFLA_VLAN_EGRESS_QOS);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not open container IFLA_VLAN_EGRESS_QOS: %m");
+ return r;
SET_FOREACH(m, v->egress_qos_maps) {
r = sd_netlink_message_append_data(req, IFLA_VLAN_QOS_MAPPING, m, sizeof(struct ifla_vlan_qos_mapping));
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_VLAN_QOS_MAPPING attribute: %m");
+ return r;
}
r = sd_netlink_message_close_container(req);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not close container IFLA_VLAN_EGRESS_QOS: %m");
+ return r;
}
if (!set_isempty(v->ingress_qos_maps)) {
@@ -79,17 +79,17 @@ static int netdev_vlan_fill_message_create(NetDev *netdev, Link *link, sd_netlin
r = sd_netlink_message_open_container(req, IFLA_VLAN_INGRESS_QOS);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not open container IFLA_VLAN_INGRESS_QOS: %m");
+ return r;
SET_FOREACH(m, v->ingress_qos_maps) {
r = sd_netlink_message_append_data(req, IFLA_VLAN_QOS_MAPPING, m, sizeof(struct ifla_vlan_qos_mapping));
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_VLAN_QOS_MAPPING attribute: %m");
+ return r;
}
r = sd_netlink_message_close_container(req);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not close container IFLA_VLAN_INGRESS_QOS: %m");
+ return r;
}
return 0;
diff --git a/src/network/netdev/vrf.c b/src/network/netdev/vrf.c
index b1b6707441..9f75eb63cf 100644
--- a/src/network/netdev/vrf.c
+++ b/src/network/netdev/vrf.c
@@ -20,9 +20,9 @@ static int netdev_vrf_fill_message_create(NetDev *netdev, Link *link, sd_netlink
r = sd_netlink_message_append_u32(m, IFLA_VRF_TABLE, v->table);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_VRF_TABLE attribute: %m");
+ return r;
- return r;
+ return 0;
}
const NetDevVTable vrf_vtable = {
diff --git a/src/network/netdev/vxcan.c b/src/network/netdev/vxcan.c
index a0ba048eb1..981854a3f1 100644
--- a/src/network/netdev/vxcan.c
+++ b/src/network/netdev/vxcan.c
@@ -19,19 +19,19 @@ static int netdev_vxcan_fill_message_create(NetDev *netdev, Link *link, sd_netli
r = sd_netlink_message_open_container(m, VXCAN_INFO_PEER);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append VXCAN_INFO_PEER attribute: %m");
+ return r;
if (v->ifname_peer) {
r = sd_netlink_message_append_string(m, IFLA_IFNAME, v->ifname_peer);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Failed to add vxcan netlink interface peer name: %m");
+ return r;
}
r = sd_netlink_message_close_container(m);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append VXCAN_INFO_PEER attribute: %m");
+ return r;
- return r;
+ return 0;
}
static int netdev_vxcan_verify(NetDev *netdev, const char *filename) {
diff --git a/src/network/netdev/vxlan.c b/src/network/netdev/vxlan.c
index addeb907dd..bdedf3e7a9 100644
--- a/src/network/netdev/vxlan.c
+++ b/src/network/netdev/vxlan.c
@@ -51,7 +51,7 @@ static int netdev_vxlan_fill_message_create(NetDev *netdev, Link *link, sd_netli
if (v->vni <= VXLAN_VID_MAX) {
r = sd_netlink_message_append_u32(m, IFLA_VXLAN_ID, v->vni);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_ID attribute: %m");
+ return r;
}
if (in_addr_is_set(v->group_family, &v->group)) {
@@ -60,19 +60,19 @@ static int netdev_vxlan_fill_message_create(NetDev *netdev, Link *link, sd_netli
else
r = sd_netlink_message_append_in6_addr(m, IFLA_VXLAN_GROUP6, &v->group.in6);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_GROUP attribute: %m");
+ return r;
} else if (in_addr_is_set(v->remote_family, &v->remote)) {
if (v->remote_family == AF_INET)
r = sd_netlink_message_append_in_addr(m, IFLA_VXLAN_GROUP, &v->remote.in);
else
r = sd_netlink_message_append_in6_addr(m, IFLA_VXLAN_GROUP6, &v->remote.in6);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_GROUP attribute: %m");
+ return r;
}
r = vxlan_get_local_address(v, link, &local_family, &local);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not find local address: %m");
+ return r;
if (in_addr_is_set(local_family, &local)) {
if (local_family == AF_INET)
@@ -80,84 +80,84 @@ static int netdev_vxlan_fill_message_create(NetDev *netdev, Link *link, sd_netli
else
r = sd_netlink_message_append_in6_addr(m, IFLA_VXLAN_LOCAL6, &local.in6);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_LOCAL attribute: %m");
+ return r;
}
r = sd_netlink_message_append_u32(m, IFLA_VXLAN_LINK, link ? link->ifindex : 0);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_LINK attribute: %m");
+ return r;
if (v->inherit) {
r = sd_netlink_message_append_flag(m, IFLA_VXLAN_TTL_INHERIT);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_TTL_INHERIT attribute: %m");
+ return r;
} else {
r = sd_netlink_message_append_u8(m, IFLA_VXLAN_TTL, v->ttl);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_TTL attribute: %m");
+ return r;
}
if (v->tos != 0) {
r = sd_netlink_message_append_u8(m, IFLA_VXLAN_TOS, v->tos);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_TOS attribute: %m");
+ return r;
}
r = sd_netlink_message_append_u8(m, IFLA_VXLAN_LEARNING, v->learning);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_LEARNING attribute: %m");
+ return r;
r = sd_netlink_message_append_u8(m, IFLA_VXLAN_RSC, v->route_short_circuit);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_RSC attribute: %m");
+ return r;
r = sd_netlink_message_append_u8(m, IFLA_VXLAN_PROXY, v->arp_proxy);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_PROXY attribute: %m");
+ return r;
r = sd_netlink_message_append_u8(m, IFLA_VXLAN_L2MISS, v->l2miss);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_L2MISS attribute: %m");
+ return r;
r = sd_netlink_message_append_u8(m, IFLA_VXLAN_L3MISS, v->l3miss);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_L3MISS attribute: %m");
+ return r;
if (v->fdb_ageing != 0) {
r = sd_netlink_message_append_u32(m, IFLA_VXLAN_AGEING, v->fdb_ageing / USEC_PER_SEC);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_AGEING attribute: %m");
+ return r;
}
if (v->max_fdb != 0) {
r = sd_netlink_message_append_u32(m, IFLA_VXLAN_LIMIT, v->max_fdb);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_LIMIT attribute: %m");
+ return r;
}
r = sd_netlink_message_append_u8(m, IFLA_VXLAN_UDP_CSUM, v->udpcsum);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_UDP_CSUM attribute: %m");
+ return r;
r = sd_netlink_message_append_u8(m, IFLA_VXLAN_UDP_ZERO_CSUM6_TX, v->udp6zerocsumtx);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_UDP_ZERO_CSUM6_TX attribute: %m");
+ return r;
r = sd_netlink_message_append_u8(m, IFLA_VXLAN_UDP_ZERO_CSUM6_RX, v->udp6zerocsumrx);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_UDP_ZERO_CSUM6_RX attribute: %m");
+ return r;
r = sd_netlink_message_append_u8(m, IFLA_VXLAN_REMCSUM_TX, v->remote_csum_tx);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_REMCSUM_TX attribute: %m");
+ return r;
r = sd_netlink_message_append_u8(m, IFLA_VXLAN_REMCSUM_RX, v->remote_csum_rx);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_REMCSUM_RX attribute: %m");
+ return r;
r = sd_netlink_message_append_u16(m, IFLA_VXLAN_PORT, htobe16(v->dest_port));
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_PORT attribute: %m");
+ return r;
if (v->port_range.low != 0 || v->port_range.high != 0) {
struct ifla_vxlan_port_range port_range;
@@ -167,32 +167,32 @@ static int netdev_vxlan_fill_message_create(NetDev *netdev, Link *link, sd_netli
r = sd_netlink_message_append_data(m, IFLA_VXLAN_PORT_RANGE, &port_range, sizeof(port_range));
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_PORT_RANGE attribute: %m");
+ return r;
}
r = sd_netlink_message_append_u32(m, IFLA_VXLAN_LABEL, htobe32(v->flow_label));
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_LABEL attribute: %m");
+ return r;
if (v->group_policy) {
r = sd_netlink_message_append_flag(m, IFLA_VXLAN_GBP);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_GBP attribute: %m");
+ return r;
}
if (v->generic_protocol_extension) {
r = sd_netlink_message_append_flag(m, IFLA_VXLAN_GPE);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_GPE attribute: %m");
+ return r;
}
if (v->df != _NETDEV_VXLAN_DF_INVALID) {
r = sd_netlink_message_append_u8(m, IFLA_VXLAN_DF, v->df);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_DF attribute: %m");
+ return r;
}
- return r;
+ return 0;
}
int config_parse_vxlan_address(
diff --git a/src/network/netdev/xfrm.c b/src/network/netdev/xfrm.c
index 4b7e73b37a..05844b8321 100644
--- a/src/network/netdev/xfrm.c
+++ b/src/network/netdev/xfrm.c
@@ -18,11 +18,11 @@ static int xfrm_fill_message_create(NetDev *netdev, Link *link, sd_netlink_messa
r = sd_netlink_message_append_u32(message, IFLA_XFRM_LINK, link ? link->ifindex : LOOPBACK_IFINDEX);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_XFRM_LINK: %m");
+ return r;
r = sd_netlink_message_append_u32(message, IFLA_XFRM_IF_ID, x->if_id);
if (r < 0)
- return log_netdev_error_errno(netdev, r, "Could not append IFLA_XFRM_IF_ID: %m");
+ return r;
return 0;
}