mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-01 16:44:23 +08:00
🐶 Sync 2026-08-11 02:49:26
This commit is contained in:
1 parent
653336f8ad
commit
2b7ce8baae
52 files changed
+841
-1058
No files matched your search
@@ -1,14 +0,0 @@
|
||||
menu "Configuration"
|
||||
depends on PACKAGE_libnetsnmp
|
||||
|
||||
config SNMP_WITH_PERL_EMBEDDED
|
||||
bool
|
||||
default n
|
||||
prompt "Enable embedded perl in the SNMP agent and snmptrapd."
|
||||
|
||||
config SNMP_WITH_PERL_MODULES
|
||||
bool
|
||||
default n
|
||||
prompt "Install perl modules"
|
||||
|
||||
endmenu
|
||||
@@ -8,8 +8,8 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=net-snmp
|
||||
PKG_VERSION:=5.9.4
|
||||
PKG_RELEASE:=1
|
||||
PKG_VERSION:=5.9.1
|
||||
PKG_RELEASE:=2
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=@SF/net-snmp
|
||||
@@ -130,10 +130,7 @@ SNMP_MIB_MODULES_INCLUDED = \
|
||||
host/hr_system \
|
||||
ieee802dot11 \
|
||||
if-mib/ifXTable \
|
||||
ip-mib/ipAddressTable \
|
||||
ip-mib/inetNetToMediaTable \
|
||||
ip-forward-mib/inetCidrRouteTable \
|
||||
ip-forward-mib/ipCidrRouteTable \
|
||||
mibII/at \
|
||||
mibII/icmp \
|
||||
mibII/ifTable \
|
||||
@@ -151,7 +148,7 @@ SNMP_MIB_MODULES_INCLUDED = \
|
||||
snmpv3/usmStats \
|
||||
snmpv3/usmUser \
|
||||
tunnel \
|
||||
ucd-snmp/disk_hw \
|
||||
ucd-snmp/disk \
|
||||
ucd-snmp/dlmod \
|
||||
ucd-snmp/extensible \
|
||||
ucd-snmp/loadave \
|
||||
@@ -206,12 +203,11 @@ CONFIGURE_ARGS += \
|
||||
--with-mib-modules="$(SNMP_MIB_MODULES_INCLUDED)" \
|
||||
--with-out-transports="$(SNMP_TRANSPORTS_EXCLUDED)" \
|
||||
--with-transports="$(SNMP_TRANSPORTS_INCLUDED)" \
|
||||
--without-openssl \
|
||||
--with-openssl=$(STAGING_DIR)/usr \
|
||||
--without-libwrap \
|
||||
--without-mysql \
|
||||
--without-rpm \
|
||||
--without-zlib \
|
||||
--with-pcre2-8 \
|
||||
--with-nl \
|
||||
$(call autoconf_bool,CONFIG_IPV6,ipv6) \
|
||||
--disable-perl-cc-checks \
|
||||
@@ -220,12 +216,15 @@ CONFIGURE_ARGS += \
|
||||
|
||||
CONFIGURE_VARS += \
|
||||
ac_cv_header_netlink_netlink_h=yes \
|
||||
ac_cv_header_pcre_h=no \
|
||||
netsnmp_cv_func_nl_connect_LIBS=-lnl-tiny \
|
||||
|
||||
ifeq ($(CONFIG_IPV6),y)
|
||||
SNMP_TRANSPORTS_INCLUDED+= UDPIPv6
|
||||
endif
|
||||
|
||||
TARGET_LDFLAGS += -L$(TOOLCHAIN_DIR)/usr/lib
|
||||
|
||||
define Build/Compile
|
||||
$(MAKE) -C $(PKG_BUILD_DIR) \
|
||||
INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \
|
||||
|
||||
@@ -15,11 +15,11 @@ link tests to fail due to a stray "no" word getting passed to the linker.
|
||||
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
||||
--- a/configure.d/config_os_libs2
|
||||
+++ b/configure.d/config_os_libs2
|
||||
@@ -252,14 +252,22 @@ if test "x$with_nl" != "xno"; then
|
||||
case $target_os in
|
||||
linux*) # Check for libnl (linux)
|
||||
@@ -247,14 +247,22 @@ if test "x$with_nl" != "xno"; then
|
||||
)
|
||||
|
||||
netsnmp_save_CPPFLAGS="$CPPFLAGS"
|
||||
- CPPFLAGS="${LIBNL3_CFLAGS} ${LIBNLROUTE3_CFLAGS} $CPPFLAGS"
|
||||
- CPPFLAGS="${LIBNL3_CFLAGS} $CPPFLAGS"
|
||||
- NETSNMP_SEARCH_LIBS(nl_connect, nl-3,
|
||||
- [AC_CHECK_HEADERS(netlink/netlink.h)
|
||||
- EXTERNAL_MIBGROUP_INCLUDES="$EXTERNAL_MIBGROUP_INCLUDES ${LIBNL3_CFLAGS}"],
|
||||
|
||||
@@ -29,6 +29,6 @@ Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
|
||||
{
|
||||
-next:
|
||||
+next: ;
|
||||
#ifdef HAVE_GETFSSTAT
|
||||
#if HAVE_GETFSSTAT
|
||||
if (HRFS_index >= fscount)
|
||||
return -1;
|
||||
@@ -1,13 +1,22 @@
|
||||
--- a/agent/mibgroup/mibII/interfaces.c
|
||||
+++ b/agent/mibgroup/mibII/interfaces.c
|
||||
@@ -1586,6 +1586,10 @@ Interface_Scan_Init(void)
|
||||
@@ -1579,6 +1579,10 @@ Interface_Scan_Init(void)
|
||||
struct ifnet *nnew;
|
||||
char *stats, *ifstart = line;
|
||||
size_t len;
|
||||
|
||||
+ /* Ignore interfaces with no statistics. */
|
||||
+ if (strstr(line, "No statistics available."))
|
||||
+ continue;
|
||||
+ continue;
|
||||
+
|
||||
len = strlen(line);
|
||||
if (len && line[len - 1] == '\n')
|
||||
line[len - 1] = '\0';
|
||||
if (line[strlen(line) - 1] == '\n')
|
||||
line[strlen(line) - 1] = '\0';
|
||||
|
||||
@@ -1611,7 +1615,7 @@ Interface_Scan_Init(void)
|
||||
&coll) != 5)) {
|
||||
if ((scan_line_to_use == scan_line_2_2)
|
||||
&& !strstr(line, "No statistics available"))
|
||||
- snmp_log(LOG_ERR,
|
||||
+ snmp_log(LOG_DEBUG,
|
||||
"/proc/net/dev data format error, line ==|%s|",
|
||||
line);
|
||||
continue;
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/configure
|
||||
+++ b/configure
|
||||
@@ -16599,7 +16599,7 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu
|
||||
@@ -15602,7 +15602,7 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu
|
||||
need_version=no
|
||||
library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
|
||||
soname_spec='$libname$release$shared_ext$major'
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
--- a/configure.d/config_project_types
|
||||
+++ b/configure.d/config_project_types
|
||||
@@ -66,7 +66,7 @@ netsnmp_save_CFLAGS=$CFLAGS
|
||||
CFLAGS="$CFLAGS -Werror"
|
||||
|
||||
AC_MSG_CHECKING([for the type of fd_set::fds_bits])
|
||||
-for type in __fd_mask __int32_t unknown; do
|
||||
+for type in fd_mask int32_t size_t; do
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
|
||||
#include <sys/select.h>
|
||||
#include <stddef.h>
|
||||
@@ -1,11 +1,11 @@
|
||||
--- a/Makefile.top
|
||||
+++ b/Makefile.top
|
||||
@@ -87,7 +87,7 @@ LIBCURRENT = 42
|
||||
LIBAGE = 2
|
||||
LIBREVISION = 1
|
||||
@@ -87,7 +87,7 @@ LIBCURRENT = 41
|
||||
LIBAGE = 1
|
||||
LIBREVISION = 0
|
||||
|
||||
-LIB_LD_CMD = $(LIBTOOL) --mode=link $(LINKCC) $(CFLAGS) -rpath $(libdir) -version-info $(LIBCURRENT):$(LIBREVISION):$(LIBAGE) @LD_NO_UNDEFINED@ -o
|
||||
+LIB_LD_CMD = $(LIBTOOL) --mode=link $(LINKCC) $(CFLAGS) -rpath $(libdir) $(LDFLAGS) -version-info $(LIBCURRENT):$(LIBREVISION):$(LIBAGE) @LD_NO_UNDEFINED@ -o
|
||||
-LIB_LD_CMD = $(LIBTOOL) --mode=link $(LINKCC) $(CFLAGS) -rpath $(libdir) -version-info $(LIBCURRENT):$(LIBREVISION):$(LIBAGE) -o
|
||||
+LIB_LD_CMD = $(LIBTOOL) --mode=link $(LINKCC) $(CFLAGS) -rpath $(libdir) $(LDFLAGS) -version-info $(LIBCURRENT):$(LIBREVISION):$(LIBAGE) -o
|
||||
LIB_EXTENSION = la
|
||||
LIB_VERSION =
|
||||
LIB_LDCONFIG_CMD = $(LIBTOOL) --mode=finish $(INSTALL_PREFIX)$(libdir)
|
||||
@@ -1,407 +0,0 @@
|
||||
From d3e95c87b32397815f6d5bcfc844259f2552697a Mon Sep 17 00:00:00 2001
|
||||
From: gagan sidhu <gagan@hotmail.com>
|
||||
Date: Sun, 21 May 2023 15:47:36 -0600
|
||||
Subject: [PATCH] add pcre2 support
|
||||
|
||||
---
|
||||
agent/mibgroup/host/data_access/swrun.c | 29 ++++++++++--
|
||||
agent/mibgroup/if-mib/data_access/interface.c | 47 ++++++++++++++++---
|
||||
agent/mibgroup/struct.h | 2 +-
|
||||
agent/mibgroup/ucd-snmp/proc.c | 32 +++++++++----
|
||||
agent/mibgroup/ucd-snmp/proc.h | 2 +-
|
||||
configure.d/config_os_libs1 | 27 +++++++++++
|
||||
configure.d/config_project_with_enable | 4 ++
|
||||
include/net-snmp/data_access/interface.h | 9 +++-
|
||||
include/net-snmp/data_access/swrun.h | 2 +-
|
||||
include/net-snmp/types.h | 2 +-
|
||||
10 files changed, 132 insertions(+), 24 deletions(-)
|
||||
|
||||
--- a/agent/mibgroup/host/data_access/swrun.c
|
||||
+++ b/agent/mibgroup/host/data_access/swrun.c
|
||||
@@ -17,7 +17,10 @@
|
||||
#include "swrun.h"
|
||||
#include "swrun_private.h"
|
||||
|
||||
-#ifdef HAVE_PCRE_H
|
||||
+#if defined(HAVE_PCRE2_H)
|
||||
+#define PCRE2_CODE_UNIT_WIDTH 8
|
||||
+#include <pcre2.h>
|
||||
+#elif defined(HAVE_PCRE_H)
|
||||
#include <pcre.h>
|
||||
#endif
|
||||
|
||||
@@ -100,32 +103,52 @@ swrun_max_processes( void )
|
||||
#endif /* NETSNMP_FEATURE_REMOVE_SWRUN_MAX_PROCESSES */
|
||||
|
||||
#ifndef NETSNMP_FEATURE_REMOVE_SWRUN_COUNT_PROCESSES_BY_REGEX
|
||||
-#ifdef HAVE_PCRE_H
|
||||
+#if defined(HAVE_PCRE2_H) || defined(HAVE_PCRE_H)
|
||||
int
|
||||
swrun_count_processes_by_regex( char *name, netsnmp_regex_ptr regexp )
|
||||
{
|
||||
netsnmp_swrun_entry *entry;
|
||||
netsnmp_iterator *it;
|
||||
int i = 0;
|
||||
+#ifdef HAVE_PCRE2_H
|
||||
+ pcre2_match_data *ndx_match;
|
||||
+ int *found_ndx;
|
||||
+ ndx_match = pcre2_match_data_create(30, NULL);
|
||||
+ found_ndx = pcre2_get_ovector_pointer(ndx_match);
|
||||
+#elif defined(HAVE_PCRE_H)
|
||||
int found_ndx[30];
|
||||
+#endif
|
||||
int found;
|
||||
char fullCommand[64 + 128 + 128 + 3];
|
||||
|
||||
netsnmp_cache_check_and_reload(swrun_cache);
|
||||
if ( !swrun_container || !name || !regexp.regex_ptr )
|
||||
+#ifdef HAVE_PCRE2_H
|
||||
+ {
|
||||
+ pcre2_match_data_free(ndx_match);
|
||||
+ return 0;
|
||||
+ }
|
||||
+#else
|
||||
return 0; /* or -1 */
|
||||
+#endif
|
||||
|
||||
it = CONTAINER_ITERATOR( swrun_container );
|
||||
while ((entry = (netsnmp_swrun_entry*)ITERATOR_NEXT( it )) != NULL) {
|
||||
/* need to assemble full command back so regexps can get full picture */
|
||||
sprintf(fullCommand, "%s %s", entry->hrSWRunPath, entry->hrSWRunParameters);
|
||||
+#ifdef HAVE_PCRE2_H
|
||||
+ found = pcre2_match(regexp.regex_ptr, fullCommand, strlen(fullCommand), 0, 0, ndx_match, NULL);
|
||||
+#elif HAVE_PCRE_H
|
||||
found = pcre_exec(regexp.regex_ptr, NULL, fullCommand, strlen(fullCommand), 0, 0, found_ndx, 30);
|
||||
+#endif
|
||||
if (found > 0) {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
ITERATOR_RELEASE( it );
|
||||
-
|
||||
+#ifdef HAVE_PCRE2_H
|
||||
+ pcre2_match_data_free(ndx_match);
|
||||
+#endif
|
||||
return i;
|
||||
}
|
||||
#endif /* HAVE_PCRE_H */
|
||||
--- a/agent/mibgroup/if-mib/data_access/interface.c
|
||||
+++ b/agent/mibgroup/if-mib/data_access/interface.c
|
||||
@@ -16,7 +16,11 @@
|
||||
#include "if-mib/ifTable/ifTable.h"
|
||||
#include "if-mib/data_access/interface.h"
|
||||
#include "interface_private.h"
|
||||
-#if defined(HAVE_PCRE_H)
|
||||
+
|
||||
+#if defined(HAVE_PCRE2_H)
|
||||
+#define PCRE2_CODE_UNIT_WIDTH 8
|
||||
+#include <pcre2.h>
|
||||
+#elif defined(HAVE_PCRE_H)
|
||||
#include <pcre.h>
|
||||
#elif defined(HAVE_REGEX_H)
|
||||
#include <sys/types.h>
|
||||
@@ -824,7 +828,13 @@ int netsnmp_access_interface_max_reached
|
||||
int netsnmp_access_interface_include(const char *name)
|
||||
{
|
||||
netsnmp_include_if_list *if_ptr;
|
||||
-#ifdef HAVE_PCRE_H
|
||||
+#if defined(HAVE_PCRE2_H)
|
||||
+ //pcre_exec->pcre2_match
|
||||
+ //ovector->pcre2_match_data
|
||||
+ pcre2_match_data *ndx_match;
|
||||
+ ndx_match = pcre2_match_data_create(3, NULL);
|
||||
+ int *found_ndx = pcre2_get_ovector_pointer(ndx_match);
|
||||
+#elif defined(HAVE_PCRE_H)
|
||||
int found_ndx[3];
|
||||
#endif
|
||||
|
||||
@@ -840,7 +850,13 @@ int netsnmp_access_interface_include(con
|
||||
|
||||
|
||||
for (if_ptr = include_list; if_ptr; if_ptr = if_ptr->next) {
|
||||
-#if defined(HAVE_PCRE_H)
|
||||
+#if defined(HAVE_PCRE2_H)
|
||||
+ if (pcre2_match(if_ptr->regex_ptr, name, strlen(name), 0, 0,
|
||||
+ ndx_match, NULL) >= 0) {
|
||||
+ pcre2_match_data_free(ndx_match);
|
||||
+ return TRUE;
|
||||
+ }
|
||||
+#elif defined(HAVE_PCRE_H)
|
||||
if (pcre_exec(if_ptr->regex_ptr, NULL, name, strlen(name), 0, 0,
|
||||
found_ndx, 3) >= 0)
|
||||
return TRUE;
|
||||
@@ -853,6 +869,9 @@ int netsnmp_access_interface_include(con
|
||||
#endif
|
||||
}
|
||||
|
||||
+#if defined(HAVE_PCRE2_H)
|
||||
+ pcre2_match_data_free(ndx_match);
|
||||
+#endif
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -964,7 +983,13 @@ _parse_include_if_config(const char *tok
|
||||
{
|
||||
netsnmp_include_if_list *if_ptr, *if_new;
|
||||
char *name, *st;
|
||||
-#if defined(HAVE_PCRE_H)
|
||||
+#if defined(HAVE_PCRE2_H)
|
||||
+ //we can only get the message upon calling pcre2_error_message.
|
||||
+ // so an additional variable is required.
|
||||
+ int pcre2_err_code;
|
||||
+ unsigned char pcre2_error[128];
|
||||
+ int pcre2_error_offset;
|
||||
+#elif defined(HAVE_PCRE_H)
|
||||
const char *pcre_error;
|
||||
int pcre_error_offset;
|
||||
#elif defined(HAVE_REGEX_H)
|
||||
@@ -996,7 +1021,15 @@ _parse_include_if_config(const char *tok
|
||||
config_perror("Out of memory");
|
||||
goto err;
|
||||
}
|
||||
-#if defined(HAVE_PCRE_H)
|
||||
+#if defined(HAVE_PCRE2_H)
|
||||
+ if_new->regex_ptr = pcre2_compile(if_new->name, PCRE2_ZERO_TERMINATED, 0,
|
||||
+ &pcre2_err_code, &pcre2_error_offset, NULL);
|
||||
+ if (!if_new->regex_ptr) {
|
||||
+ pcre2_get_error_message(pcre2_err_code, pcre2_error, 128);
|
||||
+ config_perror(pcre2_error);
|
||||
+ goto err;
|
||||
+ }
|
||||
+#elif defined(HAVE_PCRE_H)
|
||||
if_new->regex_ptr = pcre_compile(if_new->name, 0, &pcre_error,
|
||||
&pcre_error_offset, NULL);
|
||||
if (!if_new->regex_ptr) {
|
||||
@@ -1032,7 +1065,7 @@ _parse_include_if_config(const char *tok
|
||||
|
||||
err:
|
||||
if (if_new) {
|
||||
-#if defined(HAVE_PCRE_H) || defined(HAVE_REGEX_H)
|
||||
+#if defined(HAVE_PCRE2_H) || defined(HAVE_PCRE_H) || defined(HAVE_REGEX_H)
|
||||
free(if_new->regex_ptr);
|
||||
#endif
|
||||
free(if_new->name);
|
||||
@@ -1047,7 +1080,7 @@ _free_include_if_config(void)
|
||||
|
||||
while (if_ptr) {
|
||||
if_next = if_ptr->next;
|
||||
-#if defined(HAVE_PCRE_H)
|
||||
+#if defined(HAVE_PCRE2_H) || defined(HAVE_PCRE_H)
|
||||
free(if_ptr->regex_ptr);
|
||||
#elif defined(HAVE_REGEX_H)
|
||||
regfree(if_ptr->regex_ptr);
|
||||
--- a/agent/mibgroup/struct.h
|
||||
+++ b/agent/mibgroup/struct.h
|
||||
@@ -30,7 +30,7 @@ struct extensible {
|
||||
|
||||
struct myproc {
|
||||
char name[STRMAX];
|
||||
-#ifdef HAVE_PCRE_H
|
||||
+#if defined(HAVE_PCRE2_H) || defined(HAVE_PCRE_H)
|
||||
netsnmp_regex_ptr regexp;
|
||||
#endif
|
||||
char fixcmd[STRMAX];
|
||||
--- a/agent/mibgroup/ucd-snmp/proc.c
|
||||
+++ b/agent/mibgroup/ucd-snmp/proc.c
|
||||
@@ -39,7 +39,10 @@
|
||||
# include <time.h>
|
||||
# endif
|
||||
#endif
|
||||
-#ifdef HAVE_PCRE_H
|
||||
+#ifdef HAVE_PCRE2_H
|
||||
+#define PCRE2_CODE_UNIT_WIDTH 8
|
||||
+#include <pcre2.h>
|
||||
+#elifdef HAVE_PCRE_H
|
||||
#include <pcre.h>
|
||||
#endif
|
||||
|
||||
@@ -108,7 +111,7 @@ init_proc(void)
|
||||
REGISTER_MIB("ucd-snmp/proc", extensible_proc_variables, variable2,
|
||||
proc_variables_oid);
|
||||
|
||||
-#ifdef HAVE_PCRE_H
|
||||
+#if defined(HAVE_PCRE2_H) || defined(HAVE_PCRE_H)
|
||||
#define proc_parse_usage "process-name [max-num] [min-num] [regexp]"
|
||||
#else
|
||||
#define proc_parse_usage "process-name [max-num] [min-num]"
|
||||
@@ -134,7 +137,7 @@ proc_free_config(void)
|
||||
for (ptmp = procwatch; ptmp != NULL;) {
|
||||
ptmp2 = ptmp;
|
||||
ptmp = ptmp->next;
|
||||
-#ifdef HAVE_PCRE_H
|
||||
+#if defined(HAVE_PCRE2_H) || defined(HAVE_PCRE_H)
|
||||
free(ptmp2->regexp.regex_ptr);
|
||||
#endif
|
||||
free(ptmp2);
|
||||
@@ -208,7 +211,7 @@ proc_parse_config(const char *token, cha
|
||||
if (*procp == NULL)
|
||||
return; /* memory alloc error */
|
||||
numprocs++;
|
||||
-#ifdef HAVE_PCRE_H
|
||||
+#if defined(HAVE_PCRE2_H) || defined(HAVE_PCRE_H)
|
||||
(*procp)->regexp.regex_ptr = NULL;
|
||||
#endif
|
||||
/*
|
||||
@@ -220,18 +223,31 @@ proc_parse_config(const char *token, cha
|
||||
cptr = skip_not_white(cptr);
|
||||
if ((cptr = skip_white(cptr))) {
|
||||
(*procp)->min = atoi(cptr);
|
||||
-#ifdef HAVE_PCRE_H
|
||||
+#if defined(HAVE_PCRE2_H) || defined(HAVE_PCRE_H)
|
||||
cptr = skip_not_white(cptr);
|
||||
if ((cptr = skip_white(cptr))) {
|
||||
+ DEBUGMSGTL(("ucd-snmp/regexp_proc", "Loading regex %s\n", cptr));
|
||||
+#ifdef HAVE_PCRE2_H
|
||||
+ unsigned char pcre2_error_msg[128];
|
||||
+ int pcre2_err_code;
|
||||
+ int pcre2_error_offset;
|
||||
+
|
||||
+ (*procp)->regexp.regex_ptr =
|
||||
+ pcre2_compile(cptr, PCRE2_ZERO_TERMINATED, 0, &pcre2_err_code, &pcre2_error_offset, NULL);
|
||||
+ pcre2_get_error_message(pcre2_err_code, pcre2_error_msg, 128);
|
||||
+ if ((*procp)->regexp.regex_ptr == NULL) {
|
||||
+ config_perror(pcre2_error_msg);
|
||||
+ }
|
||||
+#elifdef HAVE_PCRE_H
|
||||
const char *pcre_error;
|
||||
int pcre_error_offset;
|
||||
|
||||
- DEBUGMSGTL(("ucd-snmp/regexp_proc", "Loading regex %s\n", cptr));
|
||||
(*procp)->regexp.regex_ptr =
|
||||
pcre_compile(cptr, 0, &pcre_error, &pcre_error_offset, NULL);
|
||||
if ((*procp)->regexp.regex_ptr == NULL) {
|
||||
config_perror(pcre_error);
|
||||
}
|
||||
+#endif
|
||||
}
|
||||
#endif
|
||||
} else
|
||||
@@ -390,7 +406,7 @@ sh_count_myprocs(struct myproc *proc)
|
||||
if (proc == NULL)
|
||||
return 0;
|
||||
|
||||
-#if defined(USING_HOST_DATA_ACCESS_SWRUN_MODULE) && defined(HAVE_PCRE_H)
|
||||
+#if defined(USING_HOST_DATA_ACCESS_SWRUN_MODULE) && (defined(HAVE_PCRE2_H) || defined(HAVE_PCRE_H))
|
||||
if (proc->regexp.regex_ptr != NULL)
|
||||
return sh_count_procs_by_regex(proc->name, proc->regexp);
|
||||
#endif
|
||||
@@ -406,7 +422,7 @@ sh_count_procs(char *procname)
|
||||
return swrun_count_processes_by_name( procname );
|
||||
}
|
||||
|
||||
-#ifdef HAVE_PCRE_H
|
||||
+#if defined(HAVE_PCRE2_H) || defined(HAVE_PCRE_H)
|
||||
netsnmp_feature_require(swrun_count_processes_by_regex);
|
||||
int
|
||||
sh_count_procs_by_regex(char *procname, netsnmp_regex_ptr regexp)
|
||||
--- a/agent/mibgroup/ucd-snmp/proc.h
|
||||
+++ b/agent/mibgroup/ucd-snmp/proc.h
|
||||
@@ -12,7 +12,7 @@ config_require(util_funcs);
|
||||
extern WriteMethod fixProcError;
|
||||
int sh_count_myprocs(struct myproc *);
|
||||
int sh_count_procs(char *);
|
||||
-#ifdef HAVE_PCRE_H
|
||||
+#if defined(HAVE_PCRE2_H) || defined(HAVE_PCRE_H)
|
||||
int sh_count_procs_by_regex(char *, netsnmp_regex_ptr);
|
||||
#endif
|
||||
|
||||
--- a/configure.d/config_os_libs1
|
||||
+++ b/configure.d/config_os_libs1
|
||||
@@ -97,6 +97,32 @@ LIBS="$netsnmp_save_LIBS"
|
||||
#
|
||||
# regex in process table
|
||||
#
|
||||
+if test "x$with_pcre2" != "xno"; then
|
||||
+ AC_CHECK_HEADER([pcre2.h], [
|
||||
+ AC_DEFINE([HAVE_PCRE2_H], [1], [Define to 1 if you have <pcre2.h>.])
|
||||
+ pcre2_h=yes
|
||||
+ ],
|
||||
+ [pcre2_h=no], [#define PCRE2_CODE_UNIT_WIDTH 8]
|
||||
+ )
|
||||
+fi
|
||||
+if test "x$pcre2header_h" = "xno" -o "x$pcre2_h" = "xno" ; then
|
||||
+ if test "x$with_pcre2" = "xyes" ; then
|
||||
+ AC_MSG_ERROR([Could not find the pcre2 header file needed and was specifically asked to use pcre2 support])
|
||||
+ else
|
||||
+ with_pcre2=no
|
||||
+ fi
|
||||
+fi
|
||||
+
|
||||
+if test "x$with_pcre2" != "xno"; then
|
||||
+ NETSNMP_SEARCH_LIBS([pcre2_match_8], [pcre2-8], [
|
||||
+ LMIBLIBS="$LMIBLIBS -lpcre2-8"
|
||||
+ ],,, LAGENTLIBS)
|
||||
+ AC_SUBST(LAGENTLIBS)
|
||||
+ AC_SUBST(LMIBLIBS)
|
||||
+fi
|
||||
+
|
||||
+if test "x$with_pcre2" != "xyes"; then
|
||||
+
|
||||
if test "x$with_pcre" != "xno"; then
|
||||
AC_CHECK_HEADER([pcre.h], [
|
||||
AC_DEFINE([HAVE_PCRE_H], [1], [Define to 1 if you have <pcre.h>.])
|
||||
@@ -123,3 +149,4 @@ if test "x$with_pcre" != "xno"; then
|
||||
AC_SUBST(LAGENTLIBS)
|
||||
AC_SUBST(LMIBLIBS)
|
||||
fi
|
||||
+fi
|
||||
--- a/configure.d/config_project_with_enable
|
||||
+++ b/configure.d/config_project_with_enable
|
||||
@@ -160,6 +160,10 @@ NETSNMP_ARG_WITH(rpm,
|
||||
management system when building the host MIB
|
||||
module.])
|
||||
|
||||
+NETSNMP_ARG_WITH(pcre2-8,
|
||||
+[ --without-pcre2 Don't include pcre2 process searching
|
||||
+ support in the agent.],
|
||||
+ with_pcre2="$withval", with_pcre2="maybe")
|
||||
|
||||
NETSNMP_ARG_WITH(pcre,
|
||||
[ --without-pcre Don't include pcre process searching
|
||||
--- a/include/net-snmp/data_access/interface.h
|
||||
+++ b/include/net-snmp/data_access/interface.h
|
||||
@@ -10,7 +10,10 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
-#if defined(HAVE_PCRE_H)
|
||||
+#if defined(HAVE_PCRE2_H)
|
||||
+#define PCRE2_CODE_UNIT_WIDTH 8
|
||||
+#include <pcre2.h>
|
||||
+#elif defined(HAVE_PCRE_H)
|
||||
#include <pcre.h>
|
||||
#elif defined(HAVE_REGEX_H)
|
||||
#include <regex.h>
|
||||
@@ -211,7 +214,9 @@ typedef struct _conf_if_list {
|
||||
typedef netsnmp_conf_if_list conf_if_list; /* backwards compat */
|
||||
|
||||
typedef struct _include_if_list {
|
||||
-#if defined(HAVE_PCRE_H)
|
||||
+#if defined(HAVE_PCRE2_H)
|
||||
+ pcre2_code *regex_ptr;
|
||||
+#elif defined(HAVE_PCRE_H)
|
||||
pcre *regex_ptr;
|
||||
#elif defined(HAVE_REGEX_H)
|
||||
regex_t *regex_ptr;
|
||||
--- a/include/net-snmp/data_access/swrun.h
|
||||
+++ b/include/net-snmp/data_access/swrun.h
|
||||
@@ -90,7 +90,7 @@ extern "C" {
|
||||
int swrun_count_processes_by_name( char *name );
|
||||
|
||||
#if !defined(NETSNMP_FEATURE_REMOVE_SWRUN_COUNT_PROCESSES_BY_REGEX) \
|
||||
- && defined(HAVE_PCRE_H)
|
||||
+ && (defined(HAVE_PCRE2_H) || defined(HAVE_PCRE_H))
|
||||
int swrun_count_processes_by_regex(char *name, netsnmp_regex_ptr regexp);
|
||||
#endif
|
||||
|
||||
--- a/include/net-snmp/types.h
|
||||
+++ b/include/net-snmp/types.h
|
||||
@@ -63,7 +63,7 @@ typedef long ssize_t;
|
||||
typedef unsigned long int nfds_t;
|
||||
#endif
|
||||
|
||||
-#ifdef HAVE_PCRE_H
|
||||
+#if defined(HAVE_PCRE2_H) || defined(HAVE_PCRE_H)
|
||||
/*
|
||||
* Abstract the pcre typedef such that not all *.c files have to include
|
||||
* <pcre.h>.
|
||||
@@ -1,185 +0,0 @@
|
||||
From 48b313ca34dbdf303fb232191d4f74e1d0fc9f06 Mon Sep 17 00:00:00 2001
|
||||
From: Bart Van Assche <bvanassche@acm.org>
|
||||
Date: Sun, 21 May 2023 16:20:15 -0700
|
||||
Subject: [PATCH] Run autoreconf
|
||||
|
||||
---
|
||||
configure | 126 ++++++++++++++++++++++++++
|
||||
include/net-snmp/net-snmp-config.h.in | 3 +
|
||||
2 files changed, 129 insertions(+)
|
||||
|
||||
--- a/configure
|
||||
+++ b/configure
|
||||
@@ -928,6 +928,8 @@ with_dnssec
|
||||
enable_dnssec
|
||||
with_rpm
|
||||
enable_rpm
|
||||
+with_pcre2_8
|
||||
+enable_pcre2_8
|
||||
with_pcre
|
||||
enable_pcre
|
||||
with_install_prefix
|
||||
@@ -1851,6 +1853,8 @@ Compiler Options:
|
||||
--without-rpm Don't include support for the RPM package
|
||||
management system when building the host MIB
|
||||
module.
|
||||
+ --without-pcre2 Don't include pcre2 process searching
|
||||
+ support in the agent.
|
||||
--without-pcre Don't include pcre process searching
|
||||
support in the agent.
|
||||
--with-install-prefix=PATH Just for installing, prefix all
|
||||
@@ -5259,6 +5263,21 @@ fi
|
||||
|
||||
|
||||
|
||||
+# Check whether --with-pcre2-8 was given.
|
||||
+if test ${with_pcre2_8+y}
|
||||
+then :
|
||||
+ withval=$with_pcre2_8; with_pcre2="$withval"
|
||||
+else $as_nop
|
||||
+ with_pcre2="maybe"
|
||||
+fi
|
||||
+
|
||||
+ # Check whether --enable-pcre2-8 was given.
|
||||
+if test ${enable_pcre2_8+y}
|
||||
+then :
|
||||
+ enableval=$enable_pcre2_8; as_fn_error $? "Invalid option. Use --with-pcre2-8/--without-pcre2-8 instead" "$LINENO" 5
|
||||
+fi
|
||||
+
|
||||
+
|
||||
|
||||
# Check whether --with-pcre was given.
|
||||
if test ${with_pcre+y}
|
||||
@@ -26477,6 +26496,112 @@ LIBS="$netsnmp_save_LIBS"
|
||||
#
|
||||
# regex in process table
|
||||
#
|
||||
+if test "x$with_pcre2" != "xno"; then
|
||||
+ ac_fn_c_check_header_compile "$LINENO" "pcre2.h" "ac_cv_header_pcre2_h" "#define PCRE2_CODE_UNIT_WIDTH 8
|
||||
+
|
||||
+"
|
||||
+if test "x$ac_cv_header_pcre2_h" = xyes
|
||||
+then :
|
||||
+
|
||||
+
|
||||
+printf "%s\n" "#define HAVE_PCRE2_H 1" >>confdefs.h
|
||||
+
|
||||
+ pcre2_h=yes
|
||||
+
|
||||
+else $as_nop
|
||||
+ pcre2_h=no
|
||||
+fi
|
||||
+
|
||||
+fi
|
||||
+if test "x$pcre2header_h" = "xno" -o "x$pcre2_h" = "xno" ; then
|
||||
+ if test "x$with_pcre2" = "xyes" ; then
|
||||
+ as_fn_error $? "Could not find the pcre2 header file needed and was specifically asked to use pcre2 support" "$LINENO" 5
|
||||
+ else
|
||||
+ with_pcre2=no
|
||||
+ fi
|
||||
+fi
|
||||
+
|
||||
+if test "x$with_pcre2" != "xno"; then
|
||||
+
|
||||
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing pcre2_match_8" >&5
|
||||
+printf %s "checking for library containing pcre2_match_8... " >&6; }
|
||||
+if test ${netsnmp_cv_func_pcre2_match_8_LAGENTLIBS+y}
|
||||
+then :
|
||||
+ printf %s "(cached) " >&6
|
||||
+else $as_nop
|
||||
+ netsnmp_func_search_save_LIBS="$LIBS"
|
||||
+ netsnmp_target_val="$LAGENTLIBS"
|
||||
+ netsnmp_temp_LIBS="${netsnmp_target_val} ${LIBS}"
|
||||
+ netsnmp_result=no
|
||||
+ LIBS="${netsnmp_temp_LIBS}"
|
||||
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
+/* end confdefs.h. */
|
||||
+
|
||||
+/* Override any GCC internal prototype to avoid an error.
|
||||
+ Use char because int might match the return type of a GCC
|
||||
+ builtin and then its argument prototype would still apply. */
|
||||
+char pcre2_match_8 ();
|
||||
+int
|
||||
+main (void)
|
||||
+{
|
||||
+return pcre2_match_8 ();
|
||||
+ ;
|
||||
+ return 0;
|
||||
+}
|
||||
+_ACEOF
|
||||
+if ac_fn_c_try_link "$LINENO"
|
||||
+then :
|
||||
+ netsnmp_result="none required"
|
||||
+else $as_nop
|
||||
+ for netsnmp_cur_lib in pcre2-8 ; do
|
||||
+ LIBS="-l${netsnmp_cur_lib} ${netsnmp_temp_LIBS}"
|
||||
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
+/* end confdefs.h. */
|
||||
+
|
||||
+/* Override any GCC internal prototype to avoid an error.
|
||||
+ Use char because int might match the return type of a GCC
|
||||
+ builtin and then its argument prototype would still apply. */
|
||||
+char pcre2_match_8 ();
|
||||
+int
|
||||
+main (void)
|
||||
+{
|
||||
+return pcre2_match_8 ();
|
||||
+ ;
|
||||
+ return 0;
|
||||
+}
|
||||
+_ACEOF
|
||||
+if ac_fn_c_try_link "$LINENO"
|
||||
+then :
|
||||
+ netsnmp_result=-l${netsnmp_cur_lib}
|
||||
+ break
|
||||
+fi
|
||||
+rm -f core conftest.err conftest.$ac_objext conftest.beam \
|
||||
+ conftest$ac_exeext conftest.$ac_ext
|
||||
+ done
|
||||
+fi
|
||||
+rm -f core conftest.err conftest.$ac_objext conftest.beam \
|
||||
+ conftest$ac_exeext conftest.$ac_ext
|
||||
+ LIBS="${netsnmp_func_search_save_LIBS}"
|
||||
+ netsnmp_cv_func_pcre2_match_8_LAGENTLIBS="${netsnmp_result}"
|
||||
+fi
|
||||
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $netsnmp_cv_func_pcre2_match_8_LAGENTLIBS" >&5
|
||||
+printf "%s\n" "$netsnmp_cv_func_pcre2_match_8_LAGENTLIBS" >&6; }
|
||||
+ if test "${netsnmp_cv_func_pcre2_match_8_LAGENTLIBS}" != "no" ; then
|
||||
+ if test "${netsnmp_cv_func_pcre2_match_8_LAGENTLIBS}" != "none required" ; then
|
||||
+ LAGENTLIBS="${netsnmp_result} ${netsnmp_target_val}"
|
||||
+ fi
|
||||
+
|
||||
+ LMIBLIBS="$LMIBLIBS -lpcre2-8"
|
||||
+
|
||||
+
|
||||
+ fi
|
||||
+
|
||||
+
|
||||
+
|
||||
+fi
|
||||
+
|
||||
+if test "x$with_pcre2" != "xyes"; then
|
||||
+
|
||||
if test "x$with_pcre" != "xno"; then
|
||||
ac_fn_c_check_header_compile "$LINENO" "pcre.h" "ac_cv_header_pcre_h" "$ac_includes_default"
|
||||
if test "x$ac_cv_header_pcre_h" = xyes
|
||||
@@ -31486,6 +31611,7 @@ printf "%s\n" "#define pid_t $ac_pid_typ
|
||||
|
||||
|
||||
fi
|
||||
+fi
|
||||
|
||||
|
||||
|
||||
--- a/include/net-snmp/net-snmp-config.h.in
|
||||
+++ b/include/net-snmp/net-snmp-config.h.in
|
||||
@@ -727,6 +727,9 @@
|
||||
/* Define to 1 if you have the <pci/pci.h> header file. */
|
||||
#undef HAVE_PCI_PCI_H
|
||||
|
||||
+/* Define to 1 if you have <pcre2.h>. */
|
||||
+#undef HAVE_PCRE2_H
|
||||
+
|
||||
/* Define to 1 if you have <pcre.h>. */
|
||||
#undef HAVE_PCRE_H
|
||||
|
||||
@@ -1,152 +0,0 @@
|
||||
From 346b6f8959513320e5b674fd670c49ba2cd43af5 Mon Sep 17 00:00:00 2001
|
||||
From: Bart Van Assche <bvanassche@acm.org>
|
||||
Date: Sun, 21 May 2023 16:18:56 -0700
|
||||
Subject: [PATCH] Improve pcre2 support
|
||||
|
||||
Fix compiler warnings. Convert C++ comments to C comments. Make sure that
|
||||
declarations occur before statements.
|
||||
---
|
||||
agent/mibgroup/host/data_access/swrun.c | 17 ++++------
|
||||
agent/mibgroup/if-mib/data_access/interface.c | 32 ++++++++++---------
|
||||
agent/mibgroup/ucd-snmp/proc.c | 13 +++++---
|
||||
3 files changed, 31 insertions(+), 31 deletions(-)
|
||||
|
||||
--- a/agent/mibgroup/host/data_access/swrun.c
|
||||
+++ b/agent/mibgroup/host/data_access/swrun.c
|
||||
@@ -111,10 +111,7 @@ swrun_count_processes_by_regex( char *na
|
||||
netsnmp_iterator *it;
|
||||
int i = 0;
|
||||
#ifdef HAVE_PCRE2_H
|
||||
- pcre2_match_data *ndx_match;
|
||||
- int *found_ndx;
|
||||
- ndx_match = pcre2_match_data_create(30, NULL);
|
||||
- found_ndx = pcre2_get_ovector_pointer(ndx_match);
|
||||
+ pcre2_match_data *ndx_match = pcre2_match_data_create(30, NULL);
|
||||
#elif defined(HAVE_PCRE_H)
|
||||
int found_ndx[30];
|
||||
#endif
|
||||
@@ -122,22 +119,20 @@ swrun_count_processes_by_regex( char *na
|
||||
char fullCommand[64 + 128 + 128 + 3];
|
||||
|
||||
netsnmp_cache_check_and_reload(swrun_cache);
|
||||
- if ( !swrun_container || !name || !regexp.regex_ptr )
|
||||
+ if ( !swrun_container || !name || !regexp.regex_ptr ) {
|
||||
#ifdef HAVE_PCRE2_H
|
||||
- {
|
||||
pcre2_match_data_free(ndx_match);
|
||||
- return 0;
|
||||
- }
|
||||
-#else
|
||||
- return 0; /* or -1 */
|
||||
#endif
|
||||
+ return 0; /* or -1 */
|
||||
+ }
|
||||
|
||||
it = CONTAINER_ITERATOR( swrun_container );
|
||||
while ((entry = (netsnmp_swrun_entry*)ITERATOR_NEXT( it )) != NULL) {
|
||||
/* need to assemble full command back so regexps can get full picture */
|
||||
sprintf(fullCommand, "%s %s", entry->hrSWRunPath, entry->hrSWRunParameters);
|
||||
#ifdef HAVE_PCRE2_H
|
||||
- found = pcre2_match(regexp.regex_ptr, fullCommand, strlen(fullCommand), 0, 0, ndx_match, NULL);
|
||||
+ found = pcre2_match(regexp.regex_ptr, (unsigned char *)fullCommand,
|
||||
+ strlen(fullCommand), 0, 0, ndx_match, NULL);
|
||||
#elif HAVE_PCRE_H
|
||||
found = pcre_exec(regexp.regex_ptr, NULL, fullCommand, strlen(fullCommand), 0, 0, found_ndx, 30);
|
||||
#endif
|
||||
--- a/agent/mibgroup/if-mib/data_access/interface.c
|
||||
+++ b/agent/mibgroup/if-mib/data_access/interface.c
|
||||
@@ -828,12 +828,8 @@ int netsnmp_access_interface_max_reached
|
||||
int netsnmp_access_interface_include(const char *name)
|
||||
{
|
||||
netsnmp_include_if_list *if_ptr;
|
||||
-#if defined(HAVE_PCRE2_H)
|
||||
- //pcre_exec->pcre2_match
|
||||
- //ovector->pcre2_match_data
|
||||
- pcre2_match_data *ndx_match;
|
||||
- ndx_match = pcre2_match_data_create(3, NULL);
|
||||
- int *found_ndx = pcre2_get_ovector_pointer(ndx_match);
|
||||
+#if defined(HAVE_PCRE2_H)
|
||||
+ pcre2_match_data *ndx_match = pcre2_match_data_create(3, NULL);
|
||||
#elif defined(HAVE_PCRE_H)
|
||||
int found_ndx[3];
|
||||
#endif
|
||||
@@ -851,8 +847,8 @@ int netsnmp_access_interface_include(con
|
||||
|
||||
for (if_ptr = include_list; if_ptr; if_ptr = if_ptr->next) {
|
||||
#if defined(HAVE_PCRE2_H)
|
||||
- if (pcre2_match(if_ptr->regex_ptr, name, strlen(name), 0, 0,
|
||||
- ndx_match, NULL) >= 0) {
|
||||
+ if (pcre2_match(if_ptr->regex_ptr, (const unsigned char *)name,
|
||||
+ strlen(name), 0, 0, ndx_match, NULL) >= 0) {
|
||||
pcre2_match_data_free(ndx_match);
|
||||
return TRUE;
|
||||
}
|
||||
@@ -984,11 +980,13 @@ _parse_include_if_config(const char *tok
|
||||
netsnmp_include_if_list *if_ptr, *if_new;
|
||||
char *name, *st;
|
||||
#if defined(HAVE_PCRE2_H)
|
||||
- //we can only get the message upon calling pcre2_error_message.
|
||||
- // so an additional variable is required.
|
||||
+ /*
|
||||
+ * We can only get the message upon calling pcre2_error_message.
|
||||
+ * so an additional variable is required.
|
||||
+ */
|
||||
int pcre2_err_code;
|
||||
- unsigned char pcre2_error[128];
|
||||
- int pcre2_error_offset;
|
||||
+ char pcre2_error[128];
|
||||
+ size_t pcre2_error_offset;
|
||||
#elif defined(HAVE_PCRE_H)
|
||||
const char *pcre_error;
|
||||
int pcre_error_offset;
|
||||
@@ -1022,10 +1020,14 @@ _parse_include_if_config(const char *tok
|
||||
goto err;
|
||||
}
|
||||
#if defined(HAVE_PCRE2_H)
|
||||
- if_new->regex_ptr = pcre2_compile(if_new->name, PCRE2_ZERO_TERMINATED, 0,
|
||||
- &pcre2_err_code, &pcre2_error_offset, NULL);
|
||||
+ if_new->regex_ptr = pcre2_compile((const unsigned char *)if_new->name,
|
||||
+ PCRE2_ZERO_TERMINATED, 0,
|
||||
+ &pcre2_err_code, &pcre2_error_offset,
|
||||
+ NULL);
|
||||
if (!if_new->regex_ptr) {
|
||||
- pcre2_get_error_message(pcre2_err_code, pcre2_error, 128);
|
||||
+ pcre2_get_error_message(pcre2_err_code,
|
||||
+ (unsigned char *)pcre2_error,
|
||||
+ sizeof(pcre2_error));
|
||||
config_perror(pcre2_error);
|
||||
goto err;
|
||||
}
|
||||
--- a/agent/mibgroup/ucd-snmp/proc.c
|
||||
+++ b/agent/mibgroup/ucd-snmp/proc.c
|
||||
@@ -226,15 +226,17 @@ proc_parse_config(const char *token, cha
|
||||
#if defined(HAVE_PCRE2_H) || defined(HAVE_PCRE_H)
|
||||
cptr = skip_not_white(cptr);
|
||||
if ((cptr = skip_white(cptr))) {
|
||||
- DEBUGMSGTL(("ucd-snmp/regexp_proc", "Loading regex %s\n", cptr));
|
||||
#ifdef HAVE_PCRE2_H
|
||||
- unsigned char pcre2_error_msg[128];
|
||||
+ char pcre2_error_msg[128];
|
||||
int pcre2_err_code;
|
||||
- int pcre2_error_offset;
|
||||
+ size_t pcre2_error_offset;
|
||||
|
||||
+ DEBUGMSGTL(("ucd-snmp/regexp_proc", "Loading regex %s\n", cptr));
|
||||
(*procp)->regexp.regex_ptr =
|
||||
- pcre2_compile(cptr, PCRE2_ZERO_TERMINATED, 0, &pcre2_err_code, &pcre2_error_offset, NULL);
|
||||
- pcre2_get_error_message(pcre2_err_code, pcre2_error_msg, 128);
|
||||
+ pcre2_compile((const unsigned char *)cptr, PCRE2_ZERO_TERMINATED, 0, &pcre2_err_code, &pcre2_error_offset, NULL);
|
||||
+ pcre2_get_error_message(pcre2_err_code,
|
||||
+ (unsigned char *)pcre2_error_msg,
|
||||
+ sizeof(pcre2_error_msg));
|
||||
if ((*procp)->regexp.regex_ptr == NULL) {
|
||||
config_perror(pcre2_error_msg);
|
||||
}
|
||||
@@ -242,6 +244,7 @@ proc_parse_config(const char *token, cha
|
||||
const char *pcre_error;
|
||||
int pcre_error_offset;
|
||||
|
||||
+ DEBUGMSGTL(("ucd-snmp/regexp_proc", "Loading regex %s\n", cptr));
|
||||
(*procp)->regexp.regex_ptr =
|
||||
pcre_compile(cptr, 0, &pcre_error, &pcre_error_offset, NULL);
|
||||
if ((*procp)->regexp.regex_ptr == NULL) {
|
||||
@@ -1,30 +0,0 @@
|
||||
From e5aadf1e78c624a8e4147d4b70a7795497a50e73 Mon Sep 17 00:00:00 2001
|
||||
From: Niels Baggesen <nba@users.sourceforge.net>
|
||||
Date: Mon, 22 May 2023 18:44:36 +0200
|
||||
Subject: [PATCH] if-mib/data_access/interface.c: plug a leak with pcre2
|
||||
|
||||
---
|
||||
agent/mibgroup/if-mib/data_access/interface.c | 5 ++++-
|
||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/agent/mibgroup/if-mib/data_access/interface.c
|
||||
+++ b/agent/mibgroup/if-mib/data_access/interface.c
|
||||
@@ -829,7 +829,7 @@ int netsnmp_access_interface_include(con
|
||||
{
|
||||
netsnmp_include_if_list *if_ptr;
|
||||
#if defined(HAVE_PCRE2_H)
|
||||
- pcre2_match_data *ndx_match = pcre2_match_data_create(3, NULL);
|
||||
+ pcre2_match_data *ndx_match;
|
||||
#elif defined(HAVE_PCRE_H)
|
||||
int found_ndx[3];
|
||||
#endif
|
||||
@@ -844,6 +844,9 @@ int netsnmp_access_interface_include(con
|
||||
*/
|
||||
return TRUE;
|
||||
|
||||
+#if defined(HAVE_PCRE2_H)
|
||||
+ ndx_match = pcre2_match_data_create(3, NULL);
|
||||
+#endif
|
||||
|
||||
for (if_ptr = include_list; if_ptr; if_ptr = if_ptr->next) {
|
||||
#if defined(HAVE_PCRE2_H)
|
||||
@@ -1,6 +1,6 @@
|
||||
--- /dev/null
|
||||
+++ b/agent/mibgroup/ieee802dot11.c
|
||||
@@ -0,0 +1,4916 @@
|
||||
@@ -0,0 +1,4915 @@
|
||||
+/****************************************************************************
|
||||
+* *
|
||||
+* File Name: ieee802dot11.c *
|
||||
@@ -30,7 +30,6 @@
|
||||
+#include <net-snmp/agent/net-snmp-agent-includes.h>
|
||||
+#include "ieee802dot11.h"
|
||||
+#include "iwlib.h"
|
||||
+#include "util_funcs/header_generic.h"
|
||||
+
|
||||
+/****************************************************************************
|
||||
+* Defines *
|
||||
@@ -3974,7 +3973,7 @@
|
||||
+ rc = ioctl ( skfd, SIOCGIFHWADDR, &ifr );
|
||||
+ if ( rc >= 0 ) {
|
||||
+
|
||||
+ sprintf ( MACAddress, "%02X:%02X:%02X:%02X:%02X:%02X",
|
||||
+ sprintf ( MACAddress, "%02X:%02X:%02X:%02X:%02X:%02X\0",
|
||||
+ ( UCHAR ) ifr.ifr_hwaddr.sa_data[0], ( UCHAR ) ifr.ifr_hwaddr.sa_data[1],
|
||||
+ ( UCHAR ) ifr.ifr_hwaddr.sa_data[2], ( UCHAR ) ifr.ifr_hwaddr.sa_data[3],
|
||||
+ ( UCHAR ) ifr.ifr_hwaddr.sa_data[4], ( UCHAR ) ifr.ifr_hwaddr.sa_data[5] );
|
||||
@@ -3997,83 +3996,83 @@
|
||||
+
|
||||
+ if ( hasChanged (( char * ) &nSc, sizeof ( nSc ))) {
|
||||
+ nSc.ifIndex = ifIndex;
|
||||
+ sprintf ( nSc.UID, "%04ld", nSc.ifIndex );
|
||||
+ sprintf ( nSc.UID, "%04d\0", nSc.ifIndex );
|
||||
+ strcpy ( nSc.ifName, ifName );
|
||||
+ addList (( char * ) &scList, ( char * ) &nSc, sizeof ( nSc ));
|
||||
+ }
|
||||
+
|
||||
+ if ( hasChanged (( char * ) &nPr, sizeof ( nPr ))) {
|
||||
+ nPr.ifIndex = ifIndex;
|
||||
+ sprintf ( nPr.UID, "%04ld", nPr.ifIndex );
|
||||
+ sprintf ( nPr.UID, "%04d\0", nPr.ifIndex );
|
||||
+ strcpy ( nPr.ifName, ifName );
|
||||
+ addList (( char * ) &prList, ( char * ) &nPr, sizeof ( nPr ));
|
||||
+ }
|
||||
+
|
||||
+ if ( hasChanged (( char * ) &nOp, sizeof ( nOp ))) {
|
||||
+ nOp.ifIndex = ifIndex;
|
||||
+ sprintf ( nOp.UID, "%04ld", nOp.ifIndex );
|
||||
+ sprintf ( nOp.UID, "%04d\0", nOp.ifIndex );
|
||||
+ strcpy ( nOp.ifName, ifName );
|
||||
+ addList (( char * ) &opList, ( char * ) &nOp, sizeof ( nOp ));
|
||||
+ }
|
||||
+
|
||||
+ if ( hasChanged (( char * ) &nCo, sizeof ( nCo ))) {
|
||||
+ nCo.ifIndex = ifIndex;
|
||||
+ sprintf ( nCo.UID, "%04ld", nCo.ifIndex );
|
||||
+ sprintf ( nCo.UID, "%04d\0", nCo.ifIndex );
|
||||
+ strcpy ( nCo.ifName, ifName );
|
||||
+ addList (( char * ) &coList, ( char * ) &nCo, sizeof ( nCo ));
|
||||
+ }
|
||||
+
|
||||
+ if ( hasChanged (( char * ) &nRi, sizeof ( nRi ))) {
|
||||
+ nRi.ifIndex = ifIndex;
|
||||
+ sprintf ( nRi.UID, "%04ld", nRi.ifIndex );
|
||||
+ sprintf ( nRi.UID, "%04d\0", nRi.ifIndex );
|
||||
+ strcpy ( nRi.ifName, ifName );
|
||||
+ addList (( char * ) &riList, ( char * ) &nRi, sizeof ( nRi ));
|
||||
+ }
|
||||
+
|
||||
+ if ( hasChanged (( char * ) &nPo, sizeof ( nPo ))) {
|
||||
+ nPo.ifIndex = ifIndex;
|
||||
+ sprintf ( nPo.UID, "%04ld", nPo.ifIndex );
|
||||
+ sprintf ( nPo.UID, "%04d\0", nPo.ifIndex );
|
||||
+ strcpy ( nPo.ifName, ifName );
|
||||
+ addList (( char * ) &poList, ( char * ) &nPo, sizeof ( nPo ));
|
||||
+ }
|
||||
+
|
||||
+ if ( hasChanged (( char * ) &nPa, sizeof ( nPa ))) {
|
||||
+ nPa.ifIndex = ifIndex;
|
||||
+ sprintf ( nPa.UID, "%04ld", nPa.ifIndex );
|
||||
+ sprintf ( nPa.UID, "%04d\0", nPa.ifIndex );
|
||||
+ strcpy ( nPa.ifName, ifName );
|
||||
+ addList (( char * ) &paList, ( char * ) &nPa, sizeof ( nPa ));
|
||||
+ }
|
||||
+
|
||||
+ if ( hasChanged (( char * ) &nPt, sizeof ( nPt ))) {
|
||||
+ nPt.ifIndex = ifIndex;
|
||||
+ sprintf ( nPt.UID, "%04ld", nPt.ifIndex );
|
||||
+ sprintf ( nPt.UID, "%04d\0", nPt.ifIndex );
|
||||
+ strcpy ( nPt.ifName, ifName );
|
||||
+ addList (( char * ) &ptList, ( char * ) &nPt, sizeof ( nPt ));
|
||||
+ }
|
||||
+
|
||||
+ if ( hasChanged (( char * ) &nPf, sizeof ( nPf ))) {
|
||||
+ nPf.ifIndex = ifIndex;
|
||||
+ sprintf ( nPf.UID, "%04ld", nPf.ifIndex );
|
||||
+ sprintf ( nPf.UID, "%04d\0", nPf.ifIndex );
|
||||
+ strcpy ( nPf.ifName, ifName );
|
||||
+ addList (( char * ) &pfList, ( char * ) &nPf, sizeof ( nPf ));
|
||||
+ }
|
||||
+
|
||||
+ if ( hasChanged (( char * ) &nPd, sizeof ( nPd ))) {
|
||||
+ nPd.ifIndex = ifIndex;
|
||||
+ sprintf ( nPd.UID, "%04ld", nPd.ifIndex );
|
||||
+ sprintf ( nPd.UID, "%04d\0", nPd.ifIndex );
|
||||
+ strcpy ( nPd.ifName, ifName );
|
||||
+ addList (( char * ) &pdList, ( char * ) &nPd, sizeof ( nPd ));
|
||||
+ }
|
||||
+
|
||||
+ if ( hasChanged (( char * ) &nPi, sizeof ( nPi ))) {
|
||||
+ nPi.ifIndex = ifIndex;
|
||||
+ sprintf ( nPi.UID, "%04ld", nPi.ifIndex );
|
||||
+ sprintf ( nPi.UID, "%04d\0", nPi.ifIndex );
|
||||
+ strcpy ( nPi.ifName, ifName );
|
||||
+ addList (( char * ) &piList, ( char * ) &nPi, sizeof ( nPi ));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+//printf ( "%s - ifIndex: %ld ifName: %s UID: %s\n",
|
||||
+//printf ( "%s - ifIndex: %d ifName: %s UID: %s\n",
|
||||
+// "load80211Structs() - HASCHANGED", ifIndex, ifName, nSc.UID );
|
||||
+}
|
||||
+
|
||||
@@ -4164,7 +4163,7 @@
|
||||
+ nAa.ifIndex = ifIndex;
|
||||
+ nAa.authenticationAlgorithmsIndex = 1; // index number one
|
||||
+ nAa.authenticationAlgorithm = 1; // 1 => open key
|
||||
+ sprintf ( nAa.UID, "%04ld%04ld", nAa.ifIndex, nAa.authenticationAlgorithmsIndex );
|
||||
+ sprintf ( nAa.UID, "%04d%04d\0", nAa.ifIndex, nAa.authenticationAlgorithmsIndex );
|
||||
+ nAa.authenticationAlgorithmsEnable = 1; // enabled by default
|
||||
+ if ( ( wi->has_key ) &&
|
||||
+ ( wi->key_size != 0 ) &&
|
||||
@@ -4177,7 +4176,7 @@
|
||||
+ nAa.ifIndex = ifIndex;
|
||||
+ nAa.authenticationAlgorithmsIndex = 2; // index number 2
|
||||
+ nAa.authenticationAlgorithm = 2; // 2 => shared key
|
||||
+ sprintf ( nAa.UID, "%04ld%04ld", nAa.ifIndex, nAa.authenticationAlgorithmsIndex );
|
||||
+ sprintf ( nAa.UID, "%04d%04d\0", nAa.ifIndex, nAa.authenticationAlgorithmsIndex );
|
||||
+ nAa.authenticationAlgorithmsEnable = 2;
|
||||
+ if ( ( wi->has_key ) &&
|
||||
+ ( wi->key_size != 0 ) &&
|
||||
@@ -4191,7 +4190,7 @@
|
||||
+ nDf.haveWEPDefaultKeyValue = TRUE;
|
||||
+ nDf.ifIndex = ifIndex;
|
||||
+ nDf.WEPDefaultKeyIndex = i + 1; // index number
|
||||
+ sprintf ( nDf.UID, "%04ld%04ld", nDf.ifIndex, nDf.WEPDefaultKeyIndex );
|
||||
+ sprintf ( nDf.UID, "%04d%04d\0", nDf.ifIndex, nDf.WEPDefaultKeyIndex );
|
||||
+ if ( wep[i].haveKey )
|
||||
+ strcpy ( nDf.WEPDefaultKeyValue, "*****" );
|
||||
+ else
|
||||
@@ -4256,7 +4255,7 @@
|
||||
+ nRt.supportedDataRatesTxIndex = i + 1;
|
||||
+ nRt.supportedDataRatesTxValue = wi->range.bitrate[i] / 500000L;
|
||||
+ nRt.haveSupportedDataRatesTxValue = TRUE;
|
||||
+ sprintf ( nRt.UID, "%04ld%04ld", nRt.ifIndex, nRt.supportedDataRatesTxIndex );
|
||||
+ sprintf ( nRt.UID, "%04d%04d\0", nRt.ifIndex, nRt.supportedDataRatesTxIndex );
|
||||
+ strcpy ( nRt.ifName, ifName );
|
||||
+ addList (( char * ) &rtList, ( char * ) &nRt, sizeof ( nRt ));
|
||||
+ }
|
||||
@@ -4269,7 +4268,7 @@
|
||||
+ nRr.supportedDataRatesRxIndex = i + 1;
|
||||
+ nRr.supportedDataRatesRxValue = wi->range.bitrate[i] / 500000L;
|
||||
+ nRr.haveSupportedDataRatesRxValue = TRUE;
|
||||
+ sprintf ( nRr.UID, "%04ld%04ld", nRr.ifIndex, nRr.supportedDataRatesRxIndex );
|
||||
+ sprintf ( nRr.UID, "%04d%04d\0", nRr.ifIndex, nRr.supportedDataRatesRxIndex );
|
||||
+ strcpy ( nRr.ifName, ifName );
|
||||
+ addList (( char * ) &rrList, ( char * ) &nRr, sizeof ( nRr ));
|
||||
+ }
|
||||
@@ -4442,22 +4441,22 @@
|
||||
+ s = bfr;
|
||||
+ s = strchr ( s, ':' ); s++; /* Skip ethX: */
|
||||
+ s = strtok ( s, " " ); /* ' ' => '\0' */
|
||||
+ sscanf ( s, "%hX", &wi->stats.status ); // status
|
||||
+ sscanf ( s, "%X", &wi->stats.status ); // status
|
||||
+
|
||||
+ s = strtok ( NULL, " " ); // link quality
|
||||
+ if ( strchr ( s, '.' ) != NULL )
|
||||
+ wi->stats.qual.updated |= 1;
|
||||
+ sscanf ( s, "%hhd", &wi->stats.qual.qual );
|
||||
+ sscanf ( s, "%d", &wi->stats.qual.qual );
|
||||
+
|
||||
+ s = strtok ( NULL, " " ); // signal level
|
||||
+ if ( strchr ( s,'.' ) != NULL )
|
||||
+ wi->stats.qual.updated |= 2;
|
||||
+ sscanf ( s, "%hhd", &wi->stats.qual.level );
|
||||
+ sscanf ( s, "%d", &wi->stats.qual.level );
|
||||
+
|
||||
+ s = strtok ( NULL, " " ); // noise level
|
||||
+ if ( strchr ( s, '.' ) != NULL )
|
||||
+ wi->stats.qual.updated += 4;
|
||||
+ sscanf ( s, "%hhd", &wi->stats.qual.noise );
|
||||
+ sscanf ( s, "%d", &wi->stats.qual.noise );
|
||||
+
|
||||
+ s = strtok ( NULL, " " ); sscanf ( s, "%d", &wi->stats.discard.nwid );
|
||||
+ s = strtok ( NULL, " " ); sscanf ( s, "%d", &wi->stats.discard.code );
|
||||
@@ -4563,12 +4562,12 @@
|
||||
+ printf ( "%s %s\n", "SIOCGIWFREQ", " ===> no info.freq support" );
|
||||
+
|
||||
+ if ( info.has_sens )
|
||||
+ printf ( "%s sens: %" PRIdPTR "\n", "SIOCGIWSENS", *(intptr_t *)&info.sens );
|
||||
+ printf ( "%s sens: %d\n", "SIOCGIWSENS", info.sens );
|
||||
+ else
|
||||
+ printf ( "%s %s\n", "SIOCGIWSENS", " ===> no info.sens support" );
|
||||
+
|
||||
+ if ( info.has_key ) {
|
||||
+ printf ( "%s key_size: %d key_flags: %d wepCurrentKey: %ld\n",
|
||||
+ printf ( "%s key_size: %d key_flags: %d wepCurrentKey: %d\n",
|
||||
+ "SIOCGIWENCODE", info.key_size, info.key_flags, wepCurrentKey );
|
||||
+ printf ( "%s MODE: %d DISABLED: %d INDEX: %d OPEN: %d RESTRICTED: %d NOKEY: %d TEMP: %d\n",
|
||||
+ "SIOCGIWENCODE", info.key_flags & IW_ENCODE_MODE,
|
||||
@@ -4581,7 +4580,7 @@
|
||||
+
|
||||
+ for ( i = 0; i < MAX_WEP_KEYS; i++ ) {
|
||||
+ if ( wep[i].haveKey )
|
||||
+ printf ( "%s wep[%d].len: %ld wep[%d].key: %s\n",
|
||||
+ printf ( "%s wep[%d].len: %d wep[%d].key: %s\n",
|
||||
+ "SIOCGIWENCODE", i, wep[i].len, i, wep[i].key );
|
||||
+ }
|
||||
+
|
||||
@@ -4595,19 +4594,19 @@
|
||||
+ printf ( "%s %s\n", "SIOCGIWAP", " ===> no ap_addr information" );
|
||||
+
|
||||
+ if ( info.has_bitrate )
|
||||
+ printf ( "%s bitrate: %" PRIdPTR " value: %d fixed: %d disabled: %d flags: %d\n",
|
||||
+ "SIOCGIWRATE", *(intptr_t *)&info.bitrate, info.bitrate.value, info.bitrate.fixed,
|
||||
+ printf ( "%s bitrate: %d value: %d fixed: %d disabled: %d flags: %d\n",
|
||||
+ "SIOCGIWRATE", info.bitrate, info.bitrate.value, info.bitrate.fixed,
|
||||
+ info.bitrate.disabled, info.bitrate.flags );
|
||||
+ else
|
||||
+ printf ( "%s %s\n", "SIOCGIWRATE", " ===> no info.bitrate support" );
|
||||
+
|
||||
+ if ( info.has_rts )
|
||||
+ printf ( "%s rts: %" PRIdPTR "\n", "SIOCGIWRTS", *(intptr_t *)&info.rts );
|
||||
+ printf ( "%s rts: %d\n", "SIOCGIWRTS", info.rts );
|
||||
+ else
|
||||
+ printf ( "%s %s\n", "SIOCGIWRTS", " ===> no info.rts support" );
|
||||
+
|
||||
+ if ( info.has_frag )
|
||||
+ printf ( "%s frag: %" PRIdPTR "\n", "SIOCGIWFRAG", *(intptr_t *)&info.frag );
|
||||
+ printf ( "%s frag: %d\n", "SIOCGIWFRAG", info.frag );
|
||||
+ else
|
||||
+ printf ( "%s %s\n", "SIOCGIWFRAG", " ===> no info.frag support" );
|
||||
+
|
||||
@@ -4617,7 +4616,7 @@
|
||||
+ printf ( "%s %s\n", "SIOCGIWMODE", " ===> no info.mode support" );
|
||||
+
|
||||
+ if ( info.has_power ) {
|
||||
+ printf ( "%s power: %" PRIdPTR "\n", "SIOCGIWPOWER", *(intptr_t *)&info.power );
|
||||
+ printf ( "%s power: %d\n", "SIOCGIWPOWER", info.power );
|
||||
+ printf ( "%s disabled: %d MIN: %d MAX: %d TIMEOUT: %d RELATIVE: %d\n",
|
||||
+ "SIOCGIWPOWER",
|
||||
+ info.power.disabled ? 1:0,
|
||||
@@ -4637,7 +4636,7 @@
|
||||
+ printf ( "%s %s\n", "SIOCGIWPOWER", " ===> no info.power support" );
|
||||
+
|
||||
+ if ( info.has_retry )
|
||||
+ printf ( "%s retry: %" PRIdPTR "\n", "SIOCGIWRETRY", *(intptr_t *)&info.retry );
|
||||
+ printf ( "%s retry: %d\n", "SIOCGIWRETRY", info.retry );
|
||||
+ else
|
||||
+ printf ( "%s %s\n", "SIOCGIWRETRY", " ===> no info.retry support" );
|
||||
+
|
||||
@@ -4701,12 +4700,12 @@
|
||||
+addList ( char *l, char *data, int len )
|
||||
+{
|
||||
+ char uid[256];
|
||||
+ avList_t *list;
|
||||
+ LIST_HEAD ( , avNode ) *list;
|
||||
+
|
||||
+ // NOTE: this assumes the UID is at the beginning of the
|
||||
+ // data structure and that UIDs are strings
|
||||
+
|
||||
+ list = ( avList_t * ) l; // NOTE: don't know how to get
|
||||
+ list = ( LIST_HEAD ( , avNode ) * ) 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
|
||||
@@ -4788,9 +4787,9 @@
|
||||
+****************************************************************************/
|
||||
+static void flushList ( char *l )
|
||||
+{
|
||||
+ avList_t *list;
|
||||
+ LIST_HEAD ( , avNode ) *list;
|
||||
+
|
||||
+ list = ( avList_t * ) l; // NOTE: don't know how to get
|
||||
+ list = ( LIST_HEAD ( , avNode ) * ) 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 )
|
||||
@@ -4919,7 +4918,7 @@
|
||||
+
|
||||
--- /dev/null
|
||||
+++ b/agent/mibgroup/ieee802dot11.h
|
||||
@@ -0,0 +1,732 @@
|
||||
@@ -0,0 +1,730 @@
|
||||
+/****************************************************************************
|
||||
+* *
|
||||
+* File Name: ieee802dot11.h *
|
||||
@@ -5025,7 +5024,7 @@
|
||||
+/****************************************************************************
|
||||
+* Linked List Structure *
|
||||
+****************************************************************************/
|
||||
+struct avNode {
|
||||
+static struct avNode {
|
||||
+ LIST_ENTRY ( avNode ) nodes;
|
||||
+ char *data; // pointer to data
|
||||
+};
|
||||
@@ -5649,12 +5648,10 @@
|
||||
+WriteMethod write_dot11SupportedRxAntenna;
|
||||
+WriteMethod write_dot11DiversitySelectionRx;
|
||||
+
|
||||
+void shutdown_ieee802dot11 ( void );
|
||||
+
|
||||
+#endif /* _MIBGROUP_IEEE802DOT11_H */
|
||||
--- /dev/null
|
||||
+++ b/agent/mibgroup/iwlib.h
|
||||
@@ -0,0 +1,509 @@
|
||||
@@ -0,0 +1,502 @@
|
||||
+/*
|
||||
+ * Wireless Tools
|
||||
+ *
|
||||
@@ -5686,9 +5683,6 @@
|
||||
+#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>
|
||||
+
|
||||
@@ -5745,10 +5739,6 @@
|
||||
+ && 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"
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
--- 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;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
--- a/agent/mibgroup/iwlib.h
|
||||
+++ b/agent/mibgroup/iwlib.h
|
||||
@@ -92,6 +92,10 @@
|
||||
#elif !defined(__GLIBC__) && LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0)
|
||||
#define GENERIC_HEADERS
|
||||
@@ -85,6 +85,10 @@
|
||||
&& LINUX_VERSION_CODE < KERNEL_VERSION(2,1,0)
|
||||
#define LIBC5_HEADERS
|
||||
|
||||
+/* Musl */
|
||||
+#elif !defined(__GLIBC__) && LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0)
|
||||
|
||||
@@ -1,130 +0,0 @@
|
||||
--- a/configure.d/config_modules_agent
|
||||
+++ b/configure.d/config_modules_agent
|
||||
@@ -27,8 +27,6 @@ done
|
||||
#
|
||||
AC_MSG_CHECKING([for and configuring mib modules to use])
|
||||
|
||||
-AH_TOP([#define NETSNMP_REQUIRE_SEMICOLON extern void netsnmp_unused_function(void)])
|
||||
-
|
||||
# set up the CPP command
|
||||
MODULECPP="$CPP $PARTIALTARGETFLAGS $CPPFLAGS -DNETSNMP_FEATURE_CHECKING -I${srcdir}/include -I${srcdir}/agent/mibgroup"
|
||||
if test "x$enable_mfd_rewrites" = "xyes"; then
|
||||
@@ -194,7 +192,7 @@ while test "x$new_module_list" != "x"; d
|
||||
# - mib_module => libnetsnmpmibs (default)
|
||||
# - agent_module => libnetsnmpagent
|
||||
#
|
||||
- AH_TOP([#define config_belongs_in(x) NETSNMP_REQUIRE_SEMICOLON])
|
||||
+ AH_TOP([#define config_belongs_in(x)])
|
||||
module_type=mib_module
|
||||
if test -f $srcdir/$mibdir/$i.h; then
|
||||
changequote(, )
|
||||
@@ -279,7 +277,7 @@ while test "x$new_module_list" != "x"; d
|
||||
#
|
||||
# check if $i has any conflicts
|
||||
#
|
||||
- AH_TOP([#define config_exclude(x) NETSNMP_REQUIRE_SEMICOLON])
|
||||
+ AH_TOP([#define config_exclude(x)])
|
||||
new_list_excl=`$MODULECPP module_tmp_header.h | \
|
||||
$SED -n 's/.*config_exclude(\(.*\)).*/\1/p'`
|
||||
if test "x$new_list_excl" != "x"; then
|
||||
@@ -308,7 +306,7 @@ while test "x$new_module_list" != "x"; d
|
||||
#
|
||||
# check if $i has any architecture specific requirements
|
||||
#
|
||||
- AH_TOP([#define config_arch_require(x,y) NETSNMP_REQUIRE_SEMICOLON])
|
||||
+ AH_TOP([#define config_arch_require(x,y)])
|
||||
changequote(, )
|
||||
new_list_arch=`$MODULECPP module_tmp_header.h | \
|
||||
$SED -n 's/.*config_arch_require( *\([^ ]*\) *, *\([^ ]*\) *).*/\1-xarchx-\2/p'`
|
||||
@@ -330,7 +328,7 @@ while test "x$new_module_list" != "x"; d
|
||||
# macro: config_version_require((base, version, version-modules, ...))
|
||||
# - lists alternative modules used from different versions.
|
||||
#
|
||||
- AH_TOP([#define config_version_require(x) NETSNMP_REQUIRE_SEMICOLON])
|
||||
+ AH_TOP([#define config_version_require(x)])
|
||||
[new_list_alt3=`$MODULECPP module_tmp_header.h | \
|
||||
$AWK '
|
||||
BEGIN {
|
||||
@@ -372,7 +370,7 @@ while test "x$new_module_list" != "x"; d
|
||||
#
|
||||
# check if $i has any other required modules
|
||||
#
|
||||
- AH_TOP([#define config_require(x) NETSNMP_REQUIRE_SEMICOLON])
|
||||
+ AH_TOP([#define config_require(x)])
|
||||
new_list="$new_list `$MODULECPP module_tmp_header.h | \
|
||||
$SED -n 's/.*config_require(\(.*\)).*/\1/p'`"
|
||||
AC_MSG_MODULE_DBG(" $i will test: $new_list")
|
||||
@@ -409,7 +407,7 @@ while test "x$new_module_list" != "x"; d
|
||||
#
|
||||
# check if $i has any mibs to add
|
||||
#
|
||||
- AH_TOP([#define config_add_mib(x) NETSNMP_REQUIRE_SEMICOLON])
|
||||
+ AH_TOP([#define config_add_mib(x)])
|
||||
new_mibs=`$MODULECPP module_tmp_header.h | \
|
||||
$SED -n 's/.*config_add_mib(\(.*\)).*/\1/p'`
|
||||
if test "x$new_mibs" != "x"; then
|
||||
@@ -456,7 +454,7 @@ while test "x$new_module_list" != "x"; d
|
||||
# check for config_parse_dot_conf
|
||||
# (generally not used any longer; old auto-load a .conf token)
|
||||
#
|
||||
- AH_TOP([#define config_parse_dot_conf(w,x,y,z) NETSNMP_REQUIRE_SEMICOLON])
|
||||
+ AH_TOP([#define config_parse_dot_conf(w,x,y,z)])
|
||||
changequote(, )
|
||||
$MODULECPP module_tmp_header.h | \
|
||||
$SED -n 's@.*config_parse_dot_conf(\([^)]*\), *\([^),]*\), *\([^),]*\), *\([^),]*\)).*@register_config_handler("snmpd",\1, \2, \3, \4);@p' >> $mibdir/mib_module_dot_conf.h
|
||||
@@ -468,7 +466,7 @@ while test "x$new_module_list" != "x"; d
|
||||
#
|
||||
# check if $i has any errors, or warnings
|
||||
#
|
||||
- AH_TOP([#define config_error(x) NETSNMP_REQUIRE_SEMICOLON])
|
||||
+ AH_TOP([#define config_error(x)])
|
||||
error=`$MODULECPP module_tmp_header.h | \
|
||||
$SED -n 's/.*config_error(\(.*\)).*/\1/p'`
|
||||
if test "x$error" != "x"; then
|
||||
@@ -481,7 +479,7 @@ while test "x$new_module_list" != "x"; d
|
||||
# macro: config_warning(warning text)
|
||||
# - used to signal a configuration "warning" to be printed to the user
|
||||
#
|
||||
- AH_TOP([#define config_warning(x) NETSNMP_REQUIRE_SEMICOLON])
|
||||
+ AH_TOP([#define config_warning(x)])
|
||||
warning=`$MODULECPP module_tmp_header.h | \
|
||||
$SED -n 's/.*config_warning(\(.*\)).*/\1/p'`
|
||||
if test "x$warning" != "x"; then
|
||||
--- a/include/net-snmp/net-snmp-config.h.in
|
||||
+++ b/include/net-snmp/net-snmp-config.h.in
|
||||
@@ -36,25 +36,25 @@
|
||||
|
||||
/* definitions added by configure on-the-fly */
|
||||
|
||||
-#define config_parse_dot_conf(w,x,y,z) NETSNMP_REQUIRE_SEMICOLON
|
||||
+#define config_parse_dot_conf(w,x,y,z)
|
||||
|
||||
-#define config_error(x) NETSNMP_REQUIRE_SEMICOLON
|
||||
+#define config_error(x)
|
||||
|
||||
-#define config_warning(x) NETSNMP_REQUIRE_SEMICOLON
|
||||
+#define config_warning(x)
|
||||
|
||||
-#define NETSNMP_REQUIRE_SEMICOLON extern void netsnmp_unused_function(void)
|
||||
+#define extern void netsnmp_unused_function(void)
|
||||
|
||||
-#define config_belongs_in(x) NETSNMP_REQUIRE_SEMICOLON
|
||||
+#define config_belongs_in(x)
|
||||
|
||||
-#define config_exclude(x) NETSNMP_REQUIRE_SEMICOLON
|
||||
+#define config_exclude(x)
|
||||
|
||||
-#define config_arch_require(x,y) NETSNMP_REQUIRE_SEMICOLON
|
||||
+#define config_arch_require(x,y)
|
||||
|
||||
-#define config_version_require(x) NETSNMP_REQUIRE_SEMICOLON
|
||||
+#define config_version_require(x)
|
||||
|
||||
-#define config_require(x) NETSNMP_REQUIRE_SEMICOLON
|
||||
+#define config_require(x)
|
||||
|
||||
-#define config_add_mib(x) NETSNMP_REQUIRE_SEMICOLON
|
||||
+#define config_add_mib(x)
|
||||
|
||||
/* Define to 1 if using 'alloca.c'. */
|
||||
#undef C_ALLOCA
|
||||
Reference in new issue
Block a user