summaryrefslogtreecommitdiff
path: root/src/network
diff options
context:
space:
mode:
Diffstat (limited to 'src/network')
-rw-r--r--src/network/networkd-link.c20
-rw-r--r--src/network/networkd-netdev-veth.c24
-rw-r--r--src/network/networkd-netdev-vxlan.c112
3 files changed, 42 insertions, 114 deletions
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index 127bc1249a..7841f69dab 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -749,7 +749,6 @@ static int set_hostname_handler(sd_bus_message *m, void *userdata, sd_bus_error
}
int link_set_hostname(Link *link, const char *hostname) {
- _cleanup_bus_message_unref_ sd_bus_message *m = NULL;
int r = 0;
assert(link);
@@ -764,22 +763,19 @@ int link_set_hostname(Link *link, const char *hostname) {
return 0;
}
- r = sd_bus_message_new_method_call(
+ r = sd_bus_call_method_async(
link->manager->bus,
- &m,
+ NULL,
"org.freedesktop.hostname1",
"/org/freedesktop/hostname1",
"org.freedesktop.hostname1",
- "SetHostname");
- if (r < 0)
- return r;
-
- r = sd_bus_message_append(m, "sb", hostname, false);
- if (r < 0)
- return r;
+ "SetHostname",
+ set_hostname_handler,
+ link,
+ "sb",
+ hostname,
+ false);
- r = sd_bus_call_async(link->manager->bus, NULL, m, set_hostname_handler,
- link, 0);
if (r < 0)
return log_link_error_errno(link, r, "Could not set transient hostname: %m");
diff --git a/src/network/networkd-netdev-veth.c b/src/network/networkd-netdev-veth.c
index 9e9e1225e7..7bb02d1ae1 100644
--- a/src/network/networkd-netdev-veth.c
+++ b/src/network/networkd-netdev-veth.c
@@ -35,12 +35,8 @@ static int netdev_veth_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_m
assert(m);
r = sd_rtnl_message_open_container(m, VETH_INFO_PEER);
- if (r < 0) {
- log_netdev_error(netdev,
- "Could not append VETH_INFO_PEER attribute: %s",
- strerror(-r));
- return r;
- }
+ if (r < 0)
+ return log_netdev_error_errno(netdev, r, "Could not append VETH_INFO_PEER attribute: %m");
if (v->ifname_peer) {
r = sd_rtnl_message_append_string(m, IFLA_IFNAME, v->ifname_peer);
@@ -50,21 +46,13 @@ static int netdev_veth_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_m
if (v->mac_peer) {
r = sd_rtnl_message_append_ether_addr(m, IFLA_ADDRESS, v->mac_peer);
- if (r < 0) {
- log_netdev_error(netdev,
- "Could not append IFLA_ADDRESS attribute: %s",
- strerror(-r));
- return r;
- }
+ if (r < 0)
+ return log_netdev_error_errno(netdev, r, "Could not append IFLA_ADDRESS attribute: %m");
}
r = sd_rtnl_message_close_container(m);
- if (r < 0) {
- log_netdev_error(netdev,
- "Could not append IFLA_INFO_DATA attribute: %s",
- strerror(-r));
- return r;
- }
+ if (r < 0)
+ return log_netdev_error_errno(netdev, r, "Could not append IFLA_INFO_DATA attribute: %m");
return r;
}
diff --git a/src/network/networkd-netdev-vxlan.c b/src/network/networkd-netdev-vxlan.c
index e2c2b108b9..01a1e5089c 100644
--- a/src/network/networkd-netdev-vxlan.c
+++ b/src/network/networkd-netdev-vxlan.c
@@ -39,123 +39,67 @@ static int netdev_vxlan_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_
if (v->id <= VXLAN_VID_MAX) {
r = sd_rtnl_message_append_u32(m, IFLA_VXLAN_ID, v->id);
- if (r < 0) {
- log_netdev_error(netdev,
- "Could not append IFLA_VXLAN_ID attribute: %s",
- strerror(-r));
- return r;
- }
+ if (r < 0)
+ return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_ID attribute: %m");
}
r = sd_rtnl_message_append_in_addr(m, IFLA_VXLAN_GROUP, &v->group.in);
- if (r < 0) {
- log_netdev_error(netdev,
- "Could not append IFLA_VXLAN_GROUP attribute: %s",
- strerror(-r));
- return r;
- }
+ if (r < 0)
+ return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_GROUP attribute: %m");
r = sd_rtnl_message_append_u32(m, IFLA_VXLAN_LINK, link->ifindex);
- if (r < 0) {
- log_netdev_error(netdev,
- "Could not append IFLA_VXLAN_LINK attribute: %s",
- strerror(-r));
- return r;
- }
+ if (r < 0)
+ return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_LINK attribute: %m");
if(v->ttl) {
r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_TTL, v->ttl);
- if (r < 0) {
- log_netdev_error(netdev,
- "Could not append IFLA_VXLAN_TTL attribute: %s",
- strerror(-r));
- return r;
- }
+ if (r < 0)
+ return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_TTL attribute: %m");
}
if(v->tos) {
r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_TOS, v->tos);
- if (r < 0) {
- log_netdev_error(netdev,
- "Could not append IFLA_VXLAN_TOS attribute: %s",
- strerror(-r));
- return r;
- }
+ if (r < 0)
+ return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_TOS attribute: %m");
}
r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_LEARNING, v->learning);
- if (r < 0) {
- log_netdev_error(netdev,
- "Could not append IFLA_VXLAN_LEARNING attribute: %s",
- strerror(-r));
- return r;
- }
+ if (r < 0)
+ return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_LEARNING attribute: %m");
r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_RSC, v->route_short_circuit);
- if (r < 0) {
- log_netdev_error(netdev,
- "Could not append IFLA_VXLAN_RSC attribute: %s",
- strerror(-r));
- return r;
- }
+ if (r < 0)
+ return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_RSC attribute: %m");
r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_PROXY, v->arp_proxy);
- if (r < 0) {
- log_netdev_error(netdev,
- "Could not append IFLA_VXLAN_PROXY attribute: %s",
- strerror(-r));
- return r;
- }
+ if (r < 0)
+ return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_PROXY attribute: %m");
r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_L2MISS, v->l2miss);
- if (r < 0) {
- log_netdev_error(netdev,
- "Could not append IFLA_VXLAN_L2MISS attribute: %s",
- strerror(-r));
- return r;
- }
+ if (r < 0)
+ return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_L2MISS attribute: %m");
r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_L3MISS, v->l3miss);
- if (r < 0) {
- log_netdev_error(netdev,
- "Could not append IFLA_VXLAN_L3MISS attribute: %s",
- strerror(-r));
- return r;
- }
+ if (r < 0)
+ return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_L3MISS attribute: %m");
if(v->fdb_ageing) {
r = sd_rtnl_message_append_u32(m, IFLA_VXLAN_AGEING, v->fdb_ageing / USEC_PER_SEC);
- if (r < 0) {
- log_netdev_error(netdev,
- "Could not append IFLA_VXLAN_AGEING attribute: %s",
- strerror(-r));
- return r;
- }
+ if (r < 0)
+ return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_AGEING attribute: %m");
}
r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_UDP_CSUM, v->udpcsum);
- if (r < 0) {
- log_netdev_error(netdev,
- "Could not append IFLA_VXLAN_UDP_CSUM attribute: %s",
- strerror(-r));
- return r;
- }
+ if (r < 0)
+ return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_UDP_CSUM attribute: %m");
r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_UDP_ZERO_CSUM6_TX, v->udp6zerocsumtx);
- if (r < 0) {
- log_netdev_error(netdev,
- "Could not append IFLA_VXLAN_UDP_ZERO_CSUM6_TX attribute: %s",
- strerror(-r));
- return r;
- }
+ if (r < 0)
+ return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_UDP_ZERO_CSUM6_TX attribute: %m");
r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_UDP_ZERO_CSUM6_RX, v->udp6zerocsumrx);
- if (r < 0) {
- log_netdev_error(netdev,
- "Could not append IFLA_VXLAN_UDP_ZERO_CSUM6_RX attribute: %s",
- strerror(-r));
- return r;
- }
+ if (r < 0)
+ return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_UDP_ZERO_CSUM6_RX attribute: %m");
return r;
}