101 Commits
Author SHA1 Message Date
Christian Korber 1105a16c64 net-snmp: bump PKG_RELEASE
Increment PKG_RELEASE so the updated snmpd.init (new SNMPv3
security_level option) is rebuilt and shipped to users

Signed-off-by: Christian Korber <ckorber@tdt.de>
2026-11-30 13:11:30 +01:00
Christian Korber cd1270d96b net-snmp: add security_level option to snmpv3 config
Add a security_level option (noAuthNoPriv, authNoPriv, authPriv) to
the UCI configuration so users can select the SNMPv3 security level
directly instead of having to infer it from other settings.

This makes the configuration clearer and allows luci-app-snmpd to
expose the choice as a simple dropdown, making SNMPv3 setup more
intuitive.

Signed-off-by: Christian Korber <ckorber@tdt.de>
2026-11-30 13:11:30 +01:00
Christian Korber 990cea4c85 net-snmp: add security_level for mode setting
Add an optional 'security_level' option (noAuthNoPriv, authNoPriv,
authPriv) to snmpv3 user sections, so the intended level is explicit
instead of being implied by which password options happen to be set.
This also allows luci-app-snmpd to offer it as a simple dropdown,
making SNMPv3 user setup more intuitive.

For existing sections without 'security_level', the level is derived
from the configured options, so current configurations keep working:

  - no auth_pass                       -> noAuthNoPriv
  - privacy_type and privacy_pass set  -> authPriv
  - otherwise                          -> authNoPriv

Validation is reworked around the selected level:

  - unknown security_level values are skipped with a message
  - authNoPriv and authPriv require auth_type and an auth_pass of
    at least 8 characters
  - authPriv additionally requires privacy_type and a privacy_pass
    of at least 8 characters, instead of silently falling back to
    authNoPriv when they are missing

Signed-off-by: Christian Korber <ckorber@tdt.de>
2026-11-30 13:11:30 +01:00
Christian Korber 7767a90157 net-snmp: move variables auth_type, privacy_type and privacy_pass to top
These variables should be declared in one place, to make reading the
code easier.

Signed-off-by: Christian Korber <ckorber@tdt.de>
2026-11-30 13:11:30 +01:00
Christian Korber 6519dddb9d net-snmp: allow mulitple library installations
To allow multiple libraries on the target this glob is targeting
multiple libraries.

Signed-off-by: Christian Korber <ckorber@tdt.de>
2026-06-29 13:00:09 +02:00
Ivan Pavlov d107cdb748 net-snmp: update to 5.9.5.2
Changelog: https://github.com/net-snmp/net-snmp/blob/v5.9.5.2/CHANGES
Refresh patches for current version changes
Added git headers for Debian patches
Clean 750-ieee802dot11.patch - remove unnecesary trailing spaces, fix macro definition,
 include header file
Remove patches:
- 010-HOST-MIB-hr_filesys-fix-compile-error.patch
- 161-project_types.patch
- 751-gcc-14-fix.patch
- 900-musl-compat.patch
- 990-remove-semicolon-check-in-macros.patch

Install symlink for shared library without version reference

Signed-off-by: Ivan Pavlov <AuthorReflex@gmail.com>
2026-06-26 09:09:23 +02:00
Michael Pfeifroth d5a0672d6a net-snmp: fix 'bad number' warning when engineidtype is unset
Add a -n guard before the arithmetic comparison of engineidtype in
snmpd_engineid_add(). When the engineid UCI section exists but
engineidtype is not configured, the empty string is passed to
[ -ge ]/[ -le ] which causes 'sh: bad number' on every boot.

Signed-off-by: Michael Pfeifroth <michael.pfeifroth@westermo.com>
2026-06-23 09:12:16 +02:00
Christian Korber 1fe6ecf9a2 net-snmp: enable blumenthal-aes for SNMPv3 encryption
In order to use AES-192 and the like, it is necessary to enable
blumenthal-aes.

Blumenthal AES draft was not formalized in RFC but is
widely implemented by many vendors. It has strong encryption in
connection with SNMPv3.

Signed-off-by: Christian Korber <ckorber@tdt.de>
2026-06-17 15:46:45 +02:00
Michael Pfeifroth 849d51851b net-snmp: fix service not restarting on config change
snmpd generates its runtime configuration in /var/run/snmpd.conf from
UCI during start_service(). However, since the procd instance command
line never changes, procd does not detect that a restart is needed when
the UCI config is modified.

Add 'procd_set_param file /etc/config/snmpd' so procd tracks the config
file and restarts snmpd when it changes. Without this, 'reload_service'
(triggered by procd_add_reload_trigger) re-creates an identical instance
definition and procd skips the restart, leaving stale configuration
active.

This also fixes a usability issue with SNMPv3: when changing a user's
authentication or privacy algorithm, net-snmp must restart to re-derive
localized keys via createUser. Without the restart, the daemon keeps
using cached key material and authentication fails.

Tested with net-snmp 5.9.4 on OpenWrt (aarch64 and ppc64).

Signed-off-by: Michael Pfeifroth <michael.pfeifroth@westermo.com>
2026-06-16 11:36:52 +03:00
Wei-Ting Yang 1adc058454 treewide: add or correct license information
Add or correct license information across multiple packages.

