summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2016-09-27 13:35:29 +0200
committerThomas Haller <thaller@redhat.com>2016-09-27 14:13:21 +0200
commite3a072f3c0d8046a9c1d01c8518c532b71f7bd7a (patch)
treefc59e7b009a14227dd825be31ad7bd0c59b41ae9
parent3f4aa48d6bc7302ffb38eda2d3c674f747516f37 (diff)
downloadNetworkManager-e3a072f3c0d8046a9c1d01c8518c532b71f7bd7a.tar.gz
build: don't add systemd path the include search path
Our internal copy of systemd should not be in the search path. Instead, let users only #include "systemd/nm-sd.h" which then includes everything from systemd that we need. We want to avoid to accidentally include anything from our systemd-copy. Any user of that should only include "nm-sd.h", which then includes everything that is needed further. For example, "src/devices/wwan/nm-modem-manager.c" has #include <systemd/nm-daemon.h> which in turn includes #include "_sd-common.h" This works all correctly before, because #include "" will first look in the directory where sd-daemon.h is. However, our mixing of external systemd library and internal copy is rather dangerous. Try to avoid it further by keeping the include paths clean.
-rw-r--r--src/Makefile.am3
-rw-r--r--src/devices/nm-device.c2
-rw-r--r--src/devices/nm-lldp-listener.c2
-rw-r--r--src/devices/tests/Makefile.am3
-rw-r--r--src/devices/tests/test-lldp.c4
-rw-r--r--src/dhcp-manager/nm-dhcp-systemd.c5
-rw-r--r--src/main.c2
-rw-r--r--src/nm-iface-helper.c2
-rw-r--r--src/systemd/nm-sd.h7
-rw-r--r--src/tests/Makefile.am3
-rw-r--r--src/tests/test-systemd.c6
11 files changed, 15 insertions, 24 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 10f63ded44..f08acecc0d 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -76,9 +76,6 @@ AM_CPPFLAGS = \
$(SYSTEMD_JOURNAL_CFLAGS) \
$(CODE_COVERAGE_CFLAGS) \
\
- -I$(top_srcdir)/src/systemd/src/systemd/ \
- -I$(top_srcdir)/src/systemd/ \
- \
$(NULL)
AM_LDFLAGS = $(CODE_COVERAGE_LDFLAGS)
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index e5e6056dd7..c41d8e4eba 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -62,8 +62,8 @@
#include "nm-core-internal.h"
#include "nm-default-route-manager.h"
#include "nm-route-manager.h"
+#include "systemd/nm-sd.h"
#include "nm-lldp-listener.h"
-#include "sd-ipv4ll.h"
#include "nm-audit-manager.h"
#include "nm-arping-manager.h"
diff --git a/src/devices/nm-lldp-listener.c b/src/devices/nm-lldp-listener.c
index f4663405fc..0ceb84bccf 100644
--- a/src/devices/nm-lldp-listener.c
+++ b/src/devices/nm-lldp-listener.c
@@ -28,7 +28,7 @@
#include "nm-platform.h"
#include "nm-utils.h"
-#include "sd-lldp.h"
+#include "systemd/nm-sd.h"
#define MAX_NEIGHBORS 4096
#define MIN_UPDATE_INTERVAL_NS (2 * NM_UTILS_NS_PER_SECOND)
diff --git a/src/devices/tests/Makefile.am b/src/devices/tests/Makefile.am
index cd1ef6edd3..5914b13108 100644
--- a/src/devices/tests/Makefile.am
+++ b/src/devices/tests/Makefile.am
@@ -5,9 +5,6 @@ AM_CPPFLAGS = \
-I$(top_builddir)/libnm-core \
-I$(top_srcdir)/src/platform \
-I$(top_srcdir)/src/devices \
- -I$(top_srcdir)/src/systemd/ \
- -I$(top_srcdir)/src/systemd/src/systemd/ \
- -I$(top_srcdir)/src/systemd/src/libsystemd-network/ \
-I$(top_srcdir)/src \
-I$(top_builddir)/src \
-DG_LOG_DOMAIN=\""NetworkManager"\" \
diff --git a/src/devices/tests/test-lldp.c b/src/devices/tests/test-lldp.c
index ff6f42a970..02b003fb9d 100644
--- a/src/devices/tests/test-lldp.c
+++ b/src/devices/tests/test-lldp.c
@@ -27,9 +27,7 @@
#include <sys/types.h>
#include "nm-lldp-listener.h"
-#include "nm-sd.h"
-
-#include "sd-lldp.h"
+#include "systemd/nm-sd.h"
#include "test-common.h"
diff --git a/src/dhcp-manager/nm-dhcp-systemd.c b/src/dhcp-manager/nm-dhcp-systemd.c
index ac8eb60a3a..31c6f76089 100644
--- a/src/dhcp-manager/nm-dhcp-systemd.c
+++ b/src/dhcp-manager/nm-dhcp-systemd.c
@@ -34,10 +34,7 @@
#include "NetworkManagerUtils.h"
#include "nm-platform.h"
#include "nm-dhcp-client-logging.h"
-#include "nm-sd.h"
-
-#include "sd-dhcp-client.h"
-#include "sd-dhcp6-client.h"
+#include "systemd/nm-sd.h"
G_DEFINE_TYPE (NMDhcpSystemd, nm_dhcp_systemd, NM_TYPE_DHCP_CLIENT)
diff --git a/src/main.c b/src/main.c
index 0dca1afad8..e86d6dad96 100644
--- a/src/main.c
+++ b/src/main.c
@@ -49,7 +49,7 @@
#include "nm-auth-manager.h"
#include "nm-core-internal.h"
#include "nm-exported-object.h"
-#include "nm-sd.h"
+#include "systemd/nm-sd.h"
#if !defined(NM_DIST_VERSION)
# define NM_DIST_VERSION VERSION
diff --git a/src/nm-iface-helper.c b/src/nm-iface-helper.c
index de035f1a94..b864530473 100644
--- a/src/nm-iface-helper.c
+++ b/src/nm-iface-helper.c
@@ -44,7 +44,7 @@ extern unsigned int if_nametoindex (const char *__ifname);
#include "nm-lndp-rdisc.h"
#include "nm-utils.h"
#include "nm-setting-ip6-config.h"
-#include "nm-sd.h"
+#include "systemd/nm-sd.h"
#if !defined(NM_DIST_VERSION)
# define NM_DIST_VERSION VERSION
diff --git a/src/systemd/nm-sd.h b/src/systemd/nm-sd.h
index f07a708269..f988dfd08f 100644
--- a/src/systemd/nm-sd.h
+++ b/src/systemd/nm-sd.h
@@ -19,6 +19,13 @@
#ifndef __NM_SD_H__
#define __NM_SD_H__
+#include "systemd/src/systemd/sd-dhcp-client.h"
+#include "systemd/src/systemd/sd-dhcp6-client.h"
+#include "systemd/src/systemd/sd-lldp.h"
+#include "systemd/src/systemd/sd-ipv4ll.h"
+
+/*****************************************************************************/
+
guint nm_sd_event_attach_default (void);
/*****************************************************************************
diff --git a/src/tests/Makefile.am b/src/tests/Makefile.am
index 8851c24279..c11e7a0b5f 100644
--- a/src/tests/Makefile.am
+++ b/src/tests/Makefile.am
@@ -123,8 +123,7 @@ test_wired_defname_LDADD = \
test_systemd_CFLAGS = \
"-I$(srcdir)/../" \
"-I$(srcdir)/../platform" \
- "-I$(srcdir)/../systemd" \
- "-I$(srcdir)/../systemd/src/systemd"
+ $(NULL)
test_systemd_SOURCES = \
test-systemd.c
diff --git a/src/tests/test-systemd.c b/src/tests/test-systemd.c
index 744b55c992..078879601e 100644
--- a/src/tests/test-systemd.c
+++ b/src/tests/test-systemd.c
@@ -19,11 +19,7 @@
#include "nm-default.h"
-#include "nm-sd.h"
-
-#include "sd-dhcp-client.h"
-#include "sd-lldp.h"
-#include "sd-event.h"
+#include "systemd/nm-sd.h"
#include "nm-test-utils-core.h"