aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar no92 <no92.mail@gmail.com>2024-06-16 13:02:51 +0200
committerGravatar Christian Hesse <mail@eworm.de>2024-06-18 19:07:39 +0200
commitb5872bccede521e00e5ef9aee1a280895ed9e6be (patch)
tree84cbc7970bb18e9516348bb8363290421b9b3c65
parentad9058d61e3ff02fba381de6fcd7984f27cdac12 (diff)
downloadnetlink-notify-b5872bccede521e00e5ef9aee1a280895ed9e6be.tar.gz
netlink-notify-b5872bccede521e00e5ef9aee1a280895ed9e6be.tar.zst
fix header orderingHEADmain
The kernel headers are supposed to be included after net/if.h, as they check whether net/if.h has been included before them, and if so, avoid redefinitions. This also avoid the non-portable hack of `#undef __USE_MISC`, which probably silently breaks glibc and leads to namespace pollution. Signed-off-by: Christian Hesse <mail@eworm.de>
-rw-r--r--netlink-notify.h12
1 files changed, 5 insertions, 7 deletions
diff --git a/netlink-notify.h b/netlink-notify.h
index a58f2f7..cf67621 100644
--- a/netlink-notify.h
+++ b/netlink-notify.h
@@ -31,18 +31,16 @@
#include <arpa/inet.h>
#include <ifaddrs.h>
-#include <linux/if.h>
-#include <linux/netlink.h>
-#include <linux/rtnetlink.h>
-#include <linux/wireless.h>
-/* we have to undefine this before including net/if.h to
- * notget redefined structs, etc. */
-#undef __USE_MISC
#include <net/if.h>
#include <netinet/in.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
+#include <linux/if.h>
+#include <linux/netlink.h>
+#include <linux/rtnetlink.h>
+#include <linux/wireless.h>
+
/* systemd headers */
#ifdef HAVE_SYSTEMD
#include <systemd/sd-daemon.h>