diff mbox series

[1/4] rtnl: Fixup rtnetlink includes

Message ID 20231108234544.1050199-1-denkenz@gmail.com (mailing list archive)
State New
Headers show
Series [1/4] rtnl: Fixup rtnetlink includes | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
prestwoj/iwd-ci-makedistcheck fail Make Distcheck Make FAIL: ../../src/main.c: In function ‘main’: ../../src/main.c:578:30: error: ‘NETLINK_ROUTE’ undeclared (first use in this function) 578 | rtnl = l_netlink_new(NETLINK_ROUTE); | ^~~~~~~~~~~~~ ../../src/main.c:578:30: note: each undeclared identifier is reported only once for each function it appears in make[2]: *** [Makefile:2563: src/main.o] Error 1 make[2]: *** Waiting for unfinished jobs.... make[1]: *** [Makefile:1729: all] Error 2 make: *** [Makefile:3347: distcheck] Error 1
prestwoj/iwd-ci-build success Build - Configure
prestwoj/iwd-ci-makecheckvalgrind fail Make FAIL: src/main.c: In function ‘main’: src/main.c:578:30: error: ‘NETLINK_ROUTE’ undeclared (first use in this function) 578 | rtnl = l_netlink_new(NETLINK_ROUTE); | ^~~~~~~~~~~~~ src/main.c:578:30: note: each undeclared identifier is reported only once for each function it appears in make[1]: *** [Makefile:2563: src/main.o] Error 1 make[1]: *** Waiting for unfinished jobs.... make: *** [Makefile:1729: all] Error 2
prestwoj/iwd-ci-makecheck pending makecheck SKIP
prestwoj/iwd-ci-testrunner pending testrunner SKIP
prestwoj/iwd-ci-clang fail Clang IWD - make FAIL: src/main.c:578:23: error: use of undeclared identifier 'NETLINK_ROUTE' rtnl = l_netlink_new(NETLINK_ROUTE); ^ 1 error generated. make[1]: *** [Makefile:2563: src/main.o] Error 1 make[1]: *** Waiting for unfinished jobs.... make: *** [Makefile:1729: all] Error 2

Commit Message

Denis Kenzior Nov. 8, 2023, 11:45 p.m. UTC
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(-)

Comments

Marcel Holtmann Nov. 9, 2023, 2:50 p.m. UTC | #1
Hi Denis,

> 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(-)

I applied patch 1 and patch 4 since they are simple fixes.

Regards

Marcel
diff mbox series

Patch

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"