---- net-snmp-5.4.1/configure.in 2007-09-08 16:13:11.531748373 +0200
-+++ net-snmp-5.4.1-ac/configure.in 2007-11-14 20:58:16.361317122 +0200
+--- net-snmp-5.4.1/configure.ac 2007-09-08 16:13:11.531748373 +0200
++++ net-snmp-5.4.1-ac/configure.ac 2007-11-14 20:58:16.361317122 +0200
@@ -1726,16 +1726,18 @@
rebuilt_new_with_security=
already_checked_krb5=no
--- net-snmp-5.2.1/net-snmp-config.in.orig 2005-01-05 16:12:52.000000000 +0100
+++ net-snmp-5.2.1/net-snmp-config.in 2005-02-26 14:58:33.779999232 +0100
-@@ -31,7 +31,7 @@
- exec_prefix=@exec_prefix@
+@@ -46,7 +46,7 @@
includedir=@includedir@
libdir=@libdir@
+ datarootdir=@datarootdir@
-NSC_LDFLAGS="@LDFLAGS@"
+NSC_LDFLAGS=""
NSC_INCLUDEDIR=${includedir}
NSC_LIBDIR=-L${libdir}
- NSC_LIBS="@LIBS@ @WRAPLIBS@"
+ NSC_LIBS="@LIBS@"
@@ -89,10 +89,10 @@
;;
#################################################### compile
$(RANLIB) $(AGENTLIB)
libnetsnmpmibs.$(LIB_EXTENSION)$(LIB_VERSION): ${LMIBOBJS} $(HELPERLIB) $(AGENTLIB) $(USELIBS)
-- $(LIB_LD_CMD) $(MIBLIB) ${LMIBOBJS} $(HELPERLIB) $(AGENTLIB) $(USELIBS) ${LMIBLIBS} $(LDFLAGS) $(LIB_LD_LIBS)
+- $(LIB_LD_CMD) $(MIBLIB) ${LMIBOBJS} $(HELPERLIB) $(AGENTLIB) $(USELIBS) $(LDFLAGS) ${LMIBLIBS} $(LIB_LD_LIBS)
+ $(LIB_LD_CMD) $(MIBLIB) ${LMIBOBJS} $(HELPERLIB) $(AGENTLIB) $(USELIBS) $(LDFLAGS) ${LMIBLIBS} $(LIB_LD_LIBS)
$(RANLIB) $(MIBLIB)
Source: upstream, svn diff -r 16736:16739
Reviewed-By: Jan Safranek <jsafrane@redhat.com>
-Index: configure
-===================================================================
---- configure (revision 16736)
-+++ configure (revision 16739)
-@@ -32628,7 +32628,7 @@
- fi
-
- # LM-SENSORS-MIB support
--echo " $module_list " | grep " ucd-snmp/lmSensors " > /dev/null
-+echo " $module_list " | $GREP -i "ucd-snmp/lmsensor" > /dev/null
- if test $? -eq 0 ; then
- { echo "$as_me:$LINENO: checking for sensors support" >&5
- echo $ECHO_N "checking for sensors support... $ECHO_C" >&6; }
Index: include/net-snmp/agent/hardware/sensors.h
===================================================================
--- include/net-snmp/agent/hardware/sensors.h (revision 0)
+netsnmp_sensor_info *sensor_by_name( char *, int );
+NetsnmpCacheLoad netsnmp_sensor_load;
+NetsnmpCacheFree netsnmp_sensor_free;
-Index: configure.in
-===================================================================
---- configure.in (revision 16736)
-+++ configure.in (revision 16739)
-@@ -2885,7 +2885,7 @@
- fi
-
- # LM-SENSORS-MIB support
--echo " $module_list " | grep " ucd-snmp/lmSensors " > /dev/null
-+echo " $module_list " | $GREP -i "ucd-snmp/lmsensor" > /dev/null
- if test $? -eq 0 ; then
- AC_MSG_CHECKING([for sensors support])
- case $target_os in
Index: agent/mibgroup/ucd-snmp/lmsensorsMib.c
===================================================================
--- agent/mibgroup/ucd-snmp/lmsensorsMib.c (revision 0)
-This patch makes "load X Y Z" snmpsettable via snmpset,
-
-it behaves the same as sysName.0, once written in snmpd.conf, it becames
-readonly.
-
-Signed-off-by: Elan Ruusamäe <glen@delfi.ee>
-Upstream-Tracker: https://sourceforge.net/tracker/?func=detail&aid=2931446&group_id=12694&atid=312694
-
---- net-snmp-5.4.2.1/agent/mibgroup/ucd-snmp/loadave.c~ 2009-12-21 21:00:10.094254079 +0200
-+++ net-snmp-5.4.2.1/agent/mibgroup/ucd-snmp/loadave.c 2009-12-21 22:02:45.398903148 +0200
-@@ -135,7 +135,19 @@
- #include "util_funcs.h"
- #include "kernel.h"
-
--double maxload[3];
-+static double maxload[3];
-+static int laConfigSet = 0;
-+
-+static int
-+loadave_store_config(int a, int b, void *c, void *d)
-+{
-+ char line[SNMP_MAXBUF_SMALL];
-+ if (laConfigSet > 0) {
-+ snprintf(line, SNMP_MAXBUF_SMALL, "pload %.02f %.02f %.02f", maxload[0], maxload[1], maxload[2]);
-+ snmpd_store_config(line);
-+ }
-+ return SNMPERR_SUCCESS;
-+}
-
- void
- init_loadave(void)
-@@ -152,7 +164,7 @@
- {ERRORNAME}},
- {LOADAVE, ASN_OCTET_STR, RONLY, var_extensible_loadave, 1,
- {LOADAVE}},
-- {LOADMAXVAL, ASN_OCTET_STR, RONLY, var_extensible_loadave, 1,
-+ {LOADMAXVAL, ASN_OCTET_STR, RWRITE, var_extensible_loadave, 1,
- {LOADMAXVAL}},
- {LOADAVEINT, ASN_INTEGER, RONLY, var_extensible_loadave, 1,
- {LOADAVEINT}},
-@@ -179,9 +191,22 @@
- REGISTER_MIB("ucd-snmp/loadave", extensible_loadave_variables,
- variable2, loadave_variables_oid);
-
-+ laConfigSet = 0;
-+
- snmpd_register_config_handler("load", loadave_parse_config,
- loadave_free_config,
- "max1 [max5] [max15]");
-+
-+ snmpd_register_config_handler("pload",
-+ loadave_parse_config, NULL, NULL);
-+
-+
-+ /*
-+ * we need to be called back later
-+ */
-+ snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_STORE_DATA,
-+ loadave_store_config, NULL);
-+
- }
-
- void
-@@ -189,6 +214,25 @@
- {
- int i;
-
-+ if (strcmp(token, "pload") == 0) {
-+ if (laConfigSet < 0) {
-+ snmp_log(LOG_WARNING,
-+ "ignoring attempted override of read-only load\n");
-+ return;
-+ } else {
-+ laConfigSet++;
-+ }
-+ } else {
-+ if (laConfigSet > 0) {
-+ snmp_log(LOG_WARNING,
-+ "ignoring attempted override of read-only load\n");
-+ /*
-+ * Fall through and copy in this value.
-+ */
-+ }
-+ laConfigSet = -1;
-+ }
-+
- for (i = 0; i <= 2; i++) {
- if (cptr != NULL)
- maxload[i] = atof(cptr);
-@@ -309,6 +353,71 @@
- return 0;
- }
-
-+static int
-+write_laConfig(int action,
-+ u_char * var_val,
-+ u_char var_val_type,
-+ size_t var_val_len,
-+ u_char * statP, oid * name, size_t name_len)
-+{
-+ static double laConfig = 0;
-+
-+ switch (action) {
-+ case RESERVE1: /* Check values for acceptability */
-+ if (var_val_type != ASN_OCTET_STR) {
-+ DEBUGMSGTL(("ucd-snmp/loadave",
-+ "write to laConfig not ASN_OCTET_STR\n"));
-+ return SNMP_ERR_WRONGTYPE;
-+ }
-+ if (var_val_len > 8 || var_val_len <= 0) {
-+ DEBUGMSGTL(("ucd-snmp/loadave",
-+ "write to laConfig: bad length\n"));
-+ return SNMP_ERR_WRONGLENGTH;
-+ }
-+
-+ if (laConfigSet < 0) {
-+ /*
-+ * The object is set in a read-only configuration file.
-+ */
-+ return SNMP_ERR_NOTWRITABLE;
-+ }
-+ break;
-+
-+ case RESERVE2: /* Allocate memory and similar resources */
-+ {
-+ u_char buf[8];
-+ int old_errno = errno;
-+ double val;
-+ char *endp;
-+
-+ strncpy(buf, var_val, var_val_len);
-+ buf[var_val_len] = '\0';
-+ val = strtod(buf, &endp);
-+
-+ if (errno == ERANGE || *endp != '\0' || val < 0 || val > 65536.00) {
-+ errno = old_errno;
-+ DEBUGMSGTL(("ucd-snmp/loadave",
-+ "write to laConfig: invalid value\n"));
-+ return SNMP_ERR_WRONGVALUE;
-+ }
-+
-+ errno = old_errno;
-+
-+ laConfig = val;
-+ }
-+ break;
-+
-+ case COMMIT:
-+ {
-+ int idx = name[name_len - 1] - 1;
-+ maxload[idx] = laConfig;
-+ laConfigSet = 1;
-+ }
-+ }
-+
-+ return SNMP_ERR_NOERROR;
-+}
-+
- u_char *
- var_extensible_loadave(struct variable * vp,
- oid * name,
-@@ -328,6 +437,10 @@
- case MIBINDEX:
- long_ret = name[*length - 1];
- return ((u_char *) (&long_ret));
-+ case LOADMAXVAL:
-+ /* setup write method, but don't return yet */
-+ *write_method = write_laConfig;
-+ break;
- case ERRORNAME:
- sprintf(errmsg, "Load-%d", ((name[*length - 1] == 1) ? 1 :
- ((name[*length - 1] == 2) ? 5 : 15)));
+--- net-snmp-5.5/agent/mibgroup/ucd-snmp/loadave.c~ 2010-05-12 14:39:47.608334020 +0200
++++ net-snmp-5.5/agent/mibgroup/ucd-snmp/loadave.c 2010-05-12 14:40:38.068953645 +0200
+@@ -166,7 +166,7 @@
+ var_extensible_loadave, 1, {LOADAVE}},
+ {LOADMAXVAL, ASN_OCTET_STR, NETSNMP_OLDAPI_RONLY,
+ var_extensible_loadave, 1, {LOADMAXVAL}},
+- {LOADAVEINT, ASN_INTEGER, NETSNMP_OLDAPI_RONLY,
++ {LOADAVEINT, ASN_INTEGER, NETSNMP_OLDAPI_RWRITE,
+ var_extensible_loadave, 1, {LOADAVEINT}},
+ #ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
+ {LOADAVEFLOAT, ASN_OPAQUE_FLOAT, NETSNMP_OLDAPI_RONLY,
+++ /dev/null
---- net-snmp-5.4.2.1-dev/configure.in 2009-01-22 20:00:37.030183514 +0200
-+++ net-snmp-5.4.2.1-netlink/configure.in 2009-01-23 01:30:24.148211644 +0200
-@@ -310,6 +310,12 @@
- AC_ARG_ENABLE(efence,,
- AC_MSG_ERROR([ Invalid option. Use --with-efence/--without-efence instead ]) )
-
-+AC_ARG_WITH(nl,
-+[ --with-nl Look for and use libnl (linux only).],
-+ use_nl="$withval")
-+AC_ARG_ENABLE(nl,,
-+ AC_MSG_ERROR([ Invalid option. Use --with-nl/--without-nl instead ]) )
-+
- tryrsaref=no
- AC_ARG_WITH(rsaref,
- [ --with-rsaref=PATH Look for librsaref in PATH/lib.],
-@@ -2664,6 +2670,21 @@
- AC_CHECK_LIB(efence, EF_Exit)
- fi
-
-+if test "x$use_nl" != "xno"; then
-+ case $target_os in
-+ linux*) # Check for libnl (linux)
-+ AC_CHECK_HEADERS(netlink/netlink.h,
-+ AC_CHECK_LIB(nl, nl_connect, [
-+ AC_DEFINE_UNQUOTED(HAVE_NL, "1", [have libnl])
-+ LIBNL_LIBS="-lnl"
-+ LIBNL="Yes"
-+ ])
-+ )
-+ ;;
-+ esac
-+fi
-+AC_SUBST(LIBNL_LIBS)
-+
- # Checks for libraries.
- # AC_CHECK_LIB(des, main)
- # AC_CHECK_LIB(m, asin)
---- net-snmp-5.4.2.1/agent/Makefile.in 2009-01-23 01:31:48.951541328 +0200
-+++ net-snmp-5.4.2.1/agent/Makefile.in 2009-02-05 20:50:30.825174223 +0200
-@@ -81,7 +81,7 @@
-
- LOCAL_LIBS = -L../snmplib/.libs -L../snmplib -L./.libs -L./helpers/.libs -L./helpers
- LAGENTLIBS = @LAGENTLIBS@
--LMIBLIBS = @LMIBLIBS@
-+LMIBLIBS = @LMIBLIBS@ @LIBNL_LIBS@
- PERLLDOPTS_FOR_APPS = @PERLLDOPTS_FOR_APPS@
- PERLLDOPTS_FOR_LIBS = @PERLLDOPTS_FOR_LIBS@
- LIBS = $(USELIBS) @AGENTLIBS@ $(PERLLDOPTS_FOR_APPS)
---- net-snmp-5.4.2.1-nl/agent/mibgroup/mibII/tcpTable.c 2009-03-10 21:53:36.453773342 +0200
-+++ net-snmp-5.4.2.1-nl/agent/mibgroup/mibII/tcpTable.c 2009-03-10 22:49:50.326352782 +0200
-@@ -29,6 +29,11 @@
- #if HAVE_NETINET_TCP_VAR_H
- #include <netinet/tcp_var.h>
- #endif
-+#if HAVE_NETLINK_NETLINK_H
-+#include <netlink/netlink.h>
-+#include <netlink/msg.h>
-+#include <linux/inet_diag.h>
-+#endif
-
- #include <net-snmp/net-snmp-includes.h>
- #include <net-snmp/agent/net-snmp-agent-includes.h>
-@@ -543,6 +548,112 @@
- #else /* hpux11 */
-
- #ifdef linux
-+
-+// see <netinet/tcp.h>
-+#define TCP_ALL ((1 << (TCP_CLOSING + 1)) - 1)
-+
-+static int
-+tcpTable_load_netlink()
-+{
-+ // TODO: perhaps use permanent nl handle?
-+ struct nl_handle *nl = nl_handle_alloc();
-+
-+ if (nl == NULL) {
-+ DEBUGMSGTL(("mibII/tcpTable", "Failed to allocate netlink handle\n"));
-+ snmp_log(LOG_ERR, "snmpd: Failed to allocate netlink handle\n");
-+ return -1;
-+ }
-+
-+ if (nl_connect(nl, NETLINK_INET_DIAG) < 0) {
-+ DEBUGMSGTL(("mibII/tcpTable", "Failed to connect to netlink: %s\n", nl_geterror()));
-+ snmp_log(LOG_ERR, "snmpd: Couldn't connect to netlink: %s\n", nl_geterror());
-+ nl_handle_destroy(nl);
-+ return -1;
-+ }
-+
-+ struct inet_diag_req req = {
-+ .idiag_family = AF_INET,
-+ .idiag_states = TCP_ALL,
-+ };
-+
-+ struct nl_msg *nm = nlmsg_alloc_simple(TCPDIAG_GETSOCK, NLM_F_ROOT|NLM_F_MATCH|NLM_F_REQUEST);
-+ nlmsg_append(nm, &req, sizeof(struct inet_diag_req), 0);
-+
-+ if (nl_send_auto_complete(nl, nm) < 0) {
-+ DEBUGMSGTL(("mibII/tcpTable", "nl_send_autocomplete(): %s\n", nl_geterror()));
-+ snmp_log(LOG_ERR, "snmpd: nl_send_autocomplete(): %s\n", nl_geterror());
-+ nl_handle_destroy(nl);
-+ return -1;
-+ }
-+ nlmsg_free(nm);
-+
-+ struct sockaddr_nl peer;
-+ unsigned char *buf = NULL;
-+ int running = 1, len;
-+
-+ while (running) {
-+ if ((len = nl_recv(nl, &peer, &buf, NULL)) <= 0) {
-+ DEBUGMSGTL(("mibII/tcpTable", "nl_recv(): %s\n", nl_geterror()));
-+ snmp_log(LOG_ERR, "snmpd: nl_recv(): %s\n", nl_geterror());
-+ nl_handle_destroy(nl);
-+ return -1;
-+ }
-+
-+ struct nlmsghdr *h = (struct nlmsghdr*)buf;
-+ while (nlmsg_ok(h, len)) {
-+ if (h->nlmsg_type == NLMSG_DONE) {
-+ running = 0;
-+ break;
-+ }
-+
-+ struct inet_diag_msg *r = nlmsg_data(h);
-+
-+ if (r->idiag_family != AF_INET) {
-+ h = nlmsg_next(h, &len);
-+ continue;
-+ }
-+
-+ struct inpcb pcb, *nnew;
-+ static int linux_states[12] =
-+ { 1, 5, 3, 4, 6, 7, 11, 1, 8, 9, 2, 10 };
-+
-+ memcpy(&pcb.inp_laddr.s_addr, r->id.idiag_src, r->idiag_family == AF_INET ? 4 : 6);
-+ memcpy(&pcb.inp_faddr.s_addr, r->id.idiag_dst, r->idiag_family == AF_INET ? 4 : 6);
-+
-+ pcb.inp_lport = r->id.idiag_sport;
-+ pcb.inp_fport = r->id.idiag_dport;
-+
-+ pcb.inp_state = (r->idiag_state & 0xf) < 12 ? linux_states[r->idiag_state & 0xf] : 2;
-+ if (pcb.inp_state == 5 /* established */ ||
-+ pcb.inp_state == 8 /* closeWait */ )
-+ tcp_estab++;
-+ pcb.uid = r->idiag_uid;
-+
-+ nnew = SNMP_MALLOC_TYPEDEF(struct inpcb);
-+ if (nnew == NULL) {
-+ running = 0;
-+ // XXX report malloc error and return -1?
-+ break;
-+ }
-+ memcpy(nnew, &pcb, sizeof(struct inpcb));
-+ nnew->inp_next = tcp_head;
-+ tcp_head = nnew;
-+
-+ h = nlmsg_next(h, &len);
-+ }
-+ free(buf);
-+ }
-+
-+ nl_handle_destroy(nl);
-+
-+ if (tcp_head) {
-+ DEBUGMSGTL(("mibII/tcpTable", "Loaded TCP Table using netlink\n"));
-+ return 0;
-+ }
-+ DEBUGMSGTL(("mibII/tcpTable", "Failed to load TCP Table (netlink)\n"));
-+ return -1;
-+}
-+
- int
- tcpTable_load(netsnmp_cache *cache, void *vmagic)
- {
-@@ -551,6 +662,10 @@
-
- tcpTable_free(cache, NULL);
-
-+ if (tcpTable_load_netlink() == 0) {
-+ return 0;
-+ }
-+
- if (!(in = fopen("/proc/net/tcp", "r"))) {
- DEBUGMSGTL(("mibII/tcpTable", "Failed to load TCP Table (linux1)\n"));
- snmp_log(LOG_ERR, "snmpd: cannot open /proc/net/tcp ...\n");
-diff -ur net-snmp-5.3.org/configure.in net-snmp-5.3/configure.in
---- net-snmp-5.3.org/configure.in 2005-12-28 18:20:56.000000000 +0100
-+++ net-snmp-5.3/configure.in 2006-01-09 00:57:24.173063750 +0100
-@@ -2396,20 +2396,6 @@
- ])
-
+--- net-snmp-5.5/configure.d/config_os_libs~ 2009-07-11 23:04:37.000000000 +0200
++++ net-snmp-5.5/configure.d/config_os_libs 2010-05-12 14:24:23.649259395 +0200
+@@ -310,18 +310,6 @@
+ NETSNMP_SEARCH_LIBS(BZ2_bzread, bz2,,, $LMIBLIBS, _rpmlibs)
+ fi
- # two variants of db1 need checking.
-- AC_CHECK_LIB(db1, dbopen, [_rpmlibs="-ldb1 $_rpmlibs"],
-- AC_CHECK_LIB(db, dbopen, [_rpmlibs="-ldb $_rpmlibs"]))
+- NETSNMP_SEARCH_LIBS(dbopen, [db1 db],,, $LMIBLIBS, _rpmlibs)
-
- # two variants of db3 need checking.
-- AC_CHECK_LIB(db-3.1, db_create, [_rpmlibs="-ldb-3.1 $_rpmlibs"],
-- AC_CHECK_LIB(db-3.0, db_create, [_rpmlibs="-ldb-3.0 $_rpmlibs"]))
+- NETSNMP_SEARCH_LIBS(db_create, [db-3.1 db-3.0],,, $LMIBLIBS, _rpmlibs)
-
- # rpm-3.0.5 and later needs popt.
-- AC_CHECK_LIB(popt, poptParseArgvString, [_rpmlibs="-lpopt $_rpmlibs"])
+- NETSNMP_SEARCH_LIBS(poptParseArgvString, popt,,, $LMIBLIBS, _rpmlibs)
-
- # rpm-4.0.x needs rpmio.
-- AC_CHECK_LIB(rpmio, Fopen, [_rpmlibs="-lrpmio $_rpmlibs"],,$_rpmlibs)
+- NETSNMP_SEARCH_LIBS(Fopen, rpmio,,, $LMIBLIBS, _rpmlibs)
-
+ # rpm-4.0.3 librpmdb actually contains what we need.
+ NETSNMP_SEARCH_LIBS(rpmdbOpen, rpmdb,,, $LMIBLIBS, _rpmlibs)
# now check for rpm using the appropriate libraries.
- AC_CHECK_LIB(rpm, rpmGetFilesystemList,[
- AC_DEFINE(HAVE_LIBRPM)
+++ /dev/null
---- net-snmp-5.4.2.1-dev/apps/snmpnetstat/inet.c 2009-01-22 18:26:23.264301468 +0200
-+++ net-snmp-5.4.2.1-dev/apps/snmpnetstat/inet.c 2009-01-22 18:48:30.400620330 +0200
-@@ -106,20 +106,65 @@
- };
- #define TCP_NSTATES 11
-
--void
--tcpprotopr(const char *name)
-+static void
-+tcpprotoprint_line(const char *name, netsnmp_variable_list *vp, int *first)
- {
-- netsnmp_variable_list *var, *vp;
-- oid tcpConnState_oid[] = { 1,3,6,1,2,1,6,13,1,1 };
-- size_t tcpConnState_len = OID_LENGTH( tcpConnState_oid );
- int state, width;
-+ char *cp;
- union {
- struct in_addr addr;
- char data[4];
- } tmpAddr;
- oid localPort, remotePort;
- struct in_addr localAddr, remoteAddr;
-- char *cp;
-+
-+ state = *vp->val.integer;
-+ if (!aflag && state == MIB_TCPCONNSTATE_LISTEN) {
-+ return;
-+ }
-+
-+ if (*first) {
-+ printf("Active Internet (%s) Connections", name);
-+ if (aflag)
-+ printf(" (including servers)");
-+ putchar('\n');
-+ width = Aflag ? 18 : 22;
-+ printf("%-5.5s %*.*s %*.*s %s\n",
-+ "Proto", -width, width, "Local Address",
-+ -width, width, "Remote Address", "(state)");
-+ *first = 0;
-+ }
-+
-+ /* Extract the local/remote information from the index values */
-+ cp = tmpAddr.data;
-+ cp[0] = vp->name[ 10 ] & 0xff;
-+ cp[1] = vp->name[ 11 ] & 0xff;
-+ cp[2] = vp->name[ 12 ] & 0xff;
-+ cp[3] = vp->name[ 13 ] & 0xff;
-+ localAddr.s_addr = tmpAddr.addr.s_addr;
-+ localPort = ntohs(vp->name[ 14 ]);
-+ cp = tmpAddr.data;
-+ cp[0] = vp->name[ 15 ] & 0xff;
-+ cp[1] = vp->name[ 16 ] & 0xff;
-+ cp[2] = vp->name[ 17 ] & 0xff;
-+ cp[3] = vp->name[ 18 ] & 0xff;
-+ remoteAddr.s_addr = tmpAddr.addr.s_addr;
-+ remotePort = ntohs(vp->name[ 19 ]);
-+
-+ printf("%-5.5s", name);
-+ inetprint(&localAddr, localPort, name, 1);
-+ inetprint(&remoteAddr, remotePort, name, 0);
-+ if (state < 1 || state > TCP_NSTATES) {
-+ printf("%d\n", state );
-+ } else {
-+ printf("%s\n", tcpstates[state]);
-+ }
-+}
-+
-+static void
-+tcpprotopr_get(const char *name, oid *root, size_t root_len)
-+{
-+ netsnmp_variable_list *var, *vp;
- int first = 1;
-
- /*
-@@ -127,7 +172,7 @@
- * the necessary information.
- */
- var = NULL;
-- snmp_varlist_add_variable( &var, tcpConnState_oid, tcpConnState_len,
-+ snmp_varlist_add_variable( &var, root, root_len,
- ASN_NULL, NULL, 0);
- if (!var)
- return;
-@@ -137,45 +182,111 @@
- for (vp = var; vp ; vp=vp->next_variable) {
-- state = *vp->val.integer;
-- if (!aflag && state == MIB_TCPCONNSTATE_LISTEN)
-- continue;
--
-- if (first) {
-- printf("Active Internet (%s) Connections", name);
-- if (aflag)
-- printf(" (including servers)");
-- putchar('\n');
-- width = Aflag ? 18 : 22;
-- printf("%-5.5s %*.*s %*.*s %s\n",
-- "Proto", -width, width, "Local Address",
-- -width, width, "Remote Address", "(state)");
-- first=0;
-- }
--
-- /* Extract the local/remote information from the index values */
-- cp = tmpAddr.data;
-- cp[0] = vp->name[ 10 ] & 0xff;
-- cp[1] = vp->name[ 11 ] & 0xff;
-- cp[2] = vp->name[ 12 ] & 0xff;
-- cp[3] = vp->name[ 13 ] & 0xff;
-- localAddr.s_addr = tmpAddr.addr.s_addr;
-- localPort = ntohs(vp->name[ 14 ]);
-- cp = tmpAddr.data;
-- cp[0] = vp->name[ 15 ] & 0xff;
-- cp[1] = vp->name[ 16 ] & 0xff;
-- cp[2] = vp->name[ 17 ] & 0xff;
-- cp[3] = vp->name[ 18 ] & 0xff;
-- remoteAddr.s_addr = tmpAddr.addr.s_addr;
-- remotePort = ntohs(vp->name[ 19 ]);
--
-- printf("%-5.5s", name);
-- inetprint(&localAddr, localPort, name, 1);
-- inetprint(&remoteAddr, remotePort, name, 0);
-- if ( state < 1 || state > TCP_NSTATES )
-- printf("%d\n", state );
-- else
-- printf("%s\n", tcpstates[ state ]);
-+ tcpprotoprint_line(name, vp, &first);
- }
- snmp_free_varbind( var );
- }
-
-+void
-+tcpprotopr_bulkget(const char *name, oid *root, size_t root_len)
-+{
-+ netsnmp_variable_list *vp;
-+ netsnmp_pdu *pdu, *response;
-+ oid tcpConnState_oid[MAX_OID_LEN];
-+ size_t tcpConnState_len;
-+ int first = 1;
-+ int running = 1;
-+ int status;
-+
-+ /*
-+ * setup initial object name
-+ */
-+ memmove(tcpConnState_oid, root, sizeof(root) * root_len);
-+ tcpConnState_len = root_len;
-+
-+ /*
-+ * Walking the tcpConnState column will provide all
-+ * the necessary information.
-+ */
-+ while (running) {
-+ /*
-+ * create PDU for GETBULK request and add object name to request
-+ */
-+ pdu = snmp_pdu_create(SNMP_MSG_GETBULK);
-+ pdu->non_repeaters = 0;
-+ pdu->max_repetitions = max_getbulk; /* fill the packet */
-+ snmp_add_null_var(pdu, tcpConnState_oid, tcpConnState_len);
-+
-+ /*
-+ * do the request
-+ */
-+ status = snmp_synch_response(ss, pdu, &response);
-+ if (status == STAT_SUCCESS) {
-+ if (response->errstat == SNMP_ERR_NOERROR) {
-+ for (vp = response->variables; vp ; vp=vp->next_variable) {
-+ if ((vp->name_length < root_len) ||
-+ (memcmp(root, vp->name, sizeof(oid) * root_len) != 0)) {
-+ /*
-+ * not part of this subtree
-+ */
-+ running = 0;
-+ continue;
-+ }
-+
-+ tcpprotoprint_line(name, vp, &first);
-+
-+ if ((vp->type != SNMP_ENDOFMIBVIEW) &&
-+ (vp->type != SNMP_NOSUCHOBJECT) &&
-+ (vp->type != SNMP_NOSUCHINSTANCE)) {
-+ /*
-+ * Check if last variable, and if so, save for next request.
-+ */
-+ if (vp->next_variable == NULL) {
-+ memmove(tcpConnState_oid, vp->name,
-+ vp->name_length * sizeof(oid));
-+ tcpConnState_len = vp->name_length;
-+ }
-+ } else {
-+ /*
-+ * an exception value, so stop
-+ */
-+ running = 0;
-+ }
-+ }
-+ } else {
-+ /*
-+ * error in response, print it
-+ */
-+ running = 0;
-+ }
-+ } else if (status == STAT_TIMEOUT) {
-+ running = 0;
-+ } else { /* status == STAT_ERROR */
-+ running = 0;
-+ }
-+
-+ if (response) {
-+ snmp_free_pdu(response);
-+ }
-+ }
-+}
-+
-+void
-+tcpprotopr(const char *name)
-+{
-+ oid tcpConnState_oid[] = { 1,3,6,1,2,1,6,13,1,1 };
-+ size_t tcpConnState_len = OID_LENGTH( tcpConnState_oid );
-+ int use_getbulk = 1;
-+
-+#ifndef NETSNMP_DISABLE_SNMPV1
-+ if (ss->version == SNMP_VERSION_1) {
-+ use_getbulk = 0;
-+ }
-+#endif
-+
-+ if (use_getbulk) {
-+ tcpprotopr_bulkget(name, tcpConnState_oid, tcpConnState_len);
-+ } else {
-+ tcpprotopr_get(name, tcpConnState_oid, tcpConnState_len);
-+ }
-+}
-+
- /*
---- net-snmp-5.4.2.1/man/snmpnetstat.1.def 2009-01-22 18:43:30.073986008 +0200
-+++ net-snmp-5.4.2.1-dev/man/snmpnetstat.1.def 2009-01-22 18:57:34.170565184 +0200
-@@ -92,6 +92,12 @@
- traffic on the configured network interfaces.
- The fourth form displays statistics about the named protocol.
- .PP
-+.B snmpnetstat
-+will issue GETBULK requests to query for information
-+if at least protocol version
-+.I v2
-+is used.
-+.PP
- AGENT identifies a target SNMP agent, which is
- instrumented to monitor the given objects.
- At its simplest, the AGENT specification will
-@@ -164,6 +170,11 @@
- is also present, show per-protocol routing statistics instead of
- the routing tables.
- .PP
-+.BI \-CR " repeaters"
-+For GETBULK requests,
-+.I repeaters
-+specifies the max-repeaters value to use.
-+.PP
- When snmpnetstat is invoked with an interval argument, it
- displays a running count of statistics related to network
- interfaces.
---- net-snmp-5.4.2.1/apps/snmpnetstat/main.c 2006-09-15 03:48:50.000000000 +0300
-+++ net-snmp-5.4.2.1-dev/apps/snmpnetstat/main.c 2009-01-22 18:48:17.313950236 +0200
-@@ -75,9 +75,11 @@
- int tflag; /* show i/f watchdog timers */
- int vflag; /* be verbose */
-
-+
- int interval; /* repeat interval for i/f stats */
- char *intrface; /* desired i/f for stats, or NULL for all i/fs */
- int af; /* address family */
-+int max_getbulk = 32; /* specifies the max-repeaters value to use with GETBULK requests */
-
- char *progname = NULL;
-
-@@ -231,6 +233,24 @@
- case 'r':
- rflag = 1;
- break;
-+ case 'R':
-+ if (optind < argc) {
-+ if (argv[optind]) {
-+ max_getbulk = atoi(argv[optind]);
-+ if (max_getbulk == 0) {
-+ usage();
-+ fprintf(stderr, "Bad -CR option: %s\n",
-+ argv[optind]);
-+ exit(1);
-+ }
-+ }
-+ } else {
-+ usage();
-+ fprintf(stderr, "Bad -CR option: no argument given\n");
-+ exit(1);
-+ }
-+ optind++;
-+ break;
- case 'S': /* FreeBSD:
- NetBSD: Semi-numeric display
- OpenBSD: Show route source selector */
---- net-snmp-5.4.2.1/apps/snmpnetstat/netstat.h~ 2009-01-22 19:09:36.000000000 +0200
-+++ net-snmp-5.4.2.1/apps/snmpnetstat/netstat.h 2009-01-22 19:09:38.270836446 +0200
-@@ -62,6 +62,7 @@
- extern char *intrface; /* desired i/f for stats, or NULL for all i/fs */
-
- extern int af; /* address family */
-+extern int max_getbulk; /* specifies the max-repeaters value to use with GETBULK requests */
-
- extern char *__progname; /* program name, from crt0.o */
-
+++ /dev/null
---- branches/V5-4-patches/net-snmp/snmplib/snmpUDPDomain.c 2009/01/28 09:29:09 17366
-+++ branches/V5-4-patches/net-snmp/snmplib/snmpUDPDomain.c 2009/01/28 10:10:06 17367
-@@ -110,12 +110,12 @@
- char tmp[64];
- to = (struct sockaddr_in *) &(addr_pair->remote_addr);
- if (to == NULL) {
-- sprintf(tmp, "UDP: [%s]->unknown",
-+ sprintf(tmp, "UDP: unknown->[%s]",
- inet_ntoa(addr_pair->local_addr));
- } else {
-- sprintf(tmp, "UDP: [%s]->", inet_ntoa(addr_pair->local_addr));
-- sprintf(tmp + strlen(tmp), "[%s]:%hd",
-+ sprintf(tmp, "UDP: [%s]:%hu->",
- inet_ntoa(to->sin_addr), ntohs(to->sin_port));
-+ sprintf(tmp + strlen(tmp), "[%s]", inet_ntoa(addr_pair->local_addr));
- }
- return strdup(tmp);
- }
+++ /dev/null
---- net-snmp/include/net-snmp/library/container.h 2008/02/13 23:37:48 16804
-+++ net-snmp/include/net-snmp/library/container.h 2008/10/14 09:37:21 17254
-@@ -358,7 +358,7 @@
- if(x) {
- int rc = x->insert(x,k);
- if(rc)
-- snmp_log(LOG_ERR,"error on subcontainer '%s' insert (%d)\n",
-+ snmp_log(LOG_DEBUG,"error on subcontainer '%s' insert (%d)\n",
- x->container_name ? x->container_name : "", rc);
- else {
- rc = CONTAINER_INSERT_HELPER(x->next, k);
void
init_hr_swinst(void)
{
---- net-snmp-5.4.1/configure.in 2008-05-15 13:05:07.559306690 +0300
-+++ net-snmp-5.4.1.hrmib/configure.in 2008-05-15 13:04:24.684830570 +0300
-@@ -2768,25 +2768,41 @@
- fi
- ])
-
+--- net-snmp-5.5/configure.d/config_os_libs~ 2010-05-12 14:31:17.751301337 +0200
++++ net-snmp-5.5/configure.d/config_os_libs 2010-05-12 14:34:11.694627717 +0200
+@@ -261,20 +261,34 @@
+ # RPM checks
+ #
+ ##
-AC_CHECK_HEADERS(rpm/rpmlib.h rpm/header.h)
-
+-
-AC_CHECK_HEADER(rpm/rpmlib.h,rpmlib_h=yes,rpmlib_h=no)
-AC_CHECK_HEADER(rpm/header.h,rpmheader_h=yes,rpmheader_h=no)
-
- else
- with_rpm=no
- fi
-+# check if we can use rpm hrmib export
-+if test "$with_rpm" != "no" ; then
-+ AC_PATH_PROG([RPM], rpm)
-+ if test -n "$RPM"; then
-+ changequote(, )
-+ RPM_HRMIB_PATH=$($RPM -E %{_hrmib_path} | sed -e 's,/[^/]\+$,,')
-+ changequote([, ])
-+ if test -n "$RPM_HRMIB_PATH"; then
-+ AC_DEFINE_UNQUOTED([RPM_HRMIB_PATH], ["$RPM_HRMIB_PATH"], [Directory where RPM exports packages hrmib information])
-+ fi
-+ fi
- fi
-
-+# otherwise try binary linkin
-+if test -z "$RPM_HRMIB_PATH"; then
-+ AC_CHECK_HEADERS(rpm/rpmlib.h rpm/header.h)
-+
-+ AC_CHECK_HEADER(rpm/rpmlib.h,rpmlib_h=yes,rpmlib_h=no)
-+ AC_CHECK_HEADER(rpm/header.h,rpmheader_h=yes,rpmheader_h=no)
-+
-+ if test "x$rpmheader_h" = "xno" -o "x$rpmlib_h" = "xno" ; then
-+ if test "x$with_rpm" = "xyes" ; then
-+ AC_MSG_ERROR([Could not find either the RPM header files needed and was specifically asked to use RPM support])
-+ else
-+ with_rpm=no
-+ fi
-+ fi
+-fi
+-
#
++# check if we can use rpm hrmib export
++if test "$with_rpm" != "no" ; then
++ AC_PATH_PROG([RPM], rpm)
++ if test -n "$RPM"; then
++ changequote(, )
++ RPM_HRMIB_PATH=$($RPM -E %{_hrmib_path} | sed -e 's,/[^/]\+$,,')
++ changequote([, ])
++ if test -n "$RPM_HRMIB_PATH"; then
++ AC_DEFINE_UNQUOTED([RPM_HRMIB_PATH], ["$RPM_HRMIB_PATH"], [Directory where RPM exports packages hrmib information])
++ fi
++ fi
++fi
++# otherwise try binary linkin
++if test -z "$RPM_HRMIB_PATH"; then
++ AC_CHECK_HEADERS(rpm/rpmlib.h rpm/header.h)
++
++ AC_CHECK_HEADER(rpm/rpmlib.h,rpmlib_h=yes,rpmlib_h=no)
++ AC_CHECK_HEADER(rpm/header.h,rpmheader_h=yes,rpmheader_h=no)
++
++ if test "x$rpmheader_h" = "xno" -o "x$rpmlib_h" = "xno" ; then
++ if test "x$with_rpm" = "xyes" ; then
++ AC_MSG_ERROR([Could not find either the RPM header files needed and was specifically asked to use RPM support])
++ else
++ with_rpm=no
++ fi
++ fi
++
# rpm libraries only needed for the host resources mib software
# installed tables (on linux in particular)
#
- if test "x$with_rpm" != "xno" && \
- echo " $module_list " | grep " host/hr_swinst " > /dev/null; then
-+
- # ARG. RPM is a real pain.
- # FWIW librpm.la, librpmio.la, and libpopt.la have correct dependencies.
- _rpmlibs=""
-@@ -2835,7 +2851,14 @@
- CFLAGS="$CFLAGS -I/usr/include/rpm"
- ],,-lrpm $_rpmlibs)
- ])
-+
-+ OLDLIBS=$LIBS
-+ LIBS=$LMIBLIBS
-+ AC_CHECK_FUNCS(rpmGetPath)
+@@ -319,7 +333,14 @@
+ LMIBLIBS="$_rpmlibs $LMIBLIBS"
+ CFLAGS="$CFLAGS -I/usr/include/rpm"
+ ],, $LMIBLIBS, _rpmlibs)
+-fi
++ OLDLIBS=$LIBS
++ LIBS=$LMIBLIBS
++ AC_CHECK_FUNCS(rpmGetPath)
+ LIBS=$OLDLIBS
- fi
++
++ fi
+
+fi # with rpmlib
-
- # libkvm
- AC_CHECK_LIB(kvm, kvm_read, [_libkvm="-lkvm"])
-@@ -3406,12 +3429,6 @@
- # table_array helper support
- AC_CHECK_HEADERS(search.h)
--# RPM subdirectory path (sigh)
--if test "x$with_rpm" != "xno" && \
-- echo " $module_list " | grep " host/hr_swinst " > /dev/null; then
-- AC_CHECK_HEADERS(rpm/rpmdb.h)
--fi
--
- # OpenBSD 2.6 needs netinet/in.h before netinet/in_pcb.h
- AC_MSG_CHECKING([[for netinet/in_pcb.h]])
- AC_CACHE_VAL(cv_have_netinet_in_pcb_h,
-@@ -3633,13 +3650,6 @@
- AC_CHECK_FUNCS(random lrand48 rand)
- AC_CHECK_FUNCS(execv system fork getpid strncasecmp sigalrm)
- AC_CHECK_FUNCS(lseek64 pread64)
+ ##
+ # mysql
+--- net-snmp-5.5/configure.d/config_os_functions~ 2009-07-26 20:20:55.000000000 +0200
++++ net-snmp-5.5/configure.d/config_os_functions 2010-05-12 14:35:39.421276242 +0200
+@@ -67,15 +67,6 @@
+ # (Agent)
+ ##
+
+-# rpmGetPath check needs clean LIBS environment (Linux)
+-#
-if test "x$with_rpm" != "xno" && \
-- echo " $module_list " | grep " host/hr_swinst " > /dev/null; then
-- OLDLIBS=$LIBS
-- LIBS=$LMIBLIBS
-- AC_CHECK_FUNCS(rpmGetPath)
-- LIBS=$OLDLIBS
+- echo " $module_list " | $GREP " host/hr_swinst " > /dev/null; then
+- OLDLIBS=$LIBS
+- LIBS=$LMIBLIBS
+- AC_CHECK_FUNCS(rpmGetPath)
+- LIBS=$OLDLIBS
-fi
- AC_CHECK_FUNCS(getloadavg)
- AC_CHECK_FUNCS(getaddrinfo getipnodebyname gai_strerror)
+ # statfs( char *, struct fs_data* ) (Ultrix)
+ #
+
Summary(ru.UTF-8): Набор утилит для протокола SNMP от UC-Davis
Summary(uk.UTF-8): Набір утиліт для протоколу SNMP від UC-Davis
Name: net-snmp
-Version: 5.4.2.1
-Release: 20
+Version: 5.5
+Release: 0.1
License: BSD-like
Group: Networking/Daemons
Source0: http://dl.sourceforge.net/net-snmp/%{name}-%{version}.tar.gz
-# Source0-md5: 984932520143f0c8bf7b7ce1fc9e1da1
+# Source0-md5: 5b2551e7bd024fbbee84dca22a5f13a1
Source1: %{name}d.init
Source2: %{name}d.conf
Source3: %{name}d.sysconfig
Patch10: %{name}-lvalue.patch
Patch11: %{name}-defaultconfig.patch
Patch12: %{name}-use-rpm-hrmib.patch
-Patch13: %{name}-snmpnetstat-getbulk.patch
Patch14: %{name}-lm_sensors_3.patch
-Patch15: %{name}-subcontainer.patch
-Patch16: %{name}-netlink.patch
Patch17: %{name}-TCP_STATS_CACHE_TIMEOUT.patch
-Patch18: %{name}-src-dst-confusion.patch
Patch19: %{name}-loadave-writable.patch
URL: http://www.net-snmp.org/
BuildRequires: autoconf >= 2.61-3
%prep
%setup -q -a7
-%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
+# check me
%patch11 -p1
%patch12 -p1
-%patch13 -p1
+# check me
%patch14 -p0
-%patch15 -p1
-%patch16 -p1
%patch17 -p1
-%patch18 -p3
%patch19 -p1
%build
%{__libtoolize}
-%{__aclocal}
+%{__aclocal} -I m4
%{__autoconf}
%{__autoheader}
cp -f /usr/share/automake/config.sub .
+++ /dev/null
---- net-snmp-5.4.2.1/agent/mibgroup/hardware/cpu/cpu_linux.c~ 2008-08-27 16:39:38.000000000 +0300
-+++ net-snmp-5.4.2.1/agent/mibgroup/hardware/cpu/cpu_linux.c 2010-01-15 10:57:53.491162294 +0200
-@@ -261,7 +261,7 @@
- cpu->pageOut = (unsigned long)pout;
- } else {
- if (first)
-- snmp_log(LOG_ERR, "No page line in %s\n", STAT_FILE);
-+ snmp_log(LOG_DEBUG, "No page line in %s\n", STAT_FILE);
- cpu->pageIn = cpu->pageOut = 0;
- }
- b = strstr(buff, "swap ");
-@@ -271,7 +271,7 @@
- cpu->swapOut = (unsigned long)swpout;
- } else {
- if (first)
-- snmp_log(LOG_ERR, "No swap line in %s\n", STAT_FILE);
-+ snmp_log(LOG_DEBUG, "No swap line in %s\n", STAT_FILE);
- cpu->swapIn = cpu->swapOut = 0;
- }
- }
---- net-snmp-5.4.2.1/agent/mibgroup/ucd-snmp/vmstat_linux.c~ 2006-09-15 03:48:50.000000000 +0300
-+++ net-snmp-5.4.2.1/agent/mibgroup/ucd-snmp/vmstat_linux.c 2010-01-15 10:58:55.859906415 +0200
-@@ -316,7 +316,7 @@
- sscanf(b, "page %u %u", pin, pout);
- else {
- if (first)
-- snmp_log(LOG_ERR, "No page line in %s\n", STAT_FILE);
-+ snmp_log(LOG_DEBUG, "No page line in %s\n", STAT_FILE);
- *pin = *pout = 0;
- }
- b = strstr(buff, "swap ");
-@@ -324,7 +324,7 @@
- sscanf(b, "swap %u %u", swpin, swpout);
- else {
- if (first)
-- snmp_log(LOG_ERR, "No swap line in %s\n", STAT_FILE);
-+ snmp_log(LOG_DEBUG, "No swap line in %s\n", STAT_FILE);
- *swpin = *swpout = 0;
- }
- }