82 Commits

Author SHA1 Message Date
Eric McDonald
93983e5b2a net-snmp: fix literal string test in snmpd_sink_add
The function snmpd_sink_add() has a guard clause that tests the literal
string "section", not the variable value "$section".

The test `[ -n "section" ]` always evaluates to true because the string
literal "section" is non-empty, making the check useless.

This function is only called internally with hardcoded arguments, so the
bug has no actual impact currently. For the same reason, this change
should not break existing configurations. However, I think it should be
fixed so future callers do not have a false sense of security.

Signed-off-by: Eric McDonald <librick-openwrt@proton.me>
2025-12-14 23:52:39 +02:00
Christian Korber
05d604a9fb packages/net-snmp: fix typo
CONFILTS is changed to CONFLICTS to enable condition.

Signed-off-by: Christian Korber <ck@dev.tdt.de>
2025-08-14 22:42:02 +03:00
Florian Eckert
f9f7e388ba net-snmp: fix recursive dependency
Fixes recursive dependency during 'make menuconfig'

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2025-08-11 14:44:37 +02:00
Florian Eckert
b0845b93ff net-snmp: bump PKG_RELEASE
Bump PKG_RELEASE by one.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2025-08-11 08:13:44 +02:00
Christian Korber
035c279d56 net-snmp: save pid to file
This commit saves the pid to a file in '/var/run'.

Signed-off-by: Christian Korber <ck@dev.tdt.de>
2025-08-11 08:13:44 +02:00
Christian Korber
7b616873d6 net-snmp: add logging to init script
To support logging in net-snmp this commit introduces this feature. There is
a new uci config section 'logging'.

The following new parameters are used:

config logging
	option log_file '/var/log/snmpd.log'
	option log_file_priority 'i'
	option log_syslog '0'
	option log_syslog_facility 'd'

Signed-off-by: Christian Korber <ck@dev.tdt.de>
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2025-08-11 08:13:44 +02:00
Christian Korber
2fc221699d net-snmp: modify init script for SNMPv3
This commit adds function 'snmpd_snmpv3_add' to the init script
to support SNMPv3 config parsing.

The new uci config section has the following configuration parameters:

config v3
	option username 'John'
	option allow_write '0'
	option auth_type 'SHA|MD5'
	option auth_pass 'passphrase'
	option privacy_type 'AES|DES'
	option privacy_pass 'passphrase'
	option RestrictOID 'yes|no'
	option RestrictedOID '1.3.6.1.2.1.1.1'

This new section is only relevant if the snmp_version 'v1/v2c/v3' or 'v3'
is set in the uci section 'general'.

Signed-off-by: Christian Korber <ck@dev.tdt.de>
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2025-08-11 08:13:44 +02:00
Florian Eckert
7013ea4bce net-snmp: add ssl build variant to support SNMPv3
Add build variant 'ssl' to support SNMPv3.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2025-08-11 08:13:44 +02:00
Christian Korber
b3530cc188 net-snmp: rename package to 'nossl' to support SNMPv3 'ssl' variant
To use 'SNMPv3', the net-snmp package must be compiled with openssl support.
For this purpose, the current net-snmp is renamed into build 'nossl'.

This is a preparation commit to add the 'ssl' variant.

Signed-off-by: Christian Korber <ck@dev.tdt.de>
2025-08-11 08:13:44 +02:00
Florian Eckert
c08e7f411b net-snmp: remove not needed snmpd-static build
The static build is not packaged and can therefore be removed as the build
artefact is not used.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2025-08-11 08:13:44 +02:00
Christian Korber
dcad31d88c net-snmp: add system to trigger
In a previous commit (0b12bee) hostname was added to
snmpd.init. To track changes in system, the init file
needs to add 'system' to the trigger.
Therefore it is added in this commit.

Fixes: 0b12bee66a ("net-snmp: set hostname as sysname")

Signed-off-by: Christian Korber <ck@dev.tdt.de>
2025-04-30 13:20:23 +03:00
Wei-Ting Yang
babc163fe3 net-snmp: fix PRIdPTR macro undefined error
This commit includes inttypes.h to prevent the following error:

```
mibgroup/ieee802dot11.c: In function 'displayWiExt':
mibgroup/ieee802dot11.c:4563:26: error: expected ')' before 'PRIdPTR'
 4563 |     printf ( "%s sens: %" PRIdPTR "\n", "SIOCGIWSENS", *(intptr_t *)&info.sens );
      |            ~             ^~~~~~~~
      |                          )
mibgroup/ieee802dot11.c:31:1: note: 'PRIdPTR' is defined in header '<inttypes.h>'; did you forget to '#include <inttypes.h>'?
   30 | #include "util_funcs/header_generic.h"
  +++ |+#include <inttypes.h>
   31 |
```

