Accepting request 29044 from home:hennevogel:TODO

Copy from home:hennevogel:TODO/net-snmp based on submit request 29044 from user coolo

OBS-URL: https://build.opensuse.org/request/show/29044
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/net-snmp?expand=0&rev=23
This commit is contained in:
OBS User autobuild 2010-01-21 10:28:30 +00:00 committed by Git OBS Bridge
parent f722276f7c
commit 9bb07c73bc
28 changed files with 123 additions and 30076 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,334 +0,0 @@
From ecd91d8a2b532bd1a987369e76d75fef454f2bcf Mon Sep 17 00:00:00 2001
From: Mitsuru Chinen <mitch@linux.vnet.ibm.com>
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 <mitch@linux.vnet.ibm.com>
---
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 <netinet/in.h>
#include <net/if_arp.h>
#include <arpa/inet.h>
+#include <linux/types.h>
+#include <asm/types.h>
+#ifdef NETSNMP_ENABLE_IPV6
+#ifdef HAVE_LINUX_RTNETLINK_H
+#include <linux/rtnetlink.h>
+#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 <linux/netlink.h>
#endif
]])
+# linux rtnetlink
+AC_CHECK_HEADERS(linux/rtnetlink.h,,,
+[[
+#if HAVE_ASM_TYPES_H
+#include <asm/types.h>
+#endif
+#if HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+]])
# BSDi3 headers
AC_CHECK_HEADERS(sys/stat.h)
# BSDi3/IRIX headers
--
1.6.0.2

View File

@ -1,69 +0,0 @@
From 65f75f485f428b0f22ff82c96ebd7d89e49ce7b2 Mon Sep 17 00:00:00 2001
From: Mitsuru Chinen <mitch@linux.vnet.ibm.com>
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 <mitch@linux.vnet.ibm.com>
---
.../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 <unistd.h>
#include <linux/sockios.h>
+#include <linux/if_ether.h>
#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

View File

@ -1,876 +0,0 @@
From 71ffec9f8c1bcd14a7bf6ca7762bc121ba1efaf1 Mon Sep 17 00:00:00 2001
From: Mitsuru Chinen <mitch@linux.vnet.ibm.com>
Date: Mon, 20 Oct 2008 17:42:57 +0900
Subject: [PATCH] Fix for Internet Address Prefix Table
From net-snmp patch tracker:
[ 1705594 ] ipAddressPrefixTable Fixes
http://sourceforge.net/tracker/index.php?func=detail&aid=1705594&group_id=12694&atid=312694
[ 1902105 ] hide some log messages introduced by patch 1705594
http://sourceforge.net/tracker/index.php?func=detail&aid=1902105&group_id=12694&atid=312694
Signed-off-by: Mitsuru Chinen <mitch@linux.vnet.ibm.com>
---
.../mibgroup/if-mib/data_access/interface_linux.c | 186 ++++++++++++++++++++
.../mibgroup/ip-mib/data_access/ipaddress_common.c | 67 +++++++
.../mibgroup/ip-mib/data_access/ipaddress_linux.c | 144 +++++++++++++++-
.../ipAddressPrefixTable/ipAddressPrefixTable.c | 7 +-
.../ipAddressPrefixTable_constants.h | 14 ++
.../ipAddressPrefixTable_data_access.c | 27 +++-
agent/mibgroup/util_funcs.c | 152 ++++++++++++++++-
agent/mibgroup/util_funcs.h | 41 +++++
include/net-snmp/data_access/ipaddress.h | 19 ++-
9 files changed, 645 insertions(+), 12 deletions(-)
diff --git a/agent/mibgroup/if-mib/data_access/interface_linux.c b/agent/mibgroup/if-mib/data_access/interface_linux.c
index 474a904..294963a 100644
--- a/agent/mibgroup/if-mib/data_access/interface_linux.c
+++ b/agent/mibgroup/if-mib/data_access/interface_linux.c
@@ -29,6 +29,7 @@ typedef __u8 u8; /* ditto */
#include <net-snmp/data_access/interface.h>
#include <net-snmp/data_access/ipaddress.h>
#include "if-mib/data_access/interface.h"
+#include "mibgroup/util_funcs.h"
#include "interface_ioctl.h"
#include <sys/types.h>
@@ -42,6 +43,15 @@ typedef __u8 u8; /* ditto */
#define IF_NAMESIZE 16
#endif
+#ifdef NETSNMP_ENABLE_IPV6
+#if defined(HAVE_PTHREAD_H) && defined(HAVE_LINUX_RTNETLINK_H)
+#include <pthread.h>
+#include <linux/rtnetlink.h>
+#ifdef RTMGRP_IPV6_PREFIX
+#define SUPPORT_PREFIX_FLAGS 1
+#endif /* RTMGRP_IPV6_PREFIX */
+#endif /* HAVE_PTHREAD_H && HAVE_LINUX_RTNETLINK_H */
+#endif /* NETSNMP_ENABLE_IPV6 */
unsigned int
netsnmp_linux_interface_get_if_speed(int fd, const char *name);
#ifdef HAVE_LINUX_ETHTOOL_H
@@ -59,6 +69,16 @@ static unsigned short retrans_time_factor = 1;
#define PROC_SYS_NET_IPVx_BASE_REACHABLE_TIME "/proc/sys/net/ipv%d/neigh/%s/base_reachable_time"
static const char *proc_sys_basereachable_time;
static unsigned short basereachable_time_ms = 0;
+#ifdef SUPPORT_PREFIX_FLAGS
+prefix_cbx *prefix_head_list = NULL;
+pthread_mutex_t prefix_mutex_lock = PTHREAD_MUTEX_INITIALIZER;
+netsnmp_prefix_listen_info list_info;
+pthread_t thread1;
+#define IF_PREFIX_ONLINK 0x01
+#define IF_PREFIX_AUTOCONF 0x02
+
+void *netsnmp_prefix_listen(netsnmp_prefix_listen_info *listen_info);
+#endif
void
netsnmp_arch_interface_init(void)
{
@@ -91,6 +111,13 @@ netsnmp_arch_interface_init(void)
else {
proc_sys_basereachable_time = PROC_SYS_NET_IPVx_BASE_REACHABLE_TIME;
}
+#ifdef SUPPORT_PREFIX_FLAGS
+ list_info.list_head = &prefix_head_list;
+ list_info.lockinfo = &prefix_mutex_lock;
+
+ if(pthread_create(&thread1, NULL, netsnmp_prefix_listen, &list_info) < 0)
+ snmp_log(LOG_ERR,"Unable to create thread\n");
+#endif
}
/*
@@ -885,3 +912,162 @@ netsnmp_linux_interface_get_if_speed(int fd, const char *name)
}
return retspeed;
}
+#ifdef SUPPORT_PREFIX_FLAGS
+void *netsnmp_prefix_listen(netsnmp_prefix_listen_info *listen_info)
+{
+ struct {
+ struct nlmsghdr n;
+ struct ifinfomsg r;
+ char buf[1024];
+ } req;
+
+ struct rtattr *rta;
+ int status;
+ char buf[16384];
+ struct nlmsghdr *nlmp;
+ struct rtattr *rtatp;
+ struct in6_addr *in6p;
+ struct sockaddr_nl localaddrinfo;
+ struct ifaddrmsg *ifa;
+ struct prefixmsg *prefix;
+ unsigned groups = 0;
+ struct rtattr *index_table[IFA_MAX+1];
+ char in6pAddr[40];
+ int flag1 = 0,flag2 = 0;
+ int onlink = 2,autonomous = 2; /*Assume as false*/
+ prefix_cbx *new;
+ int iret;
+ int len, req_len, length;
+ int fd = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE);
+
+
+ memset(&localaddrinfo, 0, sizeof(struct sockaddr_nl));
+ memset(&in6pAddr, '\0', sizeof(in6pAddr));
+
+ groups |= RTMGRP_IPV6_IFADDR;
+ groups |= RTMGRP_IPV6_PREFIX;
+ localaddrinfo.nl_family = AF_NETLINK;
+ localaddrinfo.nl_groups = groups;
+
+ if (bind(fd, (struct sockaddr*)&localaddrinfo, sizeof(localaddrinfo)) < 0) {
+ snmp_log(LOG_ERR,"netsnmp_prefix_listen: Bind failed. Exiting thread.\n");
+ exit(0);
+ }
+
+ memset(&req, 0, sizeof(req));
+ req.n.nlmsg_len = NLMSG_LENGTH(sizeof(struct ifinfomsg));
+ req.n.nlmsg_flags = NLM_F_REQUEST | NLM_F_ROOT;
+ req.n.nlmsg_type = RTM_GETLINK;
+ req.r.ifi_family = AF_INET6;
+ rta = (struct rtattr *)(((char *)&req) + NLMSG_ALIGN(req.n.nlmsg_len));
+ rta->rta_len = RTA_LENGTH(16);
+
+ status = send(fd, &req, req.n.nlmsg_len, 0);
+ if (status < 0) {
+ snmp_log(LOG_ERR,"netsnmp_prefix_listen: Send failed. Exiting thread\n");
+ exit(0);
+ }
+
+ while(1) {
+ status = recv(fd, buf, sizeof(buf), 0);
+ if (status < 0) {
+ snmp_log(LOG_ERR,"netsnmp_prefix_listen: Recieve failed. Exiting thread\n");
+ exit(0);
+ }
+
+ if(status == 0){
+ DEBUGMSGTL(("access:interface:prefix", "End of File\n"));
+ continue;
+ }
+
+ for(nlmp = (struct nlmsghdr *)buf; status > sizeof(*nlmp);){
+ len = nlmp->nlmsg_len;
+ req_len = len - sizeof(*nlmp);
+
+ if (req_len < 0 || len > status) {
+ snmp_log(LOG_ERR,"netsnmp_prefix_listen: Error in length. Exiting thread\n");
+ exit(0);
+ }
+
+ if (!NLMSG_OK(nlmp, status)) {
+ DEBUGMSGTL(("access:interface:prefix", "NLMSG not OK\n"));
+ continue;
+ }
+
+ if (nlmp->nlmsg_type == RTM_NEWADDR || nlmp->nlmsg_type == RTM_DELADDR) {
+ ifa = NLMSG_DATA(nlmp);
+ length = nlmp->nlmsg_len;
+ length -= NLMSG_LENGTH(sizeof(*ifa));
+
+ if (length < 0) {
+ DEBUGMSGTL(("access:interface:prefix", "wrong nlmsg length %d\n", length));
+ continue;
+ }
+ memset(index_table, 0, sizeof(struct rtattr *) * (IFA_MAX + 1));
+ if(!ifa->ifa_flags) {
+ rtatp = IFA_RTA(ifa);
+ while (RTA_OK(rtatp, length)) {
+ if (rtatp->rta_type <= IFA_MAX)
+ index_table[rtatp->rta_type] = rtatp;
+ rtatp = RTA_NEXT(rtatp,length);
+ }
+ if (index_table[IFA_ADDRESS]) {
+ in6p = (struct in6_addr *)RTA_DATA(index_table[IFA_ADDRESS]);
+ if(nlmp->nlmsg_type == RTM_DELADDR) {
+ sprintf(in6pAddr, "%04x%04x%04x%04x%04x%04x%04x%04x", NIP6(*in6p));
+ flag1 = -1;
+ } else {
+ sprintf(in6pAddr, "%04x%04x%04x%04x%04x%04x%04x%04x", NIP6(*in6p));
+ flag1 = 1;
+ }
+
+ }
+ }
+ }
+
+ if(nlmp->nlmsg_type == RTM_NEWPREFIX) {
+ prefix = NLMSG_DATA(nlmp);
+ length = nlmp->nlmsg_len;
+ length -= NLMSG_LENGTH(sizeof(*prefix));
+
+ if (length < 0) {
+ DEBUGMSGTL(("access:interface:prefix", "wrong nlmsg length %d\n", length));
+ continue;
+ }
+ flag2 = 1;
+ if (prefix->prefix_flags & IF_PREFIX_ONLINK)
+ onlink = 1;
+ if (prefix->prefix_flags & IF_PREFIX_AUTOCONF)
+ autonomous = 1;
+ }
+ status -= NLMSG_ALIGN(len);
+ nlmp = (struct nlmsghdr*)((char*)nlmp + NLMSG_ALIGN(len));
+ }
+ if((flag1 == 1) && (flag2 == 1)){
+ if(!(new = net_snmp_create_prefix_info (onlink, autonomous, in6pAddr)))
+ DEBUGMSGTL(("access:interface:prefix", "Unable to create prefix info\n"));
+ else {
+ iret = net_snmp_update_prefix_info (listen_info->list_head, new, listen_info->lockinfo);
+ if(iret < 0) {
+ DEBUGMSGTL(("access:interface:prefix", "Unable to add/update prefix info\n"));
+ free(new);
+ }
+ if(iret == 2) /*Only when enrty already exists and we are only updating*/
+ free(new);
+ }
+ flag1 = flag2 = 0;
+ onlink = autonomous = 2; /*Set to defaults again*/
+ } else if (flag1 == -1) {
+ iret = net_snmp_delete_prefix_info (listen_info->list_head, in6pAddr, listen_info->lockinfo);
+ if(iret < 0)
+ DEBUGMSGTL(("access:interface:prefix", "Unable to delete the prefix info\n"));
+ if(!iret)
+ DEBUGMSGTL(("access:interface:prefix", "Unable to find the node to delete\n"));
+ flag1 = 0;
+ }
+ }
+
+}
+#endif
+
+
diff --git a/agent/mibgroup/ip-mib/data_access/ipaddress_common.c b/agent/mibgroup/ip-mib/data_access/ipaddress_common.c
index 396fc96..3eef0cc 100644
--- a/agent/mibgroup/ip-mib/data_access/ipaddress_common.c
+++ b/agent/mibgroup/ip-mib/data_access/ipaddress_common.c
@@ -304,6 +304,27 @@ netsnmp_access_ipaddress_entry_update(netsnmp_ipaddress_entry *lhs,
++changed;
lhs->ia_origin = rhs->ia_origin;
}
+
+ if (lhs->ia_onlink_flag != rhs->ia_onlink_flag) {
+ ++changed;
+ lhs->ia_onlink_flag = rhs->ia_onlink_flag;
+ }
+
+ if (lhs->ia_autonomous_flag != rhs->ia_autonomous_flag) {
+ ++changed;
+ lhs->ia_autonomous_flag = rhs->ia_autonomous_flag;
+ }
+
+ if (lhs->ia_prefered_lifetime != rhs->ia_prefered_lifetime) {
+ ++changed;
+ lhs->ia_prefered_lifetime = rhs->ia_prefered_lifetime;
+ }
+
+ if (lhs->ia_valid_lifetime != rhs->ia_valid_lifetime) {
+ ++changed;
+ lhs->ia_valid_lifetime = rhs->ia_valid_lifetime;
+ }
+
return changed;
}
@@ -428,3 +449,49 @@ static int _access_ipaddress_entry_compare_addr(const void *lhs,
*/
return memcmp(lh->ia_address, rh->ia_address, lh->ia_address_len);
}
+
+int
+netsnmp_ipaddress_flags_copy(u_long *ipAddressPrefixAdvPreferredLifetime,
+ u_long *ipAddressPrefixAdvValidLifetime,
+ u_long *ipAddressPrefixOnLinkFlag,
+ u_long *ipAddressPrefixAutonomousFlag,
+ u_long *ia_prefered_lifetime,
+ u_long *ia_valid_lifetime,
+ u_char *ia_onlink_flag,
+ u_char *ia_autonomous_flag)
+{
+
+ /*Copy all the flags*/
+ *ipAddressPrefixAdvPreferredLifetime = *ia_prefered_lifetime;
+ *ipAddressPrefixAdvValidLifetime = *ia_valid_lifetime;
+ *ipAddressPrefixOnLinkFlag = *ia_onlink_flag;
+ *ipAddressPrefixAutonomousFlag = *ia_autonomous_flag;
+ return 0;
+}
+
+int
+netsnmp_ipaddress_prefix_origin_copy(u_long *ipAddressPrefixOrigin,
+ u_char ia_origin,
+ int flags,
+ u_long ipAddressAddrType)
+{
+ if(ipAddressAddrType == INETADDRESSTYPE_IPV4){
+ if(ia_origin == 6) /*Random*/
+ (*ipAddressPrefixOrigin) = 3 /*IPADDRESSPREFIXORIGINTC_WELLKNOWN*/;
+ else
+ (*ipAddressPrefixOrigin) = ia_origin;
+ } else {
+ if(ia_origin == 5) { /*Link Layer*/
+ if(!flags) /*Global address assigned by router adv*/
+ (*ipAddressPrefixOrigin) = 5 /*IPADDRESSPREFIXORIGINTC_ROUTERADV*/;
+ else
+ (*ipAddressPrefixOrigin) = 3 /*IPADDRESSPREFIXORIGINTC_WELLKNOWN*/;
+ }
+ else if(ia_origin == 6) /*Random*/
+ (*ipAddressPrefixOrigin) = 5 /*IPADDRESSPREFIXORIGINTC_ROUTERADV*/;
+ else
+ (*ipAddressPrefixOrigin) = ia_origin;
+ }
+ return 0;
+}
+
diff --git a/agent/mibgroup/ip-mib/data_access/ipaddress_linux.c b/agent/mibgroup/ip-mib/data_access/ipaddress_linux.c
index 4616649..c6e5fec 100644
--- a/agent/mibgroup/ip-mib/data_access/ipaddress_linux.c
+++ b/agent/mibgroup/ip-mib/data_access/ipaddress_linux.c
@@ -12,6 +12,8 @@
#include <net-snmp/data_access/interface.h>
#include "ip-mib/ipAddressTable/ipAddressTable_constants.h"
+#include "ip-mib/ipAddressPrefixTable/ipAddressPrefixTable_constants.h"
+#include "mibgroup/util_funcs.h"
#include <errno.h>
#include <sys/ioctl.h>
@@ -19,15 +21,29 @@
#if defined (NETSNMP_ENABLE_IPV6)
#include <linux/types.h>
#include <asm/types.h>
-#ifdef HAVE_LINUX_RTNETLINK_H
+#if defined(HAVE_PTHREAD_H) && defined(HAVE_LINUX_RTNETLINK_H)
#include <linux/netlink.h>
+#include <pthread.h>
#include <linux/rtnetlink.h>
-#endif
+#ifdef RTMGRP_IPV6_PREFIX
+#define SUPPORT_PREFIX_FLAGS 1
+#endif /* RTMGRP_IPV6_PREFIX */
+#endif /* HAVE_PTHREAD_H && HAVE_LINUX_RTNETLINK_H */
#endif
#include "ipaddress_ioctl.h"
-
+#ifdef SUPPORT_PREFIX_FLAGS
+extern prefix_cbx *prefix_head_list;
+extern pthread_mutex_t prefix_mutex_lock;
+#endif
int _load_v6(netsnmp_container *container, int idx_offset);
+#ifdef HAVE_LINUX_RTNETLINK_H
+int
+netsnmp_access_ipaddress_extra_prefix_info(int index,
+ u_long *preferedlt,
+ ulong *validlt,
+ char *addr);
+#endif
/*
* initialize arch specific storage
@@ -194,6 +210,7 @@ _load_v6(netsnmp_container *container, int idx_offset)
u_char *buf;
int if_index, pfx_len, scope, flags, rc = 0;
size_t in_len, out_len;
+ prefix_cbx prefix_val;
netsnmp_ipaddress_entry *entry;
_ioctl_extras *extras;
static int log_open_err = 1;
@@ -251,6 +268,7 @@ _load_v6(netsnmp_container *container, int idx_offset)
in_len = entry->ia_address_len = sizeof(entry->ia_address);
netsnmp_assert(16 == in_len);
out_len = 0;
+ entry->flags = flags;
buf = entry->ia_address;
if(1 != netsnmp_hex_to_binary(&buf, &in_len,
&out_len, 0, addr, ":")) {
@@ -341,6 +359,30 @@ _load_v6(netsnmp_container *container, int idx_offset)
entry->ia_storagetype = STORAGETYPE_PERMANENT;
/* xxx-rks: what can we do with scope? */
+#ifdef HAVE_LINUX_RTNETLINK_H
+ if(netsnmp_access_ipaddress_extra_prefix_info(entry->if_index, &entry->ia_prefered_lifetime
+ ,&entry->ia_valid_lifetime, addr) < 0){
+ DEBUGMSGTL(("access:ipaddress:container", "unable to fetch extra prefix info\n"));
+ }
+#else
+ entry->ia_prefered_lifetime = 0;
+ entry->ia_valid_lifetime = 0;
+#endif
+#ifdef SUPPORT_PREFIX_FLAGS
+ memset(&prefix_val, 0, sizeof(prefix_cbx));
+ if(net_snmp_find_prefix_info(&prefix_head_list, addr, &prefix_val, &prefix_mutex_lock) < 0) {
+ DEBUGMSGTL(("access:ipaddress:container", "unable to find info\n"));
+ entry->ia_onlink_flag = 1; /*Set by default as true*/
+ entry->ia_autonomous_flag = 2; /*Set by default as false*/
+
+ } else {
+ entry->ia_onlink_flag = prefix_val.ipAddressPrefixOnLinkFlag;
+ entry->ia_autonomous_flag = prefix_val.ipAddressPrefixAutonomousFlag;
+ }
+#else
+ entry->ia_onlink_flag = 1; /*Set by default as true*/
+ entry->ia_autonomous_flag = 2; /*Set by default as false*/
+#endif
/*
* add entry to container
@@ -448,4 +490,100 @@ netsnmp_access_other_info_get(int index, int family)
return addr;
#endif
}
+
+#ifdef HAVE_LINUX_RTNETLINK_H
+int
+netsnmp_access_ipaddress_extra_prefix_info(int index, u_long *preferedlt,
+ ulong *validlt, char *addr)
+{
+
+ struct {
+ struct nlmsghdr nlhdr;
+ struct ifaddrmsg ifaceinfo;
+ char buf[1024];
+ } req;
+
+ struct rtattr *rta;
+ int status;
+ char buf[16384];
+ char tmpaddr[40];
+ struct nlmsghdr *nlmp;
+ struct ifaddrmsg *rtmp;
+ struct rtattr *rtatp;
+ struct ifa_cacheinfo *cache_info;
+ struct in6_addr *in6p;
+ int rtattrlen;
+ int sd;
+ int reqaddr = 0;
+ sd = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE);
+ if(sd < 0) {
+ snmp_log(LOG_ERR, "could not open netlink socket\n");
+ return -1;
+ }
+ memset(&req, 0, sizeof(req));
+ req.nlhdr.nlmsg_len = NLMSG_LENGTH(sizeof(struct ifaddrmsg));
+ req.nlhdr.nlmsg_flags = NLM_F_REQUEST | NLM_F_ROOT;
+ req.nlhdr.nlmsg_type = RTM_GETADDR;
+ req.ifaceinfo.ifa_family = AF_INET6;
+ rta = (struct rtattr *)(((char *)&req) + NLMSG_ALIGN(req.nlhdr.nlmsg_len));
+ rta->rta_len = RTA_LENGTH(16); /*For ipv6*/
+
+ status = send (sd, &req, req.nlhdr.nlmsg_len, 0);
+ if (status < 0) {
+ snmp_log(LOG_ERR, "could not send netlink request\n");
+ return -1;
+ }
+ status = recv (sd, buf, sizeof(buf), 0);
+ if (status < 0) {
+ snmp_log (LOG_ERR, "could not recieve netlink request\n");
+ return -1;
+ }
+ if (status == 0) {
+ snmp_log (LOG_ERR, "nothing to read\n");
+ return -1;
+ }
+ 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 -1;
+ }
+
+ if (!NLMSG_OK (nlmp, status)) {
+ snmp_log (LOG_ERR, "invalid NLMSG message\n");
+ return -1;
+ }
+ 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_ADDRESS) {
+ in6p = (struct in6_addr *)RTA_DATA(rtatp);
+ sprintf(tmpaddr, "%04x%04x%04x%04x%04x%04x%04x%04x", NIP6(*in6p));
+ if(!strcmp(tmpaddr ,addr))
+ reqaddr = 1;
+ }
+ if(rtatp->rta_type == IFA_CACHEINFO) {
+ cache_info = (struct ifa_cacheinfo *)RTA_DATA(rtatp);
+ if(reqaddr) {
+ reqaddr = 0;
+ *validlt = cache_info->ifa_valid;
+ *preferedlt = cache_info->ifa_prefered;
+ }
+
+ }
+
+ }
+ }
+ status -= NLMSG_ALIGN(len);
+ nlmp = (struct nlmsghdr*)((char*)nlmp + NLMSG_ALIGN(len));
+ }
+ close(sd);
+ return 0;
+}
+#endif
#endif
diff --git a/agent/mibgroup/ip-mib/ipAddressPrefixTable/ipAddressPrefixTable.c b/agent/mibgroup/ip-mib/ipAddressPrefixTable/ipAddressPrefixTable.c
index ecd26a0..9188f93 100644
--- a/agent/mibgroup/ip-mib/ipAddressPrefixTable/ipAddressPrefixTable.c
+++ b/agent/mibgroup/ip-mib/ipAddressPrefixTable/ipAddressPrefixTable.c
@@ -392,10 +392,9 @@ ipAddressPrefixOrigin_get(ipAddressPrefixTable_rowreq_ctx * rowreq_ctx,
* TODO:231:o: |-> Extract the current value of the ipAddressPrefixOrigin data.
* copy (* ipAddressPrefixOrigin_val_ptr ) from rowreq_ctx->data
*/
- (*ipAddressPrefixOrigin_val_ptr) =
- rowreq_ctx->data.ipAddressPrefixOrigin;
-
- return MFD_SUCCESS;
+ (*ipAddressPrefixOrigin_val_ptr) = rowreq_ctx->data.ipAddressPrefixOrigin;
+
+ return MFD_SUCCESS;
} /* ipAddressPrefixOrigin_get */
/*---------------------------------------------------------------------
diff --git a/agent/mibgroup/ip-mib/ipAddressPrefixTable/ipAddressPrefixTable_constants.h b/agent/mibgroup/ip-mib/ipAddressPrefixTable/ipAddressPrefixTable_constants.h
index d9c0cb0..6dd440d 100644
--- a/agent/mibgroup/ip-mib/ipAddressPrefixTable/ipAddressPrefixTable_constants.h
+++ b/agent/mibgroup/ip-mib/ipAddressPrefixTable/ipAddressPrefixTable_constants.h
@@ -137,3 +137,17 @@ extern "C" {
}
#endif
#endif /* IPADDRESSPREFIXTABLE_OIDS_H */
+/****************************************************************
+* Additional constants and definitions for common implementation
+*/
+#define INFINITY_LIFE_TIME 0xFFFFFFFFU
+#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])
+
diff --git a/agent/mibgroup/ip-mib/ipAddressPrefixTable/ipAddressPrefixTable_data_access.c b/agent/mibgroup/ip-mib/ipAddressPrefixTable/ipAddressPrefixTable_data_access.c
index 4cda4de..9e0b5fe 100644
--- a/agent/mibgroup/ip-mib/ipAddressPrefixTable/ipAddressPrefixTable_data_access.c
+++ b/agent/mibgroup/ip-mib/ipAddressPrefixTable/ipAddressPrefixTable_data_access.c
@@ -251,6 +251,23 @@ ipAddressPrefixTable_container_load(netsnmp_container *container)
ia_address_len,
addr_rowreq_ctx->data->
ia_prefix_len);
+ netsnmp_ipaddress_flags_copy(&rowreq_ctx->data.
+ ipAddressPrefixAdvPreferredLifetime,
+ &rowreq_ctx->data.
+ ipAddressPrefixAdvValidLifetime,
+ &rowreq_ctx->data.
+ ipAddressPrefixOnLinkFlag,
+ &rowreq_ctx->data.
+ ipAddressPrefixAutonomousFlag,
+ &addr_rowreq_ctx->data->
+ ia_prefered_lifetime,
+ &addr_rowreq_ctx->data->
+ ia_valid_lifetime,
+ &addr_rowreq_ctx->data->
+ ia_onlink_flag,
+ &addr_rowreq_ctx->data->
+ ia_autonomous_flag);
+
if (MFD_SUCCESS !=
ipAddressPrefixTable_indexes_set(rowreq_ctx,
addr_rowreq_ctx->data->
@@ -277,8 +294,14 @@ ipAddressPrefixTable_container_load(netsnmp_container *container)
* TODO:352:r: | |-> populate ipAddressPrefixTable data context.
* Populate data context here. (optionally, delay until row prep)
*/
- rowreq_ctx->data.ipAddressPrefixOrigin =
- addr_rowreq_ctx->data->ia_origin;
+ netsnmp_ipaddress_prefix_origin_copy(&rowreq_ctx->data.
+ ipAddressPrefixOrigin,
+ addr_rowreq_ctx->data->
+ ia_origin,
+ addr_rowreq_ctx->data->
+ flags,
+ addr_rowreq_ctx->tbl_idx.
+ ipAddressAddrType);
/** defer the rest til row prep */
diff --git a/agent/mibgroup/util_funcs.c b/agent/mibgroup/util_funcs.c
index 26826f7..d060721 100644
--- a/agent/mibgroup/util_funcs.c
+++ b/agent/mibgroup/util_funcs.c
@@ -100,7 +100,9 @@
# include <ndir.h>
# endif
#endif
-
+#ifdef HAVE_PTHREAD_H
+#include <pthread.h>
+#endif
#include <net-snmp/net-snmp-includes.h>
#include <net-snmp/agent/net-snmp-agent-includes.h>
@@ -1292,3 +1294,151 @@ get_pid_from_inode(unsigned long long inode)
}
#endif /* #ifdef linux */
+
+#if defined(HAVE_PTHREAD_H)
+prefix_cbx *net_snmp_create_prefix_info(unsigned long OnLinkFlag,
+ unsigned long AutonomousFlag,
+ char *in6ptr)
+{
+ prefix_cbx *node = SNMP_MALLOC_TYPEDEF(prefix_cbx);
+ if(!in6ptr) {
+ free(node);
+ return NULL;
+ }
+ if(!node) {
+ free(node);
+ return NULL;
+ }
+ node->next_info = NULL;
+ node->ipAddressPrefixOnLinkFlag = OnLinkFlag;
+ node->ipAddressPrefixAutonomousFlag = AutonomousFlag;
+ memcpy(node->in6p, in6ptr, sizeof(node->in6p));
+
+ return node;
+}
+
+int net_snmp_find_prefix_info(prefix_cbx **head,
+ char *address,
+ prefix_cbx *node_to_find,
+ pthread_mutex_t *lockid)
+{
+ int iret;
+ memset(node_to_find, 0, sizeof(prefix_cbx));
+ if(!*head)
+ return -1;
+ memcpy(node_to_find->in6p, address, sizeof(node_to_find->in6p));
+
+ iret = net_snmp_search_update_prefix_info(head, node_to_find, 1, lockid);
+ if(iret < 0) {
+ DEBUGMSGTL(("util_funcs:prefix", "Unable to search the list\n"));
+ return -1;
+ } else if (!iret) {
+ DEBUGMSGTL(("util_funcs:prefix", "Could not find prefix info\n"));
+ return -1;
+ } else
+ return 0;
+}
+
+int net_snmp_update_prefix_info(prefix_cbx **head,
+ prefix_cbx *node_to_update,
+ pthread_mutex_t *lockid)
+{
+ int iret;
+ iret = net_snmp_search_update_prefix_info(head, node_to_update, 0, lockid);
+ if(iret < 0) {
+ DEBUGMSGTL(("util_funcs:prefix", "Unable to update prefix info\n"));
+ return -1;
+ } else if (!iret) {
+ DEBUGMSGTL(("util_funcs:prefix", "Unable to find the node to update\n"));
+ return -1;
+ } else
+ return 0;
+}
+
+int net_snmp_search_update_prefix_info(prefix_cbx **head,
+ prefix_cbx *node_to_use,
+ int functionality,
+ pthread_mutex_t *lockid)
+{
+
+ /* We define functionality based on need *
+ * 0 - Need to do a search and update. We have to provide the node_to_use structure filled fully *
+ * 1 - Need to do only search. Provide the node_to_use with in6p value filled */
+
+ prefix_cbx *temp_node;
+ netsnmp_assert(NULL != head);
+ netsnmp_assert(NULL != node_to_use);
+
+ if(functionality > 1)
+ return -1;
+ if(!node_to_use)
+ return -1;
+
+
+ if (!functionality) {
+ if (!*head) {
+ *head = node_to_use;
+ return 1;
+ }
+
+ pthread_mutex_lock( lockid );
+ for (temp_node = *head; temp_node->next_info != NULL ; temp_node = temp_node->next_info) {
+ if (0 == strcmp(temp_node->in6p, node_to_use->in6p)) {
+ temp_node->ipAddressPrefixOnLinkFlag = node_to_use->ipAddressPrefixOnLinkFlag;
+ temp_node->ipAddressPrefixAutonomousFlag = node_to_use->ipAddressPrefixAutonomousFlag;
+ pthread_mutex_unlock( lockid );
+ return 2;
+ }
+ }
+ temp_node->next_info = node_to_use;
+ pthread_mutex_unlock( lockid );
+ return 1;
+ } else {
+ pthread_mutex_lock( lockid );
+ for (temp_node = *head; temp_node != NULL ; temp_node = temp_node->next_info) {
+ if (0 == strcmp(temp_node->in6p, node_to_use->in6p)) {
+ /*need yo put sem here as i read here */
+ node_to_use->ipAddressPrefixOnLinkFlag = temp_node->ipAddressPrefixOnLinkFlag;
+ node_to_use->ipAddressPrefixAutonomousFlag = temp_node->ipAddressPrefixAutonomousFlag;
+ pthread_mutex_unlock( lockid );
+ return 1;
+ }
+ }
+ pthread_mutex_unlock( lockid );
+ return 0;
+ }
+}
+
+int net_snmp_delete_prefix_info(prefix_cbx **head,
+ char *address,
+ pthread_mutex_t *lockid)
+{
+
+ prefix_cbx *temp_node,*prev_node;
+ if(!address)
+ return -1;
+ if(!head)
+ return -1;
+
+ /*Need to acquire lock here */
+ pthread_mutex_lock( lockid );
+ for (temp_node = *head, prev_node = NULL; temp_node;
+ prev_node = temp_node, temp_node = temp_node->next_info) {
+
+ if (temp_node->in6p && strcmp(temp_node->in6p, address) == 0) {
+ if (prev_node)
+ prev_node->next_info = temp_node->next_info;
+ else
+ *head = temp_node->next_info;
+ free(temp_node);
+ pthread_mutex_unlock( lockid );
+ return 1;
+ }
+
+ }
+ /*Release Lock here */
+ pthread_mutex_unlock( lockid );
+ return 0;
+}
+#endif
+
diff --git a/agent/mibgroup/util_funcs.h b/agent/mibgroup/util_funcs.h
index 4a0b99e..aa4257f 100644
--- a/agent/mibgroup/util_funcs.h
+++ b/agent/mibgroup/util_funcs.h
@@ -8,8 +8,23 @@
extern "C" {
#endif
+#ifdef HAVE_PTHREAD_H
+#include <pthread.h>
+#endif
#include "struct.h"
+typedef struct prefix_info
+{
+ struct prefix_info *next_info;
+ unsigned long ipAddressPrefixOnLinkFlag;
+ unsigned long ipAddressPrefixAutonomousFlag;
+ char in6p[40];
+}prefix_cbx;
+typedef struct
+{
+ prefix_cbx **list_head;
+ pthread_mutex_t *lockinfo;
+}netsnmp_prefix_listen_info;
void Exit(int);
int shell_command(struct extensible *);
int exec_command(struct extensible *);
@@ -37,6 +52,32 @@ const char *make_tempfile(void);
#ifdef linux
unsigned int get_pid_from_inode(unsigned long long);
#endif
+prefix_cbx *net_snmp_create_prefix_info(unsigned long OnLinkFlag,
+ unsigned long AutonomousFlag,
+ char *in6ptr);
+int net_snmp_find_prefix_info(prefix_cbx **head,
+ char *address,
+ prefix_cbx *node_to_find,
+ pthread_mutex_t *lockid);
+int net_snmp_update_prefix_info(prefix_cbx **head,
+ prefix_cbx *node_to_update,
+ pthread_mutex_t *lockid);
+int net_snmp_search_update_prefix_info(prefix_cbx **head,
+ prefix_cbx *node_to_use,
+ int functionality,
+ pthread_mutex_t *lockid);
+int net_snmp_delete_prefix_info(prefix_cbx **head,
+ char *address,
+ pthread_mutex_t *lockid);
+#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 satosin(x) ((struct sockaddr_in *) &(x))
#define SOCKADDR(x) (satosin(x)->sin_addr.s_addr)
diff --git a/include/net-snmp/data_access/ipaddress.h b/include/net-snmp/data_access/ipaddress.h
index b751b47..37083be 100644
--- a/include/net-snmp/data_access/ipaddress.h
+++ b/include/net-snmp/data_access/ipaddress.h
@@ -47,7 +47,10 @@ typedef struct netsnmp_ipaddress_s {
u_char ia_status; /* IpAddressStatus (1-7) */
u_char ia_origin; /* IpAddressOrigin (1-6) */
u_char ia_storagetype; /* IpAddressStorageType (1-5) */
-
+ u_char ia_onlink_flag; /* IpOnlinkFlag */
+ u_char ia_autonomous_flag; /*IpAutonomousFlag */
+ u_long ia_prefered_lifetime;/*IpPreferedLifeTime*/
+ u_long ia_valid_lifetime;/*IpValidLifeTime*/
netsnmp_data_list *arch_data; /* arch specific data */
} netsnmp_ipaddress_entry;
@@ -142,7 +145,19 @@ int netsnmp_ipaddress_prefix_copy(u_char *dst, u_char *src,
int netsnmp_ipaddress_ipv4_prefix_len(in_addr_t mask);
-
+int netsnmp_ipaddress_flags_copy(u_long *ipAddressPrefixAdvPreferredLifetime,
+ u_long *ipAddressPrefixAdvValidLifetime,
+ u_long *ipAddressPrefixOnLinkFlag,
+ u_long *ipAddressPrefixAutonomousFlag,
+ u_long *ia_prefered_lifetime,
+ u_long *ia_valid_lifetime,
+ u_char *ia_onlink_flag,
+ u_char *ia_autonomous_flag);
+
+int netsnmp_ipaddress_prefix_origin_copy(u_long *ipAddressPrefixOrigin,
+ u_char ia_origin,
+ int flags,
+ u_long ipAddressAddrType);
/**---------------------------------------------------------------------*/
--
1.6.0.2

View File

@ -1,405 +0,0 @@
From 12cb1f471833a7e145bdf7cb4d471d0bd74d73f0 Mon Sep 17 00:00:00 2001
From: Mitsuru Chinen <mitch@linux.vnet.ibm.com>
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 <mitch@linux.vnet.ibm.com>
---
.../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 <linux/types.h>
#include <asm/types.h>
+#include <linux/netlink.h>
#include <linux/rtnetlink.h>
#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

View File

@ -1,368 +0,0 @@
From 757470fe3c79081b3b106f669f39e45f7aaa4baf Mon Sep 17 00:00:00 2001
From: Mitsuru Chinen <mitch@linux.vnet.ibm.com>
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 <mitch@linux.vnet.ibm.com>
---
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 <net-snmp/data_access/udp_endpoint.h>
#include "udp-mib/udpEndpointTable/udpEndpointTable_constants.h"
-
+#include "mibgroup/util_funcs.h"
#include "udp_endpoint_private.h"
#include <fcntl.h>
@@ -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 <sys/stat.h>
#endif
+#if HAVE_DIRENT_H
+#include <dirent.h>
+#else
+# define dirent direct
+# if HAVE_SYS_NDIR_H
+# include <sys/ndir.h>
+# endif
+# if HAVE_SYS_DIR_H
+# include <sys/dir.h>
+# endif
+# if HAVE_NDIR_H
+# include <ndir.h>
+# endif
+#endif
#include <net-snmp/net-snmp-includes.h>
#include <net-snmp/agent/net-snmp-agent-includes.h>
@@ -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

File diff suppressed because it is too large Load Diff

View File

@ -2,4 +2,6 @@ libsnmp15
arch ppc package net-snmp-devel
requires -net-snmp-<targettype>
requires "libsnmp15-<targettype> = <version>"
arch sparcv9 package net-snmp-devel
requires -net-snmp-<targettype>
requires "libsnmp15-<targettype> = <version>"

View File

@ -1,8 +1,8 @@
Index: apps/Makefile.in
===================================================================
--- apps/Makefile.in.orig 2007-06-30 00:18:27.000000000 +0200
+++ apps/Makefile.in 2007-07-02 19:29:01.672262509 +0200
@@ -115,7 +115,7 @@ snmptest$(EXEEXT): snmptest.$(OSUFFIX
--- apps/Makefile.in.orig
+++ apps/Makefile.in
@@ -121,7 +121,7 @@ snmptest$(EXEEXT): snmptest.$(OSUFFIX
$(LINK) ${CFLAGS} -o $@ snmptest.$(OSUFFIX) $(LOCAL_LIBS) ${LDFLAGS} ${LIBS}
snmptrapd$(EXEEXT): $(TRAPD_OBJECTS) $(USETRAPLIBS) $(INSTALLLIBS)
@ -13,9 +13,9 @@ Index: apps/Makefile.in
$(LINK) ${CFLAGS} -o $@ snmptrap.$(OSUFFIX) $(LOCAL_LIBS) ${LDFLAGS} ${LIBS}
Index: agent/Makefile.in
===================================================================
--- agent/Makefile.in.orig 2007-06-30 00:18:27.000000000 +0200
+++ agent/Makefile.in 2007-07-02 19:29:28.297866574 +0200
@@ -139,7 +139,7 @@ getmibstat.o: mibgroup/kernel_sunos5.c
--- agent/Makefile.in.orig
+++ agent/Makefile.in
@@ -142,7 +142,7 @@ getmibstat.o: mibgroup/kernel_sunos5.c
$(CC) $(CFLAGS) -o $@ -D_GETMIBSTAT_TEST -DDODEBUG -c $?
snmpd$(EXEEXT): ${LAGENTOBJS} $(USELIBS) $(AGENTLIB) $(HELPERLIB) $(MIBLIB) $(LIBTARG)

View File

@ -1,206 +0,0 @@
426355: Cannot set source agent address for SNMP traps
Author: Jan Safranek <jsafrane@redhat.com>
Introduce "v1trapaddress" snmpd config option, which defines agent address
set in SNMPv1 traps, i.e. inside the SNMPv1 TRAP-PDU, not UDP packet
source address. The agent sets arbitrary local address to the TRAP PDU
when this option is ommited.
Index: snmplib/system.c
===================================================================
--- snmplib/system.c.orig 2008-06-05 23:11:53.000000000 +0200
+++ snmplib/system.c 2008-09-06 18:04:38.784302537 +0200
@@ -77,6 +77,10 @@ SOFTWARE.
#if HAVE_NET_IF_H
#include <net/if.h>
#endif
+#if HAVE_NETDB_H
+#include <netdb.h>
+#endif
+
#if HAVE_SYS_SOCKIO_H
#include <sys/sockio.h>
@@ -825,6 +829,84 @@ get_uptime(void)
#endif /* ! WIN32 */
/*******************************************************************/
+int
+get_thisaddr(const char* name, in_addr_t *addr_out)
+{
+
+#if HAVE_GETADDRINFO
+ struct addrinfo *addrs = NULL;
+ struct addrinfo hint;
+ int err;
+
+ memset(&hint, 0, sizeof hint);
+ hint.ai_flags = 0;
+ hint.ai_family = PF_INET;
+ hint.ai_socktype = SOCK_DGRAM;
+ hint.ai_protocol = 0;
+
+ err = getaddrinfo(name, NULL, &hint, &addrs);
+ if (err != 0) {
+#if HAVE_GAI_STRERROR
+ snmp_log(LOG_ERR, "getaddrinfo: %s %s\n", name,
+ gai_strerror(err));
+#else
+ snmp_log(LOG_ERR, "getaddrinfo: %s (error %d)\n", name,
+ err);
+#endif
+ return -1;
+ }
+ if (addrs != NULL) {
+ memcpy(addr_out,
+ &((struct sockaddr_in *) addrs->ai_addr)->sin_addr,
+ sizeof(in_addr_t));
+ freeaddrinfo(addrs);
+ } else {
+ DEBUGMSGTL(("get_thisaddr",
+ "Failed to resolve IPv4 hostname\n"));
+ }
+ return 0;
+
+#elif HAVE_GETHOSTBYNAME
+ struct hostent *hp = NULL;
+
+ hp = gethostbyname(host);
+ if (hp == NULL) {
+ DEBUGMSGTL(("get_thisaddr",
+ "hostname (couldn't resolve)\n"));
+ return -1;
+ } else if (hp->h_addrtype != AF_INET) {
+ DEBUGMSGTL(("get_thisaddr",
+ "hostname (not AF_INET!)\n"));
+ return -1;
+ } else {
+ DEBUGMSGTL(("get_thisaddr",
+ "hostname (resolved okay)\n"));
+ memcpy(addr_out, hp->h_addr, sizeof(in_addr_t));
+ }
+ return 0;
+
+#elif HAVE_GETIPNODEBYNAME
+ struct hostent *hp = NULL;
+ int err;
+
+ hp = getipnodebyname(peername, AF_INET, 0, &err);
+ if (hp == NULL) {
+ DEBUGMSGTL(("get_thisaddr",
+ "hostname (couldn't resolve = %d)\n", err));
+ return -1;
+ }
+ DEBUGMSGTL(("get_thisaddr",
+ "hostname (resolved okay)\n"));
+ memcpy(addr_out, hp->h_addr, sizeof(in_addr_t));
+ return 0;
+
+#else /* HAVE_GETIPNODEBYNAME */
+ return -1;
+#endif
+}
+
+/*******************************************************************/
+
#ifndef HAVE_STRNCASECMP
/*
Index: man/snmpd.conf.5.def
===================================================================
--- man/snmpd.conf.5.def.orig 2008-08-07 11:00:04.000000000 +0200
+++ man/snmpd.conf.5.def 2008-09-06 18:04:38.788301614 +0200
@@ -641,6 +641,12 @@ Ordinarily the corresponding MIB
object (\fCsnmpEnableAuthenTraps.0\fR) is read-write, but specifying
this directive makes this object read-only, and attempts to set the
value via SET requests will result in a \fInotWritable\fR error response.
+.RE
+.IP "v1trapaddress HOST"
+defines the agent address, which is inserted into SNMPv1 TRAPs. Arbitrary local
+IPv4 address is chosen if this option is ommited. This option is useful mainly
+when the agent is visible from outside world by specific address only (e.g.
+because of network address translation or firewall).
.SS "DisMan Event MIB"
The previous directives can be used to configure where traps should
be sent, but are not concerned with \fIwhen\fR to send such traps
Index: include/net-snmp/agent/ds_agent.h
===================================================================
--- include/net-snmp/agent/ds_agent.h.orig 2007-05-07 22:23:23.000000000 +0200
+++ include/net-snmp/agent/ds_agent.h 2008-09-06 18:04:38.823792310 +0200
@@ -42,6 +42,7 @@
#define NETSNMP_DS_AGENT_PERL_INIT_FILE 4 /* used by embedded perl */
#define NETSNMP_DS_SMUX_SOCKET 5 /* ip:port socket addr */
#define NETSNMP_DS_NOTIF_LOG_CTX 6 /* "" | "snmptrapd" */
+#define NETSNMP_DS_AGENT_TRAP_ADDR 7 /* used as v1 trap agent addres */
/*
* integers
Index: include/net-snmp/library/system.h
===================================================================
--- include/net-snmp/library/system.h.orig 2007-01-11 23:13:56.000000000 +0100
+++ include/net-snmp/library/system.h 2008-09-06 18:04:38.855791728 +0200
@@ -107,6 +107,8 @@ SOFTWARE.
#include <net-snmp/types.h> /* For definition of in_addr_t */
+ int get_thisaddr(const char* name,
+ in_addr_t *addr_out);
in_addr_t get_myaddr(void);
long get_uptime(void);
Index: agent/agent_read_config.c
===================================================================
--- agent/agent_read_config.c.orig 2008-07-24 08:53:02.000000000 +0200
+++ agent/agent_read_config.c 2008-09-06 18:04:38.880308775 +0200
@@ -243,6 +243,9 @@ init_agent_read_config(const char *app)
snmpd_free_trapcommunity,
"community-string");
#endif /* support for community based SNMP */
+ netsnmp_ds_register_config(ASN_OCTET_STR, app, "v1trapaddress",
+ NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_AGENT_TRAP_ADDR);
#ifdef HAVE_UNISTD_H
register_app_config_handler("agentuser",
snmpd_set_agent_user, NULL, "userid");
Index: agent/agent_trap.c
===================================================================
--- agent/agent_trap.c.orig 2007-05-18 00:16:12.000000000 +0200
+++ agent/agent_trap.c 2008-09-06 18:06:23.367792400 +0200
@@ -58,6 +58,7 @@
#include <net-snmp/utilities.h>
#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
#include <net-snmp/agent/agent_trap.h>
#include <net-snmp/agent/snmp_agent.h>
#include <net-snmp/agent/agent_callbacks.h>
@@ -639,6 +640,8 @@ netsnmp_send_traps(int trap, int specifi
in_addr_t *pdu_in_addr_t;
u_long uptime;
struct trap_sink *sink;
+ const char *v1trapaddress;
+ int res;
DEBUGMSGTL(( "trap", "send_trap %d %d ", trap, specific));
DEBUGMSGOID(("trap", enterprise, enterprise_length));
@@ -792,7 +795,18 @@ netsnmp_send_traps(int trap, int specifi
* Ensure that the v1 trap PDU includes the local IP address
*/
pdu_in_addr_t = (in_addr_t *) template_v1pdu->agent_addr;
- *pdu_in_addr_t = get_myaddr();
+
+ v1trapaddress = netsnmp_ds_get_string(NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_AGENT_TRAP_ADDR);
+ if (v1trapaddress != NULL) {
+ /* "v1trapaddress" was specified in config, try to resolve it */
+ res = get_thisaddr(v1trapaddress, pdu_in_addr_t);
+ }
+ if (v1trapaddress == NULL || res < 0) {
+ /* "v1trapaddress" was not specified in config or the resolution failed,
+ * try any local address */
+ *pdu_in_addr_t = get_myaddr();
+ }
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3822eb6850d5b52707b93b1f632a6065d94ecb451bb735bfe9df97ee9987d2e2
size 3734297

View File

@ -1,8 +1,8 @@
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,
--- agent/mibgroup/examples/ucdDemoPublic.c.orig
+++ agent/mibgroup/examples/ucdDemoPublic.c
@@ -222,7 +222,11 @@ write_ucdDemoPublicString(int action,
}
if (action == COMMIT) {
if (var_val_len != 0) {
@ -15,55 +15,11 @@ Index: agent/mibgroup/examples/ucdDemoPublic.c
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)
--- agent/mibgroup/util_funcs.c.orig
+++ agent/mibgroup/util_funcs.c
@@ -142,6 +142,10 @@ make_tempfile(void)
}
#endif
if (fd >= 0) {
@ -76,8 +32,8 @@ Index: agent/mibgroup/util_funcs.c
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
--- agent/auto_nlist.c.orig
+++ agent/auto_nlist.c
@@ -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)
@ -96,8 +52,8 @@ Index: agent/auto_nlist.c
#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
--- apps/snmptest.c.orig
+++ apps/snmptest.c
@@ -456,6 +456,7 @@ input_variable(netsnmp_variable_list * v
goto getValue;
}
@ -106,48 +62,20 @@ Index: apps/snmptest.c
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 <sys/wait.h>
#endif
+#include <sys/stat.h>
+#include <fcntl.h>
+
#include <net-snmp/config_api.h>
#include <net-snmp/output_api.h>
#include <net-snmp/mib_api.h>
@@ -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)
{
--- snmplib/parse.c.orig
+++ snmplib/parse.c
@@ -4231,7 +4231,7 @@ parse(FILE * fp, struct node *root)
extern void xmalloc_stats(FILE *);
#endif
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)
@@ -4323,7 +4323,8 @@ parse(FILE * fp, struct node *root)
case ENDOFFILE:
continue;
default:
@ -157,7 +85,7 @@ Index: snmplib/parse.c
type = get_token(fp, token, MAXTOKEN);
nnp = NULL;
if (type == MACRO) {
@@ -4300,7 +4301,8 @@ parse(FILE * fp, struct node *root)
@@ -4340,7 +4341,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 */
}
@ -169,8 +97,8 @@ Index: snmplib/parse.c
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
--- snmplib/tools.c.orig
+++ snmplib/tools.c
@@ -696,7 +696,7 @@ dump_snmpEngineID(const u_char * estring
/*
* s += snprintf(s, remaining_len+3, "\"%s\"", esp);
@ -182,8 +110,8 @@ Index: snmplib/tools.c
/*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
--- testing/TESTCONF.sh.orig
+++ testing/TESTCONF.sh
@@ -77,8 +77,8 @@ if [ "x$SNMP_TMPDIR" = "x" -a "x$SNMP_HE
fi
SNMP_TMP_PERSISTENTDIR=$SNMP_TMPDIR/persist
@ -197,8 +125,8 @@ Index: testing/TESTCONF.sh
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
--- testing/eval_suite.sh.orig
+++ testing/eval_suite.sh
@@ -79,7 +79,11 @@ exit 0
PROGRAM=
ARGUMENTS="$*"

View File

@ -1,40 +0,0 @@
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 <sys/types.h>
#include <tcpd.h>
@@ -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 <netinet/tcp_timer.h>
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

View File

@ -1,9 +1,9 @@
Index: 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
--- net-snmp-config.in.orig
+++ net-snmp-config.in
@@ -41,6 +41,14 @@ count()
echo $#
}
+check_devel_files()
@ -17,7 +17,7 @@ Index: net-snmp-config.in
prefix=@prefix@
exec_prefix=@exec_prefix@
includedir=@includedir@
@@ -105,9 +113,11 @@ else
@@ -120,9 +128,11 @@ else
;;
#################################################### compile
--base-cflags)
@ -29,7 +29,7 @@ Index: net-snmp-config.in
echo @CFLAGS@ @DEVFLAGS@ @CPPFLAGS@ -I. -I${NSC_INCLUDEDIR}
;;
--srcdir)
@@ -118,6 +128,7 @@ else
@@ -133,6 +143,7 @@ else
echo $NSC_LIBDIR
;;
--ldflags|--ld*)
@ -37,7 +37,7 @@ Index: net-snmp-config.in
echo $NSC_LDFLAGS
;;
--build-lib-dirs)
@@ -151,30 +162,38 @@ else
@@ -166,30 +177,38 @@ else
;;
#################################################### client lib
--libs)
@ -76,7 +76,7 @@ Index: net-snmp-config.in
echo $NSC_LDFLAGS $NSC_AGENTLIBS
;;
####################################################
@@ -316,6 +335,7 @@ else
@@ -215,6 +234,7 @@ else
####################################################
--compile-subagent)

View File

@ -1,8 +1,8 @@
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
--- snmplib/mib.c.orig
+++ snmplib/mib.c
@@ -1507,7 +1507,7 @@ sprint_realloc_gauge(u_char ** buf, size
return 0;
}
} else {
@ -11,7 +11,7 @@ Index: snmplib/mib.c
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
@@ -1571,7 +1571,7 @@ sprint_realloc_counter(u_char ** buf, si
return 0;
}
}

View File

@ -1,7 +1,7 @@
Index: local/tkmib
===================================================================
--- local/tkmib.orig 2006-07-27 21:48:25.000000000 +0200
+++ local/tkmib 2008-10-24 15:31:02.574384593 +0200
--- local/tkmib.orig
+++ local/tkmib
@@ -27,10 +27,9 @@ instructions.
if (!$havetk) {

View File

@ -2,8 +2,8 @@ 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
--- local/snmpconf.orig
+++ local/snmpconf
@@ -682,6 +682,7 @@ sub output_files {
}
}

View File

@ -1,7 +1,7 @@
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
--- testing/rfc1213/snmpfun.sh.orig
+++ testing/rfc1213/snmpfun.sh
@@ -1,4 +1,3 @@
-
# functions used by RFC-1213 MIB test modules
@ -80,8 +80,8 @@ Index: testing/rfc1213/snmpfun.sh
+
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
--- testing/rfc1213/test_fun.orig
+++ testing/rfc1213/test_fun
@@ -51,6 +51,9 @@ test_finish()
if [ x$1 == x"PASS" ];then
pass_num=`expr $pass_num + 1`

View File

@ -1,7 +1,7 @@
Index: LICENSE.VELOCITY
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ LICENSE.VELOCITY 2008-10-24 15:34:16.302888835 +0200
--- /dev/null
+++ LICENSE.VELOCITY
@@ -0,0 +1,41 @@
+/* Portions of these files are subject to the following copyright(s). See
+ * the Net-SNMP's COPYING file for more details and other copyrights
@ -46,8 +46,8 @@ Index: LICENSE.VELOCITY
+ */
Index: agent/mibgroup/velocity.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ agent/mibgroup/velocity.h 2008-10-24 15:34:16.322885644 +0200
--- /dev/null
+++ agent/mibgroup/velocity.h
@@ -0,0 +1,28 @@
+/*
+ * Velocity 'wrapper' interface which is an extension of the host resources
@ -79,8 +79,8 @@ Index: agent/mibgroup/velocity.h
+config_add_mib(VELOCITY-TYPES)
Index: agent/mibgroup/velocity/velocity_app.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ agent/mibgroup/velocity/velocity_app.c 2008-10-24 15:34:16.406884701 +0200
--- /dev/null
+++ agent/mibgroup/velocity/velocity_app.c
@@ -0,0 +1,499 @@
+#include <net-snmp/net-snmp-config.h>
+
@ -583,8 +583,8 @@ Index: agent/mibgroup/velocity/velocity_app.c
+
Index: agent/mibgroup/velocity/velocity_app.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ agent/mibgroup/velocity/velocity_app.h 2008-10-24 15:34:16.422385429 +0200
--- /dev/null
+++ agent/mibgroup/velocity/velocity_app.h
@@ -0,0 +1,38 @@
+/*
+ * Application watching mib group
@ -626,8 +626,8 @@ Index: agent/mibgroup/velocity/velocity_app.h
+#endif /* _MIBGROUP_APP_H */
Index: agent/mibgroup/velocity/velocity_swrun.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ agent/mibgroup/velocity/velocity_swrun.c 2008-10-24 15:34:16.438385053 +0200
--- /dev/null
+++ agent/mibgroup/velocity/velocity_swrun.c
@@ -0,0 +1,1595 @@
+/*
+ * Velocity MIB - Running Software group implementation - velocity_swrun.c
@ -2226,8 +2226,8 @@ Index: agent/mibgroup/velocity/velocity_swrun.c
+}
Index: agent/mibgroup/velocity/velocity_swrun.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ agent/mibgroup/velocity/velocity_swrun.h 2008-10-24 15:34:16.482385229 +0200
--- /dev/null
+++ agent/mibgroup/velocity/velocity_swrun.h
@@ -0,0 +1,13 @@
+/*
+ * Velocity MIB - Running Software group interface - velocity_swrun.h
@ -2244,8 +2244,8 @@ Index: agent/mibgroup/velocity/velocity_swrun.h
+#endif /* _MIBGROUP_VELOCITYSWRUN_H */
Index: agent/mibgroup/velocity/velocity_system.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ agent/mibgroup/velocity/velocity_system.c 2008-10-24 15:34:16.506385667 +0200
--- /dev/null
+++ agent/mibgroup/velocity/velocity_system.c
@@ -0,0 +1,403 @@
+/*
+ * Velocity MIB - system group implementation - velocity_system.c
@ -2652,8 +2652,8 @@ Index: agent/mibgroup/velocity/velocity_system.c
+#endif /* UTMP_FILE */
Index: agent/mibgroup/velocity/velocity_system.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ agent/mibgroup/velocity/velocity_system.h 2008-10-24 15:34:16.522385240 +0200
--- /dev/null
+++ agent/mibgroup/velocity/velocity_system.h
@@ -0,0 +1,12 @@
+/*
+ * Velocity MIB - system group interface - velocity_system.h
@ -2669,8 +2669,8 @@ Index: agent/mibgroup/velocity/velocity_system.h
+#endif /* _MIBGROUP_VELOCITYSYSTEM_H */
Index: mibs/VELOCITY-MIB.txt
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ mibs/VELOCITY-MIB.txt 2008-10-24 15:34:16.550885795 +0200
--- /dev/null
+++ mibs/VELOCITY-MIB.txt
@@ -0,0 +1,671 @@
+VELOCITY-MIB DEFINITIONS ::= BEGIN
+
@ -3345,8 +3345,8 @@ Index: mibs/VELOCITY-MIB.txt
+END
Index: mibs/VELOCITY-TYPES.txt
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ mibs/VELOCITY-TYPES.txt 2008-10-24 15:34:16.591898815 +0200
--- /dev/null
+++ mibs/VELOCITY-TYPES.txt
@@ -0,0 +1,23 @@
+VELOCITY-TYPES DEFINITIONS ::= BEGIN
+

View File

@ -1,8 +1,8 @@
Index: Makefile.in
===================================================================
--- 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
--- Makefile.in.orig
+++ Makefile.in
@@ -175,7 +175,7 @@ perlmakefiles: net-snmp-config-x
fi
perlinstall:

View File

@ -1,13 +0,0 @@
=== agent/snmp_perl.c
==================================================================
--- agent/snmp_perl.c (revision 17294)
+++ agent/snmp_perl.c (local)
@@ -58,7 +58,7 @@
return;
bail_out:
- snmp_log(LOG_ERR, "embedded perl support failed to initalize\n");
+ snmp_log(LOG_ERR, "embedded perl support failed to initialize\n");
netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID,
NETSNMP_DS_AGENT_DISABLE_PERL, 1);
return;

3
net-snmp-5.5.tar.bz2 Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:4b8eb82e4e947c6969ddde288f429b738b8f90300a8c4e00d2211955b404073d
size 3968691

View File

@ -1,3 +1,29 @@
-------------------------------------------------------------------
Tue Dec 22 09:41:44 UTC 2009 - lchiquitto@novell.com
- update to version 5.5:
new features and lots of bug fixes, including:
- fix hrSWRunPath for processes other than init (bnc#486270)
- remove patches that are now upstream:
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-IPv6-Interface-Table.patch
Fix-for-Internet-Address-Prefix-Table.patch
Fix-for-Internet-Address-Table.patch
Fix-for-tcpConnnectionTable-tcpListenerTable-udpEn.patch
Improve-IP-Statistics-tables.patch
net-snmp-5.3.0.1_trap-agent-addr_v2.patch
net-snmp-5.4.1.2-etherlike-mib-revised_4.patch
net-snmp-5.4.x_embedded_perl_error_message.patch
-------------------------------------------------------------------
Sat Dec 19 14:00:41 CET 2009 - jengelh@medozas.de
- add baselibs.conf as a source
- add baselib defs for SPARC
-------------------------------------------------------------------
Sun Aug 30 15:17:12 UTC 2009 - aj@suse.de
@ -141,7 +167,6 @@ Fri Sep 12 18:44:53 CEST 2008 - mrueckert@suse.de
net-snmp-5.4.1.2-rmon-mib.patch
net-snmp-5.4.2_fix_dell_patches.patch
-------------------------------------------------------------------
Sat Sep 6 16:15:57 CEST 2008 - mrueckert@suse.de

View File

@ -1,7 +1,7 @@
#
# spec file for package net-snmp (Version 5.4.2.1)
# spec file for package net-snmp (Version 5.5)
#
# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -19,10 +19,10 @@
Name: net-snmp
Version: 5.4.2.1
Release: 10
Version: 5.5
Release: 1
#
License: BSD 3-clause (or similar) ; MIT License (or similar)
License: BSD3c(or similar) ; MIT License (or similar)
Group: Productivity/Networking/Other
#
%define pkg_name net-snmp
@ -64,8 +64,9 @@ Source5: net-snmp.logrotate
Source6: test_installed
Source7: net-snmp.sysconfig
Source8: net-snmp-rpmlintrc
Source9: baselibs.conf
Patch: net-snmp-5.4.2_audit.patch
Patch1: net-snmp-5.4.2_autoconf.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
@ -76,21 +77,8 @@ 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_4.patch
Patch13: net-snmp-5.4.1.2-rmon-mib-revised_3.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
Patch24: net-snmp-5.4.x_embedded_perl_error_message.patch
Patch25: net-snmp-5.4.2.1-rpm4.7.patch
Patch11: net-snmp-5.4.2_velocity-mib.patch
Patch12: net-snmp-5.4.2.1-rpm4.7.patch
#
Summary: SNMP Daemon
@ -110,7 +98,7 @@ Authors:
%define library_name libsnmp15
%package -n libsnmp15
License: BSD 3-clause (or similar) ; MIT License (or similar)
License: BSD3c(or similar) ; MIT License (or similar)
Group: Productivity/Networking/Other
Requires: snmp-mibs = %{version}
# we link libperl
@ -134,7 +122,7 @@ Authors:
Wes Hardaker <hardaker@users.sourceforge.net>
%package devel
License: BSD 3-clause (or similar) ; MIT License (or similar)
License: BSD3c(or similar) ; MIT License (or similar)
Group: Development/Libraries/C and C++
# bug437293
%ifarch ppc64
@ -144,7 +132,7 @@ Obsoletes: net-snmp-devel-64bit
Requires: %{library_name} = %{version}
# for mib2c
Requires: perl-SNMP = %{version}
Requires: openssl-devel rpm-devel tcpd-devel
Requires: libopenssl-devel rpm-devel tcpd-devel perl zlib-devel
%if 0%{?with_sensors}
Requires: libsensors3-devel
%endif
@ -165,7 +153,7 @@ Authors:
Wes Hardaker <hardaker@users.sourceforge.net>
%package -n snmp-mibs
License: BSD 3-clause (or similar) ; MIT License (or similar)
License: BSD3c(or similar) ; MIT License (or similar)
Group: Productivity/Networking/Other
#
Summary: MIB files from net-snmp
@ -185,13 +173,13 @@ Authors:
--------
Wes Hardaker <hardaker@users.sourceforge.net>
%package -n perl-SNMP
License: GPL v2 or later
%package -n perl-SNMP
License: GPLv2+
Group: Development/Libraries/Perl
Requires: %{pkg_name} = %{version}
%perl_requires
#
Summary: Perl-SNMP
Summary: Perl5 SNMP Extension Module
%description -n perl-SNMP
The Perl5 'SNMP' Extension Module v3.1.0 for the UCD SNMPv3 library.
@ -205,7 +193,7 @@ Authors:
%prep
%setup -q -n %{pkg_name}-%{version}
%patch
%patch1
#%patch1
%patch2
%patch3
%patch4
@ -216,20 +204,7 @@ Authors:
%patch9
%patch10
%patch11
%patch12 -p1
%patch13 -p1
%patch14
%patch15 -p1
%patch16 -p1
%patch17 -p1
%patch18 -p1
%patch19 -p1
%patch20 -p1
%patch21 -p1
%patch22 -p1
%patch23 -p1
%patch24
%patch25
%patch12
find -name "CVS" -type d | xargs -r %{__rm} -rfv
find -name ".cvsignore" | xargs -r %{__rm} -fv
@ -384,6 +359,7 @@ fi
%{_bindir}/snmpvacm
%{_bindir}/snmpwalk
%{_bindir}/traptoemail
%{_bindir}/net-snmp-create-v3-user
%dir %{_prefix}/lib/net-snmp
%dir %{_prefix}/lib/net-snmp/agents
%{_mandir}/man[158]/*