Skip to content

Commit

Permalink
net-snmp: fix compilation with GCC 14
Browse files Browse the repository at this point in the history
Refresh 900-musl-compat.patch, add missing headers & fixes incompatible pointer type is now an error.

Signed-off-by: Aditya Nugraha <[email protected]>
  • Loading branch information
vortexilation authored and neheb committed May 17, 2024
1 parent 4866908 commit 7d39868
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 10 deletions.
24 changes: 17 additions & 7 deletions net/net-snmp/patches/750-ieee802dot11.patch
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
--- /dev/null
+++ b/agent/mibgroup/ieee802dot11.c
@@ -0,0 +1,4915 @@
@@ -0,0 +1,4916 @@
+/****************************************************************************
+* *
+* File Name: ieee802dot11.c *
Expand Down Expand Up @@ -30,6 +30,7 @@
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "ieee802dot11.h"
+#include "iwlib.h"
+#include "util_funcs/header_generic.h"
+
+/****************************************************************************
+* Defines *
Expand Down Expand Up @@ -4700,12 +4701,12 @@
+addList ( char *l, char *data, int len )
+{
+ char uid[256];
+ LIST_HEAD ( , avNode ) *list;
+ avList_t *list;
+
+ // NOTE: this assumes the UID is at the beginning of the
+ // data structure and that UIDs are strings
+
+ list = ( LIST_HEAD ( , avNode ) * ) l; // NOTE: don't know how to get
+ list = ( avList_t * ) l; // NOTE: don't know how to get
+ strcpy ( uid, data ); // rid of compiler warning on
+ // LISTHEAD typecast
+ // create a new node and the data that goes in it
Expand Down Expand Up @@ -4787,9 +4788,9 @@
+****************************************************************************/
+static void flushList ( char *l )
+{
+ LIST_HEAD ( , avNode ) *list;
+ avList_t *list;
+
+ list = ( LIST_HEAD ( , avNode ) * ) l; // NOTE: don't know how to get
+ list = ( avList_t * ) l; // NOTE: don't know how to get
+ while ( !LIST_EMPTY ( list )) { // rid of compiler warning on
+ np = LIST_FIRST ( list ); // LISTHEAD typecast
+ if ( np->data )
Expand Down Expand Up @@ -4918,7 +4919,7 @@
+
--- /dev/null
+++ b/agent/mibgroup/ieee802dot11.h
@@ -0,0 +1,730 @@
@@ -0,0 +1,732 @@
+/****************************************************************************
+* *
+* File Name: ieee802dot11.h *
Expand Down Expand Up @@ -5648,10 +5649,12 @@
+WriteMethod write_dot11SupportedRxAntenna;
+WriteMethod write_dot11DiversitySelectionRx;
+
+void shutdown_ieee802dot11 ( void );
+
+#endif /* _MIBGROUP_IEEE802DOT11_H */
--- /dev/null
+++ b/agent/mibgroup/iwlib.h
@@ -0,0 +1,502 @@
@@ -0,0 +1,509 @@
+/*
+ * Wireless Tools
+ *
Expand Down Expand Up @@ -5683,6 +5686,9 @@
+#include <unistd.h>
+#include <netdb.h> /* gethostbyname, getnetbyname */
+#include <net/ethernet.h> /* struct ether_addr */
+#ifdef HAVE_NET_IF_H
+#include <net/if.h>
+#endif
+#include <sys/time.h> /* struct timeval */
+#include <unistd.h>
+
Expand Down Expand Up @@ -5739,6 +5745,10 @@
+ && LINUX_VERSION_CODE < KERNEL_VERSION(2,1,0)
+#define LIBC5_HEADERS
+
+/* Musl */
+#elif !defined(__GLIBC__) && LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0)
+#define GENERIC_HEADERS
+
+/* Unsupported combination */
+#else
+#error "Your kernel/libc combination is not supported"
Expand Down
10 changes: 10 additions & 0 deletions net/net-snmp/patches/751-gcc-14-fix.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
--- a/agent/mib_modules.c
+++ b/agent/mib_modules.c
@@ -42,6 +42,7 @@
#include <net-snmp/agent/table.h>
#include <net-snmp/agent/table_iterator.h>
#include "mib_module_includes.h"
+#include "mibgroup/ieee802dot11.h"

static int need_shutdown = 0;

6 changes: 3 additions & 3 deletions net/net-snmp/patches/900-musl-compat.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
--- a/agent/mibgroup/iwlib.h
+++ b/agent/mibgroup/iwlib.h
@@ -85,6 +85,10 @@
&& LINUX_VERSION_CODE < KERNEL_VERSION(2,1,0)
#define LIBC5_HEADERS
@@ -92,6 +92,10 @@
#elif !defined(__GLIBC__) && LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0)
#define GENERIC_HEADERS

+/* Musl */
+#elif !defined(__GLIBC__) && LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0)
Expand Down

0 comments on commit 7d39868

Please sign in to comment.