diff --git a/baselibs.conf b/baselibs.conf index 0e0a715..65ebf82 100644 --- a/baselibs.conf +++ b/baselibs.conf @@ -1,2 +1,5 @@ -net-snmp +libsnmp15 arch ppc64 package net-snmp-devel + requires -net-snmp- + requires "libsnmp15- = " + diff --git a/net-snmp-5.3.0.1_trap-agent-addr_v2.patch b/net-snmp-5.3.0.1_trap-agent-addr_v2.patch new file mode 100644 index 0000000..2d59d48 --- /dev/null +++ b/net-snmp-5.3.0.1_trap-agent-addr_v2.patch @@ -0,0 +1,206 @@ +426355: Cannot set source agent address for SNMP traps + +Author: Jan Safranek + +Introduce "v1trapaddress" snmpd config option, which defines agent address +set in SNMPv1 traps, i.e. inside the SNMPv1 TRAP-PDU, not UDP packet +source address. The agent sets arbitrary local address to the TRAP PDU +when this option is ommited. + +Index: snmplib/system.c +=================================================================== +--- snmplib/system.c.orig 2008-06-05 23:11:53.000000000 +0200 ++++ snmplib/system.c 2008-09-06 18:04:38.784302537 +0200 +@@ -77,6 +77,10 @@ SOFTWARE. + #if HAVE_NET_IF_H + #include + #endif ++#if HAVE_NETDB_H ++#include ++#endif ++ + + #if HAVE_SYS_SOCKIO_H + #include +@@ -825,6 +829,84 @@ get_uptime(void) + #endif /* ! WIN32 */ + /*******************************************************************/ + ++int ++get_thisaddr(const char* name, in_addr_t *addr_out) ++{ ++ ++#if HAVE_GETADDRINFO ++ struct addrinfo *addrs = NULL; ++ struct addrinfo hint; ++ int err; ++ ++ memset(&hint, 0, sizeof hint); ++ hint.ai_flags = 0; ++ hint.ai_family = PF_INET; ++ hint.ai_socktype = SOCK_DGRAM; ++ hint.ai_protocol = 0; ++ ++ err = getaddrinfo(name, NULL, &hint, &addrs); ++ if (err != 0) { ++#if HAVE_GAI_STRERROR ++ snmp_log(LOG_ERR, "getaddrinfo: %s %s\n", name, ++ gai_strerror(err)); ++#else ++ snmp_log(LOG_ERR, "getaddrinfo: %s (error %d)\n", name, ++ err); ++#endif ++ return -1; ++ } ++ if (addrs != NULL) { ++ memcpy(addr_out, ++ &((struct sockaddr_in *) addrs->ai_addr)->sin_addr, ++ sizeof(in_addr_t)); ++ freeaddrinfo(addrs); ++ } else { ++ DEBUGMSGTL(("get_thisaddr", ++ "Failed to resolve IPv4 hostname\n")); ++ } ++ return 0; ++ ++#elif HAVE_GETHOSTBYNAME ++ struct hostent *hp = NULL; ++ ++ hp = gethostbyname(host); ++ if (hp == NULL) { ++ DEBUGMSGTL(("get_thisaddr", ++ "hostname (couldn't resolve)\n")); ++ return -1; ++ } else if (hp->h_addrtype != AF_INET) { ++ DEBUGMSGTL(("get_thisaddr", ++ "hostname (not AF_INET!)\n")); ++ return -1; ++ } else { ++ DEBUGMSGTL(("get_thisaddr", ++ "hostname (resolved okay)\n")); ++ memcpy(addr_out, hp->h_addr, sizeof(in_addr_t)); ++ } ++ return 0; ++ ++#elif HAVE_GETIPNODEBYNAME ++ struct hostent *hp = NULL; ++ int err; ++ ++ hp = getipnodebyname(peername, AF_INET, 0, &err); ++ if (hp == NULL) { ++ DEBUGMSGTL(("get_thisaddr", ++ "hostname (couldn't resolve = %d)\n", err)); ++ return -1; ++ } ++ DEBUGMSGTL(("get_thisaddr", ++ "hostname (resolved okay)\n")); ++ memcpy(addr_out, hp->h_addr, sizeof(in_addr_t)); ++ return 0; ++ ++#else /* HAVE_GETIPNODEBYNAME */ ++ return -1; ++#endif ++} ++ ++/*******************************************************************/ ++ + #ifndef HAVE_STRNCASECMP + + /* +Index: man/snmpd.conf.5.def +=================================================================== +--- man/snmpd.conf.5.def.orig 2008-08-07 11:00:04.000000000 +0200 ++++ man/snmpd.conf.5.def 2008-09-06 18:04:38.788301614 +0200 +@@ -641,6 +641,12 @@ Ordinarily the corresponding MIB + object (\fCsnmpEnableAuthenTraps.0\fR) is read-write, but specifying + this directive makes this object read-only, and attempts to set the + value via SET requests will result in a \fInotWritable\fR error response. ++.RE ++.IP "v1trapaddress HOST" ++defines the agent address, which is inserted into SNMPv1 TRAPs. Arbitrary local ++IPv4 address is chosen if this option is ommited. This option is useful mainly ++when the agent is visible from outside world by specific address only (e.g. ++because of network address translation or firewall). + .SS "DisMan Event MIB" + The previous directives can be used to configure where traps should + be sent, but are not concerned with \fIwhen\fR to send such traps +Index: include/net-snmp/agent/ds_agent.h +=================================================================== +--- include/net-snmp/agent/ds_agent.h.orig 2007-05-07 22:23:23.000000000 +0200 ++++ include/net-snmp/agent/ds_agent.h 2008-09-06 18:04:38.823792310 +0200 +@@ -42,6 +42,7 @@ + #define NETSNMP_DS_AGENT_PERL_INIT_FILE 4 /* used by embedded perl */ + #define NETSNMP_DS_SMUX_SOCKET 5 /* ip:port socket addr */ + #define NETSNMP_DS_NOTIF_LOG_CTX 6 /* "" | "snmptrapd" */ ++#define NETSNMP_DS_AGENT_TRAP_ADDR 7 /* used as v1 trap agent addres */ + + /* + * integers +Index: include/net-snmp/library/system.h +=================================================================== +--- include/net-snmp/library/system.h.orig 2007-01-11 23:13:56.000000000 +0100 ++++ include/net-snmp/library/system.h 2008-09-06 18:04:38.855791728 +0200 +@@ -107,6 +107,8 @@ SOFTWARE. + + #include /* For definition of in_addr_t */ + ++ int get_thisaddr(const char* name, ++ in_addr_t *addr_out); + in_addr_t get_myaddr(void); + long get_uptime(void); + +Index: agent/agent_read_config.c +=================================================================== +--- agent/agent_read_config.c.orig 2008-07-24 08:53:02.000000000 +0200 ++++ agent/agent_read_config.c 2008-09-06 18:04:38.880308775 +0200 +@@ -243,6 +243,9 @@ init_agent_read_config(const char *app) + snmpd_free_trapcommunity, + "community-string"); + #endif /* support for community based SNMP */ ++ netsnmp_ds_register_config(ASN_OCTET_STR, app, "v1trapaddress", ++ NETSNMP_DS_APPLICATION_ID, ++ NETSNMP_DS_AGENT_TRAP_ADDR); + #ifdef HAVE_UNISTD_H + register_app_config_handler("agentuser", + snmpd_set_agent_user, NULL, "userid"); +Index: agent/agent_trap.c +=================================================================== +--- agent/agent_trap.c.orig 2007-05-18 00:16:12.000000000 +0200 ++++ agent/agent_trap.c 2008-09-06 18:06:23.367792400 +0200 +@@ -58,6 +58,7 @@ + #include + + #include ++#include + #include + #include + #include +@@ -639,6 +640,8 @@ netsnmp_send_traps(int trap, int specifi + in_addr_t *pdu_in_addr_t; + u_long uptime; + struct trap_sink *sink; ++ const char *v1trapaddress; ++ int res; + + DEBUGMSGTL(( "trap", "send_trap %d %d ", trap, specific)); + DEBUGMSGOID(("trap", enterprise, enterprise_length)); +@@ -792,7 +795,18 @@ netsnmp_send_traps(int trap, int specifi + * Ensure that the v1 trap PDU includes the local IP address + */ + pdu_in_addr_t = (in_addr_t *) template_v1pdu->agent_addr; +- *pdu_in_addr_t = get_myaddr(); ++ ++ v1trapaddress = netsnmp_ds_get_string(NETSNMP_DS_APPLICATION_ID, ++ NETSNMP_DS_AGENT_TRAP_ADDR); ++ if (v1trapaddress != NULL) { ++ /* "v1trapaddress" was specified in config, try to resolve it */ ++ res = get_thisaddr(v1trapaddress, pdu_in_addr_t); ++ } ++ if (v1trapaddress == NULL || res < 0) { ++ /* "v1trapaddress" was not specified in config or the resolution failed, ++ * try any local address */ ++ *pdu_in_addr_t = get_myaddr(); ++ } + } + + diff --git a/net-snmp-5.4.1.tar.bz2 b/net-snmp-5.4.1.tar.bz2 deleted file mode 100644 index 9f90a13..0000000 --- a/net-snmp-5.4.1.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:245eee1e5721d20e25fdafa816560cd2e400d5968e3a9a3f718bc157ab689fc1 -size 3682055 diff --git a/net-snmp-5.4.1_perl_tk_warning.patch b/net-snmp-5.4.1_perl_tk_warning.patch new file mode 100644 index 0000000..4a80654 --- /dev/null +++ b/net-snmp-5.4.1_perl_tk_warning.patch @@ -0,0 +1,17 @@ +Index: local/tkmib +=================================================================== +--- local/tkmib.orig 2006-07-27 21:48:25.000000000 +0200 ++++ local/tkmib 2008-06-21 01:23:34.985622311 +0200 +@@ -27,10 +27,9 @@ instructions. + + if (!$havetk) { + print " +-ERROR: You don't have the Tk module installed. You should be able to +-install this by running (as root): ++ERROR: You don't have the Tk module installed. + +- perl -MCPAN -e 'install Tk' ++ Please install the perl-Tk package. + "; + } + diff --git a/net-snmp-5.4.2.tar.bz2 b/net-snmp-5.4.2.tar.bz2 new file mode 100644 index 0000000..c3b2f61 --- /dev/null +++ b/net-snmp-5.4.2.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a19ebea5179ef86a98c09f45668e85d44a57c95c730817a48b754db23ac80b1a +size 3719586 diff --git a/net-snmp-rpmlintrc b/net-snmp-rpmlintrc index e9e6729..c872b88 100644 --- a/net-snmp-rpmlintrc +++ b/net-snmp-rpmlintrc @@ -1,5 +1,3 @@ -addFilter("incoherent-init-script-name") -addFilter("net-snmp-devel package-with-huge-docs") -addFilter("net-snmp-devel files-duplicate.*") -addFilter("net-snmp incoherent-init-script-name /etc/init.d/snmpd") -addFilter("perl-SNMP zero-length.*") +addFilter("net-snmp-devel.* files-duplicate.*man.*") +addFilter("net-snmp.*incoherent-init-script-name") +addFilter("perl-SNMP.* zero-length.*\.bs") diff --git a/net-snmp.changes b/net-snmp.changes index 35d6b92..28abfb5 100644 --- a/net-snmp.changes +++ b/net-snmp.changes @@ -1,3 +1,23 @@ +------------------------------------------------------------------- +Sat Sep 6 16:15:57 CEST 2008 - mrueckert@suse.de + +- update to version 5.4.2 + - [PATCH 1921861]: Avoid endless loop after truncating 64bit int + - Better handling of CONTAINER_INSERT failures with multiple + indices + - [PATCH 2023633]: add SCTP-MIB implementation (Linux only) + - suppress annoying "registration != duplicate" warning for root + oids + - Update to libtool 1.5.26 +- add net-snmp-5.4.1_perl_tk_warning.patch (bnc#392695) + correctly recommend installing the perl-Tk package instead of + referring to cpan. +- fix Required-Stop in the init scripts +- cleanup the spec file: + - moved files from the mibs package to the packages where they + really belong (snmpconf-data, mib2c) + - move mib2c from the perl package to the devel package + ------------------------------------------------------------------- Mon Aug 25 11:53:31 CEST 2008 - prusnak@suse.cz diff --git a/net-snmp.spec b/net-snmp.spec index 083caca..812de64 100644 --- a/net-snmp.spec +++ b/net-snmp.spec @@ -1,5 +1,5 @@ # -# spec file for package net-snmp (Version 5.4.1) +# spec file for package net-snmp (Version 5.4.2) # # Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany. # @@ -19,8 +19,8 @@ Name: net-snmp -Version: 5.4.1 -Release: 95 +Version: 5.4.2 +Release: 1 # License: BSD 3-Clause; X11/MIT Group: Productivity/Networking/Other @@ -29,6 +29,11 @@ Group: Productivity/Networking/Other %ifnarch s390 s390x %define with_sensors 1 %endif +%if 0%{?suse_version} > 1020 +%define perl_requires Requires: perl-base = %{perl_version} +%else +%define perl_requires Requires: perl = %{perl_version} +%endif %define netsnmp_logfile /var/log/net-snmpd.log %define netsnmp_agentx_socket_dir_fhs /var/run/agentx %define netsnmp_agentx_socket_dir_rfc /var/agentx @@ -39,6 +44,7 @@ BuildRequires: lzma-alpha-devel openssl-devel rpm-devel tcpd-devel BuildRequires: libsensors3-devel %endif Requires: perl-TermReadKey logrotate +Requires: perl-SNMP = %{version} PreReq: %insserv_prereq %fillup_prereq /sbin/chkconfig Provides: snmp ucdsnmp Obsoletes: snmp ucdsnmp @@ -63,7 +69,9 @@ Patch5: net-snmp-5.2.1.testing.empty_arptable.patch Patch6: net-snmp-5.1.1-pie.patch Patch7: net-snmp-5.3_vendorperl.patch Patch8: net-snmp-5.4_net-snmp-config_headercheck.patch -Patch9: net-snmp-5.1.2-snmpconf-selinux.patch +Patch9: net-snmp-5.4.1_perl_tk_warning.patch +Patch10: net-snmp-5.1.2-snmpconf-selinux.patch +Patch11: net-snmp-5.3.0.1_trap-agent-addr_v2.patch # Summary: SNMP Daemon @@ -76,6 +84,32 @@ net-snmp in November 2000. +Authors: +-------- + Wes Hardaker + +%define library_name libsnmp15 + +%package -n libsnmp15 +License: BSD 3-Clause; X11/MIT +Group: Productivity/Networking/Other +Requires: snmp-mibs = %{version} +# we link libperl +%perl_requires +# +Summary: Shared Libraries from net-snmp + +%description -n libsnmp15 +This package was originally based on the CMU 2.1.2.1 snmp code. It has +been greatly modified, restructured, enhanced, and fixed. It hardly +looks the same as anything that CMU has ever released. It was renamed +from cmu-snmp to ucd-snmp in 1995 and later renamed from ucd-snmp to +net-snmp in November 2000. + +This package holds the shared libraries from the net-snmp package. + + + Authors: -------- Wes Hardaker @@ -83,8 +117,10 @@ Authors: %package devel License: BSD 3-Clause; X11/MIT Group: Development/Libraries/C and C++ -Requires: %{pkg_name} = %{version} -Requires: openssl-devel rpm-devel tcpd-devel perl +Requires: %{library_name} = %{version} +# for mib2c +Requires: perl-SNMP = %{version} +Requires: openssl-devel rpm-devel tcpd-devel %if 0%{?with_sensors} Requires: libsensors3-devel %endif @@ -100,28 +136,6 @@ net-snmp in November 2000. -Authors: --------- - Wes Hardaker - -%package -n libsnmp15 -License: BSD 3-Clause; X11/MIT -Group: Productivity/Networking/Other -Requires: snmp-mibs = %{version} -# -Summary: Shared Libraries from net-snmp - -%description -n libsnmp15 -This package was originally based on the CMU 2.1.2.1 snmp code. It has -been greatly modified, restructured, enhanced, and fixed. It hardly -looks the same as anything that CMU has ever released. It was renamed -from cmu-snmp to ucd-snmp in 1995 and later renamed from ucd-snmp to -net-snmp in November 2000. - -This package holds the shared libraries from the net-snmp package. - - - Authors: -------- Wes Hardaker @@ -151,11 +165,8 @@ Authors: License: GPL v2 or later Group: Development/Libraries/Perl Requires: %{pkg_name} = %{version} -%if 0%{?suse_version} > 1020 -Requires: perl-base = %{perl_version} -%else -Requires: perl = %{perl_version} -%endif +Recommends: perl-Tk +%perl_requires # Summary: Perl-SNMP @@ -179,7 +190,9 @@ Authors: %patch6 %patch7 %patch8 -%patch9 -p1 +%patch9 +%patch10 -p1 +%patch11 find -name "CVS" -type d | xargs -r %{__rm} -rfv find -name ".cvsignore" | xargs -r %{__rm} -fv find -name "*.orig" | xargs -r %{__rm} -fv @@ -294,9 +307,9 @@ fi %restart_on_update snmpd %{insserv_cleanup} -%post -n libsnmp15 -p /sbin/ldconfig +%post -n %{library_name} -p /sbin/ldconfig -%postun -n libsnmp15 -p /sbin/ldconfig +%postun -n %{library_name} -p /sbin/ldconfig %files %defattr(-,root,root) @@ -340,12 +353,16 @@ fi %config(noreplace) /etc/logrotate.d/net-snmp /var/adm/fillup-templates/sysconfig.%{pkg_name} %{netsnmp_agentx_socket_dir_rfc} +%{_datadir}/snmp/snmpconf-data/ +%{_datadir}/snmp/snmp_perl.pl +%{_datadir}/snmp/snmp_perl_trapd.pl %files -n snmp-mibs %defattr(-,root,root) -%{_datadir}/snmp +%dir %{_datadir}/snmp +%{_datadir}/snmp/mibs/ -%files -n libsnmp15 +%files -n %{library_name} %defattr(-,root,root) %{_libdir}/libsnmp*.so.* %{_libdir}/libnetsnmp*.so.* @@ -360,6 +377,9 @@ fi %{_libdir}/libsnmp*.so %{_libdir}/libnetsnmp*.la %{_libdir}/libnetsnmp*.so +%{_bindir}/mib2c +%{_bindir}/mib2c-update +%{_datadir}/snmp/mib2c* %files -n perl-SNMP %defattr(-,root,root) @@ -370,10 +390,25 @@ fi %{perl_vendorarch}/NetSNMP /var/adm/perl-modules/%{name} %{_bindir}/tkmib -%{_bindir}/mib2c -%{_bindir}/mib2c-update %changelog +* Sat Sep 06 2008 mrueckert@suse.de +- update to version 5.4.2 + - [PATCH 1921861]: Avoid endless loop after truncating 64bit int + - Better handling of CONTAINER_INSERT failures with multiple + indices + - [PATCH 2023633]: add SCTP-MIB implementation (Linux only) + - suppress annoying "registration != duplicate" warning for root + oids + - Update to libtool 1.5.26 +- add net-snmp-5.4.1_perl_tk_warning.patch (bnc#392695) + correctly recommend installing the perl-Tk package instead of + referring to cpan. +- fix Required-Stop in the init scripts +- cleanup the spec file: + - moved files from the mibs package to the packages where they + really belong (snmpconf-data, mib2c) + - move mib2c from the perl package to the devel package * Mon Aug 25 2008 prusnak@suse.cz - fixed wrong SELinux context (selinux.patch) [Fate#303662] * Fri Aug 22 2008 mrueckert@suse.de diff --git a/rc.net-snmp b/rc.net-snmp index 93b5f2b..a5979e3 100644 --- a/rc.net-snmp +++ b/rc.net-snmp @@ -7,8 +7,10 @@ # ### BEGIN INIT INFO # Provides: net-snmp snmp -# Required-Start: $remote_fs $syslog -# Required-Stop: $remote_fs $syslog +# Required-Start: $remote_fs +# Should-Start: $syslog $network +# Required-Stop: $remote_fs +# Should-Stop: $syslog $network # Default-Start: 2 3 5 # Default-Stop: 0 1 6 # Description: Net-SNMP snmpd diff --git a/rc.snmptrapd b/rc.snmptrapd index 5ac55d9..7478cc3 100644 --- a/rc.snmptrapd +++ b/rc.snmptrapd @@ -7,8 +7,8 @@ # ### BEGIN INIT INFO # Provides: snmpdtrapd -# Required-Start: $network $remote_fs -# Required-Stop: $network $remote_fs +# Required-Start: $network +# Required-Stop: $network # Default-Start: 2 3 5 # Default-Stop: 0 1 6 # Description: start net-snmptrapd