Commit Graph

91 Commits

Author SHA1 Message Date
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
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