Signed-off-by: Wei-Ting Yang <williamatcg@gmail.com>
2026-06-08 16:29:56 +03:00
Yanase Yuki b0d8a3d384 treewide: cleanup URLs
This commit converts plain HTTP URLs to HTTPS, and updates
old or outdated URLs.

Signed-off-by: Yanase Yuki <dev@zpc.st>
2026-05-08 22:28:27 +02:00
Kamil Bienkiewicz 3892e96152 net-snmp: add distro extend using /etc/os-release
Read PRETTY_NAME from /etc/os-release via /bin/sh for distro output.

Bump PKG_RELEASE to account for the package configuration change.

Signed-off-by: Kamil Bienkiewicz <perceivalpercy@gmail.com>
2026-03-24 07:30:51 +01:00
Eric McDonald ba27353e34 net-snmp: bump PKG_RELEASE
Bump PKG_RELEASE to reflect fixes to UCI init script config
generation for missing/unset options and RestrictOID handling.

Signed-off-by: Eric McDonald <librick-openwrt@proton.me>
2026-03-11 09:07:04 +01:00
Eric McDonald 136bff9a8e net-snmp: fix newline when RestrictOID is neither yes nor no
snmpd_access_default_add, snmpd_access_HostName_add, and
snmpd_access_HostIP_add check if RestrictOID is `yes` or `no`
but fail to write a newline for other values of RestrictOID
(e.g., `true`, `false`) or if unset, corrupting the generated config.

Fix by using config_get_bool and restructuring to write either
a complete line or nothing. Also require RestrictedOID to be
non-empty when RestrictOID is enabled.

This is a breaking change for configs where RestrictOID is set
to a value that the old code did not match as `yes` (e.g., `true`,
`1`, `on`, `enabled`) but config_get_bool evaluates as true. In
practice, this is unlikely to affect existing installs unless a
user is unknowingly relying on unintended behavior or is deliberately
relying on the old code's non-standard boolean evaluation; this
latter case is considered unlikely by this commit's author. Configs
where RestrictOID is enabled but RestrictedOID is empty are also
affected; previously a directive with a trailing space was written,
now no directive is written.

Signed-off-by: Eric McDonald <librick-openwrt@proton.me>
2026-03-11 09:07:04 +01:00
Eric McDonald b6ff8c79b1 net-snmp: add early return when IPMask is unset
snmpd_access_HostIP_add would write unintended output to the
config file if the IPMask option is not specified. Add an early
return to prevent writing in that case.

This is a breaking change for configs where IPMask is unset.
Previously, an empty IPMask option would result in a malformed
directive containing a trailing slash with no guaranteed newline,
the exact form of which depended on the values of other options.
Now, no directive is written.

Signed-off-by: Eric McDonald <librick-openwrt@proton.me>
2026-03-11 09:07:04 +01:00
Eric McDonald 1215e7e87a net-snmp: add early return when HostIP is unset
snmpd_access_HostIP_add would write unintended output to the
config file if the HostIP option is not specified. Add an early
return to prevent writing in that case.

This is a breaking change for configs where HostIP is unset.
Previously, an empty HostIP option would result in a malformed
directive containing a bare /mask with no guaranteed newline, the
exact form of which depended on the values of other options.
Now, no directive is written.

Signed-off-by: Eric McDonald <librick-openwrt@proton.me>
2026-03-11 09:07:04 +01:00
Eric McDonald 8033cfc287 net-snmp: add early return when HostName is unset
snmpd_access_HostName_add would write unintended output to the
config file if the HostName option is not specified. Add an early
return to prevent writing in that case.

This is a breaking change for configs where HostName is unset.
Previously, an empty HostName option would result in a malformed
directive with a trailing space and no guaranteed newline, the
exact form of which depended on the values of other options.
Now, no directive is written.

Signed-off-by: Eric McDonald <librick-openwrt@proton.me>
2026-03-11 09:07:04 +01:00
Eric McDonald dbd293d751 net-snmp: add early return when CommunityName is unset
snmpd_access_default_add, snmpd_access_HostName_add, and
snmpd_access_HostIP_add would write unintended output to the
config file if the CommunityName option is not specified. Add an
early return to each function to prevent writing in that case.

This is a breaking change for configs where CommunityName is
unset. Previously, an empty CommunityName option would result in
a malformed directive with a double space and no guaranteed
newline, the exact form of which depended on the values of other
options. Now, no directive is written.

Signed-off-by: Eric McDonald <librick-openwrt@proton.me>
2026-03-11 09:07:04 +01:00
Eric McDonald c3862ec354 net-snmp: add early return when Mode is unset
snmpd_access_default_add, snmpd_access_HostName_add, and
snmpd_access_HostIP_add would write unintended output to the
config file if the Mode option is not specified. Add an early
return to each function to prevent writing in that case.

This is a breaking change for configs where Mode is unset.
Previously, an empty Mode option would result in a malformed
directive with a leading space and no guaranteed newline, the
exact form of which depended on the values of other options.
Now, no directive is written.

Signed-off-by: Eric McDonald <librick-openwrt@proton.me>
2026-03-11 09:07:04 +01:00
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