Hello community,
here is the log from the commit of package net-snmp
checked in at Fri Oct 24 22:48:24 CEST 2008.
--------
--- net-snmp/net-snmp.changes 2008-10-20 17:06:01.000000000 +0200
+++ /mounts/work_src_done/STABLE/net-snmp/net-snmp.changes 2008-10-24 16:56:40.998886000 +0200
@@ -1,0 +2,40 @@
+Fri Oct 24 16:54:46 CEST 2008 - mrueckert@suse.de
+
+- added net-snmp-5.4.2_velocity-mib.patch (FATE#303556)
+
+-------------------------------------------------------------------
+Fri Oct 24 16:43:34 CEST 2008 - mrueckert@suse.de
+
+- refreshed patches to apply cleanly:
+ old: net-snmp-5.1.2-snmpconf-selinux.patch
+ new: net-snmp-5.4.2_snmpconf-selinux.patch
+ old: net-snmp-5.2.1-overflow.diff
+ new: net-snmp-5.4.2_overflow.patch
+ old: net-snmp-5.2.1.testing.empty_arptable.patch
+ new: net-snmp-5.4.2_testing.empty_arptable.patch
+ old: net-snmp-5.3.0.1-audit.diff
+ new: nmp-5.4.2_audit.patch
+ old: net-snmp-5.3_vendorperl.patch
+ new: net-snmp-5.4.2_vendorperl.patch
+ old: net-snmp-5.4.1-autoconf.diff
+ new: net-snmp-5.4.2_autoconf.patch
+ old: net-snmp-5.4.1_perl_tk_warning.patch
+ new: net-snmp-5.4.2_perl_tk_warning.patch
+ old: net-snmp-5.4_net-snmp-config_headercheck.patch
+ new: net-snmp-5.4.2_net-snmp-config_headercheck.patch
+
+-------------------------------------------------------------------
+Fri Oct 24 14:43:35 CEST 2008 - kkeil@suse.de
+
+- more IPv6 support from IBM (mainline backports) (bnc#437208)
+ Fix-for-tcpConnnectionTable-tcpListenerTable-udpEn.patch
+ Fix-for-IPv6-Interface-Table.patch
+ Fix-for-Internet-Address-Table.patch
+ Add-ICMP-Statistics-Tables-support.patch
+ Add-Default-Router-Table-support.patch
+ Add-IPv6-support-on-Internet-Address-Translation-Tab.patch
+ Fix-for-Internet-Address-Prefix-Table.patch
+ Add-IPv6-Scope-Zone-Index.patch
+ Improve-IP-Statistics-tables.patch
+
+-------------------------------------------------------------------
calling whatdependson for head-i586
Old:
----
net-snmp-5.1.2-snmpconf-selinux.patch
net-snmp-5.2.1-overflow.diff
net-snmp-5.2.1.testing.empty_arptable.patch
net-snmp-5.3.0.1-audit.diff
net-snmp-5.3_vendorperl.patch
net-snmp-5.4.1-autoconf.diff
net-snmp-5.4.1_perl_tk_warning.patch
net-snmp-5.4_net-snmp-config_headercheck.patch
New:
----
Add-Default-Router-Table-support.patch
Add-ICMP-Statistics-Tables-support.patch
Add-IPv6-Scope-Zone-Index.patch
Add-IPv6-support-on-Internet-Address-Translation-Tab.patch
Fix-for-Internet-Address-Prefix-Table.patch
Fix-for-Internet-Address-Table.patch
Fix-for-IPv6-Interface-Table.patch
Fix-for-tcpConnnectionTable-tcpListenerTable-udpEn.patch
Improve-IP-Statistics-tables.patch
net-snmp-5.4.2_audit.patch
net-snmp-5.4.2_autoconf.patch
net-snmp-5.4.2_net-snmp-config_headercheck.patch
net-snmp-5.4.2_overflow.patch
net-snmp-5.4.2_perl_tk_warning.patch
net-snmp-5.4.2_snmpconf-selinux.patch
net-snmp-5.4.2_testing.empty_arptable.patch
net-snmp-5.4.2_velocity-mib.patch
net-snmp-5.4.2_vendorperl.patch
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ net-snmp.spec ++++++
--- /var/tmp/diff_new_pack.hH9523/_old 2008-10-24 22:47:11.000000000 +0200
+++ /var/tmp/diff_new_pack.hH9523/_new 2008-10-24 22:47:11.000000000 +0200
@@ -20,7 +20,7 @@
Name: net-snmp
Version: 5.4.2
-Release: 7
+Release: 8
#
License: BSD 3-Clause; X11/MIT
Group: Productivity/Networking/Other
@@ -59,21 +59,31 @@
Source6: test_installed
Source7: net-snmp.sysconfig
Source8: net-snmp-rpmlintrc
-Patch: net-snmp-5.3.0.1-audit.diff
-Patch1: net-snmp-5.4.1-autoconf.diff
+Patch: net-snmp-5.4.2_audit.patch
+Patch1: net-snmp-5.4.2_autoconf.patch
# unused patch atm
Patch2: net-snmp-5.2.1-socket_path.diff
Patch3: net-snmp-5.4.rc2-versinfo.diff
-Patch4: net-snmp-5.2.1-overflow.diff
-Patch5: net-snmp-5.2.1.testing.empty_arptable.patch
+Patch4: net-snmp-5.4.2_overflow.patch
+Patch5: net-snmp-5.4.2_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.4.1_perl_tk_warning.patch
-Patch10: net-snmp-5.1.2-snmpconf-selinux.patch
+Patch7: net-snmp-5.4.2_vendorperl.patch
+Patch8: net-snmp-5.4.2_net-snmp-config_headercheck.patch
+Patch9: net-snmp-5.4.2_perl_tk_warning.patch
+Patch10: net-snmp-5.4.2_snmpconf-selinux.patch
Patch11: net-snmp-5.3.0.1_trap-agent-addr_v2.patch
Patch12: net-snmp-5.4.1.2-etherlike-mib-revised_1.patch
Patch13: net-snmp-5.4.1.2-rmon-mib-revised.patch
+Patch14: net-snmp-5.4.2_velocity-mib.patch
+Patch15: Fix-for-tcpConnnectionTable-tcpListenerTable-udpEn.patch
+Patch16: Fix-for-IPv6-Interface-Table.patch
+Patch17: Fix-for-Internet-Address-Table.patch
+Patch18: Add-ICMP-Statistics-Tables-support.patch
+Patch19: Add-Default-Router-Table-support.patch
+Patch20: Add-IPv6-support-on-Internet-Address-Translation-Tab.patch
+Patch21: Fix-for-Internet-Address-Prefix-Table.patch
+Patch22: Add-IPv6-Scope-Zone-Index.patch
+Patch23: Improve-IP-Statistics-tables.patch
#
Summary: SNMP Daemon
@@ -193,16 +203,25 @@
%patch7
%patch8
%patch9
-%patch10 -p1
+%patch10
%patch11
%patch12
%patch13
+%patch14
+%patch15 -p1
+%patch16 -p1
+%patch17 -p1
+%patch18 -p1
+%patch19 -p1
+%patch20 -p1
+%patch21 -p1
+%patch22 -p1
+%patch23 -p1
find -name "CVS" -type d | xargs -r %{__rm} -rfv
find -name ".cvsignore" | xargs -r %{__rm} -fv
-find -name "*.orig" | xargs -r %{__rm} -fv
%build
-#autoconf
+autoreconf -fi
# possibly add later
# --with-python-modules \ => need python-setuptools
# ip-mib/ipv4InterfaceTable ip-mib/ipv6InterfaceTable
@@ -216,10 +235,14 @@
--with-mib-modules="misc/ipfwacc \
ucd-snmp/diskio \
etherlike-mib rmon-mib \
+ velocity \
%if 0%{?with_sensors}
ucd-snmp/lmSensors \
%endif
- smux" \
+ smux \
+ ip-mib/ipv4InterfaceTable ip-mib/ipv6InterfaceTable \
+ ip-mib/ipDefaultRouterTable ip-mib/ipAddressPrefixTable \
+ ip-mib/ipv6ScopeZoneIndexTable ip-mib/ipIfStatsTable" \
--with-persistent-directory=/var/lib/net-snmp \
--with-agentx-socket=%{netsnmp_agentx_socket_dir_fhs}/master \
--with-sys-location="unknown" \
@@ -397,6 +420,37 @@
%{_bindir}/tkmib
%changelog
+* Fri Oct 24 2008 mrueckert@suse.de
+- added net-snmp-5.4.2_velocity-mib.patch (FATE#303556)
+* Fri Oct 24 2008 mrueckert@suse.de
+- refreshed patches to apply cleanly:
+ old: net-snmp-5.1.2-snmpconf-selinux.patch
+ new: net-snmp-5.4.2_snmpconf-selinux.patch
+ old: net-snmp-5.2.1-overflow.diff
+ new: net-snmp-5.4.2_overflow.patch
+ old: net-snmp-5.2.1.testing.empty_arptable.patch
+ new: net-snmp-5.4.2_testing.empty_arptable.patch
+ old: net-snmp-5.3.0.1-audit.diff
+ new: nmp-5.4.2_audit.patch
+ old: net-snmp-5.3_vendorperl.patch
+ new: net-snmp-5.4.2_vendorperl.patch
+ old: net-snmp-5.4.1-autoconf.diff
+ new: net-snmp-5.4.2_autoconf.patch
+ old: net-snmp-5.4.1_perl_tk_warning.patch
+ new: net-snmp-5.4.2_perl_tk_warning.patch
+ old: net-snmp-5.4_net-snmp-config_headercheck.patch
+ new: net-snmp-5.4.2_net-snmp-config_headercheck.patch
+* Fri Oct 24 2008 kkeil@suse.de
+- more IPv6 support from IBM (mainline backports) (bnc#437208)
+ Fix-for-tcpConnnectionTable-tcpListenerTable-udpEn.patch
+ Fix-for-IPv6-Interface-Table.patch
+ Fix-for-Internet-Address-Table.patch
+ Add-ICMP-Statistics-Tables-support.patch
+ Add-Default-Router-Table-support.patch
+ Add-IPv6-support-on-Internet-Address-Translation-Tab.patch
+ Fix-for-Internet-Address-Prefix-Table.patch
+ Add-IPv6-Scope-Zone-Index.patch
+ Improve-IP-Statistics-tables.patch
* Mon Oct 20 2008 mrueckert@suse.de
- remove lzma-alpha-devel. rpm-devel has to require it if it is
really needed
++++++ Add-Default-Router-Table-support.patch ++++++
++++ 3568 lines (skipped)
++++++ Add-ICMP-Statistics-Tables-support.patch ++++++
++++ 1477 lines (skipped)
++++++ Add-IPv6-Scope-Zone-Index.patch ++++++
++++ 3481 lines (skipped)
++++++ Add-IPv6-support-on-Internet-Address-Translation-Tab.patch ++++++
From ecd91d8a2b532bd1a987369e76d75fef454f2bcf Mon Sep 17 00:00:00 2001
From: Mitsuru Chinen
Date: Mon, 20 Oct 2008 17:33:11 +0900
Subject: [PATCH] Add IPv6 support on Internet Address Translation Table
[ 1708243 ] add linux support for ipDefaultRouterTable OID to net-snmp
http://sourceforge.net/tracker/index.php?func=detail&aid=1708243&group_id=12694&atid=312694
[ 1724602 ] [Linux] ipDefaultRouterTable improvement
http://sourceforge.net/tracker/index.php?func=detail&aid=1724602&group_id=12694&atid=312694
[ 1728223 ] [Linux] add configure check for netlink socket
http://sourceforge.net/tracker/index.php?func=detail&aid=1728223&group_id=12694&atid=312694
Signed-off-by: Mitsuru Chinen
---
agent/mibgroup/ip-mib/data_access/arp_linux.c | 243 +++++++++++++++++++-
.../inetNetToMediaTable_data_access.c | 2 +-
configure.in | 10 +
3 files changed, 249 insertions(+), 6 deletions(-)
diff --git a/agent/mibgroup/ip-mib/data_access/arp_linux.c b/agent/mibgroup/ip-mib/data_access/arp_linux.c
index e1d20c1..a25e4d8 100644
--- a/agent/mibgroup/ip-mib/data_access/arp_linux.c
+++ b/agent/mibgroup/ip-mib/data_access/arp_linux.c
@@ -14,9 +14,32 @@
#include
#include
#include
+#include
+#include
+#ifdef NETSNMP_ENABLE_IPV6
+#ifdef HAVE_LINUX_RTNETLINK_H
+#include
+#define NIP6(addr) \
+ ntohs((addr).s6_addr16[0]), \
+ ntohs((addr).s6_addr16[1]), \
+ ntohs((addr).s6_addr16[2]), \
+ ntohs((addr).s6_addr16[3]), \
+ ntohs((addr).s6_addr16[4]), \
+ ntohs((addr).s6_addr16[5]), \
+ ntohs((addr).s6_addr16[6]), \
+ ntohs((addr).s6_addr16[7])
+#define NIP6_FMT "%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x"
+#endif
+#endif
int _load_v4(netsnmp_container *container, int idx_offset);
-
+static int _load_v6(netsnmp_container *container, int idx_offset);
+#ifdef HAVE_LINUX_RTNETLINK_H
+int get_translation_table_info (int sd, int *status,
+ char *buff, size_t size);
+int fillup_entry_info(netsnmp_arp_entry *entry,
+ struct nlmsghdr *nlmp);
+#endif
/**
*/
int
@@ -28,11 +51,10 @@ netsnmp_access_arp_container_arch_load(netsnmp_container *container)
if(rc < 0) {
u_int flags = NETSNMP_ACCESS_ARP_FREE_KEEP_CONTAINER;
netsnmp_access_arp_container_free(container, flags);
- return rc;
}
-#if defined (NETSNMP_ENABLE_IPV6) && 0 /* xx-rks: arp for v6? */
- idx_offset = rc;
+#if defined (NETSNMP_ENABLE_IPV6)
+ idx_offset = (rc < 0) ? 0 : rc;
rc = _load_v6(container, idx_offset);
if(rc < 0) {
@@ -64,7 +86,7 @@ _load_v4(netsnmp_container *container, int idx_offset)
#define PROCFILE "/proc/net/arp"
if (!(in = fopen(PROCFILE, "r"))) {
- snmp_log(LOG_ERR,"could not open " PROCFILE "\n");
+ snmp_log(LOG_DEBUG,"could not open " PROCFILE "\n");
return -2;
}
@@ -192,3 +214,214 @@ _load_v4(netsnmp_container *container, int idx_offset)
return idx_offset;
}
+
+#if defined (NETSNMP_ENABLE_IPV6)
+static int
+_load_v6(netsnmp_container *container, int idx_offset)
+{
+ char buffer[16384];
+#if defined(HAVE_LINUX_RTNETLINK_H)
+ struct nlmsghdr *nlmp;
+#endif
+ int sd = 0;
+ int status = 0;
+ int rc = 0;
+ int len, req_len;
+ netsnmp_arp_entry *entry;
+
+ netsnmp_assert(NULL != container);
+#if defined(HAVE_LINUX_RTNETLINK_H)
+ if((sd = socket (PF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE)) < 0) {
+ snmp_log(LOG_ERR,"Unable to create netlink socket\n");
+ return -2;
+ }
+
+ if(get_translation_table_info (sd, &status, buffer, sizeof(buffer)) < 0) {
+ snmp_log(LOG_ERR,"Unable to fetch translation table info\n");
+ close(sd);
+ return -2;
+ }
+
+ for (nlmp = (struct nlmsghdr *)buffer; status > sizeof(*nlmp); ) {
+ len = nlmp->nlmsg_len;
+ req_len = len - sizeof(*nlmp);
+ if (req_len < 0 || len > status) {
+ snmp_log(LOG_ERR,"invalid length\n");
+ return -2;
+ }
+ if (!NLMSG_OK (nlmp, status)) {
+ snmp_log(LOG_ERR,"NLMSG not OK\n");
+ return -2;
+ }
+ entry = netsnmp_access_arp_entry_create();
+ if(NULL == entry) {
+ rc = -3;
+ break;
+ }
+ entry->ns_arp_index = ++idx_offset;
+ if(fillup_entry_info (entry, nlmp) < 0) {
+ DEBUGMSGTL(("access:arp:load_v6", "filling entry info failed\n"));
+ netsnmp_access_arp_entry_free(entry);
+ status -= NLMSG_ALIGN(len);
+ nlmp = (struct nlmsghdr*)((char*)nlmp + NLMSG_ALIGN(len));
+ continue;
+ }
+ CONTAINER_INSERT(container, entry);
+ status -= NLMSG_ALIGN(len);
+ nlmp = (struct nlmsghdr*)((char*)nlmp + NLMSG_ALIGN(len));
+ }
+
+ close(sd);
+#endif
+ if(rc<0) {
+ return rc;
+ }
+
+ return idx_offset;
+}
+#if defined(HAVE_LINUX_RTNETLINK_H)
+int
+get_translation_table_info (int sd, int *status, char *buff, size_t size)
+{
+ struct {
+ struct nlmsghdr n;
+ struct ndmsg r;
+ char buf[1024];
+ } req;
+ struct rtattr *rta;
+
+ memset(&req, 0, sizeof(req));
+ req.n.nlmsg_len = NLMSG_LENGTH (sizeof(struct ndmsg));
+ req.n.nlmsg_flags = NLM_F_REQUEST | NLM_F_ROOT;
+ req.n.nlmsg_type = RTM_GETNEIGH;
+
+ req.r.ndm_family = AF_INET6;
+ rta = (struct rtattr *)(((char *)&req) + NLMSG_ALIGN(req.n.nlmsg_len));
+ rta->rta_len = RTA_LENGTH(16);
+
+ if(send(sd, &req, req.n.nlmsg_len, 0) < 0) {
+ snmp_log(LOG_ERR,"Sending request failed\n");
+ return -1;
+ }
+ if((*status = recv(sd, buff, size, 0)) < 0) {
+ snmp_log(LOG_ERR,"Recieving request failed\n");
+ return -1;
+ }
+ if(*status == 0) {
+ snmp_log(LOG_ERR,"End of file\n");
+ return -1;
+ }
+ return 0;
+}
+
+int
+fillup_entry_info(netsnmp_arp_entry *entry, struct nlmsghdr *nlmp)
+{
+ struct ndmsg *rtmp;
+ struct in6_addr *in6p;
+ struct rtattr *tb[NDA_MAX+1], *rta;
+ size_t in_len, out_len;
+ unsigned int i;
+ int length;
+ char addr[40];
+ u_char *buf;
+ u_char *hwaddr;
+
+ rtmp = (struct ndmsg *)NLMSG_DATA(nlmp);
+ if (nlmp->nlmsg_type != RTM_NEWNEIGH && nlmp->nlmsg_type != RTM_DELNEIGH)
+ return -1;
+
+ if(rtmp->ndm_state != NUD_NOARP) {
+ memset(tb, 0, sizeof(struct rtattr *) * (NDA_MAX + 1));
+ length = nlmp->nlmsg_len - NLMSG_LENGTH(sizeof(*rtmp));
+ /* this is what the kernel-removed NDA_RTA define did */
+ rta = ((struct rtattr*)(((char*)(rtmp)) +
+ NLMSG_ALIGN(sizeof(struct ndmsg))));
+ while (RTA_OK(rta, length)) {
+ if (rta->rta_type <= NDA_MAX)
+ tb[rta->rta_type] = rta;
+ rta = RTA_NEXT(rta,length);
+ }
+ if(length)
+ return -1;
+ /* Fill up the index
+ */
+ entry->if_index = rtmp->ndm_ifindex;
+ /* Fill up ip address */
+ if (tb[NDA_DST]) {
+ memset(&addr, '\0', sizeof(addr));
+ in6p = (struct in6_addr *)RTA_DATA(tb[NDA_DST]);
+ sprintf(addr, NIP6_FMT, NIP6(*in6p));
+ in_len = entry->arp_ipaddress_len = sizeof(entry->arp_ipaddress);
+ netsnmp_assert(16 == in_len);
+ out_len = 0;
+ buf = entry->arp_ipaddress;
+ if(1 != netsnmp_hex_to_binary(&buf, &in_len,
+ &out_len, 0, addr, ":")) {
+ snmp_log(LOG_ERR,"error parsing '%s', skipping\n",
+ entry->arp_ipaddress);
+ return -1;
+ }
+ netsnmp_assert(16 == out_len);
+ entry->arp_ipaddress_len = out_len;
+ }
+ if (tb[NDA_LLADDR]) {
+ memset(&addr, '\0', sizeof(addr));
+ hwaddr = RTA_DATA(tb[NDA_LLADDR]);
+ entry->arp_physaddress_len = RTA_PAYLOAD(tb[NDA_LLADDR]);
+ buf = entry->arp_physaddress;
+ for (i = 0; i < entry->arp_physaddress_len; i++)
+ entry->arp_physaddress[i] = hwaddr[i];
+ }
+
+ switch (rtmp->ndm_state) {
+ case NUD_INCOMPLETE:
+ entry->arp_state = INETNETTOMEDIASTATE_INCOMPLETE;
+ break;
+ case NUD_REACHABLE:
+ case NUD_PERMANENT:
+ entry->arp_state = INETNETTOMEDIASTATE_REACHABLE;
+ break;
+ case NUD_STALE:
+ entry->arp_state = INETNETTOMEDIASTATE_STALE;
+ break;
+ case NUD_DELAY:
+ entry->arp_state = INETNETTOMEDIASTATE_DELAY;
+ break;
+ case NUD_PROBE:
+ entry->arp_state = INETNETTOMEDIASTATE_PROBE;
+ break;
+ case NUD_FAILED:
+ entry->arp_state = INETNETTOMEDIASTATE_INVALID;
+ break;
+ case NUD_NONE:
+ entry->arp_state = INETNETTOMEDIASTATE_UNKNOWN;
+ break;
+ }
+
+ switch (rtmp->ndm_state) {
+ case NUD_INCOMPLETE:
+ case NUD_FAILED :
+ case NUD_NONE :
+ entry->arp_type = INETNETTOMEDIATYPE_INVALID;
+ break;
+ case NUD_REACHABLE:
+ case NUD_STALE :
+ case NUD_DELAY :
+ case NUD_PROBE :
+ entry->arp_type = INETNETTOMEDIATYPE_DYNAMIC;
+ break;
+ case NUD_PERMANENT:
+ entry->arp_type = INETNETTOMEDIATYPE_STATIC;
+ break;
+ default:
+ entry->arp_type = INETNETTOMEDIATYPE_LOCAL;
+ break;
+ }
+ } else {
+ return -1; /* could not create data for this interface */
+ }
+ return 0;
+}
+#endif
+#endif
diff --git a/agent/mibgroup/ip-mib/inetNetToMediaTable/inetNetToMediaTable_data_access.c b/agent/mibgroup/ip-mib/inetNetToMediaTable/inetNetToMediaTable_data_access.c
index cad942c..dcc7900 100644
--- a/agent/mibgroup/ip-mib/inetNetToMediaTable/inetNetToMediaTable_data_access.c
+++ b/agent/mibgroup/ip-mib/inetNetToMediaTable/inetNetToMediaTable_data_access.c
@@ -155,7 +155,7 @@ _snarf_arp_entry(netsnmp_arp_entry *arp_entry,
inetAddressType = INETADDRESSTYPE_IPV4;
break;
- case 6:
+ case 16:
inetAddressType = INETADDRESSTYPE_IPV6;
break;
diff --git a/configure.in b/configure.in
index c5e05ba..220506a 100644
--- a/configure.in
+++ b/configure.in
@@ -3365,6 +3365,16 @@ AC_CHECK_HEADERS(linux/rtnetlink.h,,,
#include
#endif
]])
+# linux rtnetlink
+AC_CHECK_HEADERS(linux/rtnetlink.h,,,
+[[
+#if HAVE_ASM_TYPES_H
+#include
+#endif
+#if HAVE_SYS_SOCKET_H
+#include
+#endif
+]])
# BSDi3 headers
AC_CHECK_HEADERS(sys/stat.h)
# BSDi3/IRIX headers
--
1.6.0.2
++++++ Fix-for-Internet-Address-Prefix-Table.patch ++++++
++++ 876 lines (skipped)
++++++ Fix-for-Internet-Address-Table.patch ++++++
From 12cb1f471833a7e145bdf7cb4d471d0bd74d73f0 Mon Sep 17 00:00:00 2001
From: Mitsuru Chinen
Date: Mon, 20 Oct 2008 16:08:06 +0900
Subject: [PATCH] Fix for Internet Address Table
From net-snmp patch tracker:
[ 1692817 ] ipAddressTable fixes
http://sourceforge.net/tracker/index.php?func=detail&aid=1692817&group_id=12694&atid=312694
[ 1712645 ] meaningful log message on duplicate IP address
http://sourceforge.net/tracker/index.php?func=detail&aid=1712645&group_id=12694&atid=312694
[ 1810660 ] Fix broadcast addresses in ipAddressTable on 64 bit
linux
http://sourceforge.net/tracker/index.php?func=detail&aid=1810660&group_id=12694&atid=312694
Signed-off-by: Mitsuru Chinen
---
.../mibgroup/ip-mib/data_access/ipaddress_ioctl.c | 63 +++++++++-
.../mibgroup/ip-mib/data_access/ipaddress_ioctl.h | 13 ++
.../mibgroup/ip-mib/data_access/ipaddress_linux.c | 121 ++++++++++++++++++--
.../ip-mib/ipAddressTable/ipAddressTable.c | 5 +-
include/net-snmp/library/container.h | 2 +-
snmplib/container.c | 2 +-
6 files changed, 189 insertions(+), 17 deletions(-)
diff --git a/agent/mibgroup/ip-mib/data_access/ipaddress_ioctl.c b/agent/mibgroup/ip-mib/data_access/ipaddress_ioctl.c
index d5e78f0..085653d 100644
--- a/agent/mibgroup/ip-mib/data_access/ipaddress_ioctl.c
+++ b/agent/mibgroup/ip-mib/data_access/ipaddress_ioctl.c
@@ -135,7 +135,9 @@ _netsnmp_ioctl_ipaddress_container_load_v4(netsnmp_container *container,
struct ifreq *ifrp;
struct sockaddr save_addr;
struct sockaddr_in * si;
- netsnmp_ipaddress_entry *entry;
+ netsnmp_ipaddress_entry *entry, *bcastentry;
+ struct address_flag_info addr_info;
+ in_addr_t ipval;
_ioctl_extras *extras;
if ((sd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
@@ -184,6 +186,7 @@ _netsnmp_ioctl_ipaddress_container_load_v4(netsnmp_container *container,
netsnmp_assert(AF_INET == ifrp->ifr_addr.sa_family);
si = (struct sockaddr_in *) &ifrp->ifr_addr;
entry->ia_address_len = sizeof(si->sin_addr.s_addr);
+ ipval = si->sin_addr.s_addr;
memcpy(entry->ia_address, &si->sin_addr.s_addr,
entry->ia_address_len);
@@ -220,6 +223,26 @@ _netsnmp_ioctl_ipaddress_container_load_v4(netsnmp_container *container,
}
/*
+ * get broadcast
+ */
+ memset(&addr_info, 0, sizeof(struct address_flag_info));
+#if defined (NETSNMP_ENABLE_IPV6)
+ addr_info = netsnmp_access_other_info_get(entry->if_index, AF_INET);
+ if(addr_info.bcastflg) {
+ bcastentry = netsnmp_access_ipaddress_entry_create();
+ if(NULL == entry) {
+ rc = -3;
+ break;
+ }
+ bcastentry->if_index = entry->if_index;
+ bcastentry->ns_ia_index = ++idx_offset;
+ bcastentry->ia_address_len = sizeof(addr_info.inp->s_addr);
+ memcpy(bcastentry->ia_address, &addr_info.inp->s_addr,
+ bcastentry->ia_address_len);
+ }
+#endif
+
+ /*
* get netmask
*/
ifrp->ifr_addr = save_addr;
@@ -232,7 +255,10 @@ _netsnmp_ioctl_ipaddress_container_load_v4(netsnmp_container *container,
netsnmp_assert(AF_INET == ifrp->ifr_addr.sa_family);
si = (struct sockaddr_in *) &ifrp->ifr_addr;
entry->ia_prefix_len =
- netsnmp_ipaddress_ipv4_prefix_len(si->sin_addr.s_addr);
+ netsnmp_ipaddress_ipv4_prefix_len(ntohl(si->sin_addr.s_addr));
+ if(addr_info.bcastflg)
+ bcastentry->ia_prefix_len = entry->ia_prefix_len;
+
/*
* get flags
@@ -246,7 +272,12 @@ _netsnmp_ioctl_ipaddress_container_load_v4(netsnmp_container *container,
}
extras->flags = ifrp->ifr_flags;
- entry->ia_type = IPADDRESSTYPE_UNICAST; /* assume unicast? */
+ if(addr_info.bcastflg)
+ bcastentry->ia_type = IPADDRESSTYPE_BROADCAST;
+ if(addr_info.anycastflg)
+ entry->ia_type = IPADDRESSTYPE_ANYCAST;
+ else
+ entry->ia_type = IPADDRESSTYPE_UNICAST;
/** entry->ia_prefix_oid ? */
@@ -256,12 +287,23 @@ _netsnmp_ioctl_ipaddress_container_load_v4(netsnmp_container *container,
* always preferred(1).
*/
entry->ia_status = IPADDRESSSTATUSTC_PREFERRED;
+ if(addr_info.bcastflg)
+ bcastentry->ia_status = IPADDRESSSTATUSTC_PREFERRED;
/*
* can we figure out if an address is from DHCP?
* use manual until then...
*/
- entry->ia_origin = IPADDRESSORIGINTC_MANUAL;
+ if(IS_APIPA(ipval)) {
+ entry->ia_origin = IPADDRESSORIGINTC_RANDOM;
+ if(addr_info.bcastflg)
+ bcastentry->ia_origin = IPADDRESSORIGINTC_RANDOM;
+ }
+ else {
+ entry->ia_origin = IPADDRESSORIGINTC_MANUAL;
+ if(addr_info.bcastflg)
+ bcastentry->ia_origin = IPADDRESSORIGINTC_MANUAL;
+ }
DEBUGIF("access:ipaddress:container") {
DEBUGMSGT_NC(("access:ipaddress:container",
@@ -279,12 +321,21 @@ _netsnmp_ioctl_ipaddress_container_load_v4(netsnmp_container *container,
/*
* add entry to container
*/
- if (CONTAINER_INSERT(container, entry) < 0)
- {
+ if(addr_info.bcastflg){
+ if (CONTAINER_INSERT(container, bcastentry) < 0) {
+ DEBUGMSGTL(("access:ipaddress:container","error with ipaddress_entry: insert broadcast entry into container failed.\n"));
+ netsnmp_access_ipaddress_entry_free(bcastentry);
+ netsnmp_access_ipaddress_entry_free(entry);
+ continue;
+ }
+ }
+
+ if (CONTAINER_INSERT(container, entry) < 0) {
DEBUGMSGTL(("access:ipaddress:container","error with ipaddress_entry: insert into container failed.\n"));
netsnmp_access_ipaddress_entry_free(entry);
continue;
}
+
}
/*
diff --git a/agent/mibgroup/ip-mib/data_access/ipaddress_ioctl.h b/agent/mibgroup/ip-mib/data_access/ipaddress_ioctl.h
index a7a0ea2..fc9774f 100644
--- a/agent/mibgroup/ip-mib/data_access/ipaddress_ioctl.h
+++ b/agent/mibgroup/ip-mib/data_access/ipaddress_ioctl.h
@@ -2,6 +2,17 @@
extern "C" {
#endif
+/*
+ * struct for netlink extras
+ */
+struct address_flag_info {
+ int bcastflg;
+ int anycastflg;
+ struct in_addr *inp;
+};
+
+#define IS_APIPA(a) (((in_addr_t)(a << 16)) == 0xFEA90000)
+
int
_netsnmp_ioctl_ipaddress_container_load_v4(netsnmp_container *container,
int idx_offset);
@@ -13,6 +24,8 @@ _netsnmp_ioctl_ipaddress_remove_v4(netsnmp_ipaddress_entry * entry);
int
netsnmp_access_ipaddress_ioctl_get_interface_count(int sd, struct ifconf * ifc);
+struct address_flag_info
+netsnmp_access_other_info_get(int index, int family);
/*
* struct ioctl for arch_data
diff --git a/agent/mibgroup/ip-mib/data_access/ipaddress_linux.c b/agent/mibgroup/ip-mib/data_access/ipaddress_linux.c
index 8cb06a2..ac37578 100644
--- a/agent/mibgroup/ip-mib/data_access/ipaddress_linux.c
+++ b/agent/mibgroup/ip-mib/data_access/ipaddress_linux.c
@@ -19,6 +19,7 @@
#if defined (NETSNMP_ENABLE_IPV6)
#include
#include
+#include
#include
#endif
@@ -188,6 +189,7 @@ _load_v6(netsnmp_container *container, int idx_offset)
netsnmp_ipaddress_entry *entry;
_ioctl_extras *extras;
static int log_open_err = 1;
+ struct address_flag_info addr_info;
netsnmp_assert(NULL != container);
@@ -268,6 +270,10 @@ _load_v6(netsnmp_container *container, int idx_offset)
* every time it is called.
*/
entry->if_index = netsnmp_access_interface_index_find(if_name);
+ memset(&addr_info, 0, sizeof(struct address_flag_info));
+#if defined (NETSNMP_ENABLE_IPV6)
+ addr_info = netsnmp_access_other_info_get(entry->if_index, AF_INET6);
+#endif
/*
#define IPADDRESSSTATUSTC_PREFERRED 1
@@ -278,7 +284,7 @@ _load_v6(netsnmp_container *container, int idx_offset)
#define IPADDRESSSTATUSTC_TENTATIVE 6
#define IPADDRESSSTATUSTC_DUPLICATE 7
*/
- if(flags & IFA_F_PERMANENT)
+ if((flags & IFA_F_PERMANENT) || (!flags) || (flags & IFA_F_TEMPORARY))
entry->ia_status = IPADDRESSSTATUSTC_PREFERRED; /* ?? */
else if(flags & IFA_F_DEPRECATED)
entry->ia_status = IPADDRESSSTATUSTC_DEPRECATED;
@@ -294,7 +300,7 @@ _load_v6(netsnmp_container *container, int idx_offset)
* if it's not multi, it must be uni.
* (an ipv6 address is never broadcast)
*/
- if (IN6_IS_ADDR_MULTICAST(entry->ia_address))
+ if(addr_info.anycastflg)
entry->ia_type = IPADDRESSTYPE_ANYCAST;
else
entry->ia_type = IPADDRESSTYPE_UNICAST;
@@ -314,18 +320,28 @@ _load_v6(netsnmp_container *container, int idx_offset)
*
* are 'local' address assigned by link layer??
*/
- if (IN6_IS_ADDR_LINKLOCAL(entry->ia_address) ||
- IN6_IS_ADDR_SITELOCAL(entry->ia_address))
- entry->ia_origin = IPADDRESSORIGINTC_LINKLAYER;
- else
- entry->ia_origin = IPADDRESSORIGINTC_MANUAL;
+ if (!flags)
+ entry->ia_origin = IPADDRESSORIGINTC_LINKLAYER;
+ else if (flags & IFA_F_TEMPORARY)
+ entry->ia_origin = IPADDRESSORIGINTC_RANDOM;
+ else if (IN6_IS_ADDR_LINKLOCAL(entry->ia_address))
+ entry->ia_origin = IPADDRESSORIGINTC_LINKLAYER;
+ else
+ entry->ia_origin = IPADDRESSORIGINTC_MANUAL;
+
+ if(entry->ia_origin == IPADDRESSORIGINTC_LINKLAYER)
+ entry->ia_storagetype = STORAGETYPE_PERMANENT;
/* xxx-rks: what can we do with scope? */
/*
* add entry to container
*/
- CONTAINER_INSERT(container, entry);
+ if (CONTAINER_INSERT(container, entry) < 0) {
+ DEBUGMSGTL(("access:ipaddress:container","error with ipaddress_entry: insert into container failed.\n"));
+ netsnmp_access_ipaddress_entry_free(entry);
+ continue;
+ }
}
fclose(in);
@@ -335,4 +351,93 @@ _load_v6(netsnmp_container *container, int idx_offset)
return idx_offset;
}
+
+struct address_flag_info
+netsnmp_access_other_info_get(int index, int family)
+{
+ struct {
+ struct nlmsghdr n;
+ struct ifaddrmsg r;
+ char buf[1024];
+ } req;
+ struct address_flag_info addr;
+ struct rtattr *rta;
+ int status;
+ char buf[16384];
+ struct nlmsghdr *nlmp;
+ struct ifaddrmsg *rtmp;
+ struct rtattr *rtatp;
+ int rtattrlen;
+ int sd;
+
+ memset(&addr, 0, sizeof(struct address_flag_info));
+ sd = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE);
+ if(sd < 0) {
+ snmp_log(LOG_ERR, "could not open netlink socket\n");
+ return addr;
+ }
+
+ memset(&req, 0, sizeof(req));
+ req.n.nlmsg_len = NLMSG_LENGTH(sizeof(struct ifaddrmsg));
+ req.n.nlmsg_flags = NLM_F_REQUEST | NLM_F_ROOT;
+ req.n.nlmsg_type = RTM_GETADDR;
+ req.r.ifa_family = family;
+ rta = (struct rtattr *)(((char *)&req) + NLMSG_ALIGN(req.n.nlmsg_len));
+ if(family == AF_INET)
+ rta->rta_len = RTA_LENGTH(4);
+ else
+ rta->rta_len = RTA_LENGTH(16);
+
+ status = send(sd, &req, req.n.nlmsg_len, 0);
+ if (status < 0) {
+ snmp_log(LOG_ERR, "could not send netlink request\n");
+ return addr;
+ }
+
+ status = recv(sd, buf, sizeof(buf), 0);
+ if (status < 0) {
+ snmp_log (LOG_ERR, "could not recieve netlink request\n");
+ return addr;
+ }
+
+ if(status == 0) {
+ snmp_log (LOG_ERR, "nothing to read\n");
+ return addr;
+ }
+
+ for(nlmp = (struct nlmsghdr *)buf; status > sizeof(*nlmp);) {
+ int len = nlmp->nlmsg_len;
+ int req_len = len - sizeof(*nlmp);
+
+ if (req_len < 0 || len > status) {
+ snmp_log (LOG_ERR, "invalid netlink message\n");
+ return addr;
+ }
+
+ if (!NLMSG_OK(nlmp, status)) {
+ snmp_log (LOG_ERR, "invalid NLMSG message\n");
+ return addr;
+ }
+ rtmp = (struct ifaddrmsg *)NLMSG_DATA(nlmp);
+ rtatp = (struct rtattr *)IFA_RTA(rtmp);
+ rtattrlen = IFA_PAYLOAD(nlmp);
+ if(index == rtmp->ifa_index){
+ for (; RTA_OK(rtatp, rtattrlen); rtatp = RTA_NEXT(rtatp, rtattrlen)) {
+ if(rtatp->rta_type == IFA_BROADCAST){
+ addr.inp = (struct in_addr *)RTA_DATA(rtatp);
+ addr.bcastflg = 1;
+ }
+ if(rtatp->rta_type == IFA_ANYCAST){
+ addr.inp = (struct in_addr *)RTA_DATA(rtatp);
+ addr.anycastflg = 1;
+ }
+ }
+ }
+ status -= NLMSG_ALIGN(len);
+ nlmp = (struct nlmsghdr*)((char*)nlmp + NLMSG_ALIGN(len));
+ }
+ close(sd);
+ return addr;
+}
#endif
+
diff --git a/agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable.c b/agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable.c
index e695ab3..8bb3cbc 100644
--- a/agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable.c
+++ b/agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable.c
@@ -942,7 +942,10 @@ ipAddressRowStatus_get(ipAddressTable_rowreq_ctx * rowreq_ctx,
netsnmp_assert(NULL != ipAddressRowStatus_val_ptr);
/** WARNING: this code might not work for netsnmp_ipaddress_entry */
- (*ipAddressRowStatus_val_ptr) = rowreq_ctx->ipAddressRowStatus;
+ if(rowreq_ctx->data->if_index)
+ (*ipAddressRowStatus_val_ptr) = rowreq_ctx->ipAddressRowStatus;
+ else
+ (*ipAddressRowStatus_val_ptr) = ROWSTATUS_NOTREADY;
return MFD_SUCCESS;
} /* ipAddressRowStatus_get */
diff --git a/include/net-snmp/library/container.h b/include/net-snmp/library/container.h
index f88fa21..22684aa 100644
--- a/include/net-snmp/library/container.h
+++ b/include/net-snmp/library/container.h
@@ -358,7 +358,7 @@ extern "C" {
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);
diff --git a/snmplib/container.c b/snmplib/container.c
index e34e922..1255f0a 100644
--- a/snmplib/container.c
+++ b/snmplib/container.c
@@ -275,7 +275,7 @@ int CONTAINER_INSERT_HELPER(netsnmp_container* x, const void* k)
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);
--
1.6.0.2
++++++ Fix-for-IPv6-Interface-Table.patch ++++++
From 65f75f485f428b0f22ff82c96ebd7d89e49ce7b2 Mon Sep 17 00:00:00 2001
From: Mitsuru Chinen
Date: Mon, 20 Oct 2008 14:50:37 +0900
Subject: [PATCH] Fix for IPv6 Interface Table
From net-snmp patch tracker:
[ 1669048 ] Support ipv6InterfaceIdentifier on Linux
http://sourceforge.net/tracker/index.php?func=detail&aid=1669048&group_id=12694&atid=312694
[ 1783423 ] correct ipv6InterfaceIdentifier of loopback device
http://sourceforge.net/tracker/index.php?func=detail&aid=1783423&group_id=12694&atid=312694
Signed-off-by: Mitsuru Chinen
---
.../mibgroup/if-mib/data_access/interface_linux.c | 31 ++++++++++++++++++++
1 files changed, 31 insertions(+), 0 deletions(-)
diff --git a/agent/mibgroup/if-mib/data_access/interface_linux.c b/agent/mibgroup/if-mib/data_access/interface_linux.c
index 245fa99..474a904 100644
--- a/agent/mibgroup/if-mib/data_access/interface_linux.c
+++ b/agent/mibgroup/if-mib/data_access/interface_linux.c
@@ -36,6 +36,7 @@ typedef __u8 u8; /* ditto */
#include
#include
+#include
#ifndef IF_NAMESIZE
#define IF_NAMESIZE 16
@@ -635,6 +636,36 @@ netsnmp_arch_interface_container_load(netsnmp_container* container,
entry->type = IANAIFTYPE_OTHER;
}
+ /*
+ * interface identifier is specified based on physaddr and type
+ */
+ switch (entry->type) {
+ case IANAIFTYPE_ETHERNETCSMACD:
+ case IANAIFTYPE_ETHERNET3MBIT:
+ case IANAIFTYPE_FASTETHER:
+ case IANAIFTYPE_FASTETHERFX:
+ case IANAIFTYPE_GIGABITETHERNET:
+ case IANAIFTYPE_FDDI:
+ case IANAIFTYPE_ISO88025TOKENRING:
+ if (NULL != entry->paddr && ETH_ALEN != entry->paddr_len)
+ break;
+
+ entry->v6_if_id_len = entry->paddr_len + 2;
+ memcpy(entry->v6_if_id, entry->paddr, 3);
+ memcpy(entry->v6_if_id + 5, entry->paddr + 3, 3);
+ entry->v6_if_id[0] ^= 2;
+ entry->v6_if_id[3] = 0xFF;
+ entry->v6_if_id[4] = 0xFE;
+
+ entry->ns_flags |= NETSNMP_INTERFACE_FLAGS_HAS_V6_IFID;
+ break;
+
+ case IANAIFTYPE_SOFTWARELOOPBACK:
+ entry->v6_if_id_len = 0;
+ entry->ns_flags |= NETSNMP_INTERFACE_FLAGS_HAS_V6_IFID;
+ break;
+ }
+
if (IANAIFTYPE_ETHERNETCSMACD == entry->type)
entry->speed =
netsnmp_linux_interface_get_if_speed(fd, entry->name);
--
1.6.0.2
++++++ Fix-for-tcpConnnectionTable-tcpListenerTable-udpEn.patch ++++++
From 757470fe3c79081b3b106f669f39e45f7aaa4baf Mon Sep 17 00:00:00 2001
From: Mitsuru Chinen
Date: Mon, 20 Oct 2008 14:36:05 +0900
Subject: [PATCH] Fix for tcpConnnectionTable, tcpListenerTable, udpEndpointTable
From net-snmp patch tracker:
[ 1670511 ] agent returns 0 for process id in tcp and udp mib
http://sourceforge.net/tracker/index.php?func=detail&aid=1670511&group_id=12694&atid=312694
Signed-off-by: Mitsuru Chinen
---
agent/mibgroup/tcp-mib/data_access/tcpConn_linux.c | 18 ++--
.../udp-mib/data_access/udp_endpoint_linux.c | 7 +-
.../udp-mib/udpEndpointTable/udpEndpointTable.c | 17 +++-
.../udp-mib/udpEndpointTable/udpEndpointTable.h | 12 ++-
.../udpEndpointTable_data_access.c | 3 +-
agent/mibgroup/util_funcs.c | 100 ++++++++++++++++++++
agent/mibgroup/util_funcs.h | 4 +
include/net-snmp/data_access/udp_endpoint.h | 1 +
8 files changed, 146 insertions(+), 16 deletions(-)
diff --git a/agent/mibgroup/tcp-mib/data_access/tcpConn_linux.c b/agent/mibgroup/tcp-mib/data_access/tcpConn_linux.c
index 7ffebe6..72495a9 100644
--- a/agent/mibgroup/tcp-mib/data_access/tcpConn_linux.c
+++ b/agent/mibgroup/tcp-mib/data_access/tcpConn_linux.c
@@ -11,7 +11,7 @@
#include "tcp-mib/tcpConnectionTable/tcpConnectionTable_constants.h"
#include "tcp-mib/data_access/tcpConn_private.h"
-
+#include "mibgroup/util_funcs.h"
static int
linux_states[12] = { 1, 5, 3, 4, 6, 7, 11, 1, 8, 9, 2, 10 };
@@ -135,15 +135,16 @@ _load4(netsnmp_container *container, u_int load_flags)
while (fgets(line, sizeof(line), in)) {
netsnmp_tcpconn_entry *entry;
int state, rc, local_port, remote_port, tmp_state;
+ unsigned long long inode;
size_t buf_len, offset;
u_char local_addr[10], remote_addr[10];
u_char *tmp_ptr;
- if (5 != (rc = sscanf(line, "%*d: %8[0-9A-Z]:%x %8[0-9A-Z]:%x %x",
+ if (6 != (rc = sscanf(line, "%*d: %8[0-9A-Z]:%x %8[0-9A-Z]:%x %x %*x:%*x %*x:%*x %*x %*x %*x %llu",
local_addr, &local_port,
- remote_addr, &remote_port, &tmp_state))) {
+ remote_addr, &remote_port, &tmp_state, &inode))) {
DEBUGMSGT(("access:tcpconn:container",
- "error parsing line (%d != 5)\n", rc));
+ "error parsing line (%d != 6)\n", rc));
DEBUGMSGT(("access:tcpconn:container"," line '%s'\n", line));
continue;
}
@@ -180,6 +181,7 @@ _load4(netsnmp_container *container, u_int load_flags)
entry->loc_port = (unsigned short) local_port;
entry->rmt_port = (unsigned short) remote_port;
entry->tcpConnState = state;
+ entry->pid = get_pid_from_inode(inode);
/** the addr string may need work */
buf_len = strlen(local_addr);
@@ -286,15 +288,16 @@ _load6(netsnmp_container *container, u_int load_flags)
while (fgets(line, sizeof(line), in)) {
netsnmp_tcpconn_entry *entry;
int state, rc, local_port, remote_port, tmp_state;
+ unsigned long long inode;
size_t buf_len, offset;
u_char local_addr[48], remote_addr[48];
u_char *tmp_ptr;
- if (5 != (rc = sscanf(line, "%*d: %47[0-9A-Z]:%x %47[0-9A-Z]:%x %x",
+ if (6 != (rc = sscanf(line, "%*d: %47[0-9A-Z]:%x %47[0-9A-Z]:%x %x %*x:%*x %*x:%*x %*x %*x %*x %llu",
local_addr, &local_port,
- remote_addr, &remote_port, &tmp_state))) {
+ remote_addr, &remote_port, &tmp_state, &inode))) {
DEBUGMSGT(("access:tcpconn:container",
- "error parsing line (%d != 5)\n", rc));
+ "error parsing line (%d != 6)\n", rc));
DEBUGMSGT(("access:tcpconn:container"," line '%s'\n", line));
continue;
}
@@ -331,6 +334,7 @@ _load6(netsnmp_container *container, u_int load_flags)
entry->loc_port = (unsigned short) local_port;
entry->rmt_port = (unsigned short) remote_port;
entry->tcpConnState = state;
+ entry->pid = get_pid_from_inode(inode);
/** the addr string may need work */
buf_len = strlen((char*)local_addr);
diff --git a/agent/mibgroup/udp-mib/data_access/udp_endpoint_linux.c b/agent/mibgroup/udp-mib/data_access/udp_endpoint_linux.c
index 4e43e01..70dcace 100644
--- a/agent/mibgroup/udp-mib/data_access/udp_endpoint_linux.c
+++ b/agent/mibgroup/udp-mib/data_access/udp_endpoint_linux.c
@@ -14,7 +14,7 @@
#include
#include "udp-mib/udpEndpointTable/udpEndpointTable_constants.h"
-
+#include "mibgroup/util_funcs.h"
#include "udp_endpoint_private.h"
#include
@@ -222,6 +222,11 @@ _process_line_udp_ep(netsnmp_line_info *line_info, void *mem,
inode = strtoull(ptr, &ptr, 0);
ep->instance = (u_int)inode;
+ /*
+ * get the pid also
+ */
+ ep->pid = get_pid_from_inode(inode);
+
ep->index = (u_int)(lpi->user_context);
lpi->user_context = (void*)((u_int)(lpi->user_context) + 1);
diff --git a/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable.c b/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable.c
index 5da022f..b2d8b23 100644
--- a/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable.c
+++ b/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable.c
@@ -223,7 +223,8 @@ udpEndpointTable_indexes_set_tbl_idx(udpEndpointTable_mib_index * tbl_idx,
size_t
udpEndpointRemoteAddress_val_ptr_len,
u_long udpEndpointRemotePort_val,
- u_long udpEndpointInstance_val)
+ u_long udpEndpointInstance_val,
+ u_long udpEndpointProcess_val)
{
DEBUGMSGTL(("verbose:udpEndpointTable:udpEndpointTable_indexes_set_tbl_idx", "called\n"));
@@ -292,6 +293,10 @@ udpEndpointTable_indexes_set_tbl_idx(udpEndpointTable_mib_index * tbl_idx,
* udpEndpointInstance(7)/UNSIGNED32/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/h
*/
tbl_idx->udpEndpointInstance = udpEndpointInstance_val;
+ /*
+ * udpEndpointProcess(8)/UNSIGNED32/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/h
+ */
+ tbl_idx->udpEndpointProcess = udpEndpointProcess_val;
return MFD_SUCCESS;
@@ -320,7 +325,8 @@ udpEndpointTable_indexes_set(udpEndpointTable_rowreq_ctx * rowreq_ctx,
char *udpEndpointRemoteAddress_val_ptr,
size_t udpEndpointRemoteAddress_val_ptr_len,
u_long udpEndpointRemotePort_val,
- u_long udpEndpointInstance_val)
+ u_long udpEndpointInstance_val,
+ u_long udpEndpointProcess_val)
{
DEBUGMSGTL(("verbose:udpEndpointTable:udpEndpointTable_indexes_set",
"called\n"));
@@ -335,7 +341,8 @@ udpEndpointTable_indexes_set(udpEndpointTable_rowreq_ctx * rowreq_ctx,
udpEndpointRemoteAddress_val_ptr,
udpEndpointRemoteAddress_val_ptr_len,
udpEndpointRemotePort_val,
- udpEndpointInstance_val))
+ udpEndpointInstance_val,
+ udpEndpointProcess_val))
return MFD_ERROR;
/*
@@ -402,9 +409,9 @@ udpEndpointProcess_get(udpEndpointTable_rowreq_ctx * rowreq_ctx,
/*
* TODO:231:o: |-> Extract the current value of the udpEndpointProcess data.
- * copy (* udpEndpointProcess_val_ptr ) from rowreq_ctx->data
+ * copy (* udpEndpointProcess_val_ptr ) from rowreq_ctx->tbl_idx.udpEndpointProcess
*/
- (*udpEndpointProcess_val_ptr) = rowreq_ctx->data.udpEndpointProcess;
+ (*udpEndpointProcess_val_ptr) = rowreq_ctx->tbl_idx.udpEndpointProcess;
return MFD_SUCCESS;
} /* udpEndpointProcess_get */
diff --git a/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable.h b/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable.h
index f023db8..fce1659 100644
--- a/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable.h
+++ b/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable.h
@@ -132,6 +132,11 @@ config_require(udp-mib/udpEndpointTable/udpEndpointTable_data_access)
*/
u_long udpEndpointInstance;
+ /*
+ * udpEndpointProcess(8)/UNSIGNED32/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/h
+ */
+ u_long udpEndpointProcess;
+
} udpEndpointTable_mib_index;
@@ -257,7 +262,9 @@ config_require(udp-mib/udpEndpointTable/udpEndpointTable_data_access)
u_long
udpEndpointRemotePort_val,
u_long
- udpEndpointInstance_val);
+ udpEndpointInstance_val,
+ u_long
+ udpEndpointProcess_val);
int
udpEndpointTable_indexes_set(udpEndpointTable_rowreq_ctx *
rowreq_ctx,
@@ -273,7 +280,8 @@ config_require(udp-mib/udpEndpointTable/udpEndpointTable_data_access)
size_t
udpEndpointRemoteAddress_val_ptr_len,
u_long udpEndpointRemotePort_val,
- u_long udpEndpointInstance_val);
+ u_long udpEndpointInstance_val,
+ u_long udpEndpointProcess_val);
diff --git a/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable_data_access.c b/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable_data_access.c
index af4762f..1e9ef0f 100644
--- a/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable_data_access.c
+++ b/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable_data_access.c
@@ -265,7 +265,8 @@ udpEndpointTable_container_load(netsnmp_container *container)
ep->rmt_addr,
ep->rmt_addr_len,
ep->rmt_port,
- ep->instance)) {
+ ep->instance,
+ ep->pid)) {
snmp_log(LOG_ERR,
"error setting index while loading "
"udpEndpointTable data.\n");
diff --git a/agent/mibgroup/util_funcs.c b/agent/mibgroup/util_funcs.c
index 95ee4bf..26826f7 100644
--- a/agent/mibgroup/util_funcs.c
+++ b/agent/mibgroup/util_funcs.c
@@ -86,6 +86,20 @@
#ifdef HAVE_SYS_STAT_H
#include
#endif
+#if HAVE_DIRENT_H
+#include
+#else
+# define dirent direct
+# if HAVE_SYS_NDIR_H
+# include
+# endif
+# if HAVE_SYS_DIR_H
+# include
+# endif
+# if HAVE_NDIR_H
+# include
+# endif
+#endif
#include
#include
@@ -1192,3 +1206,89 @@ Retrieve_Table_Data(mib_table_t t, int *max_idx)
*max_idx = table->next_index - 1;
return table->data;
}
+
+#ifdef linux
+# define PROC_PATH "/proc"
+# define FILE_DISP "fd/"
+# define SOCKET_TYPE_1 "socket:["
+# define SOCKET_TYPE_2 "[0000]:"
+
+unsigned long long
+extract_inode(char *format)
+{
+ unsigned long long ret = 0;
+
+ if (!strncmp(format, SOCKET_TYPE_1, 8)) {
+ ret = strtoull(format + 8, NULL, 0);
+ } else if (!strncmp(format, SOCKET_TYPE_2, 7)) {
+ ret = strtoull(format + 7, NULL, 0);
+ }
+
+ return ret;
+}
+
+unsigned int
+get_pid_from_inode(unsigned long long inode)
+{
+ DIR *procdirs = NULL, *piddirs = NULL;
+ char *name = NULL;
+ char path_name[PATH_MAX + 1];
+ char socket_lnk[NAME_MAX + 1];
+ int filelen = 0, readlen = 0, iflag = 0;
+ struct dirent *procinfo, *pidinfo;
+ unsigned int pid;
+ unsigned long long temp_inode;
+
+ if (!(procdirs = opendir(PROC_PATH))) {
+ snmp_log(LOG_ERR, "snmpd: cannot open /proc\n");
+ return 0;
+ }
+
+ while ((procinfo = readdir(procdirs)) != NULL) {
+ name = procinfo->d_name;
+ for (; *name; name++) {
+ if (!isdigit(*name))
+ break;
+ }
+ if(*name)
+ continue;
+
+ memset(path_name, '\0', PATH_MAX + 1);
+ filelen = snprintf(path_name, PATH_MAX,
+ PROC_PATH "/%s/" FILE_DISP, procinfo->d_name);
+ if (filelen <= 0 || PATH_MAX < filelen)
+ continue;
+
+ pid = strtoul(procinfo->d_name, NULL, 0);
+
+ if (!(piddirs = opendir(path_name)))
+ continue;
+
+ while ((pidinfo = readdir(piddirs)) != NULL) {
+ if (filelen + strlen(pidinfo->d_name) > PATH_MAX)
+ continue;
+
+ strcpy(path_name + filelen, pidinfo->d_name);
+
+ memset(socket_lnk, '\0', NAME_MAX + 1);
+ readlen = readlink(path_name, socket_lnk, NAME_MAX);
+ if (readlen < 0)
+ continue;
+ socket_lnk[readlen] = '\0';
+
+ temp_inode = extract_inode(socket_lnk);
+ if (inode == temp_inode) {
+ iflag = 1;
+ break;
+ }
+ }
+ closedir(piddirs);
+ if (iflag == 1)
+ break;
+ }
+ if (procdirs)
+ closedir(procdirs);
+ return pid;
+}
+
+#endif /* #ifdef linux */
diff --git a/agent/mibgroup/util_funcs.h b/agent/mibgroup/util_funcs.h
index 1b3fefe..4a0b99e 100644
--- a/agent/mibgroup/util_funcs.h
+++ b/agent/mibgroup/util_funcs.h
@@ -34,6 +34,10 @@ void string_append_int(char *, int);
void wait_on_exec(struct extensible *);
const char *make_tempfile(void);
+#ifdef linux
+unsigned int get_pid_from_inode(unsigned long long);
+#endif
+
#define satosin(x) ((struct sockaddr_in *) &(x))
#define SOCKADDR(x) (satosin(x)->sin_addr.s_addr)
#ifndef MIB_STATS_CACHE_TIMEOUT
diff --git a/include/net-snmp/data_access/udp_endpoint.h b/include/net-snmp/data_access/udp_endpoint.h
index cc81b02..b9831ec 100644
--- a/include/net-snmp/data_access/udp_endpoint.h
+++ b/include/net-snmp/data_access/udp_endpoint.h
@@ -41,6 +41,7 @@ extern "C" {
u_short rmt_port;
u_int instance;
+ u_int pid;
} netsnmp_udp_endpoint_entry;
--
1.6.0.2
++++++ Improve-IP-Statistics-tables.patch ++++++
++++ 7453 lines (skipped)
++++++ net-snmp-5.4.1.2-etherlike-mib-revised_1.patch ++++++
--- /var/tmp/diff_new_pack.hH9523/_old 2008-10-24 22:47:11.000000000 +0200
+++ /var/tmp/diff_new_pack.hH9523/_new 2008-10-24 22:47:11.000000000 +0200
@@ -4604,4 +4604,4 @@
+config_require(etherlike-mib/dot3StatsTable_data_get)
+config_require(etherlike-mib/dot3StatsTable_data_set)
+config_require(etherlike-mib/dot3StatsTable_data_access)
-+config_add_mib(ETHERLIKE-MIB)
++config_add_mib(EtherLike-MIB)
++++++ net-snmp-5.4.2_audit.patch ++++++
Index: agent/mibgroup/examples/ucdDemoPublic.c
===================================================================
--- agent/mibgroup/examples/ucdDemoPublic.c.orig 2002-12-19 16:07:36.000000000 +0100
+++ agent/mibgroup/examples/ucdDemoPublic.c 2008-10-24 15:30:26.538387687 +0200
@@ -219,7 +219,11 @@ write_ucdDemoPublicString(int action,
}
if (action == COMMIT) {
if (var_val_len != 0) {
- strcpy(publicString, var_val);
+ strncpy(publicString, var_val, sizeof(publicString)-1);
+ /* XXX thomas: just some sanity checks */
+ if(strlen(var_val) > sizeof(publicString)-1 || strlen(var_val) != var_val_len)
+ publicString[sizeof(publicString)-1] = '\0';
+ else
publicString[var_val_len] = '\0';
} else
publicString[0] = '\0';
Index: agent/mibgroup/mibII/system_mib.c
===================================================================
--- agent/mibgroup/mibII/system_mib.c.orig 2006-09-15 02:48:50.000000000 +0200
+++ agent/mibgroup/mibII/system_mib.c 2008-10-24 15:30:26.550386000 +0200
@@ -126,7 +126,7 @@ system_parse_config_sysloc(const char *t
char tmpbuf[1024];
if (strlen(cptr) >= sizeof(sysLocation)) {
- snprintf(tmpbuf, 1024,
+ snprintf(tmpbuf, sizeof(tmpbuf),
"syslocation token too long (must be < %lu):\n\t%s",
(unsigned long)sizeof(sysLocation), cptr);
config_perror(tmpbuf);
@@ -173,7 +173,7 @@ system_parse_config_syscon(const char *t
char tmpbuf[1024];
if (strlen(cptr) >= sizeof(sysContact)) {
- snprintf(tmpbuf, 1024,
+ snprintf(tmpbuf, sizeof(tmpbuf),
"syscontact token too long (must be < %lu):\n\t%s",
(unsigned long)sizeof(sysContact), cptr);
config_perror(tmpbuf);
@@ -220,7 +220,7 @@ system_parse_config_sysname(const char *
char tmpbuf[1024];
if (strlen(cptr) >= sizeof(sysName)) {
- snprintf(tmpbuf, 1024,
+ snprintf(tmpbuf, sizeof(tmpbuf),
"sysname token too long (must be < %lu):\n\t%s",
(unsigned long)sizeof(sysName), cptr);
config_perror(tmpbuf);
Index: agent/mibgroup/mibII/var_route.c
===================================================================
--- agent/mibgroup/mibII/var_route.c.orig 2008-07-28 16:39:55.000000000 +0200
+++ agent/mibgroup/mibII/var_route.c 2008-10-24 15:30:26.582385351 +0200
@@ -1381,7 +1381,7 @@ Route_Scan_Reload(void)
/*
* Sort it!
*/
- qsort((char *) rthead, rtsize, sizeof(rthead[0]), qsort_compare);
+ qsort((char *) rthead, rtsize, sizeof(rthead[0]), (int (*) (const void*, const void*)) qsort_compare);
}
#endif
#endif
Index: agent/mibgroup/util_funcs.c
===================================================================
--- agent/mibgroup/util_funcs.c.orig 2007-08-16 16:12:47.000000000 +0200
+++ agent/mibgroup/util_funcs.c 2008-10-24 15:30:26.598384777 +0200
@@ -140,6 +140,10 @@ make_tempfile(void)
}
#endif
if (fd >= 0) {
+ if(fchmod(fd, 0600) != 0) {
+ close(fd);
+ return NULL;
+ }
close(fd);
DEBUGMSGTL(("make_tempfile", "temp file created: %s\n", name));
return name;
Index: agent/auto_nlist.c
===================================================================
--- agent/auto_nlist.c.orig 2008-06-05 23:11:53.000000000 +0200
+++ agent/auto_nlist.c 2008-10-24 15:30:26.630385059 +0200
@@ -64,6 +64,7 @@ auto_nlist_value(const char *string)
it->nl[0].n_name = (char *) malloc(strlen(string) + 2);
#if defined(aix4) || defined(aix5) || defined(aix6)
strcpy(it->nl[0].n_name, string);
+ it->nl[0].n_name[strlen(string)+1] = '\0';
#else
sprintf(it->nl[0].n_name, "_%s", string);
#endif
@@ -72,6 +73,7 @@ auto_nlist_value(const char *string)
#if !(defined(aix4) || defined(aix5) || defined(aix6))
if (it->nl[0].n_type == 0) {
strcpy(it->nl[0].n_name, string);
+ it->nl[0].n_name[strlen(string)+1] = '\0';
init_nlist(it->nl);
}
#endif
Index: apps/snmptest.c
===================================================================
--- apps/snmptest.c.orig 2008-05-29 11:59:06.000000000 +0200
+++ apps/snmptest.c 2008-10-24 15:30:26.650386319 +0200
@@ -456,6 +456,7 @@ input_variable(netsnmp_variable_list * v
goto getValue;
}
memcpy(vp->val.string, buf, strlen(buf) - 1);
+ vp->val.string[sizeof(vp->val.string)-1] = 0;
vp->val_len = strlen(buf) - 1;
} else if (ch == 'x') {
size_t buf_len = 256;
Index: apps/snmptrapd_handlers.c
===================================================================
--- apps/snmptrapd_handlers.c.orig 2007-06-08 12:44:37.000000000 +0200
+++ apps/snmptrapd_handlers.c 2008-10-24 15:30:26.682736940 +0200
@@ -24,6 +24,9 @@
#include
#endif
+#include
+#include
+
#include
#include
#include
@@ -863,10 +866,11 @@ do_external(char *cmd, struct hostent *h
#else
char command_buf[128];
char file_buf[L_tmpnam];
+ int win_fd;
tmpnam(file_buf);
- file = fopen(file_buf, "w");
- if (!file) {
+ win_fd = open(file_buf, O_RDWR | O_CREAT | O_EXCL, 0600);
+ if (win_fd < 0 || (file = fdopen(win_fd, "w")) == NULL)
fprintf(stderr, "fopen: %s: %s\n", file_buf, strerror(errno));
} else {
send_handler_data(file, host, pdu, transport);
Index: snmplib/parse.c
===================================================================
--- snmplib/parse.c.orig 2008-04-07 16:00:44.000000000 +0200
+++ snmplib/parse.c 2008-10-24 15:30:26.706385615 +0200
@@ -4191,7 +4191,7 @@ static struct node *
parse(FILE * fp, struct node *root)
{
char token[MAXTOKEN];
- char name[MAXTOKEN];
+ char name[MAXTOKEN+1];
int type = LABEL;
int lasttype = LABEL;
@@ -4283,7 +4283,8 @@ parse(FILE * fp, struct node *root)
case ENDOFFILE:
continue;
default:
- strcpy(name, token);
+ strncpy(name, token, sizeof(name));
+ name[sizeof(name)-1] = '\0';
type = get_token(fp, token, MAXTOKEN);
nnp = NULL;
if (type == MACRO) {
@@ -4300,7 +4301,8 @@ parse(FILE * fp, struct node *root)
print_error(name, "is a reserved word", lasttype);
continue; /* see if we can parse the rest of the file */
}
- strcpy(name, token);
+ strncpy(name, token, sizeof(name));
+ name[sizeof(name)-1] = '\0';
type = get_token(fp, token, MAXTOKEN);
nnp = NULL;
Index: snmplib/tools.c
===================================================================
--- snmplib/tools.c.orig 2007-02-21 14:58:27.000000000 +0100
+++ snmplib/tools.c 2008-10-24 15:30:26.750385578 +0200
@@ -696,7 +696,7 @@ dump_snmpEngineID(const u_char * estring
/*
* s += snprintf(s, remaining_len+3, "\"%s\"", esp);
*/
- s += sprintf(s, "\"%s\"", esp);
+ s += sprintf(s, "\"%.*s\"", sizeof(buf)-strlen(buf)-3, esp);
goto dump_snmpEngineID_quit;
break;
/*NOTREACHED*/ case 5: /* Octets. */
Index: testing/TESTCONF.sh
===================================================================
--- testing/TESTCONF.sh.orig 2006-08-07 17:34:16.000000000 +0200
+++ testing/TESTCONF.sh 2008-10-24 15:30:26.774385440 +0200
@@ -77,8 +77,8 @@ if [ "x$SNMP_TMPDIR" = "x" -a "x$SNMP_HE
fi
SNMP_TMP_PERSISTENTDIR=$SNMP_TMPDIR/persist
export SNMP_TMP_PERSISTENTDIR
- mkdir $SNMP_TMPDIR
- mkdir $SNMP_TMP_PERSISTENTDIR
+ mkdir -m 0700 $SNMP_TMPDIR
+ mkdir -m 0700 $SNMP_TMP_PERSISTENTDIR
fi
if [ "x$SNMP_SAVE_TMPDIR" = "x" ]; then
Index: testing/eval_suite.sh
===================================================================
--- testing/eval_suite.sh.orig 2002-04-20 09:30:29.000000000 +0200
+++ testing/eval_suite.sh 2008-10-24 15:30:26.798384612 +0200
@@ -79,7 +79,11 @@ exit 0
PROGRAM=
ARGUMENTS="$*"
-TMPFILE=/tmp/eval_suite.sh$$
+umask 0077 # just to be on the save side
+TMPDIR=/tmp/ucd-snmpd-eval-dir.$$
+/bin/rm -rf $TMPDIR
+/bin/mkdir -m 0700 $TMPDIR || exit -1
+TMPFILE=$TMPDIR/eval_suite.sh$$
TESTLISTFILE=eval_testlist
@@ -205,6 +209,7 @@ done # endwhile
# Cleanup, exit.
#
rm -f $TMPFILE
+rm -rf $TMPDIR
exit $TESTFAILURE
++++++ net-snmp-5.4.2_autoconf.patch ++++++
Index: configure.in
===================================================================
--- configure.in.orig 2008-09-05 11:27:25.000000000 +0200
+++ configure.in 2008-10-24 15:30:38.018389374 +0200
@@ -1025,7 +1025,7 @@ AC_SUBST(LINKCC)
AC_AIX
# system check
-AC_CANONICAL_TARGET
+AC_CANONICAL_TARGET([])
changequote(, )
PARTIALTARGETOS=`echo $target_os | sed 's/[-._].*//'`
changequote([, ])
@@ -2756,8 +2756,6 @@ AC_ARG_WITH(libwrap,
[
AC_MSG_RESULT([no])
# Linux RedHat 6.1 won't link libwrap without libnsl
- AC_CHECK_FUNC(yp_get_default_domain, ,
- AC_CHECK_LIB(nsl, yp_get_default_domain))
AC_MSG_CHECKING([for TCP wrappers library -lwrap linked with -lnsl])
AC_TRY_LINK([#include
#include
@@ -4555,7 +4553,7 @@ fi
# we need to have a local variable `hz' in scope and set to a useful
# value whenever we use one of these constants.
#
-AC_CACHE_CHECK(whether TCP timers depend on \`hz',ac_cv_TCPTV_NEEDS_HZ,
+AC_CACHE_CHECK(whether TCP timers depend on hz,ac_cv_TCPTV_NEEDS_HZ,
[AC_EGREP_CPP(hz,
[#include
TCPTV_SRTTDFLT
@@ -4609,7 +4607,7 @@ fi
ME=`$WHOAMI`
if test -f /etc/resolv.conf; then
- LOC=`cat /etc/resolv.conf | grep '^domain' | tail -1 | awk '{print $NF}'`
+ LOC=`cat /etc/resolv.conf | grep '^domain' | tail -n 1 | awk '{print $NF}'`
else
LOC="@no.where"
fi
++++++ net-snmp-5.4_net-snmp-config_headercheck.patch -> net-snmp-5.4.2_net-snmp-config_headercheck.patch ++++++
--- net-snmp/net-snmp-5.4_net-snmp-config_headercheck.patch 2006-11-14 18:23:18.000000000 +0100
+++ /mounts/work_src_done/STABLE/net-snmp/net-snmp-5.4.2_net-snmp-config_headercheck.patch 2008-10-24 15:31:00.322385000 +0200
@@ -1,7 +1,7 @@
Index: net-snmp-config.in
===================================================================
---- net-snmp-config.in.orig
-+++ net-snmp-config.in
+--- net-snmp-config.in.orig 2008-07-30 19:28:08.000000000 +0200
++++ net-snmp-config.in 2008-10-24 15:30:56.926874746 +0200
@@ -27,6 +27,14 @@ check_build_dir()
fi
}
@@ -17,7 +17,7 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
includedir=@includedir@
-@@ -104,9 +112,11 @@ else
+@@ -105,9 +113,11 @@ else
;;
#################################################### compile
--base-cflags)
@@ -29,7 +29,7 @@
echo @CFLAGS@ @DEVFLAGS@ @CPPFLAGS@ -I. -I${NSC_INCLUDEDIR}
;;
--srcdir)
-@@ -117,6 +127,7 @@ else
+@@ -118,6 +128,7 @@ else
echo $NSC_LIBDIR
;;
--ldflags|--ld*)
@@ -37,7 +37,7 @@
echo $NSC_LDFLAGS
;;
--build-lib-dirs)
-@@ -150,30 +161,38 @@ else
+@@ -151,30 +162,38 @@ else
;;
#################################################### client lib
--libs)
@@ -76,11 +76,11 @@
echo $NSC_LDFLAGS $NSC_AGENTLIBS
;;
####################################################
-@@ -314,6 +333,7 @@ else
+@@ -316,6 +335,7 @@ else
####################################################
--compile-subagent)
+ check_devel_files
shift
+ shifted=1
while test "x$done" = "x" -a "x$1" != "x" ; do
- case $1 in
++++++ net-snmp-5.4.2_overflow.patch ++++++
Index: snmplib/mib.c
===================================================================
--- snmplib/mib.c.orig 2008-07-30 09:57:19.000000000 +0200
+++ snmplib/mib.c 2008-10-24 15:30:42.854387100 +0200
@@ -1489,7 +1489,7 @@ sprint_realloc_gauge(u_char ** buf, size
return 0;
}
} else {
- sprintf(tmp, "%lu", *var->val.integer);
+ sprintf(tmp, "%u", (unsigned int)(*var->val.integer & 0xffffffff));
if (!snmp_strcat
(buf, buf_len, out_len, allow_realloc, (const u_char *) tmp)) {
return 0;
@@ -1553,7 +1553,7 @@ sprint_realloc_counter(u_char ** buf, si
return 0;
}
}
- sprintf(tmp, "%lu", *var->val.integer);
+ sprintf(tmp, "%u", (unsigned int)(*var->val.integer & 0xffffffff));
if (!snmp_strcat
(buf, buf_len, out_len, allow_realloc, (const u_char *) tmp)) {
return 0;
++++++ net-snmp-5.4.1_perl_tk_warning.patch -> net-snmp-5.4.2_perl_tk_warning.patch ++++++
--- net-snmp/net-snmp-5.4.1_perl_tk_warning.patch 2008-06-21 01:23:43.000000000 +0200
+++ /mounts/work_src_done/STABLE/net-snmp/net-snmp-5.4.2_perl_tk_warning.patch 2008-10-24 15:31:05.530887000 +0200
@@ -1,7 +1,7 @@
Index: local/tkmib
===================================================================
--- local/tkmib.orig 2006-07-27 21:48:25.000000000 +0200
-+++ local/tkmib 2008-06-21 01:23:34.985622311 +0200
++++ local/tkmib 2008-10-24 15:31:02.574384593 +0200
@@ -27,10 +27,9 @@ instructions.
if (!$havetk) {
++++++ net-snmp-5.4.2_snmpconf-selinux.patch ++++++
https://bugzilla.redhat.com/show_bug.cgi?id=248329
Index: local/snmpconf
===================================================================
--- local/snmpconf.orig 2005-08-16 17:59:16.000000000 +0200
+++ local/snmpconf 2008-10-24 15:31:06.798387241 +0200
@@ -682,6 +682,7 @@ sub output_files {
}
}
close(O);
+ system("restorecon $outputf");
}
}
++++++ net-snmp-5.4.2_testing.empty_arptable.patch ++++++
Index: testing/rfc1213/snmpfun.sh
===================================================================
--- testing/rfc1213/snmpfun.sh.orig 2004-12-10 16:15:52.000000000 +0100
+++ testing/rfc1213/snmpfun.sh 2008-10-24 15:30:46.066386937 +0200
@@ -1,4 +1,3 @@
-
# functions used by RFC-1213 MIB test modules
myport=$SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT
@@ -11,6 +10,23 @@ else
TEST_AUTHPRIV_PARMS="-l authNoPriv -a MD5 -A testpass"
fi
+check_skip_arp_tests ()
+{
+ #
+ # skip all tests relying on a filed arp table. e.g. on s390 boxes this
+ # does not have to be the case
+ #
+ TABLE_ENTRIES="at.atTable ip.ipNetToMediaTable"
+ ARP_COUNT=`/sbin/arp | grep -v incomplete | wc -l`
+ for entry in $TABLE_ENTRIES ; do
+ if [ "x$1" == "x$entry" -a $ARP_COUNT == 0 ] ; then
+ echo "skipping $1, because the arp table is empty." >&2
+ return 0
+ fi
+ done
+ return 1
+}
+
config()
{
rm -f $SNMP_CONFIG_FILE
@@ -54,25 +70,35 @@ get_snmpv3_variable()
get_snmp_table()
{
test_start "Access table $2 by SNMPv$1..."
- CAPTURE "snmpgetnext -Of -v $1 -c test $myport $2"
- CHECKFILE '' "\.$2\."
- if [ "$snmp_last_test_result" = 0 ] ; then
- test_finish FAIL
+ check_skip_arp_tests
+ if check_skip_arp_tests "$2" ; then
+ test_finish SKIPPED
else
- test_finish PASS
+ CAPTURE "snmpgetnext -Of -v $1 -c test $myport $2"
+ CHECKFILE '' "\.$2\."
+ if [ "$snmp_last_test_result" = 0 ] ; then
+ test_finish FAIL
+ else
+ test_finish PASS
+ fi
fi
}
get_snmpv3_table()
{
- test_start "Access table $2 by SNMPv3..."
- CAPTURE "snmpgetnext -Of -v 3 -u testrwuser $TEST_AUTHPRIV_PARMS $myport $2"
- CHECKFILE '' "\.$2\."
- if [ "$snmp_last_test_result" = 0 ] ; then
- test_finish FAIL
+ test_start "Access table $2 by SNMPv3..."
+ if check_skip_arp_tests "$2" ; then
+ test_finish SKIPPED
else
- test_finish PASS
+ CAPTURE "snmpgetnext -Of -v 3 -u testrwuser $TEST_AUTHPRIV_PARMS $myport $2"
+ CHECKFILE '' "\.$2\."
+ if [ "$snmp_last_test_result" = 0 ] ; then
+ test_finish FAIL
+ else
+ test_finish PASS
+ fi
fi
}
+
Index: testing/rfc1213/test_fun
===================================================================
--- testing/rfc1213/test_fun.orig 2004-10-16 22:44:35.000000000 +0200
+++ testing/rfc1213/test_fun 2008-10-24 15:30:46.066386937 +0200
@@ -51,6 +51,9 @@ test_finish()
if [ x$1 == x"PASS" ];then
pass_num=`expr $pass_num + 1`
pass_info "PASS\n"
+ elif [ x$1 == x"SKIPPED" ];then
+ pass_num=`expr $pass_num + 1`
+ pass_info "SKIPPED\n"
else
fail_num=`expr $fail_num + 1`
fail_info "FAIL\n"
@@ -66,3 +69,4 @@ summary()
fi
}
+
++++++ net-snmp-5.4.2_velocity-mib.patch ++++++
++++ 3373 lines (skipped)
++++++ net-snmp-5.3_vendorperl.patch -> net-snmp-5.4.2_vendorperl.patch ++++++
--- net-snmp/net-snmp-5.3_vendorperl.patch 2006-11-14 18:23:18.000000000 +0100
+++ /mounts/work_src_done/STABLE/net-snmp/net-snmp-5.4.2_vendorperl.patch 2008-10-24 15:30:55.010885000 +0200
@@ -1,8 +1,8 @@
Index: Makefile.in
===================================================================
---- Makefile.in.orig
-+++ Makefile.in
-@@ -167,7 +167,7 @@
+--- Makefile.in.orig 2007-06-08 22:32:56.000000000 +0200
++++ Makefile.in 2008-10-24 15:30:52.442885040 +0200
+@@ -169,7 +169,7 @@ perlmakefiles: net-snmp-config-x
fi
perlinstall:
++++++ net-snmp.logrotate ++++++
--- /var/tmp/diff_new_pack.hH9523/_old 2008-10-24 22:47:12.000000000 +0200
+++ /var/tmp/diff_new_pack.hH9523/_new 2008-10-24 22:47:12.000000000 +0200
@@ -11,7 +11,7 @@
postrotate
/etc/init.d/snmpd try-restart ||:
if [ -x /etc/init.d/snmptrapd ] ; then \
- /etc/init.d/snmptrapd try-restart ; \
+ /etc/init.d/snmptrapd try-restart ||: ; \
fi
endscript
++++++ rc.net-snmp ++++++
--- /var/tmp/diff_new_pack.hH9523/_old 2008-10-24 22:47:12.000000000 +0200
+++ /var/tmp/diff_new_pack.hH9523/_new 2008-10-24 22:47:12.000000000 +0200
@@ -81,7 +81,7 @@
# do not even try to start if the log file is (2GB-1MB) big.
# the snmpd doesnt handle LFS properly
#
- SNMPD_LOGFILE="/var/log/net-snmpd.log"
+ SNMPD_LOGFILE="${SNMPD_LOGFILE:-/var/log/net-snmpd.log}"
if [ -e "$SNMPD_LOGFILE" ] ; then
SNMPD_SIZE_LOGFILE="$(stat -c "%s" $SNMPD_LOGFILE)"
SNMPD_SIZE_MAX="1073741824"
@@ -126,7 +126,7 @@
killproc -TERM $SNMPD
rc_status -v ; rc_reset
# we also need to make sure all agents die
- if test -n $agents; then
+ if test -n "$agents"; then
for agent in $AGENTDIR/*; do
test -x $agent || continue
echo -ne "\tShutting down `basename $agent`:"
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
--
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org