diff --git a/0002-net-snmp-5.9-dir-fix.patch b/0002-net-snmp-5.9-dir-fix.patch index 9e42e22d5007a2eb6198825543c521ebe994eaea..f7311ca33db2c2b7e05fc140d7749e11af5a6a1d 100644 --- a/0002-net-snmp-5.9-dir-fix.patch +++ b/0002-net-snmp-5.9-dir-fix.patch @@ -1,5 +1,5 @@ diff --git a/net-snmp-create-v3-user.in b/net-snmp-create-v3-user.in -index 19895a1..a9f5745 100644 +index 19895a1..ac3c60f 100644 --- a/net-snmp-create-v3-user.in +++ b/net-snmp-create-v3-user.in @@ -14,6 +14,10 @@ Xalgorithm="DES" @@ -13,11 +13,17 @@ index 19895a1..a9f5745 100644 unset shifted case $1 in -@@ -138,7 +142,7 @@ prefix=@prefix@ - datarootdir=@datarootdir@ - # To suppress shellcheck complaints about $prefix and $datarootdir. - : "$prefix" "$datarootdir" +@@ -134,11 +138,9 @@ if test ! -d "$outfile"; then + touch "$outfile" + fi + echo "$line" >> "$outfile" +-prefix=@prefix@ +-datarootdir=@datarootdir@ +-# To suppress shellcheck complaints about $prefix and $datarootdir. +-: "$prefix" "$datarootdir" -outfile="@datadir@/snmp/snmpd.conf" ++# Avoid that configure complains that this script ignores @datarootdir@ ++echo "@datarootdir@" >/dev/null +outfile="/etc/snmp/snmpd.conf" line="$token $user" echo "adding the following line to $outfile:" diff --git a/0022-net-snmp-5.9-multilib.patch b/0022-net-snmp-5.9-multilib.patch new file mode 100644 index 0000000000000000000000000000000000000000..ffd8da83bda850dc6cbca94224f995df6b8927fd --- /dev/null +++ b/0022-net-snmp-5.9-multilib.patch @@ -0,0 +1,48 @@ +diff --git a/man/netsnmp_config_api.3.def b/man/netsnmp_config_api.3.def +index 90b20d9..bd5abe1 100644 +--- a/man/netsnmp_config_api.3.def ++++ b/man/netsnmp_config_api.3.def +@@ -295,7 +295,7 @@ for one particular machine. + .PP + The default list of directories to search is \fC SYSCONFDIR/snmp\fP, + followed by \fC DATADIR/snmp\fP, +-followed by \fC LIBDIR/snmp\fP, ++followed by \fC /usr/lib(64)/snmp\fP, + followed by \fC $HOME/.snmp\fP. + This list can be changed by setting the environmental variable + .I SNMPCONFPATH +@@ -367,7 +367,7 @@ A colon separated list of directories to search for configuration + files in. + Default: + .br +-SYSCONFDIR/snmp:\:DATADIR/snmp:\:LIBDIR/snmp:\:$HOME/.snmp ++SYSCONFDIR/snmp:\:DATADIR/snmp:\:/usr/lib(64)/snmp:\:$HOME/.snmp + .SH "SEE ALSO" + netsnmp_mib_api(3), snmp_api(3) + .\" Local Variables: +diff --git a/man/snmp_config.5.def b/man/snmp_config.5.def +index fd30873..c3437d6 100644 +--- a/man/snmp_config.5.def ++++ b/man/snmp_config.5.def +@@ -10,7 +10,7 @@ First off, there are numerous places that configuration files can be + found and read from. By default, the applications look for + configuration files in the following 4 directories, in order: + SYSCONFDIR/snmp, +-DATADIR/snmp, LIBDIR/snmp, and $HOME/.snmp. In each of these ++DATADIR/snmp, /usr/lib(64)/snmp, and $HOME/.snmp. In each of these + directories, it looks for files snmp.conf, snmpd.conf and/or + snmptrapd.conf, as well as snmp.local.conf, snmpd.local.conf + and/or snmptrapd.local.conf. *.local.conf are always +diff --git a/man/snmpd.conf.5.def b/man/snmpd.conf.5.def +index 7ce8a46..a4000f9 100644 +--- a/man/snmpd.conf.5.def ++++ b/man/snmpd.conf.5.def +@@ -1593,7 +1593,7 @@ filename), and call the initialisation routine \fIinit_NAME\fR. + .RS + .IP "Note:" + If the specified PATH is not a fully qualified filename, it will +-be interpreted relative to LIBDIR/snmp/dlmod, and \fC.so\fR ++be interpreted relative to /usr/lib(64)/snmp/dlmod, and \fC.so\fR + will be appended to the filename. + .RE + .PP diff --git a/0023-net-snmp-5.9.4-remove-mail-sender.patch b/0023-net-snmp-5.9.4-remove-mail-sender.patch new file mode 100644 index 0000000000000000000000000000000000000000..152bea4067921b86f8ff528212eeb332635be1ba --- /dev/null +++ b/0023-net-snmp-5.9.4-remove-mail-sender.patch @@ -0,0 +1,43 @@ +diff -urNp a/local/checkbandwidth b/local/checkbandwidth +--- a/local/checkbandwidth 2024-06-21 21:17:01.675417287 +0200 ++++ b/local/checkbandwidth 2024-06-21 21:19:40.107746544 +0200 +@@ -326,7 +326,6 @@ See the Net-SNMP COPYING file for licens + + use JSON; + use Data::Dumper; +-use Mail::Sender; + use SNMP; + use Fcntl ':flock'; + +@@ -744,19 +743,19 @@ sub send_rate_message($$$$$$) { + sub send_message($$$) { + my ($to, $subject, $text) = @_; + +- my $sender = new Mail::Sender { smtp => $opts{'S'} , +- port => $opts{'P'}, +- from => $opts{'F'}, +- }; +- +- my $status = +- $sender->MailMsg({ +- to => $to, +- subject => $subject, +- msg => $text +- }); ++# my $sender = new Mail::Sender { smtp => $opts{'S'} , ++# port => $opts{'P'}, ++# from => $opts{'F'}, ++# }; ++ ++ my $status = -1; ++# $sender->MailMsg({ ++# to => $to, ++# subject => $subject, ++# msg => $text ++# }); + if ($status < 0) { +- Log("Failed to send mail with error code $status: $Mail::Sender::Error"); ++ Log("Failed to send mail with error code $status: Mail::Sender is not available"); + } + } + diff --git a/0024-net-snmp-5.9.4-test-fix.patch b/0024-net-snmp-5.9.4-test-fix.patch new file mode 100644 index 0000000000000000000000000000000000000000..43fa8ccaece227a25d6edb95d55facfc6d7f8031 --- /dev/null +++ b/0024-net-snmp-5.9.4-test-fix.patch @@ -0,0 +1,29 @@ +diff -ruNp a/testing/fulltests/support/simple_eval_tools.sh b/testing/fulltests/support/simple_eval_tools.sh +--- a/testing/fulltests/support/simple_eval_tools.sh 2024-02-26 14:36:03.641432345 +0100 ++++ b/testing/fulltests/support/simple_eval_tools.sh 2024-02-26 14:38:15.946855878 +0100 +@@ -525,7 +525,6 @@ STARTPROG() { + if test -f $CFG_FILE; then + COMMAND="$COMMAND -C -c $CFG_FILE" + fi +- COMMAND="$COMMAND -f" + if [ "x$PORT_SPEC" != "x" ]; then + COMMAND="$COMMAND $PORT_SPEC" + fi +@@ -537,10 +536,13 @@ STARTPROG() { + OUTPUTENVVARS $LOG_FILE.command + echo $COMMAND >> $LOG_FILE.command + fi +- { +- { $COMMAND; } >$LOG_FILE.stdout 2>&1 +- echo $? >$LOG_FILE.exitcode +- } & ++ if [ "x$OSTYPE" = "xmsys" ]; then ++ $COMMAND > $LOG_FILE.stdout 2>&1 & ++ ## COMMAND="cmd.exe //c start //min $COMMAND" ++ ## start $COMMAND > $LOG_FILE.stdout 2>&1 ++ else ++ $COMMAND > $LOG_FILE.stdout 2>&1 ++ fi + } + + #------------------------------------ -o- diff --git a/0025-net-snmp-5.9.4-kernel-6.7.patch b/0025-net-snmp-5.9.4-kernel-6.7.patch new file mode 100644 index 0000000000000000000000000000000000000000..089f23b532ffb7f3903dd9f423a2361e292cc975 --- /dev/null +++ b/0025-net-snmp-5.9.4-kernel-6.7.patch @@ -0,0 +1,120 @@ +From f5ae6baf0018abda9dedc368fe6d52c0d7a8ab8f Mon Sep 17 00:00:00 2001 +From: Philippe Troin +Date: Sat, 3 Feb 2024 10:30:30 -0800 +Subject: [PATCH] Add Linux 6.7 compatibility parsing /proc/net/snmp + +Linux 6.7 adds a new OutTransmits field to Ip in /proc/net/snmp. +This breaks the hard-coded assumptions about the Ip line length. +Add compatibility to parse Linux 6.7 Ip header while keep support +for previous versions. +--- + .../ip-mib/data_access/systemstats_linux.c | 46 +++++++++++++++---- + 1 file changed, 37 insertions(+), 9 deletions(-) + +diff --git a/agent/mibgroup/ip-mib/data_access/systemstats_linux.c b/agent/mibgroup/ip-mib/data_access/systemstats_linux.c +index 49e0a34d5c..f04e828a94 100644 +--- a/agent/mibgroup/ip-mib/data_access/systemstats_linux.c ++++ b/agent/mibgroup/ip-mib/data_access/systemstats_linux.c +@@ -36,7 +36,7 @@ netsnmp_access_systemstats_arch_init(void) + } + + /* +- /proc/net/snmp ++ /proc/net/snmp - Linux 6.6 and lower + + Ip: Forwarding DefaultTTL InReceives InHdrErrors InAddrErrors ForwDatagrams InUnknownProtos InDiscards InDelivers OutRequests OutDiscards OutNoRoutes ReasmTimeout ReasmReqds ReasmOKs ReasmFails FragOKs FragFails FragCreates + Ip: 2 64 7083534 0 0 0 0 0 6860233 6548963 0 0 1 286623 63322 1 259920 0 0 +@@ -49,6 +49,26 @@ netsnmp_access_systemstats_arch_init(void) + + Udp: InDatagrams NoPorts InErrors OutDatagrams + Udp: 1491094 122 0 1466178 ++* ++ /proc/net/snmp - Linux 6.7 and higher ++ ++ Ip: Forwarding DefaultTTL InReceives InHdrErrors InAddrErrors ForwDatagrams InUnknownProtos InDiscards InDelivers OutRequests OutDiscards OutNoRoutes ReasmTimeout ReasmReqds ReasmOKs ReasmFails FragOKs FragFails FragCreates OutTransmits ++ Ip: 1 64 50859058 496 0 37470604 0 0 20472980 7515791 1756 0 0 7264 3632 0 3548 0 7096 44961424 ++ ++ Icmp: InMsgs InErrors InCsumErrors InDestUnreachs InTimeExcds InParmProbs InSrcQuenchs InRedirects InEchos InEchoReps InTimestamps InTimestampReps InAddrMasks InAddrMaskReps OutMsgs OutErrors OutRateLimitGlobal OutRateLimitHost OutDestUnreachs OutTimeExcds OutParmProbs OutSrcQuenchs OutRedirects OutEchos OutEchoReps OutTimestamps OutTimestampReps OutAddrMasks OutAddrMaskReps ++ Icmp: 114447 2655 0 17589 0 0 0 0 66905 29953 0 0 0 0 143956 0 0 572 16610 484 0 0 0 59957 66905 0 0 0 0 ++ ++ IcmpMsg: InType0 InType3 InType8 OutType0 OutType3 OutType8 OutType11 ++ IcmpMsg: 29953 17589 66905 66905 16610 59957 484 ++ ++ Tcp: RtoAlgorithm RtoMin RtoMax MaxConn ActiveOpens PassiveOpens AttemptFails EstabResets CurrEstab InSegs OutSegs RetransSegs InErrs OutRsts InCsumErrors ++ Tcp: 1 200 120000 -1 17744 13525 307 3783 6 18093137 9277788 3499 8 7442 0 ++ ++ Udp: InDatagrams NoPorts InErrors OutDatagrams RcvbufErrors SndbufErrors InCsumErrors IgnoredMulti MemErrors ++ Udp: 2257832 1422 0 2252835 0 0 0 84 0 ++ ++ UdpLite: InDatagrams NoPorts InErrors OutDatagrams RcvbufErrors SndbufErrors InCsumErrors IgnoredMulti MemErrors ++ UdpLite: 0 0 0 0 0 0 0 0 0 + */ + + +@@ -101,10 +121,10 @@ _systemstats_v4(netsnmp_container* container, u_int load_flags) + FILE *devin; + char line[1024]; + netsnmp_systemstats_entry *entry = NULL; +- int scan_count; ++ int scan_count, expected_scan_count; + char *stats, *start = line; + int len; +- unsigned long long scan_vals[19]; ++ unsigned long long scan_vals[20]; + + DEBUGMSGTL(("access:systemstats:container:arch", "load v4 (flags %x)\n", + load_flags)); +@@ -126,10 +146,17 @@ _systemstats_v4(netsnmp_container* container, u_int load_flags) + */ + NETSNMP_IGNORE_RESULT(fgets(line, sizeof(line), devin)); + len = strlen(line); +- if (224 != len) { ++ switch (len) { ++ case 224: ++ expected_scan_count = 19; ++ break; ++ case 237: ++ expected_scan_count = 20; ++ break; ++ default: + fclose(devin); + snmp_log(LOG_ERR, "systemstats_linux: unexpected header length in /proc/net/snmp." +- " %d != 224\n", len); ++ " %d not in { 224, 237 } \n", len); + return -4; + } + +@@ -178,20 +205,20 @@ _systemstats_v4(netsnmp_container* container, u_int load_flags) + memset(scan_vals, 0x0, sizeof(scan_vals)); + scan_count = sscanf(stats, + "%llu %llu %llu %llu %llu %llu %llu %llu %llu %llu" +- "%llu %llu %llu %llu %llu %llu %llu %llu %llu", ++ "%llu %llu %llu %llu %llu %llu %llu %llu %llu %llu", + &scan_vals[0],&scan_vals[1],&scan_vals[2], + &scan_vals[3],&scan_vals[4],&scan_vals[5], + &scan_vals[6],&scan_vals[7],&scan_vals[8], + &scan_vals[9],&scan_vals[10],&scan_vals[11], + &scan_vals[12],&scan_vals[13],&scan_vals[14], + &scan_vals[15],&scan_vals[16],&scan_vals[17], +- &scan_vals[18]); ++ &scan_vals[18],&scan_vals[19]); + DEBUGMSGTL(("access:systemstats", " read %d values\n", scan_count)); + +- if(scan_count != 19) { ++ if(scan_count != expected_scan_count) { + snmp_log(LOG_ERR, + "error scanning systemstats data (expected %d, got %d)\n", +- 19, scan_count); ++ expected_scan_count, scan_count); + netsnmp_access_systemstats_entry_free(entry); + return -4; + } +@@ -223,6 +250,7 @@ _systemstats_v4(netsnmp_container* container, u_int load_flags) + entry->stats.HCOutFragFails.high = scan_vals[17] >> 32; + entry->stats.HCOutFragCreates.low = scan_vals[18] & 0xffffffff; + entry->stats.HCOutFragCreates.high = scan_vals[18] >> 32; ++ /* entry->stats. = scan_vals[19]; / * OutTransmits */ + + entry->stats.columnAvail[IPSYSTEMSTATSTABLE_HCINRECEIVES] = 1; + entry->stats.columnAvail[IPSYSTEMSTATSTABLE_INHDRERRORS] = 1; + diff --git a/0026-net-snmp-5.9-ipv6-disable-leak.patch b/0026-net-snmp-5.9-ipv6-disable-leak.patch new file mode 100644 index 0000000000000000000000000000000000000000..f8c20fd8c22b11ad53a2b4e2a70643055517d5ea --- /dev/null +++ b/0026-net-snmp-5.9-ipv6-disable-leak.patch @@ -0,0 +1,12 @@ +diff -urNp a/snmplib/snmp_logging.c b/snmplib/snmp_logging.c +--- a/snmplib/snmp_logging.c 2023-02-15 10:19:15.691827254 +0100 ++++ b/snmplib/snmp_logging.c 2023-02-15 10:24:41.006642974 +0100 +@@ -490,7 +490,7 @@ snmp_log_options(char *optarg, int argc, + char * + snmp_log_syslogname(const char *pstr) + { +- if (pstr) ++ if (pstr && (pstr != syslogname)) + strlcpy (syslogname, pstr, sizeof(syslogname)); + + return syslogname; diff --git a/net-snmp.spec b/net-snmp.spec index 0c9035651e8cfe2c621a3ef5614080adfd90c34e..4987c3125c503936d990ebf8a00e48c4a91f297a 100644 --- a/net-snmp.spec +++ b/net-snmp.spec @@ -1,4 +1,5 @@ -%define anolis_release 1 +ExclusiveArch: x86_64 aarch64 +%define anolis_release 2 # use nestnmp_check 0 to speed up packaging by disabling 'make test' %{!?netsnmp_check: %global netsnmp_check 1} @@ -43,6 +44,11 @@ Patch17: 0017-net-snmp-5.8-clientaddr-error-message.patch Patch18: 0018-net-snmp-5.9-intermediate-certs.patch Patch19: 0019-net-snmp-5.9.1-remove-des.patch Patch21: 0021-net-snmp-libs-misunderstanding.patch +Patch22: 0022-net-snmp-5.9-multilib.patch +Patch23: 0023-net-snmp-5.9.4-remove-mail-sender.patch +Patch24: 0024-net-snmp-5.9.4-test-fix.patch +Patch25: 0025-net-snmp-5.9.4-kernel-6.7.patch +Patch26: 0026-net-snmp-5.9-ipv6-disable-leak.patch # Modern RPM API means Patch101: 0101-net-snmp-5.8-modern-rpm-api.patch @@ -434,6 +440,13 @@ LD_LIBRARY_PATH=%{buildroot}/%{_libdir} make test %{abidir}/libnetsnmptrapd*.dump %changelog +* Sun Mar 22 2026 wenjie2025 - 5.9.4-2 +- Update man pages to use standard library paths for better consistency +- Disable email notifications to prevent failures and ensure script stability +- Fix unreliable program launching and logging in test environments +- Restore correct IP system statistics collection on newer kernels +- Prevent undefined behavior in syslog logging functions + * Wed Mar 26 2025 Hong Wei Qin - 5.9.4-1 - Update to 5.9.4-1 from 5.9.3-5 - Remove patches because bugs are not exist in new version.