Signed-off-by: Wei-Ting Yang <williamatcg@gmail.com>
2025-04-23 15:06:16 +02:00
Wei-Ting Yang
665bac8e17 net-snmp: support compilation with GCC 11 permissively
Use #elif defined instead of #elifdef as seen elsewhere throughout the patch
file. This avoids the following errors when compiling with GCC 11:

```
mibgroup/ucd-snmp/proc.c:45:2: error: invalid preprocessing directive #elifdef; did you mean #ifdef?
   45 | #elifdef HAVE_PCRE_H
      |  ^~~~~~~
      |  ifdef

mibgroup/ucd-snmp/proc.c:243:2: error: invalid preprocessing directive #elifdef; did you mean #ifdef?
  243 | #elifdef HAVE_PCRE_H
      |  ^~~~~~~
      |  ifdef
```

Signed-off-by: Wei-Ting Yang <williamatcg@gmail.com>
2024-12-23 14:43:48 -08:00
Christian Korber
0b12bee66a net-snmp: set hostname as sysname
This commit writes the option hostname obtained via uci_get
system.@system[0].hostname to the snmpd.conf file if sysName
is not defined in /etc/config/snmpd.

Signed-off-by: Christian Korber <ckorber@tdt.de>
2024-07-26 13:07:50 +02:00
Peca Nesovanovic
b18c0f17f7 net-snmp: include ipv6 address & route mibs
description: Since IPv6 is present in everyday use, we need to include
  information about IPv6 addresses & routes in SNMP

example:
  IP-MIB::ipAddressOrigin.ipv6

  IP-MIB::ipAddressOrigin[ipv6]["00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:01"] = manual
  IP-MIB::ipAddressOrigin[ipv6]["fd:00:00:09:02:55:00:00:00:00:00:00:00:00:01:01"] = manual
  IP-MIB::ipAddressOrigin[ipv6]["fe:80:00:00:00:00:00:00:0c:00:09:ff:fe:06:01:01"] = linklayer
  IP-MIB::ipAddressOrigin[ipv6]["fe:80:00:00:00:00:00:00:0c:02:09:ff:fe:00:01:01"] = linklayer
  IP-MIB::ipAddressOrigin[ipv6]["fe:80:00:00:00:00:00:00:ae:84:c6:ff:fe:25:8c:ce"] = linklayer

tested:
  23.05-snapshot
  master snapshot
  with LibreNMS, OpenWRT device IPv6 Addresses & Routes are properly recognized

Signed-off-by: Peca Nesovanovic <peca.nesovanovic@sattrakt.com>
2024-06-23 23:10:35 -07:00
Christian Marangi
e28bd51cab treewide: update packages to use new toolchain define
Update packages to use new toolchain define and drop usage of
TOOLCHAIN_DIR.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2024-05-28 15:42:30 +08:00
Rosen Penev
88ef251c44 net-snmp: finish up GCC14 fix
This fixes it with musl support. Also fixed several -Wformat warnings.

Main problem was __fd_mask not existing on musl but fd_mask existing.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2024-05-27 20:17:29 -07:00
Aditya Nugraha
fe5fd2c2b1 net-snmp: fix compilation with GCC 14
Refresh 900-musl-compat.patch, add missing headers & fixes incompatible pointer type is now an error.

Signed-off-by: Aditya Nugraha <vortexilation@gmail.com>
2024-05-27 20:17:29 -07:00
Rosen Penev
5bce0b09e6 Revert "net-snmp: fix compilation with GCC 14"
This reverts commit 7d39868294.
2024-05-16 23:44:08 -07:00
Aditya Nugraha
7d39868294 net-snmp: fix compilation with GCC 14
Refresh 900-musl-compat.patch, add missing headers & fixes incompatible pointer type is now an error.

Signed-off-by: Aditya Nugraha <vortexilation@gmail.com>
2024-05-16 23:33:27 -07:00
Ivan Pavlov
13a237d941 net-snmp: update to 5.9.4
Adjust patches for current version changes
Module "disk" renamed to "disk_hw"
Internal type "unknown" changed to "u_int32_t"
Add patch with removing macro syntax checking for successful build

Signed-off-by: Ivan Pavlov <AuthorReflex@gmail.com>
2024-02-10 14:57:25 -08:00
Christian Marangi
9f50361691 net-snmp: backport patch fixing memory leak for PCRE2
Backport patch fixing memory leak for PCRE2 present upstream.

