summaryrefslogtreecommitdiff
path: root/src/network/networkd-address.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/network/networkd-address.c')
-rw-r--r--src/network/networkd-address.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/network/networkd-address.c b/src/network/networkd-address.c
index 75a9bae201..9fb24c95c1 100644
--- a/src/network/networkd-address.c
+++ b/src/network/networkd-address.c
@@ -55,10 +55,13 @@ void address_free(Address *address) {
free(address);
}
-int address_configure(Manager *manager, Address *address, Link *link) {
+int address_configure(Address *address, Link *link,
+ sd_rtnl_message_handler_t callback) {
_cleanup_sd_rtnl_message_unref_ sd_rtnl_message *req = NULL;
int r;
+ assert(link->manager);
+
r = sd_rtnl_message_addr_new(RTM_NEWADDR, link->ifindex,
address->family, address->prefixlen,
IFA_F_PERMANENT, RT_SCOPE_UNIVERSE, &req);
@@ -97,13 +100,13 @@ int address_configure(Manager *manager, Address *address, Link *link) {
}
}
- r = sd_rtnl_call(manager->rtnl, req, 0, NULL);
+ r = sd_rtnl_call_async(link->manager->rtnl, req, callback, link, 0, NULL);
if (r < 0) {
- log_error("Could not configure address: %s", strerror(-r));
- return r != -EEXIST ? r : 0;
+ log_error("Could not send rtnetlink message: %s", strerror(-r));
+ return r;
}
- log_info("Configured interface address");
+ link->rtnl_messages ++;
return 0;
}