From ce4b1dc89172dc5399703709539e92d8ac546afa Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Sun, 28 Feb 2016 11:32:02 +0100 Subject: [PATCH 1/9] build: sort files for libsystemd_nm_la_SOURCES alphabetically --- src/Makefile.am | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 1711b925c..98ae942a7 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -103,9 +103,9 @@ libsystemd_nm_la_SOURCES = \ systemd/src/basic/random-util.c \ systemd/src/basic/random-util.h \ systemd/src/basic/refcnt.h \ + systemd/src/basic/set.h \ systemd/src/basic/siphash24.c \ systemd/src/basic/siphash24.h \ - systemd/src/basic/set.h \ systemd/src/basic/socket-util.h \ systemd/src/basic/sparse-endian.h \ systemd/src/basic/stdio-util.h \ @@ -138,15 +138,15 @@ libsystemd_nm_la_SOURCES = \ systemd/src/libsystemd-network/dhcp6-network.c \ systemd/src/libsystemd-network/dhcp6-option.c \ systemd/src/libsystemd-network/dhcp6-protocol.h \ - systemd/src/libsystemd-network/lldp.h \ - systemd/src/libsystemd-network/lldp-network.h \ + systemd/src/libsystemd-network/lldp-internal.c \ + systemd/src/libsystemd-network/lldp-internal.h \ systemd/src/libsystemd-network/lldp-network.c \ - systemd/src/libsystemd-network/lldp-tlv.c \ - systemd/src/libsystemd-network/lldp-tlv.h \ + systemd/src/libsystemd-network/lldp-network.h \ systemd/src/libsystemd-network/lldp-port.c \ systemd/src/libsystemd-network/lldp-port.h \ - systemd/src/libsystemd-network/lldp-internal.h \ - systemd/src/libsystemd-network/lldp-internal.c \ + systemd/src/libsystemd-network/lldp-tlv.c \ + systemd/src/libsystemd-network/lldp-tlv.h \ + systemd/src/libsystemd-network/lldp.h \ systemd/src/libsystemd-network/network-internal.c \ systemd/src/libsystemd-network/network-internal.h \ systemd/src/libsystemd-network/sd-dhcp-client.c \ @@ -164,11 +164,11 @@ libsystemd_nm_la_SOURCES = \ systemd/src/systemd/sd-dhcp-lease.h \ systemd/src/systemd/sd-dhcp6-client.h \ systemd/src/systemd/sd-dhcp6-lease.h \ - systemd/src/systemd/sd-lldp.h \ systemd/src/systemd/sd-event.h \ systemd/src/systemd/sd-id128.h \ systemd/src/systemd/sd-ipv4acd.h \ systemd/src/systemd/sd-ipv4ll.h \ + systemd/src/systemd/sd-lldp.h \ systemd/src/systemd/sd-ndisc.h libsystemd_nm_la_CPPFLAGS = \ From bf29d02ac11fb5304bb048bdb2f49b74de7a71dd Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Sun, 28 Feb 2016 11:38:51 +0100 Subject: [PATCH 2/9] systemd: don't include "nm-sd-adapt.h" in systemd header files The header files are not compiled directly, but always included while compiling other source files. We already require every source file to include "nm-sd-adapt.h" as first, thus we don't need the include in the headers too. --- src/dhcp-manager/nm-dhcp-systemd.c | 3 +++ src/systemd/nm-sd-adapt.c | 3 ++- src/systemd/src/basic/alloc-util.h | 2 -- src/systemd/src/basic/async.h | 2 -- src/systemd/src/basic/escape.h | 2 -- src/systemd/src/basic/fd-util.h | 2 -- src/systemd/src/basic/fileio.h | 2 -- src/systemd/src/basic/fs-util.h | 2 -- src/systemd/src/basic/hash-funcs.h | 2 -- src/systemd/src/basic/hashmap.h | 2 -- src/systemd/src/basic/hexdecoct.h | 2 -- src/systemd/src/basic/hostname-util.h | 2 -- src/systemd/src/basic/in-addr-util.h | 2 -- src/systemd/src/basic/io-util.h | 2 -- src/systemd/src/basic/list.h | 2 -- src/systemd/src/basic/log.h | 2 -- src/systemd/src/basic/macro.h | 2 -- src/systemd/src/basic/mempool.h | 2 -- src/systemd/src/basic/parse-util.h | 2 -- src/systemd/src/basic/path-util.h | 2 -- src/systemd/src/basic/prioq.h | 2 -- src/systemd/src/basic/random-util.h | 2 -- src/systemd/src/basic/refcnt.h | 2 -- src/systemd/src/basic/set.h | 2 -- src/systemd/src/basic/siphash24.h | 2 -- src/systemd/src/basic/socket-util.h | 2 -- src/systemd/src/basic/sparse-endian.h | 2 -- src/systemd/src/basic/stdio-util.h | 2 -- src/systemd/src/basic/string-table.h | 2 -- src/systemd/src/basic/string-util.h | 2 -- src/systemd/src/basic/strv.h | 2 -- src/systemd/src/basic/time-util.h | 2 -- src/systemd/src/basic/umask-util.h | 2 -- src/systemd/src/basic/unaligned.h | 2 -- src/systemd/src/basic/utf8.h | 2 -- src/systemd/src/basic/util.h | 2 -- src/systemd/src/libsystemd-network/arp-util.h | 2 -- src/systemd/src/libsystemd-network/dhcp-identifier.h | 2 -- src/systemd/src/libsystemd-network/dhcp-internal.h | 2 -- src/systemd/src/libsystemd-network/dhcp-lease-internal.h | 2 -- src/systemd/src/libsystemd-network/dhcp-protocol.h | 2 -- src/systemd/src/libsystemd-network/dhcp6-internal.h | 2 -- src/systemd/src/libsystemd-network/dhcp6-lease-internal.h | 2 -- src/systemd/src/libsystemd-network/dhcp6-protocol.h | 2 -- src/systemd/src/libsystemd-network/lldp-internal.h | 2 -- src/systemd/src/libsystemd-network/lldp-network.h | 2 -- src/systemd/src/libsystemd-network/lldp-port.h | 2 -- src/systemd/src/libsystemd-network/lldp-tlv.h | 2 -- src/systemd/src/libsystemd-network/lldp.h | 2 -- src/systemd/src/libsystemd-network/network-internal.h | 2 -- src/systemd/src/shared/dns-domain.h | 1 - src/systemd/src/systemd/_sd-common.h | 2 -- src/systemd/src/systemd/sd-dhcp-client.h | 2 -- src/systemd/src/systemd/sd-dhcp-lease.h | 2 -- src/systemd/src/systemd/sd-dhcp6-client.h | 2 -- src/systemd/src/systemd/sd-dhcp6-lease.h | 2 -- src/systemd/src/systemd/sd-event.h | 2 -- src/systemd/src/systemd/sd-id128.h | 2 -- src/systemd/src/systemd/sd-ipv4acd.h | 2 -- src/systemd/src/systemd/sd-ipv4ll.h | 2 -- src/systemd/src/systemd/sd-lldp.h | 2 -- src/systemd/src/systemd/sd-ndisc.h | 2 -- 62 files changed, 5 insertions(+), 120 deletions(-) diff --git a/src/dhcp-manager/nm-dhcp-systemd.c b/src/dhcp-manager/nm-dhcp-systemd.c index 7c2bc78f5..b5a3d67cc 100644 --- a/src/dhcp-manager/nm-dhcp-systemd.c +++ b/src/dhcp-manager/nm-dhcp-systemd.c @@ -36,6 +36,9 @@ #include "sd-dhcp-client.h" #include "sd-dhcp6-client.h" + +/* we use a private systemd header, thus need to include nm-sd-adapt.h. */ +#include "nm-sd-adapt.h" #include "dhcp-lease-internal.h" G_DEFINE_TYPE (NMDhcpSystemd, nm_dhcp_systemd, NM_TYPE_DHCP_CLIENT) diff --git a/src/systemd/nm-sd-adapt.c b/src/systemd/nm-sd-adapt.c index e10df9c74..fa7cd9387 100644 --- a/src/systemd/nm-sd-adapt.c +++ b/src/systemd/nm-sd-adapt.c @@ -18,7 +18,8 @@ #include "nm-default.h" -#include +#include "nm-sd-adapt.h" + #include #include diff --git a/src/systemd/src/basic/alloc-util.h b/src/systemd/src/basic/alloc-util.h index 8482baba2..679ba7f39 100644 --- a/src/systemd/src/basic/alloc-util.h +++ b/src/systemd/src/basic/alloc-util.h @@ -19,8 +19,6 @@ along with systemd; If not, see . ***/ -#include "nm-sd-adapt.h" - #include #include #include diff --git a/src/systemd/src/basic/async.h b/src/systemd/src/basic/async.h index 8d096982b..9bd13ff6e 100644 --- a/src/systemd/src/basic/async.h +++ b/src/systemd/src/basic/async.h @@ -19,8 +19,6 @@ along with systemd; If not, see . ***/ -#include "nm-sd-adapt.h" - int asynchronous_job(void* (*func)(void *p), void *arg); int asynchronous_sync(void); diff --git a/src/systemd/src/basic/escape.h b/src/systemd/src/basic/escape.h index 9f1bb45f7..ce5181117 100644 --- a/src/systemd/src/basic/escape.h +++ b/src/systemd/src/basic/escape.h @@ -19,8 +19,6 @@ along with systemd; If not, see . ***/ -#include "nm-sd-adapt.h" - #include #include #include diff --git a/src/systemd/src/basic/fd-util.h b/src/systemd/src/basic/fd-util.h index 13e8a9fe6..44528c6e3 100644 --- a/src/systemd/src/basic/fd-util.h +++ b/src/systemd/src/basic/fd-util.h @@ -19,8 +19,6 @@ along with systemd; If not, see . ***/ -#include "nm-sd-adapt.h" - #include #include #include diff --git a/src/systemd/src/basic/fileio.h b/src/systemd/src/basic/fileio.h index 503af4549..8084895ff 100644 --- a/src/systemd/src/basic/fileio.h +++ b/src/systemd/src/basic/fileio.h @@ -19,8 +19,6 @@ along with systemd; If not, see . ***/ -#include "nm-sd-adapt.h" - #include #include #include diff --git a/src/systemd/src/basic/fs-util.h b/src/systemd/src/basic/fs-util.h index b9b0f3d7b..0e2fcb21b 100644 --- a/src/systemd/src/basic/fs-util.h +++ b/src/systemd/src/basic/fs-util.h @@ -19,8 +19,6 @@ along with systemd; If not, see . ***/ -#include "nm-sd-adapt.h" - #include #include #include diff --git a/src/systemd/src/basic/hash-funcs.h b/src/systemd/src/basic/hash-funcs.h index 607ff7a3a..299189d14 100644 --- a/src/systemd/src/basic/hash-funcs.h +++ b/src/systemd/src/basic/hash-funcs.h @@ -20,8 +20,6 @@ along with systemd; If not, see . ***/ -#include "nm-sd-adapt.h" - #include "macro.h" #include "siphash24.h" diff --git a/src/systemd/src/basic/hashmap.h b/src/systemd/src/basic/hashmap.h index 76643a3c9..6d1ae48b2 100644 --- a/src/systemd/src/basic/hashmap.h +++ b/src/systemd/src/basic/hashmap.h @@ -20,8 +20,6 @@ along with systemd; If not, see . ***/ -#include "nm-sd-adapt.h" - #include #include #include diff --git a/src/systemd/src/basic/hexdecoct.h b/src/systemd/src/basic/hexdecoct.h index 263d6997d..1ba2f69eb 100644 --- a/src/systemd/src/basic/hexdecoct.h +++ b/src/systemd/src/basic/hexdecoct.h @@ -19,8 +19,6 @@ along with systemd; If not, see . ***/ -#include "nm-sd-adapt.h" - #include #include #include diff --git a/src/systemd/src/basic/hostname-util.h b/src/systemd/src/basic/hostname-util.h index f0c1e2cea..d062eddea 100644 --- a/src/systemd/src/basic/hostname-util.h +++ b/src/systemd/src/basic/hostname-util.h @@ -19,8 +19,6 @@ along with systemd; If not, see . ***/ -#include "nm-sd-adapt.h" - #include #include "macro.h" diff --git a/src/systemd/src/basic/in-addr-util.h b/src/systemd/src/basic/in-addr-util.h index 4b2126456..17798ce81 100644 --- a/src/systemd/src/basic/in-addr-util.h +++ b/src/systemd/src/basic/in-addr-util.h @@ -19,8 +19,6 @@ along with systemd; If not, see . ***/ -#include "nm-sd-adapt.h" - #include #include #include diff --git a/src/systemd/src/basic/io-util.h b/src/systemd/src/basic/io-util.h index b3cff3c00..142c940d9 100644 --- a/src/systemd/src/basic/io-util.h +++ b/src/systemd/src/basic/io-util.h @@ -19,8 +19,6 @@ along with systemd; If not, see . ***/ -#include "nm-sd-adapt.h" - #include #include #include diff --git a/src/systemd/src/basic/list.h b/src/systemd/src/basic/list.h index 781ea4679..c68185f58 100644 --- a/src/systemd/src/basic/list.h +++ b/src/systemd/src/basic/list.h @@ -19,8 +19,6 @@ along with systemd; If not, see . ***/ -#include "nm-sd-adapt.h" - /* The head of the linked list. Use this in the structure that shall * contain the head of the linked list */ #define LIST_HEAD(t,name) \ diff --git a/src/systemd/src/basic/log.h b/src/systemd/src/basic/log.h index 8018149a1..d0ec4dfab 100644 --- a/src/systemd/src/basic/log.h +++ b/src/systemd/src/basic/log.h @@ -19,8 +19,6 @@ along with systemd; If not, see . ***/ -#include "nm-sd-adapt.h" - #include #include #include diff --git a/src/systemd/src/basic/macro.h b/src/systemd/src/basic/macro.h index 0ae6eaeca..d12e09a79 100644 --- a/src/systemd/src/basic/macro.h +++ b/src/systemd/src/basic/macro.h @@ -19,8 +19,6 @@ along with systemd; If not, see . ***/ -#include "nm-sd-adapt.h" - #include #include #include diff --git a/src/systemd/src/basic/mempool.h b/src/systemd/src/basic/mempool.h index 710f234d2..fea7841bc 100644 --- a/src/systemd/src/basic/mempool.h +++ b/src/systemd/src/basic/mempool.h @@ -20,8 +20,6 @@ along with systemd; If not, see . ***/ -#include "nm-sd-adapt.h" - #include struct pool; diff --git a/src/systemd/src/basic/parse-util.h b/src/systemd/src/basic/parse-util.h index 0163df5c6..d8dc26a36 100644 --- a/src/systemd/src/basic/parse-util.h +++ b/src/systemd/src/basic/parse-util.h @@ -19,8 +19,6 @@ along with systemd; If not, see . ***/ -#include "nm-sd-adapt.h" - #include #include #include diff --git a/src/systemd/src/basic/path-util.h b/src/systemd/src/basic/path-util.h index 09d733c49..2c2f87a9f 100644 --- a/src/systemd/src/basic/path-util.h +++ b/src/systemd/src/basic/path-util.h @@ -19,8 +19,6 @@ along with systemd; If not, see . ***/ -#include "nm-sd-adapt.h" - #include #include #include diff --git a/src/systemd/src/basic/prioq.h b/src/systemd/src/basic/prioq.h index a4106b041..113c73d04 100644 --- a/src/systemd/src/basic/prioq.h +++ b/src/systemd/src/basic/prioq.h @@ -19,8 +19,6 @@ along with systemd; If not, see . ***/ -#include "nm-sd-adapt.h" - #include #include "hashmap.h" diff --git a/src/systemd/src/basic/random-util.h b/src/systemd/src/basic/random-util.h index 1ae76ef03..3cee4c501 100644 --- a/src/systemd/src/basic/random-util.h +++ b/src/systemd/src/basic/random-util.h @@ -19,8 +19,6 @@ along with systemd; If not, see . ***/ -#include "nm-sd-adapt.h" - #include #include diff --git a/src/systemd/src/basic/refcnt.h b/src/systemd/src/basic/refcnt.h index 275cf9721..1d77a6445 100644 --- a/src/systemd/src/basic/refcnt.h +++ b/src/systemd/src/basic/refcnt.h @@ -19,8 +19,6 @@ along with systemd; If not, see . ***/ -#include "nm-sd-adapt.h" - /* A type-safe atomic refcounter. * * DO NOT USE THIS UNLESS YOU ACTUALLY CARE ABOUT THREAD SAFETY! */ diff --git a/src/systemd/src/basic/set.h b/src/systemd/src/basic/set.h index 45ddd424f..2bff5062d 100644 --- a/src/systemd/src/basic/set.h +++ b/src/systemd/src/basic/set.h @@ -19,8 +19,6 @@ along with systemd; If not, see . ***/ -#include "nm-sd-adapt.h" - #include "hashmap.h" #include "macro.h" diff --git a/src/systemd/src/basic/siphash24.h b/src/systemd/src/basic/siphash24.h index d8d76083c..54e2420cc 100644 --- a/src/systemd/src/basic/siphash24.h +++ b/src/systemd/src/basic/siphash24.h @@ -1,7 +1,5 @@ #pragma once -#include "nm-sd-adapt.h" - #include #include #include diff --git a/src/systemd/src/basic/socket-util.h b/src/systemd/src/basic/socket-util.h index 8ac915e7c..92edc1dc2 100644 --- a/src/systemd/src/basic/socket-util.h +++ b/src/systemd/src/basic/socket-util.h @@ -19,8 +19,6 @@ along with systemd; If not, see . ***/ -#include "nm-sd-adapt.h" - #include #include #include diff --git a/src/systemd/src/basic/sparse-endian.h b/src/systemd/src/basic/sparse-endian.h index 02de0feca..c913fda8c 100644 --- a/src/systemd/src/basic/sparse-endian.h +++ b/src/systemd/src/basic/sparse-endian.h @@ -21,8 +21,6 @@ #ifndef SPARSE_ENDIAN_H #define SPARSE_ENDIAN_H -#include "nm-sd-adapt.h" - #include #include #include diff --git a/src/systemd/src/basic/stdio-util.h b/src/systemd/src/basic/stdio-util.h index af65e223b..0a675571f 100644 --- a/src/systemd/src/basic/stdio-util.h +++ b/src/systemd/src/basic/stdio-util.h @@ -19,8 +19,6 @@ along with systemd; If not, see . ***/ -#include "nm-sd-adapt.h" - #include #include #include diff --git a/src/systemd/src/basic/string-table.h b/src/systemd/src/basic/string-table.h index 2eb266762..b180488fe 100644 --- a/src/systemd/src/basic/string-table.h +++ b/src/systemd/src/basic/string-table.h @@ -20,8 +20,6 @@ along with systemd; If not, see . ***/ -#include "nm-sd-adapt.h" - #include #include #include diff --git a/src/systemd/src/basic/string-util.h b/src/systemd/src/basic/string-util.h index 699e16b70..ad0c81376 100644 --- a/src/systemd/src/basic/string-util.h +++ b/src/systemd/src/basic/string-util.h @@ -19,8 +19,6 @@ along with systemd; If not, see . ***/ -#include "nm-sd-adapt.h" - #include #include #include diff --git a/src/systemd/src/basic/strv.h b/src/systemd/src/basic/strv.h index e1e18a4e7..4a93818a4 100644 --- a/src/systemd/src/basic/strv.h +++ b/src/systemd/src/basic/strv.h @@ -19,8 +19,6 @@ along with systemd; If not, see . ***/ -#include "nm-sd-adapt.h" - #include #include #include diff --git a/src/systemd/src/basic/time-util.h b/src/systemd/src/basic/time-util.h index 05c5c250b..9894e626c 100644 --- a/src/systemd/src/basic/time-util.h +++ b/src/systemd/src/basic/time-util.h @@ -19,8 +19,6 @@ along with systemd; If not, see . ***/ -#include "nm-sd-adapt.h" - #include #include #include diff --git a/src/systemd/src/basic/umask-util.h b/src/systemd/src/basic/umask-util.h index b8ab47ed0..359d87d27 100644 --- a/src/systemd/src/basic/umask-util.h +++ b/src/systemd/src/basic/umask-util.h @@ -19,8 +19,6 @@ along with systemd; If not, see . ***/ -#include "nm-sd-adapt.h" - #include #include #include diff --git a/src/systemd/src/basic/unaligned.h b/src/systemd/src/basic/unaligned.h index a34771eb3..79be645be 100644 --- a/src/systemd/src/basic/unaligned.h +++ b/src/systemd/src/basic/unaligned.h @@ -19,8 +19,6 @@ along with systemd; If not, see . ***/ -#include "nm-sd-adapt.h" - #include #include diff --git a/src/systemd/src/basic/utf8.h b/src/systemd/src/basic/utf8.h index 8b917cb03..a3c8558ea 100644 --- a/src/systemd/src/basic/utf8.h +++ b/src/systemd/src/basic/utf8.h @@ -19,8 +19,6 @@ along with systemd; If not, see . ***/ -#include "nm-sd-adapt.h" - #include #include #include diff --git a/src/systemd/src/basic/util.h b/src/systemd/src/basic/util.h index 9ec160302..5033b0291 100644 --- a/src/systemd/src/basic/util.h +++ b/src/systemd/src/basic/util.h @@ -19,8 +19,6 @@ along with systemd; If not, see . ***/ -#include "nm-sd-adapt.h" - #include #include #include diff --git a/src/systemd/src/libsystemd-network/arp-util.h b/src/systemd/src/libsystemd-network/arp-util.h index 6ccb72c74..3ef56b002 100644 --- a/src/systemd/src/libsystemd-network/arp-util.h +++ b/src/systemd/src/libsystemd-network/arp-util.h @@ -19,8 +19,6 @@ along with systemd; If not, see . ***/ -#include "nm-sd-adapt.h" - #include #include "socket-util.h" diff --git a/src/systemd/src/libsystemd-network/dhcp-identifier.h b/src/systemd/src/libsystemd-network/dhcp-identifier.h index 8ef7ad16c..93f06f593 100644 --- a/src/systemd/src/libsystemd-network/dhcp-identifier.h +++ b/src/systemd/src/libsystemd-network/dhcp-identifier.h @@ -19,8 +19,6 @@ along with systemd; If not, see . ***/ -#include "nm-sd-adapt.h" - #include "sd-id128.h" #include "macro.h" diff --git a/src/systemd/src/libsystemd-network/dhcp-internal.h b/src/systemd/src/libsystemd-network/dhcp-internal.h index 517ae1135..a3b842cda 100644 --- a/src/systemd/src/libsystemd-network/dhcp-internal.h +++ b/src/systemd/src/libsystemd-network/dhcp-internal.h @@ -20,8 +20,6 @@ along with systemd; If not, see . ***/ -#include "nm-sd-adapt.h" - #include #include #include diff --git a/src/systemd/src/libsystemd-network/dhcp-lease-internal.h b/src/systemd/src/libsystemd-network/dhcp-lease-internal.h index 00b701f01..82cae2300 100644 --- a/src/systemd/src/libsystemd-network/dhcp-lease-internal.h +++ b/src/systemd/src/libsystemd-network/dhcp-lease-internal.h @@ -20,8 +20,6 @@ along with systemd; If not, see . ***/ -#include "nm-sd-adapt.h" - #include #include diff --git a/src/systemd/src/libsystemd-network/dhcp-protocol.h b/src/systemd/src/libsystemd-network/dhcp-protocol.h index 421ae9bb3..3e32484c1 100644 --- a/src/systemd/src/libsystemd-network/dhcp-protocol.h +++ b/src/systemd/src/libsystemd-network/dhcp-protocol.h @@ -19,8 +19,6 @@ along with systemd; If not, see . ***/ -#include "nm-sd-adapt.h" - #include #include #include diff --git a/src/systemd/src/libsystemd-network/dhcp6-internal.h b/src/systemd/src/libsystemd-network/dhcp6-internal.h index af36480c1..749086d33 100644 --- a/src/systemd/src/libsystemd-network/dhcp6-internal.h +++ b/src/systemd/src/libsystemd-network/dhcp6-internal.h @@ -19,8 +19,6 @@ along with systemd; If not, see . ***/ -#include "nm-sd-adapt.h" - #include #include diff --git a/src/systemd/src/libsystemd-network/dhcp6-lease-internal.h b/src/systemd/src/libsystemd-network/dhcp6-lease-internal.h index 83c62305b..14e708ef6 100644 --- a/src/systemd/src/libsystemd-network/dhcp6-lease-internal.h +++ b/src/systemd/src/libsystemd-network/dhcp6-lease-internal.h @@ -20,8 +20,6 @@ along with systemd; If not, see . ***/ -#include "nm-sd-adapt.h" - #include #include "sd-dhcp6-lease.h" diff --git a/src/systemd/src/libsystemd-network/dhcp6-protocol.h b/src/systemd/src/libsystemd-network/dhcp6-protocol.h index b12df5543..ee4bdfb07 100644 --- a/src/systemd/src/libsystemd-network/dhcp6-protocol.h +++ b/src/systemd/src/libsystemd-network/dhcp6-protocol.h @@ -19,8 +19,6 @@ along with systemd; If not, see . ***/ -#include "nm-sd-adapt.h" - #include #include diff --git a/src/systemd/src/libsystemd-network/lldp-internal.h b/src/systemd/src/libsystemd-network/lldp-internal.h index 6f1ea1050..15b4a11b1 100644 --- a/src/systemd/src/libsystemd-network/lldp-internal.h +++ b/src/systemd/src/libsystemd-network/lldp-internal.h @@ -20,8 +20,6 @@ #pragma once -#include "nm-sd-adapt.h" - #include "sd-event.h" #include "list.h" diff --git a/src/systemd/src/libsystemd-network/lldp-network.h b/src/systemd/src/libsystemd-network/lldp-network.h index 3957002b4..dcf31faa9 100644 --- a/src/systemd/src/libsystemd-network/lldp-network.h +++ b/src/systemd/src/libsystemd-network/lldp-network.h @@ -20,8 +20,6 @@ #pragma once -#include "nm-sd-adapt.h" - #include "sd-event.h" int lldp_network_bind_raw_socket(int ifindex); diff --git a/src/systemd/src/libsystemd-network/lldp-port.h b/src/systemd/src/libsystemd-network/lldp-port.h index a09bf0c2e..96092f8df 100644 --- a/src/systemd/src/libsystemd-network/lldp-port.h +++ b/src/systemd/src/libsystemd-network/lldp-port.h @@ -20,8 +20,6 @@ #pragma once -#include "nm-sd-adapt.h" - #include #include "sd-event.h" diff --git a/src/systemd/src/libsystemd-network/lldp-tlv.h b/src/systemd/src/libsystemd-network/lldp-tlv.h index b5eba52da..8e7706c61 100644 --- a/src/systemd/src/libsystemd-network/lldp-tlv.h +++ b/src/systemd/src/libsystemd-network/lldp-tlv.h @@ -20,8 +20,6 @@ #pragma once -#include "nm-sd-adapt.h" - #include #include "sd-lldp.h" diff --git a/src/systemd/src/libsystemd-network/lldp.h b/src/systemd/src/libsystemd-network/lldp.h index ce2c1323c..d2c716463 100644 --- a/src/systemd/src/libsystemd-network/lldp.h +++ b/src/systemd/src/libsystemd-network/lldp.h @@ -20,8 +20,6 @@ #pragma once -#include "nm-sd-adapt.h" - #define LLDP_MULTICAST_ADDR { 0x01, 0x80, 0xc2, 0x00, 0x00, 0x0e } #define ETHERTYPE_LLDP 0x88cc diff --git a/src/systemd/src/libsystemd-network/network-internal.h b/src/systemd/src/libsystemd-network/network-internal.h index bb8c7b717..fd1610561 100644 --- a/src/systemd/src/libsystemd-network/network-internal.h +++ b/src/systemd/src/libsystemd-network/network-internal.h @@ -19,8 +19,6 @@ along with systemd; If not, see . ***/ -#include "nm-sd-adapt.h" - #include #include "sd-dhcp-lease.h" diff --git a/src/systemd/src/shared/dns-domain.h b/src/systemd/src/shared/dns-domain.h index ba0e00114..2de3642cb 100644 --- a/src/systemd/src/shared/dns-domain.h +++ b/src/systemd/src/shared/dns-domain.h @@ -19,7 +19,6 @@ #pragma once -#include "nm-sd-adapt.h" #include #include diff --git a/src/systemd/src/systemd/_sd-common.h b/src/systemd/src/systemd/_sd-common.h index 59314265e..2d4e1f26e 100644 --- a/src/systemd/src/systemd/_sd-common.h +++ b/src/systemd/src/systemd/_sd-common.h @@ -20,8 +20,6 @@ along with systemd; If not, see . ***/ -#include "nm-sd-adapt.h" - /* This is a private header; never even think of including this directly! */ #if __INCLUDE_LEVEL__ <= 1 diff --git a/src/systemd/src/systemd/sd-dhcp-client.h b/src/systemd/src/systemd/sd-dhcp-client.h index ce863ecc3..2b865a80e 100644 --- a/src/systemd/src/systemd/sd-dhcp-client.h +++ b/src/systemd/src/systemd/sd-dhcp-client.h @@ -20,8 +20,6 @@ along with systemd; If not, see . ***/ -#include "nm-sd-adapt.h" - #include #include #include diff --git a/src/systemd/src/systemd/sd-dhcp-lease.h b/src/systemd/src/systemd/sd-dhcp-lease.h index 9ceef46d0..2f565ca82 100644 --- a/src/systemd/src/systemd/sd-dhcp-lease.h +++ b/src/systemd/src/systemd/sd-dhcp-lease.h @@ -21,8 +21,6 @@ along with systemd; If not, see . ***/ -#include "nm-sd-adapt.h" - #include #include #include diff --git a/src/systemd/src/systemd/sd-dhcp6-client.h b/src/systemd/src/systemd/sd-dhcp6-client.h index bfa10540e..960806083 100644 --- a/src/systemd/src/systemd/sd-dhcp6-client.h +++ b/src/systemd/src/systemd/sd-dhcp6-client.h @@ -20,8 +20,6 @@ along with systemd; If not, see . ***/ -#include "nm-sd-adapt.h" - #include #include #include diff --git a/src/systemd/src/systemd/sd-dhcp6-lease.h b/src/systemd/src/systemd/sd-dhcp6-lease.h index 691ee2de7..184fbb8e0 100644 --- a/src/systemd/src/systemd/sd-dhcp6-lease.h +++ b/src/systemd/src/systemd/sd-dhcp6-lease.h @@ -21,8 +21,6 @@ along with systemd; If not, see . ***/ -#include "nm-sd-adapt.h" - #include #include diff --git a/src/systemd/src/systemd/sd-event.h b/src/systemd/src/systemd/sd-event.h index 0d49067f9..1ea97e47f 100644 --- a/src/systemd/src/systemd/sd-event.h +++ b/src/systemd/src/systemd/sd-event.h @@ -20,8 +20,6 @@ along with systemd; If not, see . ***/ -#include "nm-sd-adapt.h" - #include #include #include diff --git a/src/systemd/src/systemd/sd-id128.h b/src/systemd/src/systemd/sd-id128.h index efecb268b..a3bf5897b 100644 --- a/src/systemd/src/systemd/sd-id128.h +++ b/src/systemd/src/systemd/sd-id128.h @@ -20,8 +20,6 @@ along with systemd; If not, see . ***/ -#include "nm-sd-adapt.h" - #include #include diff --git a/src/systemd/src/systemd/sd-ipv4acd.h b/src/systemd/src/systemd/sd-ipv4acd.h index c028aea97..3a2219c82 100644 --- a/src/systemd/src/systemd/sd-ipv4acd.h +++ b/src/systemd/src/systemd/sd-ipv4acd.h @@ -21,8 +21,6 @@ along with systemd; If not, see . ***/ -#include "nm-sd-adapt.h" - #include #include diff --git a/src/systemd/src/systemd/sd-ipv4ll.h b/src/systemd/src/systemd/sd-ipv4ll.h index 8e44d3a24..67c566fe0 100644 --- a/src/systemd/src/systemd/sd-ipv4ll.h +++ b/src/systemd/src/systemd/sd-ipv4ll.h @@ -20,8 +20,6 @@ along with systemd; If not, see . ***/ -#include "nm-sd-adapt.h" - #include #include diff --git a/src/systemd/src/systemd/sd-lldp.h b/src/systemd/src/systemd/sd-lldp.h index 6dc97da64..ea952ef18 100644 --- a/src/systemd/src/systemd/sd-lldp.h +++ b/src/systemd/src/systemd/sd-lldp.h @@ -21,8 +21,6 @@ along with systemd; If not, see . ***/ -#include "nm-sd-adapt.h" - #include #include diff --git a/src/systemd/src/systemd/sd-ndisc.h b/src/systemd/src/systemd/sd-ndisc.h index e8ccf055e..762947531 100644 --- a/src/systemd/src/systemd/sd-ndisc.h +++ b/src/systemd/src/systemd/sd-ndisc.h @@ -20,8 +20,6 @@ along with systemd; If not, see . ***/ -#include "nm-sd-adapt.h" - #include #include From 3a81c0f301aa0966df19ce68ad632ca13d9208dc Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Sun, 28 Feb 2016 11:53:54 +0100 Subject: [PATCH 3/9] macros: add nm_auto() macro to cleanup functions --- shared/nm-macros-internal.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/shared/nm-macros-internal.h b/shared/nm-macros-internal.h index 9971f15c8..aa38bacf5 100644 --- a/shared/nm-macros-internal.h +++ b/shared/nm-macros-internal.h @@ -24,12 +24,14 @@ /********************************************************/ +#define nm_auto(fcn) __attribute ((cleanup(fcn))) + /** * nm_auto_free: * * Call free() on a variable location when it goes out of scope. */ -#define nm_auto_free __attribute__ ((cleanup(_nm_auto_free_impl))) +#define nm_auto_free nm_auto(_nm_auto_free_impl) GS_DEFINE_CLEANUP_FUNCTION(void*, _nm_auto_free_impl, free) /********************************************************/ From bd797e9fe147cd8ee2e7ca3c556e5cf67f4a79ec Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Sun, 28 Feb 2016 12:51:20 +0100 Subject: [PATCH 4/9] lldp: refactor process_lldp_neighbors() --- src/devices/nm-lldp-listener.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/src/devices/nm-lldp-listener.c b/src/devices/nm-lldp-listener.c index 767851bdd..9d82c3d28 100644 --- a/src/devices/nm-lldp-listener.c +++ b/src/devices/nm-lldp-listener.c @@ -119,18 +119,22 @@ lldp_neighbor_id_equal (gconstpointer a, gconstpointer b) } static void -lldp_neighbor_free (gpointer data) +lldp_neighbor_free (LLDPNeighbor *neighbor) { - LLDPNeighbor *neighbor = data; - if (neighbor) { g_free (neighbor->chassis_id); g_free (neighbor->port_id); g_hash_table_unref (neighbor->tlvs); - g_free (neighbor); + g_slice_free (LLDPNeighbor, neighbor); } } +static void +lldp_neighbor_freep (LLDPNeighbor **ptr) +{ + lldp_neighbor_free (*ptr); +} + static gboolean lldp_neighbor_equal (LLDPNeighbor *a, LLDPNeighbor *b) { @@ -234,12 +238,12 @@ process_lldp_neighbors (NMLldpListener *self) } hash = g_hash_table_new_full (lldp_neighbor_id_hash, lldp_neighbor_id_equal, - lldp_neighbor_free, NULL); + (GDestroyNotify) lldp_neighbor_free, NULL); for (i = 0; packets && i < num; i++) { + nm_auto (lldp_neighbor_freep) LLDPNeighbor *neigh = NULL; uint8_t chassis_id_type, port_id_type, *chassis_id, *port_id, data8; uint16_t chassis_id_len, port_id_len, len, data16; - LLDPNeighbor *neigh; GValue *value; char *str; int r; @@ -257,16 +261,14 @@ process_lldp_neighbors (NMLldpListener *self) if (r < 0) goto next_packet; - neigh = g_malloc0 (sizeof (LLDPNeighbor)); + neigh = g_slice_new0 (LLDPNeighbor); neigh->tlvs = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, gvalue_destroy); neigh->chassis_id_type = chassis_id_type; neigh->port_id_type = port_id_type; sd_lldp_packet_get_destination_type (packets[i], &neigh->dest); - if (chassis_id_len < 1) { - lldp_neighbor_free (neigh); + if (chassis_id_len < 1) goto next_packet; - } switch (chassis_id_type) { case LLDP_CHASSIS_SUBTYPE_INTERFACE_ALIAS: @@ -280,14 +282,11 @@ process_lldp_neighbors (NMLldpListener *self) break; default: nm_log_dbg (LOGD_DEVICE, "LLDP: unsupported chassis ID type %d", chassis_id_type); - lldp_neighbor_free (neigh); goto next_packet; } - if (port_id_len < 1) { - lldp_neighbor_free (neigh); + if (port_id_len < 1) goto next_packet; - } switch (port_id_type) { case LLDP_PORT_SUBTYPE_INTERFACE_ALIAS: @@ -301,7 +300,6 @@ process_lldp_neighbors (NMLldpListener *self) break; default: nm_log_dbg (LOGD_DEVICE, "LLDP: unsupported port ID type %d", port_id_type); - lldp_neighbor_free (neigh); goto next_packet; } @@ -350,6 +348,7 @@ process_lldp_neighbors (NMLldpListener *self) neigh->chassis_id, neigh->port_id); g_hash_table_add (hash, neigh); + neigh = NULL; next_packet: sd_lldp_packet_unref (packets[i]); } @@ -595,7 +594,7 @@ nm_lldp_listener_init (NMLldpListener *self) priv->lldp_neighbors = g_hash_table_new_full (lldp_neighbor_id_hash, lldp_neighbor_id_equal, - lldp_neighbor_free, NULL); + (GDestroyNotify) lldp_neighbor_free, NULL); } NMLldpListener * From a3f9115c0bd37613ef8e22dd0aece9a14b4ef442 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Sun, 28 Feb 2016 13:01:32 +0100 Subject: [PATCH 5/9] lldp: fix calling free on memory returned by systemd systemd's malloc() must be matched by free() and not g_free(). Thereby, use a cleanup attribute. --- src/devices/nm-lldp-listener.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/devices/nm-lldp-listener.c b/src/devices/nm-lldp-listener.c index 9d82c3d28..f4ac90a22 100644 --- a/src/devices/nm-lldp-listener.c +++ b/src/devices/nm-lldp-listener.c @@ -226,7 +226,7 @@ static void process_lldp_neighbors (NMLldpListener *self) { NMLldpListenerPrivate *priv = NM_LLDP_LISTENER_GET_PRIVATE (self); - sd_lldp_packet **packets = NULL; + nm_auto_free sd_lldp_packet **packets = NULL; GHashTable *hash; int num, i; @@ -353,8 +353,6 @@ next_packet: sd_lldp_packet_unref (packets[i]); } - g_free (packets); - if (lldp_hash_table_equal (priv->lldp_neighbors, hash)) { g_hash_table_destroy (hash); } else { From 2a466216e1c1ed7f8f8b0df3b86f55ac2eb198a3 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Sun, 28 Feb 2016 13:30:13 +0100 Subject: [PATCH 6/9] lldp: refactor logging to use _LOG() macros --- src/devices/nm-lldp-listener.c | 56 +++++++++++++++++++++++++++++----- 1 file changed, 48 insertions(+), 8 deletions(-) diff --git a/src/devices/nm-lldp-listener.c b/src/devices/nm-lldp-listener.c index f4ac90a22..fa77cc74e 100644 --- a/src/devices/nm-lldp-listener.c +++ b/src/devices/nm-lldp-listener.c @@ -65,6 +65,32 @@ typedef struct { static void process_lldp_neighbors (NMLldpListener *self); +/*****************************************************************************/ + +#define _NMLOG_PREFIX_NAME "lldp" +#define _NMLOG_DOMAIN LOGD_DEVICE +#define _NMLOG(level, ...) \ + G_STMT_START { \ + const NMLogLevel _level = (level); \ + \ + if (nm_logging_enabled (_level, _NMLOG_DOMAIN)) { \ + char _sbuf[64]; \ + int _ifindex = (self) ? NM_LLDP_LISTENER_GET_PRIVATE (self)->ifindex : 0; \ + \ + _nm_log (_level, _NMLOG_DOMAIN, 0, \ + "%s%s: " _NM_UTILS_MACRO_FIRST (__VA_ARGS__), \ + _NMLOG_PREFIX_NAME, \ + ((_ifindex > 0) \ + ? nm_sprintf_buf (_sbuf, "[%p,%d]", (self), _ifindex) \ + : ((self) \ + ? nm_sprintf_buf (_sbuf, "[%p]", (self)) \ + : "")) \ + _NM_UTILS_MACRO_REST (__VA_ARGS__)); \ + } \ + } G_STMT_END \ + +/*****************************************************************************/ + static void gvalue_destroy (gpointer data) { @@ -211,8 +237,12 @@ lldp_hash_table_equal (GHashTable *a, GHashTable *b) static gboolean lldp_timeout (gpointer user_data) { - NMLldpListener *self = NM_LLDP_LISTENER (user_data); - NMLldpListenerPrivate *priv = NM_LLDP_LISTENER_GET_PRIVATE (self); + NMLldpListener *self = user_data; + NMLldpListenerPrivate *priv; + + g_return_val_if_fail (NM_IS_LLDP_LISTENER (self), G_SOURCE_REMOVE); + + priv = NM_LLDP_LISTENER_GET_PRIVATE (self); priv->timer = 0; @@ -230,10 +260,12 @@ process_lldp_neighbors (NMLldpListener *self) GHashTable *hash; int num, i; + g_return_if_fail (priv->lldp_handle); + num = sd_lldp_get_packets (priv->lldp_handle, &packets); if (num < 0) { - nm_log_dbg (LOGD_DEVICE, "LLDP: error %d retrieving neighbor packets for %s", - num, priv->iface); + _LOGD ("process: error %d retrieving neighbor packets for %s", + num, priv->iface); return; } @@ -281,7 +313,7 @@ process_lldp_neighbors (NMLldpListener *self) neigh->chassis_id = nm_utils_hwaddr_ntoa (chassis_id, chassis_id_len); break; default: - nm_log_dbg (LOGD_DEVICE, "LLDP: unsupported chassis ID type %d", chassis_id_type); + _LOGD ("process: unsupported chassis ID type %d", chassis_id_type); goto next_packet; } @@ -299,7 +331,7 @@ process_lldp_neighbors (NMLldpListener *self) neigh->port_id = nm_utils_hwaddr_ntoa (port_id, port_id_len); break; default: - nm_log_dbg (LOGD_DEVICE, "LLDP: unsupported port ID type %d", port_id_type); + _LOGD ("process: unsupported port ID type %d", port_id_type); goto next_packet; } @@ -344,8 +376,8 @@ process_lldp_neighbors (NMLldpListener *self) g_hash_table_insert (neigh->tlvs, NM_LLDP_ATTR_IEEE_802_1_VLAN_NAME, value); } - nm_log_dbg (LOGD_DEVICE, "LLDP: new neigh: CHASSIS='%s' PORT='%s'", - neigh->chassis_id, neigh->port_id); + _LOGD ("process: new neigh: CHASSIS='%s' PORT='%s'", + neigh->chassis_id, neigh->port_id); g_hash_table_add (hash, neigh); neigh = NULL; @@ -377,6 +409,7 @@ lldp_event_handler (sd_lldp *lldp, int event, void *userdata) NMLldpListenerPrivate *priv; g_return_if_fail (NM_IS_LLDP_LISTENER (self)); + priv = NM_LLDP_LISTENER_GET_PRIVATE (self); if (priv->timer > 0) { @@ -443,6 +476,7 @@ nm_lldp_listener_start (NMLldpListener *self, int ifindex, const char *iface, priv->ifindex = ifindex; priv->iface = strdup (iface); + _LOGD ("start"); return TRUE; err: @@ -463,6 +497,7 @@ nm_lldp_listener_stop (NMLldpListener *self) priv = NM_LLDP_LISTENER_GET_PRIVATE (self); if (priv->lldp_handle) { + _LOGD ("stop"); sd_lldp_stop (priv->lldp_handle); sd_lldp_detach_event (priv->lldp_handle); sd_lldp_unref (priv->lldp_handle); @@ -478,6 +513,7 @@ nm_lldp_listener_stop (NMLldpListener *self) } nm_clear_g_source (&priv->timer); + priv->ifindex = 0; } gboolean @@ -593,6 +629,8 @@ nm_lldp_listener_init (NMLldpListener *self) priv->lldp_neighbors = g_hash_table_new_full (lldp_neighbor_id_hash, lldp_neighbor_id_equal, (GDestroyNotify) lldp_neighbor_free, NULL); + + _LOGT ("lldp listener created"); } NMLldpListener * @@ -620,6 +658,8 @@ finalize (GObject *object) nm_clear_g_variant (&priv->variant); + _LOGT ("lldp listener destroyed"); + G_OBJECT_CLASS (nm_lldp_listener_parent_class)->finalize (object); } From c130a3b39a1753294ec6e4da5e254fb389cd6577 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Sun, 28 Feb 2016 14:17:15 +0100 Subject: [PATCH 7/9] lldp: don't mix malloc() with g_malloc() --- src/devices/nm-lldp-listener.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/devices/nm-lldp-listener.c b/src/devices/nm-lldp-listener.c index fa77cc74e..f57a3068f 100644 --- a/src/devices/nm-lldp-listener.c +++ b/src/devices/nm-lldp-listener.c @@ -307,7 +307,7 @@ process_lldp_neighbors (NMLldpListener *self) case LLDP_CHASSIS_SUBTYPE_INTERFACE_NAME: case LLDP_CHASSIS_SUBTYPE_LOCALLY_ASSIGNED: case LLDP_CHASSIS_SUBTYPE_CHASSIS_COMPONENT: - neigh->chassis_id = strndup ((char *) chassis_id, chassis_id_len); + neigh->chassis_id = g_strndup ((const char *) chassis_id, chassis_id_len); break; case LLDP_CHASSIS_SUBTYPE_MAC_ADDRESS: neigh->chassis_id = nm_utils_hwaddr_ntoa (chassis_id, chassis_id_len); From 06252c9863315d1284507bd9348c809f2e8058f3 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Sun, 28 Feb 2016 14:37:09 +0100 Subject: [PATCH 8/9] lldp: handle NULL values in lldp_neighbor_id_hash() g_str_hash() can not be called with NULL. Ensure that we don't crash. Thereby, refactor the hashing algorithm because the chassis-id and port-id are small numbers and xor-ing can cancel them easily. --- src/devices/nm-lldp-listener.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/devices/nm-lldp-listener.c b/src/devices/nm-lldp-listener.c index f57a3068f..818278176 100644 --- a/src/devices/nm-lldp-listener.c +++ b/src/devices/nm-lldp-listener.c @@ -126,11 +126,13 @@ static guint lldp_neighbor_id_hash (gconstpointer ptr) { const LLDPNeighbor *neigh = ptr; + guint hash; - return g_str_hash (neigh->chassis_id) ^ - g_str_hash (neigh->port_id) ^ - neigh->chassis_id_type ^ - (neigh->port_id_type * 33); + hash = 23423423u + ((guint) (neigh->chassis_id ? g_str_hash (neigh->chassis_id) : 12321u)); + hash = (hash * 33u) + ((guint) (neigh->port_id ? g_str_hash (neigh->port_id) : 34342343u)); + hash = (hash * 33u) + ((guint) neigh->chassis_id_type); + hash = (hash * 33u) + ((guint) neigh->port_id_type); + return hash; } static gboolean From ae9cc8910ddd04d43c9a15dbbe92a4863b6c49f0 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 29 Feb 2016 14:23:08 +0100 Subject: [PATCH 9/9] lldp/tests: unref lldp instance in test --- src/devices/tests/test-lldp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/devices/tests/test-lldp.c b/src/devices/tests/test-lldp.c index 7ec0d34e1..15aa324fa 100644 --- a/src/devices/tests/test-lldp.c +++ b/src/devices/tests/test-lldp.c @@ -136,7 +136,7 @@ get_lldp_neighbor_attribute (GVariant *neighbors, static void test_receive_frame (test_fixture *fixture, gconstpointer user_data) { - NMLldpListener *listener; + gs_unref_object NMLldpListener *listener = NULL; GMainLoop *loop; TestInfo info = { }; GVariant *neighbors, *attr;