From fc6a313b5b836a8642a47348272d7883e1b9349d Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 2 Jun 2016 17:45:08 +0200 Subject: lldp: add proper ref counting to sd_lldp object and a separate call for setting the ifindex Let's make sd-lldp a bit more like sd-ndisc ant the other APIs, and add proper ref counting and a separate call for setting the ifindex. This also adds a new lldp_reset() call we can use at various places to close all fds. This is also similar to how sd-ndisc already does it. --- src/network/networkd-link.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/network/networkd-link.c') diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c index ee52b1ce1e..90ed55d42c 100644 --- a/src/network/networkd-link.c +++ b/src/network/networkd-link.c @@ -2364,7 +2364,11 @@ static int link_configure(Link *link) { } if (link_lldp_rx_enabled(link)) { - r = sd_lldp_new(&link->lldp, link->ifindex); + r = sd_lldp_new(&link->lldp); + if (r < 0) + return r; + + r = sd_lldp_set_ifindex(link->lldp, link->ifindex); if (r < 0) return r; -- cgit v1.2.3-54-g00ecf