summaryrefslogtreecommitdiff
path: root/src/network/networkd-link.c
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2014-01-18 19:32:45 +0100
committerTom Gundersen <teg@jklm.no>2014-01-18 19:32:45 +0100
commitb25ef18b334d85d54f50478446bf81fe214cb2fc (patch)
tree2565dc0bc9d540ad173600ca8a90eb0d8054a022 /src/network/networkd-link.c
parent35bbea48dcb74ed2ecc1cab1ca7306acf6d6bb65 (diff)
sd-dhcp-client: refactor client_{free,new}
Make them more simiar to sd_bus and friends. Also factor out the event attachment. In the future, we will likely want to support external main-loops, so this is a first step. For the time being, we are still requiring an sd_event to be attached though.
Diffstat (limited to 'src/network/networkd-link.c')
-rw-r--r--src/network/networkd-link.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index f1a2695e83..ce1f956eaf 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -588,9 +588,13 @@ static int link_acquire_conf(Link *link) {
assert(link->manager->event);
if (!link->dhcp) {
- link->dhcp = sd_dhcp_client_new(link->manager->event);
- if (!link->dhcp)
- return -ENOMEM;
+ r = sd_dhcp_client_new(&link->dhcp);
+ if (r < 0)
+ return r;
+
+ r = sd_dhcp_client_attach_event(link->dhcp, NULL, 0);
+ if (r < 0)
+ return r;
r = sd_dhcp_client_set_index(link->dhcp, link->ifindex);
if (r < 0)