Fixes: #22428
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2023-10-18 13:26:48 +02:00
Christian Marangi
daf29ecbb2 net-snmp: move to PCRE2 library
Add upstream patch adding support for pcre2 and update dependency to
require libpcre2 instead of libpcre.

--with-pcre2-8 is now needed to exclude support for pcre and only
require pcre2 as net-snmp still use and try to use pcre by default.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2023-09-30 20:30:31 +02:00
Paul Fertser
0c10c224be treewide: remove AUTORELEASE
Automatically compute and substitute current values for all
$(AUTORELEASE) instances as this feature is deprecated and shouldn't be
used.

The following temporary change was made to the core:

diff --git a/rules.mk b/rules.mk
index 57d7995d4fa8..f16367de87a8 100644
--- a/rules.mk
+++ b/rules.mk
@@ -429,7 +429,7 @@ endef
 abi_version_str = $(subst -,,$(subst _,,$(subst .,,$(1))))

 COMMITCOUNT = $(if $(DUMP),0,$(call commitcount))
-AUTORELEASE = $(if $(DUMP),0,$(call commitcount,1))
+AUTORELEASE = $(if $(DUMP),0,$(shell sed -i "s/\$$(AUTORELEASE)/$(call commitcount,1)/" $(CURDIR)/Makefile))

 all:
 FORCE: ;

And this command used to fix affected packages:

for i in $(cd feeds/packages; git grep -l PKG_RELEASE:=.*AUTORELEASE | \
                              sed 's^.*/\([^/]*\)/Makefile^\1^';);
do
  make package/$i/download
done

Signed-off-by: Paul Fertser <fercerpav@gmail.com>
2023-04-21 22:46:58 +02:00
Florian Eckert
9b67f7d134 net-snmp: rename stop_service to service_stopped
The commands in the function 'stop_service' do not stop the service.
Rather, they are commands that are to be executed when the service has
already been stopped. By renaming the function, the commands are now
executed after the service has been stopped.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2023-03-30 10:23:41 +03:00
Florian Eckert
d6edd837f5 net-snmp: fix whitespaces
Replace spaces with tabs

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2023-03-30 10:16:00 +03:00
Seth Kingry
7b1bfb181a net-snmp: move start order from 50 to 99
Signed-off-by: Seth Kingry <sjkingry@gmail.com>
2022-02-08 00:36:36 -05:00
Rosen Penev
2661d615db net-snmp: remove uClibc reference in patch
uClibc is no longer used in OpenWrt. It's pointless anyway. uClibc
defines __GLIBC__.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-10-05 02:01:39 +03:00
Rosen Penev
9aa6d9b9ac net-snmp: update to 5.9.1
Switch to AUTORELEASE for simplicity.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
[remove irrelevant part from commit message after splitting changes]
Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
2021-10-05 02:00:56 +03:00
Stijn Tintel
4cdbe799b1 net-snmp: bump to 5.9
Neither the configure option nor configure variable to disable linking
against PCRE seem to work anymore, so simply drop both and add a
dependency on libpcre. As net-snmp is unlikely to fit on devices with
small flash anyway, the extra size requirement shouldn't be a problem.
If it is, feel free to submit a patch to fix the broken upstream
behaviour.

Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
2021-03-17 21:53:10 +02:00
Ilya Lipnitskiy
5d8d4fbbcb treewide: Run refresh on all packages
The crude loop I wrote to come up with this changeset:

  find -L package/feeds/packages/ -name patches | \
  sed 's/patches$/refresh/' | sort | xargs make

Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
2021-02-20 16:02:15 -08:00
Rosen Penev
5a7148d112 treewide: add missing BUILDONLY
Fixes Makefile warnings:

WARNING: skipping X -- package has no install section

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-10-12 17:43:49 -07:00
Rosen Penev
621c161afe net-snmp: backport signal patch
Fixes compilation with uClibc-ng.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-09-26 16:07:25 -07:00
Stijn Tintel
6df49a634a net-snmp: do not exit if files cannot be opened
If snmpd fails to open files, like /dev/kmem or /dev/mem, it exits.
Avoid this by adding the -r argument.

Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
2019-12-19 20:04:38 +02:00
Jan Pavlinec
299e5b0a9b treewide: add PKG_CPE_ID for better cvescanner coverage
Signed-off-by: Jan Pavlinec <jan.pavlinec@nic.cz>
2019-09-17 12:40:26 +02:00
Alin Nastac
2168930089 net-snmp: reload firewall only when needed
Firewall needs to be reloaded in the following cases:
 - on service start when snmpd.general.enabled=1
 - when snmpd daemon is stopped

