[PATCH 1/4] rtnl: Fixup rtnetlink includes
Denis Kenzior <[email protected]> Wed, 8 Nov 2023 17:45:20 -0600
| Newsgroups | dev.linux.lists.ell |
|---|---|
| Message-ID | <[email protected]> |
man 7 rtnetlink suggests the 4 includes listed should be used. Also,
remove rtnetlink.h inclusion from rtnl.h and move it into the individual
code files.
---
ell/netconfig.c | 4 ++++
ell/rtnl.c | 5 ++++-
ell/rtnl.h | 3 ++-
unit/test-rtnl.c | 4 ++++
4 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/ell/netconfig.c b/ell/netconfig.c
index 0e00981e7e98..9b01581fff45 100644
--- a/ell/netconfig.c
+++ b/ell/netconfig.c
@@ -9,6 +9,10 @@
#include <config.h>
#endif
+#include <asm/types.h>
+#include <linux/netlink.h>
+#include <linux/rtnetlink.h>
+#include <sys/socket.h>
#include <net/if.h>
#include <linux/types.h>
#include <linux/if_ether.h>
diff --git a/ell/rtnl.c b/ell/rtnl.c
index 7f14faa7abc6..ad2dca2f9e3c 100644
--- a/ell/rtnl.c
+++ b/ell/rtnl.c
@@ -10,12 +10,15 @@
#endif
#define _GNU_SOURCE
+#include <asm/types.h>
+#include <linux/netlink.h>
+#include <linux/rtnetlink.h>
+#include <sys/socket.h>
#include <linux/if.h>
#include <linux/icmpv6.h>
#include <linux/neighbour.h>
#include <linux/if_ether.h>
#include <net/if_arp.h>
-#include <sys/socket.h>
#include <arpa/inet.h>
#include <errno.h>
diff --git a/ell/rtnl.h b/ell/rtnl.h
index efe58b27a075..fa5d99eb4b53 100644
--- a/ell/rtnl.h
+++ b/ell/rtnl.h
@@ -9,13 +9,14 @@
#define __ELL_RTNL_H
#include <stdint.h>
-#include <linux/rtnetlink.h>
#include <ell/cleanup.h>
#ifdef __cplusplus
extern "C" {
#endif
+struct rtmsg;
+struct ifaddrmsg;
struct l_rtnl_address;
struct l_rtnl_route;
diff --git a/unit/test-rtnl.c b/unit/test-rtnl.c
index 02629040865d..cd944af64de9 100644
--- a/unit/test-rtnl.c
+++ b/unit/test-rtnl.c
@@ -16,6 +16,10 @@
#include <stdlib.h>
#include <signal.h>
#include <sys/wait.h>
+#include <asm/types.h>
+#include <linux/netlink.h>
+#include <linux/rtnetlink.h>
+#include <sys/socket.h>
#include <ell/ell.h>
#include "ell/dbus-private.h"
--
2.42.0