pespin submitted this change.

View Change

Approvals: osmith: Looks good to me, but someone else must approve laforge: Looks good to me, approved Jenkins Builder: Verified
core: guard Linux netlink headers by libmnl usage

Only include Linux-specific netlink headers when the libmnl backend
is enabled.

The code paths requiring <linux/if_link.h> and <linux/rtnetlink.h>
are entirely guarded by ENABLE_LIBMNL conditionals, so the headers should
not be included unconditionally.

This avoids pulling in Linux-only headers when the corresponding
backend is not built.

Change-Id: I0b681deb1f1e025e3ea9996f19b1de06a5feb408
---
M src/core/netdev.c
1 file changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/core/netdev.c b/src/core/netdev.c
index 1e886f9..7e5a409 100644
--- a/src/core/netdev.c
+++ b/src/core/netdev.c
@@ -82,6 +82,8 @@
#include <net/if.h>
#include <net/route.h>

+#if ENABLE_LIBMNL
+
#if defined(__linux__)
#include <linux/if_link.h>
#include <linux/rtnetlink.h>
@@ -89,6 +91,8 @@
#error "Unknown platform!"
#endif

+#endif /* ENABLE_LIBMNL */
+
#include <osmocom/core/utils.h>
#include <osmocom/core/select.h>
#include <osmocom/core/linuxlist.h>

To view, visit change 41941. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: merged
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I0b681deb1f1e025e3ea9996f19b1de06a5feb408
Gerrit-Change-Number: 41941
Gerrit-PatchSet: 4
Gerrit-Owner: Timur Davydov <dtv.comp@gmail.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge@osmocom.org>
Gerrit-Reviewer: osmith <osmith@sysmocom.de>
Gerrit-Reviewer: pespin <pespin@sysmocom.de>