🤞 Sync 2026-04-23 06:19:46

This commit is contained in:
github-actions[bot] committed 2026-04-23 06:19:46 +08:00
1 parent a1df15cd3d
commit b86d032e91
250 files changed
+41507 -188

No files matched your search

+14
View File
@@ -0,0 +1,14 @@
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
+287
View File
@@ -0,0 +1,287 @@
#
# Copyright (C) 2006-2017 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=net-snmp
PKG_VERSION:=5.9.4
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=@SF/net-snmp
PKG_HASH:=skip
PKG_MAINTAINER:=Stijn Tintel <stijn@linux-ipv6.be>
PKG_LICENSE:=MIT BSD-3-Clause-Clear
PKG_CPE_ID:=cpe:/a:net-snmp:net-snmp
PKG_FIXUP:=autoreconf
include $(INCLUDE_DIR)/package.mk
define Package/net-snmp-ssl/Default
SECTION:=net
CATEGORY:=Network
URL:=http://www.net-snmp.org/
endef
define Package/net-snmp-ssl/Default/description
Simple Network Management Protocol (SNMP) is a widely used protocol for
monitoring the health and welfare of network equipment (eg. routers),
computer equipment and even devices like UPSs. Net-SNMP is a suite of
applications used to implement SNMP v1, SNMP v2c and SNMP v3 using both
IPv4 and IPv6.
endef
define Package/libnetsnmp-ssl
$(call Package/net-snmp-ssl/Default)
SECTION:=libs
CATEGORY:=Libraries
DEPENDS:=+libnl-tiny +libpci +libpcre2 +libopenssl
TITLE:=Open source SNMP implementation (libraries)
endef
define Package/libnetsnmp-ssl/description
$(call Package/net-snmp-ssl/Default/description)
.
This package contains shared libraries, needed by other programs.
endef
define Package/snmp-mibs-ssl
$(call Package/net-snmp-ssl/Default)
TITLE:=Open source SNMP implementation (MIB-files)
endef
define Package/snmp-mibs-ssl/description
$(call Package/net-snmp-ssl/Default/description)
.
This package contains SNMP MIB-Files.
endef
define Package/snmp-utils-ssl
$(call Package/net-snmp-ssl/Default)
DEPENDS:=+libnetsnmp-ssl
TITLE:=Open source SNMP implementation (utilities)
endef
define Package/snmp-utils-ssl/description
$(call Package/net-snmp-ssl/Default/description)
.
This package contains SNMP client utilities:
- snmpget
- snmpset
- snmpstatus
- snmptest
- snmptrap
- snmpwalk
endef
define Package/snmpd-ssl
$(call Package/net-snmp-ssl/Default)
DEPENDS:=+libnetsnmp-ssl
TITLE:=Open source SNMP implementation (daemon)
endef
define Package/snmpd-ssl/description
$(call Package/net-snmp-ssl/Default/description)
.
This package contains the SNMP agent, dynamically linked.
endef
define Package/snmpd-static-ssl
$(call Package/net-snmp-ssl/Default)
DEPENDS:=+snmpd-ssl
TITLE:=Open source SNMP implementation (daemon)
BUILDONLY:=1
endef
define Package/snmptrapd-ssl
$(call Package/net-snmp-ssl/Default)
DEPENDS:=+libnetsnmp-ssl
TITLE:=Open source SNMP implementation (notification receiver)
endef
define Package/snmptrapd-ssl/description
$(call Package/net-snmp-ssl/Default/description)
.
This package contains the SNMP notification receiver.
endef
SNMP_MIB_MODULES_INCLUDED = \
agent/extend \
agentx \
host/hr_device \
host/hr_disk \
host/hr_filesys \
host/hr_network \
host/hr_partition \
host/hr_proc \
host/hr_storage \
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 \
mibII/ip \
mibII/snmp_mib \
mibII/sysORTable \
mibII/system_mib \
mibII/tcp \
mibII/udp \
mibII/vacm_context \
mibII/vacm_vars \
snmpv3/snmpEngine \
snmpv3/snmpMPDStats \
snmpv3/usmConf \
snmpv3/usmStats \
snmpv3/usmUser \
tunnel \
ucd-snmp/disk_hw \
ucd-snmp/dlmod \
ucd-snmp/extensible \
ucd-snmp/loadave \
ucd-snmp/memory \
ucd-snmp/pass \
ucd-snmp/pass_persist \
ucd-snmp/proc \
ucd-snmp/vmstat \
util_funcs \
utilities/execute \
SNMP_MIB_MODULES_EXCLUDED = \
agent_mibs \
disman/event \
disman/schedule \
hardware \
host \
if-mib \
ip-mib \
mibII \
notification \
notification-log-mib \
snmpv3mibs \
target \
tcp-mib \
ucd_snmp \
udp-mib \
utilities \
SNMP_TRANSPORTS_INCLUDED = Callback UDP Unix
SNMP_TRANSPORTS_EXCLUDED = TCP TCPIPv6
TARGET_CFLAGS += $(FPIC)
TARGET_CPPFLAGS += -I$(STAGING_DIR)/usr/include/libnl-tiny
CONFIGURE_ARGS += \
--enable-mfd-rewrites \
--enable-shared \
--enable-static \
--with-endianness=$(if $(CONFIG_BIG_ENDIAN),big,little) \
--with-logfile=/var/log/snmpd.log \
--with-persistent-directory=/usr/lib/snmp/ \
--with-default-snmp-version=1 \
--with-sys-contact=root@localhost \
--with-sys-location=Unknown \
--enable-applications \
--disable-debugging \
--disable-manuals \
--disable-scripts \
--with-out-mib-modules="$(SNMP_MIB_MODULES_EXCLUDED)" \
--with-mib-modules="$(SNMP_MIB_MODULES_INCLUDED)" \
--with-out-transports="$(SNMP_TRANSPORTS_EXCLUDED)" \
--with-transports="$(SNMP_TRANSPORTS_INCLUDED)" \
--without-openssl \
--without-libwrap \
--without-mysql \
--without-rpm \
--without-zlib \
--with-pcre2-8 \
--with-nl \
$(call autoconf_bool,CONFIG_IPV6,ipv6) \
--disable-perl-cc-checks \
--disable-embedded-perl \
--without-perl-modules
CONFIGURE_VARS += \
ac_cv_header_netlink_netlink_h=yes \
netsnmp_cv_func_nl_connect_LIBS=-lnl-tiny \
ifeq ($(CONFIG_IPV6),y)
SNMP_TRANSPORTS_INCLUDED+= UDPIPv6
endif
define Build/Compile
$(MAKE) -C $(PKG_BUILD_DIR) \
INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \
LDFLAGS="$(TARGET_LDFLAGS) -lm -lc" \
all install
endef
define Build/InstallDev
$(INSTALL_DIR) $(2)/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/net-snmp-config $(2)/bin/
$(SED) 's,=/usr,=$(STAGING_DIR)/usr,g' $(2)/bin/net-snmp-config
$(INSTALL_DIR) $(STAGING_DIR)/usr/bin
$(LN) $(STAGING_DIR)/host/bin/net-snmp-config $(STAGING_DIR)/usr/bin/
$(INSTALL_DIR) $(1)/usr/include
$(CP) $(PKG_INSTALL_DIR)/usr/include/net-snmp $(1)/usr/include/
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libnetsnmp{,agent,helpers,mibs}.{a,so*} $(1)/usr/lib/
endef
define Package/libnetsnmp-ssl/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libnetsnmp{,agent,helpers,mibs}.so.* $(1)/usr/lib/
endef
define Package/snmp-mibs-ssl/install
$(INSTALL_DIR) $(1)/usr/share/snmp/mibs
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/snmp/mibs/* $(1)/usr/share/snmp/mibs/
endef
define Package/snmp-utils-ssl/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/snmp{get,set,status,test,trap,walk} $(1)/usr/bin/
endef
define Package/snmpd-ssl/install
$(INSTALL_DIR) $(1)/etc/snmp
$(LN) /var/run/snmpd.conf $(1)/etc/snmp/
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/snmpd.init $(1)/etc/init.d/snmpd
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/snmpd $(1)/usr/sbin/snmpd
endef
define Package/snmptrapd-ssl/install
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/snmptrapd.init $(1)/etc/init.d/snmptrapd
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libnetsnmptrapd.so.* $(1)/usr/lib/
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/snmptrapd $(1)/usr/sbin/
endef
$(eval $(call BuildPackage,libnetsnmp-ssl))
$(eval $(call BuildPackage,snmp-mibs-ssl))
$(eval $(call BuildPackage,snmp-utils-ssl))
$(eval $(call BuildPackage,snmpd-ssl))
$(eval $(call BuildPackage,snmpd-static-ssl))
$(eval $(call BuildPackage,snmptrapd-ssl))
+417
View File
@@ -0,0 +1,417 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2008 OpenWrt.org
START=99
USE_PROCD=1
PROG="/usr/sbin/snmpd"
CONFIGFILE="/var/run/snmpd.conf"
CONFIGFILE2="/usr/lib/snmp/snmpd.conf"
snmpd_agent_add() {
local cfg="$1"
config_get agentaddress "$cfg" agentaddress
[ -n "$agentaddress" ] || return 0
echo "agentaddress $agentaddress" >> $CONFIGFILE
}
snmpd_agentx_add() {
local cfg="$1"
echo "master agentx" >> $CONFIGFILE
config_get agentxsocket "$cfg" agentxsocket
[ -n "$agentxsocket" ] && echo "agentXSocket $agentxsocket" >> $CONFIGFILE
}
snmpd_system_add() {
local cfg="$1"
config_get syslocation "$cfg" sysLocation
[ -n "$syslocation" ] && echo "sysLocation $syslocation" >> $CONFIGFILE
config_get syscontact "$cfg" sysContact
[ -n "$syscontact" ] && echo "sysContact $syscontact" >> $CONFIGFILE
config_get sysname "$cfg" sysName
[ -n "$sysname" ] && echo "sysName $sysname" >> $CONFIGFILE
config_get sysservice "$cfg" sysService
[ -n "$sysservice" ] && echo "sysService $sysservice" >> $CONFIGFILE
config_get sysdescr "$cfg" sysDescr
[ -n "$sysdescr" ] && echo "sysDescr $sysdescr" >> $CONFIGFILE
config_get sysobjectid "$cfg" sysObjectID
[ -n "$sysobjectid" ] && echo "sysObjectID $sysobjectid" >> $CONFIGFILE
}
snmpd_com2sec_add() {
local cfg="$1"
config_get secname "$cfg" secname
[ -n "$secname" ] || return 0
config_get source "$cfg" source
[ -n "$source" ] || return 0
config_get community "$cfg" community
[ -n "$community" ] || return 0
echo "com2sec $secname $source $community" >> $CONFIGFILE
}
snmpd_com2sec6_add() {
local cfg="$1"
config_get secname "$cfg" secname
[ -n "$secname" ] || return 0
config_get source "$cfg" source
[ -n "$source" ] || return 0
config_get community "$cfg" community
[ -n "$community" ] || return 0
echo "com2sec6 $secname $source $community" >> $CONFIGFILE
}
snmpd_group_add() {
local cfg="$1"
config_get group "$cfg" group
[ -n "$group" ] || return 0
config_get version "$cfg" version
[ -n "$version" ] || return 0
config_get secname "$cfg" secname
[ -n "$secname" ] || return 0
echo "group $group $version $secname" >> $CONFIGFILE
}
snmpd_view_add() {
local cfg="$1"
config_get viewname "$cfg" viewname
[ -n "$viewname" ] || return 0
config_get type "$cfg" type
[ -n "$type" ] || return 0
config_get oid "$cfg" oid
[ -n "$oid" ] || return 0
# optional mask
config_get mask "$cfg" mask
echo "view $viewname $type $oid $mask" >> $CONFIGFILE
}
snmpd_access_add() {
local cfg="$1"
config_get group "$cfg" group
[ -n "$group" ] || return 0
config_get context "$cfg" context
[ -n $context ] || return 0
[ "$context" == "none" ] && context='""'
config_get version "$cfg" version
[ -n "$version" ] || return 0
config_get level "$cfg" level
[ -n "$level" ] || return 0
config_get prefix "$cfg" prefix
[ -n "$prefix" ] || return 0
config_get read "$cfg" read
[ -n "$read" ] || return 0
config_get write "$cfg" write
[ -n "$write" ] || return 0
config_get notify "$cfg" notify
[ -n "$notify" ] || return 0
echo "access $group $context $version $level $prefix $read $write $notify" >> $CONFIGFILE
}
snmpd_trap_hostname_add() {
local cfg="$1"
config_get hostname "$cfg" HostName
config_get port "$cfg" Port
config_get community "$cfg" Community
config_get type "$cfg" Type
echo "$type $hostname $community $port" >> $CONFIGFILE
}
snmpd_trap_ip_add() {
local cfg="$1"
config_get host_ip "$cfg" HostIP
config_get port "$cfg" Port
config_get community "$cfg" Community
config_get type "$cfg" Type
echo "$type $host_ip $community $port" >> $CONFIGFILE
}
snmpd_access_default_add() {
local cfg="$1"
config_get mode "$cfg" Mode
config_get community "$cfg" CommunityName
config_get oidrestrict "$cfg" RestrictOID
config_get oid "$cfg" RestrictedOID
echo -n "$mode $community default" >> $CONFIGFILE
[ "$oidrestrict" == "yes" ] && echo " $oid" >> $CONFIGFILE
[ "$oidrestrict" == "no" ] && echo "" >> $CONFIGFILE
}
snmpd_access_HostName_add() {
local cfg="$1"
config_get hostname "$cfg" HostName
config_get mode "$cfg" Mode
config_get community "$cfg" CommunityName
config_get oidrestrict "$cfg" RestrictOID
config_get oid "$cfg" RestrictedOID
echo -n "$mode $community $hostname" >> $CONFIGFILE
[ "$oidrestrict" == "yes" ] && echo " $oid" >> $CONFIGFILE
[ "$oidrestrict" == "no" ] && echo "" >> $CONFIGFILE
}
snmpd_access_HostIP_add() {
local cfg="$1"
config_get host_ip "$cfg" HostIP
config_get ip_mask "$cfg" IPMask
config_get mode "$cfg" Mode
config_get community "$cfg" CommunityName
config_get oidrestrict "$cfg" RestrictOID
config_get oid "$cfg" RestrictedOID
echo -n "$mode $community $host_ip/$ip_mask" >> $CONFIGFILE
[ "$oidrestrict" == "yes" ] && echo " $oid" >> $CONFIGFILE
[ "$oidrestrict" == "no" ] && echo "" >> $CONFIGFILE
}
snmpd_pass_add() {
local cfg="$1"
local pass='pass'
config_get miboid "$cfg" miboid
[ -n "$miboid" ] || return 0
config_get prog "$cfg" prog
[ -n "$prog" ] || return 0
config_get_bool persist "$cfg" persist 0
[ $persist -ne 0 ] && pass='pass_persist'
config_get priority "$cfg" priority
priority=${priority:+-p $priority}
echo "$pass $priority $miboid $prog" >> $CONFIGFILE
}
snmpd_exec_add() {
local cfg="$1"
config_get name "$cfg" name
[ -n "$name" ] || return 0
config_get prog "$cfg" prog
[ -n "$prog" ] || return 0
config_get args "$cfg" args
config_get miboid "$cfg" miboid
echo "exec $miboid $name $prog $args" >> $CONFIGFILE
}
snmpd_extend_add() {
local cfg="$1"
config_get name "$cfg" name
[ -n "$name" ] || return 0
config_get prog "$cfg" prog
[ -n "$prog" ] || return 0
config_get args "$cfg" args
config_get miboid "$cfg" miboid
echo "extend $miboid $name $prog $args" >> $CONFIGFILE
}
snmpd_disk_add() {
local cfg="$1"
local disk='disk'
config_get partition "$cfg" partition
[ -n "$partition" ] || return 0
config_get size "$cfg" size
[ -n "$size" ] || return 0
echo "$disk $partition $size" >> $CONFIGFILE
}
snmpd_engineid_add() {
local cfg="$1"
config_get engineid "$cfg" engineid
[ -n "$engineid" ] && echo "engineID $engineid" >> $CONFIGFILE
config_get engineidtype "$cfg" engineidtype
[ "$engineidtype" -ge 1 -a "$engineidtype" -le 3 ] && \
echo "engineIDType $engineidtype" >> $CONFIGFILE
config_get engineidnic "$cfg" engineidnic
[ -n "$engineidnic" ] && echo "engineIDNic $engineidnic" >> $CONFIGFILE
}
snmpd_sink_add() {
local cfg="$1"
local section="$2"
local community
local port
local host
config_get host "$cfg" host
[ -n "section" -a -n "$host" ] || return 0
# optional community
config_get community "$cfg" community
# optional port
config_get port "$cfg" port
port=${port:+:$port}
echo "$section $host$port $community" >> $CONFIGFILE
}
append_parm() {
local section="$1"
local option="$2"
local switch="$3"
local _loctmp
config_get _loctmp "$section" "$option"
[ -z "$_loctmp" ] && return 0
echo "$switch $_loctmp" >> $CONFIGFILE
}
append_authtrapenable() {
local section="$1"
local option="$2"
local switch="$3"
local _loctmp
config_get_bool _loctmp "$section" "$option"
[ -z "$_loctmp" ] && return 0
[ "$_loctmp" -gt 0 ] && echo "$switch $_loctmp" >> $CONFIGFILE
}
snmpd_setup_fw_rules() {
local net="$1"
local zone
zone=$(fw3 -q network "$net" 2>/dev/null)
local handled_zone
for handled_zone in $HANDLED_SNMP_ZONES; do
[ "$handled_zone" = "$zone" ] && return
done
json_add_object ""
json_add_string type rule
json_add_string src "$zone"
json_add_string proto udp
json_add_string dest_port 161
json_add_string target ACCEPT
json_close_object
HANDLED_SNMP_ZONES="$HANDLED_SNMP_ZONES $zone"
}
snmpd_v3_add() {
local section="$1"
config_get mode "$section" mode
if [[ "$mode" != "v1_v2c_v3" ]] && [[ "$mode" != "v3" ]]; then
return
fi
config_get security_name "$section" security_name
[ -n "$security_name" ] || return
config_get security_type "$section" security_type
[ -n "$security_type" ] || return
config_get v3_mode "$section" v3_mode
[ -n "$v3_mode" ] || return
config_get auth_prot "$section" auth_prot
config_get auth_pass "$section" auth_pass
config_get priv_prot "$section" priv_prot
config_get priv_pass "$section" priv_pass
case "$security_type" in
"noAuthNoPriv" )
echo "createUser $security_name" >> $CONFIGFILE
echo "$v3_mode $security_name noauth" >> $CONFIGFILE
;;
"authNoPriv" )
if [[ -z "$auth_prot" ]] || [[ -z "$auth_pass" ]]; then
return
fi
echo "createUser $security_name $auth_prot \"$auth_pass\"" >> $CONFIGFILE
echo "$v3_mode $security_name auth" >> $CONFIGFILE
;;
"authPriv" )
if [[ -z "$auth_prot" ]] || [[ -z "$auth_pass" ]]; then
return
fi
if [[ -z "$priv_prot" ]] || [[ -z "$priv_pass" ]]; then
return
fi
echo "createUser $security_name $auth_prot \"$auth_pass\" $priv_prot \"$priv_pass\"" >> $CONFIGFILE
echo "$v3_mode $security_name priv" >> $CONFIGFILE
;;
esac
}
start_service() {
[ -f "$CONFIGFILE" ] && rm -f "$CONFIGFILE"
[ -f "$CONFIGFILE2" ] && sed -i '/usmUser/d' "$CONFIGFILE2"
config_load snmpd
config_get_bool snmp_enabled general enabled 1
[ "$snmp_enabled" -eq 0 ] && return
config_get ip_family general ip_family
config_get mode general mode
procd_open_instance
config_foreach snmpd_agent_add agent
config_foreach snmpd_agentx_add agentx
config_foreach snmpd_system_add system
if [[ "$mode" == "v1_v2c_v3" ]] || [[ "$mode" == "v1_v2c" ]]; then
if [[ "$ip_family" == "ipv4" || "$ip_family" == "both" ]]; then
config_foreach snmpd_com2sec_add com2sec
fi
if [[ "$ip_family" == "ipv6" || "$ip_family" == "both" ]]; then
config_foreach snmpd_com2sec6_add com2sec6
fi
fi
config_foreach snmpd_group_add group
config_foreach snmpd_view_add view
config_foreach snmpd_access_add access
config_foreach snmpd_trap_hostname_add trap_HostName
config_foreach snmpd_trap_ip_add trap_HostIP
config_foreach snmpd_access_default_add access_default
config_foreach snmpd_access_HostName_add access_HostName
config_foreach snmpd_access_HostIP_add access_HostIP
config_foreach snmpd_pass_add pass
config_foreach snmpd_exec_add exec
config_foreach snmpd_extend_add extend
config_foreach snmpd_disk_add disk
config_foreach snmpd_engineid_add engineid
append_parm trapcommunity community trapcommunity
config_foreach snmpd_sink_add trapsink trapsink
config_foreach snmpd_sink_add trap2sink trap2sink
config_foreach snmpd_sink_add informsink informsink
config_foreach snmpd_v3_add snmpd
append_authtrapenable authtrapenable enable authtrapenable
append_parm v1trapaddress host v1trapaddress
append_parm trapsess trapsess trapsess
procd_set_param command $PROG -Lf /dev/null -f -r
procd_set_param file $CONFIGFILE
procd_set_param respawn
for iface in $(ls /sys/class/net 2>/dev/null); do
procd_append_param netdev "$iface"
done
procd_open_data
json_add_array firewall
config_list_foreach general network snmpd_setup_fw_rules
json_close_array
procd_close_data
procd_close_instance
}
stop_service() {
[ -f "$CONFIGFILE" ] || return
rm -f "$CONFIGFILE"
procd_set_config_changed firewall
}
reload_service() {
stop
start
}
service_triggers(){
local script=$(readlink "$initscript")
local name=$(basename ${script:-$initscript})
procd_open_trigger
procd_add_raw_trigger "interface.*" 2000 /etc/init.d/$name reload
procd_close_trigger
procd_add_reload_trigger 'snmpd'
}
service_started() {
[ "$snmp_enabled" -eq 0 ] && return
procd_set_config_changed firewall
}
+15
View File
@@ -0,0 +1,15 @@
#!/bin/sh /etc/rc.common
START=50
USE_PROCD=1
PROG="/usr/sbin/snmptrapd"
start_service() {
procd_open_instance
procd_set_param command $PROG -Lf /dev/null -f
procd_set_param respawn
procd_close_instance
}
@@ -0,0 +1,47 @@
From: Jo-Philipp Wich <jo@mein.io>
Date: Fri, 6 Jan 2017 13:41:00 +0100
Subject: [PATCH] configure: allow overriding hardcoded /usr/include/libnl3
In a cross-compile setting we do not want to probe the host systems
/usr/include path, therfore allow to disable this include path by passing
ac_cv_header_netlink_netlink_h=yes to configure.
Also disable the testing for libraries providing nl_connect when
netsnmp_cv_func_nl_connect_LIBS is predefined since the proprietary
NETSNMP_SEARCH_LIBS() macro will clobber the internal link flags upon
encountering predefined cache variables, causing all subsequent configure
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)
netsnmp_save_CPPFLAGS="$CPPFLAGS"
- CPPFLAGS="${LIBNL3_CFLAGS} ${LIBNLROUTE3_CFLAGS} $CPPFLAGS"
- NETSNMP_SEARCH_LIBS(nl_connect, nl-3,
- [AC_CHECK_HEADERS(netlink/netlink.h)
- EXTERNAL_MIBGROUP_INCLUDES="$EXTERNAL_MIBGROUP_INCLUDES ${LIBNL3_CFLAGS}"],
- [CPPFLAGS="$netsnmp_save_CPPFLAGS"], [], [LMIBLIBS])
+ netsnmp_netlink_include_flags=""
if test "x$ac_cv_header_netlink_netlink_h" != xyes; then
- NETSNMP_SEARCH_LIBS(nl_connect, nl, [
- AC_CHECK_HEADERS(netlink/netlink.h)], [], [], LMIBLIBS)
+ netsnmp_netlink_include_flags="-I/usr/include/libnl3"
+ fi
+ CPPFLAGS="$netsnmp_netlink_include_flags $CPPFLAGS"
+ if test "x$netsnmp_cv_func_nl_connect_LIBS" = x; then
+ NETSNMP_SEARCH_LIBS(nl_connect, nl-3,
+ [AC_CHECK_HEADERS(netlink/netlink.h)
+ EXTERNAL_MIBGROUP_INCLUDES="$EXTERNAL_MIBGROUP_INCLUDES $netsnmp_netlink_include_flags"],
+ [CPPFLAGS="$netsnmp_save_CPPFLAGS"], [], [], [LMIBLIBS])
+ if test "x$ac_cv_header_netlink_netlink_h" != xyes; then
+ NETSNMP_SEARCH_LIBS(nl_connect, nl, [
+ AC_CHECK_HEADERS(netlink/netlink.h)], [], [], LMIBLIBS)
+ fi
+ else
+ LMIBLIBS="$LMIBLIBS $netsnmp_cv_func_nl_connect_LIBS"
fi
if test "x$ac_cv_header_netlink_netlink_h" = xyes; then
AC_EGREP_HEADER([nl_socket_free], [netlink/socket.h],
@@ -0,0 +1,34 @@
From 9588b5c9c27239b1f8c02f0bf417f13735e93225 Mon Sep 17 00:00:00 2001
From: Stijn Tintel <stijn@linux-ipv6.be>
Date: Sat, 26 Sep 2020 04:34:18 +0300
Subject: [PATCH] HOST-MIB, hr_filesys: fix compile error
On non-AIX systems without getfsstat, a variable is being declared right
after a label. This is a violation of the C language standard, and
causes the following compile error:
host/hr_filesys.c: In function 'Get_Next_HR_FileSys':
host/hr_filesys.c:752:5: error: a label can only be part of a statement and a declaration is not a statement
const char **cpp;
^~~~~
Fix the problem by adding an empty statement after the label.
Fixes: 22e1371bb1fd ("HOST-MIB, hr_filesys: Convert recursion into iteration")
Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
---
agent/mibgroup/host/hr_filesys.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/agent/mibgroup/host/hr_filesys.c
+++ b/agent/mibgroup/host/hr_filesys.c
@@ -718,7 +718,7 @@ static const char *HRFS_ignores[] = {
int
Get_Next_HR_FileSys(void)
{
-next:
+next: ;
#ifdef HAVE_GETFSSTAT
if (HRFS_index >= fscount)
return -1;
@@ -0,0 +1,13 @@
--- a/agent/mibgroup/mibII/interfaces.c
+++ b/agent/mibgroup/mibII/interfaces.c
@@ -1586,6 +1586,10 @@ Interface_Scan_Init(void)
char *stats, *ifstart = line;
size_t len;
+ /* Ignore interfaces with no statistics. */
+ if (strstr(line, "No statistics available."))
+ continue;
+
len = strlen(line);
if (len && line[len - 1] == '\n')
line[len - 1] = '\0';
@@ -0,0 +1,40 @@
--- a/local/Makefile.in
+++ b/local/Makefile.in
@@ -101,7 +101,7 @@ tkmib.made: $(srcdir)/tkmib
mib2c.made: $(srcdir)/mib2c
if test "x$(PERL)" != "x" ; then \
- $(PERL) -p -e 's%^#!.*/perl.*%#!$(PERL)%;s#/usr/local/share/snmp#$(snmplibdir)#;' ${srcdir}/mib2c > mib2c.made; \
+ $(PERL) -p -e 's%^#!.*/perl.*%#!$(PERL)%;s#/usr/local/share/snmp#$(snmplibdir)#;s#/usr/local/etc/snmp#$(SNMPCONFPATH)#;' ${srcdir}/mib2c > mib2c.made; \
else \
touch mib2c.made; \
fi
--- a/Makefile.top
+++ b/Makefile.top
@@ -28,6 +28,7 @@ man8dir = $(mandir)/man8
snmplibdir = $(datadir)/snmp
mibdir = $(snmplibdir)/mibs
persistentdir = @PERSISTENT_DIRECTORY@
+sysconfdir = @sysconfdir@
DESTDIR = @INSTALL_PREFIX@
INSTALL_PREFIX = $(DESTDIR)
--- a/mibs/Makefile.in
+++ b/mibs/Makefile.in
@@ -47,11 +47,15 @@ NETSNMPMIBS = NET-SNMP-TC.txt NET-SNMP-M
UCDMIBS = UCD-SNMP-MIB.txt UCD-DEMO-MIB.txt UCD-IPFWACC-MIB.txt \
UCD-DLMOD-MIB.txt UCD-DISKIO-MIB.txt
+EXTRAMIBS = BGP4-MIB.txt BRIDGE-MIB.txt GNOME-SMI.txt OSPF-MIB.txt \
+ OSPF-TRAP-MIB.txt RIPv2-MIB.txt SOURCE-ROUTING-MIB.txt \
+ LM-SENSORS-MIB.txt
+
DEFAULTMIBS = @default_mibs_install@
MIBS = $(V1MIBS) $(V2MIBS) $(V3MIBS) $(RFCMIBS) \
$(AGENTMIBS) $(IANAMIBS) \
- $(NETSNMPMIBS) $(UCDMIBS) $(DEFAULTMIBS)
+ $(NETSNMPMIBS) $(UCDMIBS) $(DEFAULTMIBS) $(EXTRAMIBS)
all: standardall
@@ -0,0 +1,14 @@
--- a/local/mib2c
+++ b/local/mib2c
@@ -61,8 +61,9 @@ $currentlevel = -1;
if($ENV{MIB2C_DIR}) {
push @def_search_dirs, split(/:/, $ENV{MIB2C_DIR});
}
-push @def_search_dirs, "/usr/local/share/snmp/";
-push @def_search_dirs, "/usr/local/share/snmp/mib2c-data";
+push @def_search_dirs, "/etc/snmp/";
+push @def_search_dirs, "/usr/share/snmp/";
+push @def_search_dirs, "/usr/share/snmp/mib2c-data";
push @def_search_dirs, "./mib2c-conf.d";
sub usage {
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,11 @@
--- a/configure
+++ b/configure
@@ -16599,7 +16599,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'
- finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+ finish_cmds=''
shlibpath_var=LD_LIBRARY_PATH
shlibpath_overrides_runpath=no
@@ -0,0 +1,11 @@
--- 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>
+11
View File
@@ -0,0 +1,11 @@
--- a/Makefile.top
+++ b/Makefile.top
@@ -87,7 +87,7 @@ LIBCURRENT = 42
LIBAGE = 2
LIBREVISION = 1
-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_EXTENSION = la
LIB_VERSION =
LIB_LDCONFIG_CMD = $(LIBTOOL) --mode=finish $(INSTALL_PREFIX)$(libdir)
@@ -0,0 +1,407 @@
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>.
@@ -0,0 +1,185 @@
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
@@ -0,0 +1,152 @@
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) {
@@ -0,0 +1,30 @@
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)
File diff suppressed because it is too large. Load diff
+10
View File
@@ -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;
@@ -0,0 +1,13 @@
--- 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
+/* 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"
@@ -0,0 +1,130 @@
--- 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