Signed-off-by: Alin Nastac <alin.nastac@gmail.com>
2019-08-12 10:27:22 +02:00
Koen Vandeputte
7bb78c3f9c net-snmp: add missing dependency to libpci
There's a build race condition with other packages which sometimes results in:

Package libnetsnmp is missing dependencies for the following libraries:
libpci.so.3
2019-04-05 16:53:03 +02:00
Stijn Tintel
68a58ff22b Merge pull request #8219 from Apteryks/master
net-snmp: disable support for perl
2019-02-16 17:28:50 +02:00
Stijn Tintel
bf729d2f38 Merge pull request #5821 from kbabioch/feat/ipNetToPhysicalTable
net-snmp: Enable MIB ip-mib/inetNetToMediaTable
2019-02-16 17:15:04 +02:00
Maxim Cournoyer
90a713e3c6 net-snmp: disable support for perl
Using an external toolchain, it was discovered that net-snmp would
link with the Perl library (-lperl) from the host rather than from the
target.

Since we do not provide Perl as a dependency to net-snmp, the solution
is to disable support for it.

Fixes issue #8217.

Signed-off-by: Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com>
2019-02-14 13:34:39 -05:00
Rosen Penev
9251f51084 net-snmp: update to 5.8
Disable PCRE process searching to avoid linking against libprce, which
would cause the build to fail due to a missing dependency. With the
--without-pcre switch, build fails due to an undefined reference, so do
it via CONFIGURE_VARS instead.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
[disable PCRE process searching]
Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
2018-10-17 16:03:54 +02:00
Stijn Tintel
1709b83091 Merge pull request #5069 from dedeckeh/pr-netsnmp-fw
net-snmp: fix inbound firewall rule support
2018-08-02 19:41:08 +03:00
Xavier Franquet
a565ef8eaa SNMPD: Add snmp_extend config option
Signed-off-by: Xavier Franquet <xavier@franquet.es>
2018-05-23 16:04:13 +02:00
Hans Dedecker
ffd78405f0 net-snmp: InstallDev fix
Commit 384c2a8cfd added support for symlinking
net-snmp-config into $(STAGING_DIR)/usr/bin but forgot to install first
$(STAGING_DIR)/usr/bin resulting into a compile issue if
$(STAGING_DIR)/usr/bin is not yet present.

Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2018-03-31 09:29:49 +02:00
Karol Babioch
9e856e2e3d net-snmp: Enable MIB ip-mib/inetNetToMediaTable
This enables the table `inetNetToMediaTable` from `ip-mib`, which implements
the `ipNetToPhysicalTable`. The former one is already enabled with the current
configuraiton, but it has been deprecatd by the IP version-neutral
`ipNetToMediaTable`, which also supports IPv6 entries [1]. It also disables all
other submodules from this MIB to keep the footprint small.

[1]: http://net-snmp.sourceforge.net/docs/mibs/IP-MIB.txt

Signed-off-by: Karol Babioch <karol@babioch.de>
2018-03-26 00:59:36 +02:00
Hans Dedecker
8d446e8da6 net-snmp: InstallDev fix
Commit 384c2a8cfd added support for symlinking
net-snmp-config into $(STAGING_DIR)/usr/bin but forgot to install first
$(STAGING_DIR)/usr/bin resulting into a compile issue if
$(STAGING_DIR)/usr/bin is not yet present.

Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-11-11 18:06:16 +01:00
Hans Dedecker
0bd19db049 net-snmp: fix inbound firewall rule support
Commit ae5ee6ba6c added support for inbound
firewall rule support but some corner cases were not covered.

In case net-snmp is started and the network interface is already up
the procd firewall rule is created but not applied by fw3 as
service_started calling procd_set_config_changed firewall was missing.

When stopping net-snmp clean up the net-snmp inbound firewall rules in
iptables by calling procd_set_config_changed firewall in stop_service
which will trigger fw3 to remove the inbound firewall rules.

Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-11-11 18:06:03 +01:00
Stijn Tintel
e4165b4452 net-snmp: avoid duplicate section names
It seems that UCI can't handle duplicate section names in a single
config file, even if they use different types. After the previous
commit, running `uci export` results in the following error:

uci: Parse error (section of different type overwrites prior section with same name) at line 17, byte 23

Append a 6 to the com2sec6 section names to solve this.

Fixes: 0e1c8b4ccc ("net-snmp: snmpd: listen on IPv6 by default")
Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
2017-09-29 04:36:47 +03:00
Stijn Tintel
0e1c8b4ccc net-snmp: snmpd: listen on IPv6 by default
Closes #4758.

Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
2017-09-29 02:45:25 +03:00
Stijn Tintel
8079f86caa net-snmp: add snmptrapd packages
Closes #4724.

Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
2017-09-29 02:40:49 +03:00