diff --git a/Add-Default-Router-Table-support.patch b/Add-Default-Router-Table-support.patch new file mode 100644 index 0000000..0fc58f9 --- /dev/null +++ b/Add-Default-Router-Table-support.patch @@ -0,0 +1,3568 @@ +From c1b7328c39698ce792f7b5082de9dc079da8b848 Mon Sep 17 00:00:00 2001 +From: Mitsuru Chinen +Date: Mon, 20 Oct 2008 17:22:10 +0900 +Subject: [PATCH] Add Default Router Table support + +From net-snmp patch tracker: +[ 1708243 ] add linux support for ipDefaultRouterTable OID to net-snmp +http://sourceforge.net/tracker/index.php?func=detail&aid=1708243&group_id=12694&atid=312694 + +[ 1724602 ] [Linux] ipDefaultRouterTable improvement +http://sourceforge.net/tracker/index.php?func=detail&aid=1724602&group_id=12694&atid=312694 + +[ 1728223 ] [Linux] add configure check for netlink socket +http://sourceforge.net/tracker/index.php?func=detail&aid=1728223&group_id=12694&atid=312694 + +Signed-off-by: Mitsuru Chinen +--- + agent/mibgroup/ip-mib/data_access/defaultrouter.h | 29 + + .../ip-mib/data_access/defaultrouter_common.c | 291 ++++++ + .../ip-mib/data_access/defaultrouter_linux.c | 322 ++++++ + .../mibgroup/ip-mib/data_access/ipaddress_linux.c | 10 +- + agent/mibgroup/ip-mib/ipDefaultRouterTable.h | 5 + + .../ipDefaultRouterTable/ipDefaultRouterTable.c | 213 ++++ + .../ipDefaultRouterTable/ipDefaultRouterTable.h | 212 ++++ + .../ipDefaultRouterTable_data_access.c | 420 ++++++++ + .../ipDefaultRouterTable_data_access.h | 76 ++ + .../ipDefaultRouterTable_data_get.c | 325 +++++++ + .../ipDefaultRouterTable_data_get.h | 84 ++ + .../ipDefaultRouterTable_enums.h | 93 ++ + .../ipDefaultRouterTable_interface.c | 1018 ++++++++++++++++++++ + .../ipDefaultRouterTable_interface.h | 99 ++ + .../ipDefaultRouterTable_oids.h | 39 + + agent/mibgroup/mibII/var_route.c | 1 + + configure.in | 23 + + include/net-snmp/data_access/defaultrouter.h | 114 +++ + 18 files changed, 3373 insertions(+), 1 deletions(-) + create mode 100644 agent/mibgroup/ip-mib/data_access/defaultrouter.h + create mode 100644 agent/mibgroup/ip-mib/data_access/defaultrouter_common.c + create mode 100644 agent/mibgroup/ip-mib/data_access/defaultrouter_linux.c + create mode 100644 agent/mibgroup/ip-mib/ipDefaultRouterTable.h + create mode 100644 agent/mibgroup/ip-mib/ipDefaultRouterTable/ipDefaultRouterTable.c + create mode 100644 agent/mibgroup/ip-mib/ipDefaultRouterTable/ipDefaultRouterTable.h + create mode 100644 agent/mibgroup/ip-mib/ipDefaultRouterTable/ipDefaultRouterTable_data_access.c + create mode 100644 agent/mibgroup/ip-mib/ipDefaultRouterTable/ipDefaultRouterTable_data_access.h + create mode 100644 agent/mibgroup/ip-mib/ipDefaultRouterTable/ipDefaultRouterTable_data_get.c + create mode 100644 agent/mibgroup/ip-mib/ipDefaultRouterTable/ipDefaultRouterTable_data_get.h + create mode 100644 agent/mibgroup/ip-mib/ipDefaultRouterTable/ipDefaultRouterTable_enums.h + create mode 100644 agent/mibgroup/ip-mib/ipDefaultRouterTable/ipDefaultRouterTable_interface.c + create mode 100644 agent/mibgroup/ip-mib/ipDefaultRouterTable/ipDefaultRouterTable_interface.h + create mode 100644 agent/mibgroup/ip-mib/ipDefaultRouterTable/ipDefaultRouterTable_oids.h + create mode 100644 include/net-snmp/data_access/defaultrouter.h + +diff --git a/agent/mibgroup/ip-mib/data_access/defaultrouter.h b/agent/mibgroup/ip-mib/data_access/defaultrouter.h +new file mode 100644 +index 0000000..9e7b1ef +--- /dev/null ++++ b/agent/mibgroup/ip-mib/data_access/defaultrouter.h +@@ -0,0 +1,29 @@ ++/* ++ * defaultrouter data access header ++ * ++ * $Id: $ ++ */ ++/**---------------------------------------------------------------------*/ ++/* ++ * configure required files ++ * ++ * Notes: ++ * ++ * 1) prefer functionality over platform, where possible. If a method ++ * is available for multiple platforms, test that first. That way ++ * when a new platform is ported, it won't need a new test here. ++ * ++ * 2) don't do detail requirements here. If, for example, ++ * HPUX11 had different reuirements than other HPUX, that should ++ * be handled in the *_hpux.h header file. ++ */ ++config_require(ip-mib/data_access/defaultrouter_common) ++#if defined( linux ) ++config_require(ip-mib/data_access/defaultrouter_linux) ++#else ++/* ++ * couldn't determine the correct file! ++ * require a bogus file to generate an error. ++ */ ++config_require(ip-mib/data_access/defaultrouter-unknown-arch); ++#endif +diff --git a/agent/mibgroup/ip-mib/data_access/defaultrouter_common.c b/agent/mibgroup/ip-mib/data_access/defaultrouter_common.c +new file mode 100644 +index 0000000..64ca425 +--- /dev/null ++++ b/agent/mibgroup/ip-mib/data_access/defaultrouter_common.c +@@ -0,0 +1,291 @@ ++/* ++ * defaultrouter MIB architecture support ++ * ++ * $Id:$ ++ */ ++#include ++#include ++ ++#include ++#include ++ ++#include "ip-mib/ipDefaultRouterTable/ipDefaultRouterTable.h" ++ ++/**---------------------------------------------------------------------*/ ++/* ++ * local static prototypes ++ */ ++static int _access_defaultrouter_entry_compare_addr(const void *lhs, ++ const void *rhs); ++static void _access_defaultrouter_entry_release(netsnmp_defaultrouter_entry * entry, ++ void *unused); ++ ++/**---------------------------------------------------------------------*/ ++/* ++ * external per-architecture functions prototypes ++ * ++ * These shouldn't be called by the general public, so they aren't in ++ * the header file. ++ */ ++extern int ++netsnmp_arch_defaultrouter_entry_init(netsnmp_defaultrouter_entry *entry); ++ ++extern int ++netsnmp_arch_defaultrouter_container_load(netsnmp_container* container, ++ u_int load_flags); ++ ++/**---------------------------------------------------------------------*/ ++/* ++ * container functions ++ */ ++/** ++ */ ++netsnmp_container * ++netsnmp_access_defaultrouter_container_init(u_int flags) ++{ ++ netsnmp_container *container1; ++ ++ DEBUGMSGTL(("access:defaultrouter:container", "init\n")); ++ ++ /* ++ * create the containers. one indexed by ifIndex, the other ++ * indexed by ifName. ++ */ ++ container1 = netsnmp_container_find("access_defaultrouter:table_container"); ++ if (NULL == container1) { ++ snmp_log(LOG_ERR, "defaultrouter primary container is not found\n"); ++ return NULL; ++ } ++ container1->container_name = strdup("dr_index"); ++ ++ if (flags & NETSNMP_ACCESS_DEFAULTROUTER_INIT_ADDL_IDX_BY_ADDR) { ++ netsnmp_container *container2 = ++ netsnmp_container_find("defaultrouter_addr:access_defaultrouter:table_container"); ++ if (NULL == container2) { ++ snmp_log(LOG_ERR, "defaultrouter secondary container not found\n"); ++ CONTAINER_FREE(container1); ++ return NULL; ++ } ++ ++ container2->compare = _access_defaultrouter_entry_compare_addr; ++ container2->container_name = strdup("dr_addr"); ++ ++ netsnmp_container_add_index(container1, container2); ++ } ++ ++ return container1; ++} ++ ++/** ++ * @retval NULL error ++ * @retval !NULL pointer to container ++ */ ++netsnmp_container* ++netsnmp_access_defaultrouter_container_load(netsnmp_container* container, ++ u_int load_flags) ++{ ++ int rc; ++ u_int container_flags = 0; ++ ++ DEBUGMSGTL(("access:defaultrouter:container", "load\n")); ++ ++ if (NULL == container) { ++ if (load_flags & NETSNMP_ACCESS_DEFAULTROUTER_LOAD_ADDL_IDX_BY_ADDR) { ++ container_flags |= ++ NETSNMP_ACCESS_DEFAULTROUTER_INIT_ADDL_IDX_BY_ADDR; ++ } ++ container = ++ netsnmp_access_defaultrouter_container_init(container_flags); ++ } ++ ++ if (NULL == container) { ++ snmp_log(LOG_ERR, "no container specified/found for access_defaultrouter\n"); ++ return NULL; ++ } ++ ++ rc = netsnmp_arch_defaultrouter_container_load(container, load_flags); ++ if (0 != rc) { ++ netsnmp_access_defaultrouter_container_free(container, ++ NETSNMP_ACCESS_DEFAULTROUTER_FREE_NOFLAGS); ++ container = NULL; ++ } ++ ++ return container; ++} ++ ++void ++netsnmp_access_defaultrouter_container_free(netsnmp_container *container, ++ u_int free_flags) ++{ ++ DEBUGMSGTL(("access:defaultrouter:container", "free\n")); ++ ++ if (NULL == container) { ++ snmp_log(LOG_ERR, ++ "invalid container for netsnmp_access_defaultrouter_free\n"); ++ return; ++ } ++ ++ if(! (free_flags & NETSNMP_ACCESS_DEFAULTROUTER_FREE_DONT_CLEAR)) { ++ /* ++ * free all items. ++ */ ++ CONTAINER_CLEAR(container, ++ (netsnmp_container_obj_func*)_access_defaultrouter_entry_release, ++ NULL); ++ } ++ ++ if(! (free_flags & NETSNMP_ACCESS_DEFAULTROUTER_FREE_KEEP_CONTAINER)) ++ CONTAINER_FREE(container); ++} ++ ++/**---------------------------------------------------------------------*/ ++/* ++ * defaultrouter_entry functions ++ */ ++/** ++ */ ++/** ++ */ ++netsnmp_defaultrouter_entry * ++netsnmp_access_defaultrouter_entry_create(void) ++{ ++ int rc = 0; ++ netsnmp_defaultrouter_entry *entry = ++ SNMP_MALLOC_TYPEDEF(netsnmp_defaultrouter_entry); ++ ++ DEBUGMSGTL(("access:defaultrouter:entry", "create\n")); ++ ++ if(NULL == entry) ++ return NULL; ++ ++ entry->oid_index.len = 1; ++ entry->oid_index.oids = &entry->ns_dr_index; ++ ++ /* ++ * set up defaults ++ */ ++ entry->dr_lifetime = IPDEFAULTROUTERLIFETIME_MAX; ++ entry->dr_preference = IPDEFAULTROUTERPREFERENCE_MEDIUM; ++ ++ rc = netsnmp_arch_defaultrouter_entry_init(entry); ++ if (SNMP_ERR_NOERROR != rc) { ++ DEBUGMSGT(("access:defaultrouter:create","error %d in arch init\n")); ++ netsnmp_access_defaultrouter_entry_free(entry); ++ entry = NULL; ++ } ++ ++ return entry; ++} ++ ++void ++netsnmp_access_defaultrouter_entry_free(netsnmp_defaultrouter_entry * entry) ++{ ++ if (NULL == entry) ++ return; ++ ++ free(entry); ++} ++ ++/** ++ * update an old defaultrouter_entry from a new one ++ * ++ * @note: only mib related items are compared. Internal objects ++ * such as oid_index, ns_dr_index and flags are not compared. ++ * ++ * @retval -1 : error ++ * @retval >=0 : number of fields updated ++ */ ++int ++netsnmp_access_defaultrouter_entry_update(netsnmp_defaultrouter_entry *lhs, ++ netsnmp_defaultrouter_entry *rhs) ++{ ++ int changed = 0; ++ ++ if (lhs->dr_addresstype != rhs->dr_addresstype) { ++ ++changed; ++ lhs->dr_addresstype = rhs->dr_addresstype; ++ } ++ ++ if (lhs->dr_address_len != rhs->dr_address_len) { ++ changed += 2; ++ lhs->dr_address_len = rhs->dr_address_len; ++ memcpy(lhs->dr_address, rhs->dr_address, rhs->dr_address_len); ++ } ++ else if (memcmp(lhs->dr_address, rhs->dr_address, rhs->dr_address_len) != 0) { ++ ++changed; ++ memcpy(lhs->dr_address, rhs->dr_address, rhs->dr_address_len); ++ } ++ ++ if (lhs->dr_if_index != rhs->dr_if_index) { ++ ++changed; ++ lhs->dr_if_index = rhs->dr_if_index; ++ } ++ ++ if (lhs->dr_lifetime != rhs->dr_lifetime) { ++ ++changed; ++ lhs->dr_lifetime = rhs->dr_lifetime; ++ } ++ ++ if (lhs->dr_preference != rhs->dr_preference) { ++ ++changed; ++ lhs->dr_preference = rhs->dr_preference; ++ } ++ ++ return changed; ++} ++ ++/** ++ * copy an defaultrouter_entry ++ * ++ * @retval -1 : error ++ * @retval 0 : no error ++ */ ++int ++netsnmp_access_defaultrouter_entry_copy(netsnmp_defaultrouter_entry *lhs, ++ netsnmp_defaultrouter_entry *rhs) ++{ ++ lhs->dr_addresstype = rhs->dr_addresstype; ++ lhs->dr_address_len = rhs->dr_address_len; ++ memcpy(lhs->dr_address, rhs->dr_address, rhs->dr_address_len); ++ lhs->dr_if_index = rhs->dr_if_index; ++ lhs->dr_lifetime = rhs->dr_lifetime; ++ lhs->dr_preference = rhs->dr_preference; ++ ++ return 0; ++} ++ ++/**---------------------------------------------------------------------*/ ++/* ++ * Utility routines ++ */ ++ ++/** ++ */ ++void ++_access_defaultrouter_entry_release(netsnmp_defaultrouter_entry * entry, void *context) ++{ ++ netsnmp_access_defaultrouter_entry_free(entry); ++} ++ ++static int _access_defaultrouter_entry_compare_addr(const void *lhs, ++ const void *rhs) ++{ ++ const netsnmp_defaultrouter_entry *lh = (const netsnmp_defaultrouter_entry *)lhs; ++ const netsnmp_defaultrouter_entry *rh = (const netsnmp_defaultrouter_entry *)rhs; ++ ++ netsnmp_assert(NULL != lhs); ++ netsnmp_assert(NULL != rhs); ++ ++ /* ++ * compare address length ++ */ ++ if (lh->dr_address_len < rh->dr_address_len) ++ return -1; ++ else if (lh->dr_address_len > rh->dr_address_len) ++ return 1; ++ ++ /* ++ * length equal, compare address ++ */ ++ return memcmp(lh->dr_address, rh->dr_address, lh->dr_address_len); ++} +diff --git a/agent/mibgroup/ip-mib/data_access/defaultrouter_linux.c b/agent/mibgroup/ip-mib/data_access/defaultrouter_linux.c +new file mode 100644 +index 0000000..156e137 +--- /dev/null ++++ b/agent/mibgroup/ip-mib/data_access/defaultrouter_linux.c +@@ -0,0 +1,322 @@ ++/* ++ * Interface MIB architecture support ++ * ++ * $Id:$ ++ */ ++#include ++#include ++ ++#include ++#include ++ ++#include "ip-mib/ipDefaultRouterTable/ipDefaultRouterTable.h" ++ ++#include ++#ifdef HAVE_LINUX_RTNETLINK_H ++#include ++#include ++#endif ++#include ++#include ++#include ++#include ++ ++#define RCVBUF_SIZE 32768 ++#define SNDBUF_SIZE 512 ++ ++#ifdef NETSNMP_ENABLE_IPV6 ++#define DR_ADDRSTRLEN INET6_ADDRSTRLEN ++#else ++#define DR_ADDRSTRLEN INET_ADDRSTRLEN ++#endif ++ ++/**---------------------------------------------------------------------*/ ++/* ++ * local static prototypes ++ */ ++static int _load(netsnmp_container *container); ++ ++ ++/* ++ * initialize arch specific storage ++ * ++ * @retval 0: success ++ * @retval <0: error ++ */ ++int ++netsnmp_arch_defaultrouter_entry_init(netsnmp_defaultrouter_entry *entry) ++{ ++ /* ++ * init ++ */ ++ return 0; ++} ++ ++/** ++ * ++ * @retval 0 no errors ++ * @retval !0 errors ++ */ ++int ++netsnmp_arch_defaultrouter_container_load(netsnmp_container *container, ++ u_int load_flags) ++{ ++ int rc = 0; ++ ++ DEBUGMSGTL(("access:defaultrouter:entry:arch", "load (linux)\n")); ++ ++ rc = _load(container); ++ if (rc < 0) { ++ u_int flags = NETSNMP_ACCESS_DEFAULTROUTER_FREE_KEEP_CONTAINER; ++ netsnmp_access_defaultrouter_container_free(container, flags); ++ } ++ ++ return rc; ++} ++ ++/** ++ * ++ * @retval 0 no errors ++ * @retval !0 errors ++ */ ++static int ++_load(netsnmp_container *container) ++{ ++#ifndef HAVE_LINUX_RTNETLINK_H ++ DEBUGMSGTL(("access:defaultrouter", ++ "cannot get default router information" ++ "as netlink socket is not available\n")); ++ return -1; ++#else ++ int rc = 0; ++ int idx_offset = 0; ++ netsnmp_defaultrouter_entry *entry; ++ int nlsk; ++ struct sockaddr_nl addr; ++ unsigned char rcvbuf[RCVBUF_SIZE]; ++ int rcvbuf_size = RCVBUF_SIZE; ++ unsigned char sndbuf[SNDBUF_SIZE]; ++ struct nlmsghdr *hdr; ++ struct rtmsg *rthdr; ++ int count; ++ int end_of_message = 0; ++ long hz = sysconf(_SC_CLK_TCK); ++ ++ netsnmp_assert(NULL != container); ++ ++ /* ++ * Open a netlink socket ++ */ ++ nlsk = socket(AF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE); ++ if (nlsk < 0) { ++ snmp_log(LOG_ERR, "Could not open netlink socket : %s\n", ++ strerror(errno)); ++ return -1; ++ } ++ ++ if (setsockopt(nlsk, SOL_SOCKET, SO_RCVBUF, ++ &rcvbuf_size, sizeof(rcvbuf_size)) < 0) { ++ snmp_log(LOG_ERR, "Could not open netlink socket : %s\n", ++ strerror(errno)); ++ close(nlsk); ++ return -1; ++ } ++ ++ memset(&addr, '\0', sizeof(struct sockaddr_nl)); ++ addr.nl_family = AF_NETLINK; ++ ++ memset(sndbuf, '\0', SNDBUF_SIZE); ++ hdr = (struct nlmsghdr *)sndbuf; ++ hdr->nlmsg_type = RTM_GETROUTE; ++ hdr->nlmsg_pid = getpid(); ++ hdr->nlmsg_seq = 0; ++ hdr->nlmsg_flags = NLM_F_ROOT | NLM_F_MATCH | NLM_F_REQUEST; ++ hdr->nlmsg_len = NLMSG_LENGTH(sizeof(struct rtmsg)); ++ rthdr = (struct rtmsg *)NLMSG_DATA(hdr); ++ rthdr->rtm_table = RT_TABLE_MAIN; ++ ++ /* ++ * Send a request to the kernel to dump the routing table to us ++ */ ++ count = sendto(nlsk, sndbuf, hdr->nlmsg_len, 0, ++ (struct sockaddr *)&addr, sizeof(struct sockaddr_nl)); ++ if (count < 0) { ++ snmp_log(LOG_ERR, "unable to send netlink message to kernel : %s\n", ++ strerror(errno)); ++ close(nlsk); ++ return -2; ++ } ++ ++ /* ++ * Now listen for response ++ */ ++ do { ++ struct nlmsghdr *nlmhp; ++ struct rtmsg *rtmp; ++ struct rtattr *rtap; ++ struct rta_cacheinfo *rtci; ++ socklen_t sock_len; ++ int rtcount; ++ ++ memset(rcvbuf, '\0', RCVBUF_SIZE); ++ sock_len = sizeof(struct sockaddr_nl); ++ ++ /* ++ * Get the message ++ */ ++ count = recvfrom(nlsk, rcvbuf, RCVBUF_SIZE, 0, ++ (struct sockaddr *)&addr, &sock_len); ++ if (count < 0) { ++ snmp_log(LOG_ERR, "unable to receive netlink messages: %s\n", ++ strerror(errno)); ++ rc = -1; ++ break; ++ } ++ ++ /* ++ * Walk all of the returned messages ++ */ ++ nlmhp = (struct nlmsghdr *)rcvbuf; ++ while (NLMSG_OK(nlmhp, count)) { ++ u_char addresstype; ++ char address[NETSNMP_ACCESS_DEFAULTROUTER_BUF_SIZE + 1]; ++ size_t address_len = 0; ++ int if_index = -1; ++ u_long lifetime = 0; ++ int preference = -3; ++ ++ /* ++ * Make sure the message is ok ++ */ ++ if (nlmhp->nlmsg_type == NLMSG_ERROR) { ++ snmp_log(LOG_ERR, "kernel produced nlmsg err\n"); ++ rc = -1; ++ break; ++ } ++ ++ /* ++ * End of message, we're done ++ */ ++ if (nlmhp->nlmsg_type & NLMSG_DONE) { ++ end_of_message = 1; ++ break; ++ } ++ ++ /* ++ * Get the pointer to the rtmsg struct ++ */ ++ rtmp = NLMSG_DATA(nlmhp); ++ ++ /* ++ * zero length destination is a default route ++ */ ++ if (rtmp->rtm_dst_len != 0) ++ goto next_nlmsghdr; ++ ++ /* ++ * Start scanning the attributes for needed info ++ */ ++ if (rtmp->rtm_family == AF_INET) { ++ addresstype = INETADDRESSTYPE_IPV4; ++ lifetime = IPDEFAULTROUTERLIFETIME_MAX; /* infinity */ ++ } ++#ifdef NETSNMP_ENABLE_IPV6 ++ else if (rtmp->rtm_family == AF_INET6) { ++ addresstype = INETADDRESSTYPE_IPV6; ++ /* router lifetime for IPv6 is retrieved by RTA_CACHEINFO */ ++ lifetime = 0; ++ } ++#endif ++ else ++ goto next_nlmsghdr; /* skip, we don't care about this route */ ++ ++ preference = 0; /* preference is medium(0) for now */ ++ ++ rtap = RTM_RTA(rtmp); ++ rtcount = RTM_PAYLOAD(nlmhp); ++ while (RTA_OK(rtap, rtcount)) { ++ switch (rtap->rta_type) { ++ case RTA_OIF: ++ if_index = *(int *)(RTA_DATA(rtap)); ++ break; ++ ++ case RTA_GATEWAY: ++ address_len = RTA_PAYLOAD(rtap); ++ memset(address, '\0', sizeof(address)); ++ memcpy(address, RTA_DATA(rtap), address_len); ++ break; ++ ++#ifdef NETSNMP_ENABLE_IPV6 ++ case RTA_CACHEINFO: ++ rtci = RTA_DATA(rtap); ++ if ((rtmp->rtm_flags & RTM_F_CLONED) || ++ (rtci && rtci->rta_expires)) { ++ lifetime = rtci->rta_expires / hz; ++ } ++ break; ++#endif ++ ++ default: ++ break; ++ } /* switch */ ++ ++ rtap = RTA_NEXT(rtap, rtcount); ++ } /* while RTA_OK(rtap) */ ++ ++ ++ if (address_len != 0 && if_index != -1 && ++ lifetime != 0 && preference != -3 ) { ++ DEBUGIF("access:defaultrouter") { ++ char addr_str[DR_ADDRSTRLEN]; ++ memset(addr_str, '\0', DR_ADDRSTRLEN); ++ ++ if (rtmp->rtm_family == AF_INET) ++ inet_ntop(AF_INET, address, addr_str, DR_ADDRSTRLEN); ++#ifdef NETSNMP_ENABLE_IPV6 ++ else ++ inet_ntop(AF_INET6, address, addr_str, DR_ADDRSTRLEN); ++#endif ++ DEBUGMSGTL(("access:defaultrouter", ++ "found default route: %s if_index %d " ++ "lifetime %lu preference %d\n", ++ addr_str, if_index, lifetime, preference)); ++ } ++ ++ entry = netsnmp_access_defaultrouter_entry_create(); ++ if (NULL == entry) { ++ rc = -3; ++ break; ++ } ++ ++ entry->ns_dr_index = ++idx_offset; ++ entry->dr_addresstype = addresstype; ++ entry->dr_address_len = address_len; ++ memcpy(entry->dr_address, address, ++ NETSNMP_ACCESS_DEFAULTROUTER_BUF_SIZE); ++ entry->dr_if_index = if_index; ++ entry->dr_lifetime = lifetime; ++ entry->dr_preference = preference; ++ ++ if (CONTAINER_INSERT(container, entry) < 0) ++ { ++ DEBUGMSGTL(("access:arp:container", ++ "error with defaultrouter_entry: " ++ "insert into container failed.\n")); ++ netsnmp_access_defaultrouter_entry_free(entry); ++ continue; ++ } ++ } ++ ++next_nlmsghdr: ++ nlmhp = NLMSG_NEXT(nlmhp, count); ++ } /* while NLMSG_OK(nlmhp) */ ++ ++ if (rc < 0) ++ break; ++ ++ } while (!end_of_message); ++ ++ close(nlsk); ++ return rc; ++#endif /* HAVE_LINUX_RTNETLINK_H */ ++} +diff --git a/agent/mibgroup/ip-mib/data_access/ipaddress_linux.c b/agent/mibgroup/ip-mib/data_access/ipaddress_linux.c +index ac37578..4616649 100644 +--- a/agent/mibgroup/ip-mib/data_access/ipaddress_linux.c ++++ b/agent/mibgroup/ip-mib/data_access/ipaddress_linux.c +@@ -19,9 +19,11 @@ + #if defined (NETSNMP_ENABLE_IPV6) + #include + #include ++#ifdef HAVE_LINUX_RTNETLINK_H + #include + #include + #endif ++#endif + + #include "ipaddress_ioctl.h" + +@@ -180,6 +182,12 @@ netsnmp_arch_ipaddress_container_load(netsnmp_container *container, + int + _load_v6(netsnmp_container *container, int idx_offset) + { ++#ifndef HAVE_LINUX_RTNETLINK_H ++ DEBUGMSGTL(("access:ipaddress:container", ++ "cannot get ip address information" ++ "as netlink socket is not available\n")); ++ return -1; ++#else + FILE *in; + char line[80], addr[40]; + char if_name[IFNAMSIZ+1];/* +1 for '\0' because of the ugly sscanf below */ +@@ -438,6 +446,6 @@ netsnmp_access_other_info_get(int index, int family) + } + close(sd); + return addr; ++#endif + } + #endif +- +diff --git a/agent/mibgroup/ip-mib/ipDefaultRouterTable.h b/agent/mibgroup/ip-mib/ipDefaultRouterTable.h +new file mode 100644 +index 0000000..28ed84b +--- /dev/null ++++ b/agent/mibgroup/ip-mib/ipDefaultRouterTable.h +@@ -0,0 +1,5 @@ ++/* ++ * module to include the modules ++ */ ++ ++config_require(ip-mib/ipDefaultRouterTable/ipDefaultRouterTable) +diff --git a/agent/mibgroup/ip-mib/ipDefaultRouterTable/ipDefaultRouterTable.c b/agent/mibgroup/ip-mib/ipDefaultRouterTable/ipDefaultRouterTable.c +new file mode 100644 +index 0000000..8ce841d +--- /dev/null ++++ b/agent/mibgroup/ip-mib/ipDefaultRouterTable/ipDefaultRouterTable.c +@@ -0,0 +1,213 @@ ++/* ++ * Note: this file originally auto-generated by mib2c using ++ * version : 14170 $ of $ ++ * ++ * $Id:$ ++ */ ++/** \page MFD helper for ipDefaultRouterTable ++ * ++ * \section intro Introduction ++ * Introductory text. ++ * ++ */ ++/* ++ * standard Net-SNMP includes ++ */ ++#include ++#include ++#include ++ ++/* ++ * include our parent header ++ */ ++#include "ipDefaultRouterTable.h" ++ ++#include ++ ++#include "ipDefaultRouterTable_interface.h" ++ ++oid ipDefaultRouterTable_oid[] = { IPDEFAULTROUTERTABLE_OID }; ++int ipDefaultRouterTable_oid_size = ++OID_LENGTH(ipDefaultRouterTable_oid); ++ ++ipDefaultRouterTable_registration ipDefaultRouterTable_user_context; ++ ++void initialize_table_ipDefaultRouterTable(void); ++void shutdown_table_ipDefaultRouterTable(void); ++ ++ ++/** ++ * Initializes the ipDefaultRouterTable module ++ */ ++void ++init_ipDefaultRouterTable(void) ++{ ++ DEBUGMSGTL(("verbose:ipDefaultRouterTable:init_ipDefaultRouterTable", ++ "called\n")); ++ ++ /* ++ * TODO:300:o: Perform ipDefaultRouterTable one-time module initialization. ++ */ ++ ++ /* ++ * here we initialize all the tables we're planning on supporting ++ */ ++ if (should_init("ipDefaultRouterTable")) ++ initialize_table_ipDefaultRouterTable(); ++ ++} /* init_ipDefaultRouterTable */ ++ ++/** ++ * Shut-down the ipDefaultRouterTable module (agent is exiting) ++ */ ++void ++shutdown_ipDefaultRouterTable(void) ++{ ++ if (should_init("ipDefaultRouterTable")) ++ shutdown_table_ipDefaultRouterTable(); ++ ++} ++ ++/** ++ * Initialize the table ipDefaultRouterTable ++ * (Define its contents and how it's structured) ++ */ ++void ++initialize_table_ipDefaultRouterTable(void) ++{ ++ ipDefaultRouterTable_registration *user_context; ++ u_long flags; ++ ++ DEBUGMSGTL(("verbose:ipDefaultRouterTable:initialize_table_ipDefaultRouterTable", "called\n")); ++ ++ /* ++ * TODO:301:o: Perform ipDefaultRouterTable one-time table initialization. ++ */ ++ ++ /* ++ * TODO:302:o: |->Initialize ipDefaultRouterTable user context ++ * if you'd like to pass in a pointer to some data for this ++ * table, allocate or set it up here. ++ */ ++ /* ++ * a netsnmp_data_list is a simple way to store void pointers. A simple ++ * string token is used to add, find or remove pointers. ++ */ ++ user_context = ++ netsnmp_create_data_list("ipDefaultRouterTable", NULL, NULL); ++ ++ /* ++ * No support for any flags yet, but in the future you would ++ * set any flags here. ++ */ ++ flags = 0; ++ ++ /* ++ * call interface initialization code ++ */ ++ _ipDefaultRouterTable_initialize_interface(user_context, flags); ++} /* initialize_table_ipDefaultRouterTable */ ++ ++/** ++ * Shutdown the table ipDefaultRouterTable ++ */ ++void ++shutdown_table_ipDefaultRouterTable(void) ++{ ++ /* ++ * call interface shutdown code ++ */ ++ _ipDefaultRouterTable_shutdown_interface ++ (&ipDefaultRouterTable_user_context); ++} ++ ++/** ++ * extra context initialization (eg default values) ++ * ++ * @param rowreq_ctx : row request context ++ * @param user_init_ctx : void pointer for user (parameter to rowreq_ctx_allocate) ++ * ++ * @retval MFD_SUCCESS : no errors ++ * @retval MFD_ERROR : error (context allocate will fail) ++ */ ++int ++ipDefaultRouterTable_rowreq_ctx_init(ipDefaultRouterTable_rowreq_ctx * ++ rowreq_ctx, void *user_init_ctx) ++{ ++ DEBUGMSGTL(("verbose:ipDefaultRouterTable:ipDefaultRouterTable_rowreq_ctx_init", "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:210:o: |-> Perform extra ipDefaultRouterTable rowreq initialization. (eg DEFVALS) ++ */ ++ ++ return MFD_SUCCESS; ++} /* ipDefaultRouterTable_rowreq_ctx_init */ ++ ++/** ++ * extra context cleanup ++ * ++ */ ++void ++ipDefaultRouterTable_rowreq_ctx_cleanup(ipDefaultRouterTable_rowreq_ctx * ++ rowreq_ctx) ++{ ++ DEBUGMSGTL(("verbose:ipDefaultRouterTable:ipDefaultRouterTable_rowreq_ctx_cleanup", "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:211:o: |-> Perform extra ipDefaultRouterTable rowreq cleanup. ++ */ ++} /* ipDefaultRouterTable_rowreq_ctx_cleanup */ ++ ++/** ++ * pre-request callback ++ * ++ * ++ * @retval MFD_SUCCESS : success. ++ * @retval MFD_ERROR : other error ++ */ ++int ++ipDefaultRouterTable_pre_request(ipDefaultRouterTable_registration * ++ user_context) ++{ ++ DEBUGMSGTL(("verbose:ipDefaultRouterTable:ipDefaultRouterTable_pre_request", "called\n")); ++ ++ /* ++ * TODO:510:o: Perform ipDefaultRouterTable pre-request actions. ++ */ ++ ++ return MFD_SUCCESS; ++} /* ipDefaultRouterTable_pre_request */ ++ ++/** ++ * post-request callback ++ * ++ * Note: ++ * New rows have been inserted into the container, and ++ * deleted rows have been removed from the container and ++ * released. ++ * ++ * @param user_context ++ * @param rc : MFD_SUCCESS if all requests succeeded ++ * ++ * @retval MFD_SUCCESS : success. ++ * @retval MFD_ERROR : other error (ignored) ++ */ ++int ++ipDefaultRouterTable_post_request(ipDefaultRouterTable_registration * ++ user_context, int rc) ++{ ++ DEBUGMSGTL(("verbose:ipDefaultRouterTable:ipDefaultRouterTable_post_request", "called\n")); ++ ++ /* ++ * TODO:511:o: Perform ipDefaultRouterTable post-request actions. ++ */ ++ ++ return MFD_SUCCESS; ++} /* ipDefaultRouterTable_post_request */ ++ ++ ++/** @{ */ +diff --git a/agent/mibgroup/ip-mib/ipDefaultRouterTable/ipDefaultRouterTable.h b/agent/mibgroup/ip-mib/ipDefaultRouterTable/ipDefaultRouterTable.h +new file mode 100644 +index 0000000..1bca12e +--- /dev/null ++++ b/agent/mibgroup/ip-mib/ipDefaultRouterTable/ipDefaultRouterTable.h +@@ -0,0 +1,212 @@ ++/* ++ * Note: this file originally auto-generated by mib2c using ++ * version : 14170 $ of $ ++ * ++ * $Id:$ ++ */ ++#ifndef IPDEFAULTROUTERTABLE_H ++#define IPDEFAULTROUTERTABLE_H ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++ ++/** @addtogroup misc misc: Miscellaneous routines ++ * ++ * @{ ++ */ ++#include ++#include ++ ++ /* ++ * other required module components ++ */ ++ /* *INDENT-OFF* */ ++config_require(ip-mib/data_access/defaultrouter) ++config_require(ip-mib/ipDefaultRouterTable/ipDefaultRouterTable_interface) ++config_require(ip-mib/ipDefaultRouterTable/ipDefaultRouterTable_data_access) ++config_require(ip-mib/ipDefaultRouterTable/ipDefaultRouterTable_data_get) ++ /* *INDENT-ON* */ ++ ++ /* ++ * OID and column number definitions for ipDefaultRouterTable ++ */ ++#include "ipDefaultRouterTable_oids.h" ++ ++ /* ++ * enum definions ++ */ ++#include "ipDefaultRouterTable_enums.h" ++ ++ /* ++ ********************************************************************* ++ * function declarations ++ */ ++ void init_ipDefaultRouterTable(void); ++ void shutdown_ipDefaultRouterTable(void); ++ ++ /* ++ ********************************************************************* ++ * Table declarations ++ */ ++/********************************************************************** ++ ********************************************************************** ++ *** ++ *** Table ipDefaultRouterTable ++ *** ++ ********************************************************************** ++ **********************************************************************/ ++ /* ++ * IP-MIB::ipDefaultRouterTable is subid 37 of ip. ++ * Its status is Current. ++ * OID: .1.3.6.1.2.1.4.37, length: 8 ++ */ ++ /* ++ ********************************************************************* ++ * When you register your mib, you get to provide a generic ++ * pointer that will be passed back to you for most of the ++ * functions calls. ++ * ++ * TODO:100:r: Review all context structures ++ */ ++ /* ++ * TODO:101:o: |-> Review ipDefaultRouterTable registration context. ++ */ ++ typedef netsnmp_data_list ipDefaultRouterTable_registration; ++ ++/**********************************************************************/ ++ /* ++ * TODO:110:r: |-> Review ipDefaultRouterTable data context structure. ++ * This structure is used to represent the data for ipDefaultRouterTable. ++ */ ++ typedef netsnmp_defaultrouter_entry ipDefaultRouterTable_data; ++ ++ ++ /* ++ * TODO:120:r: |-> Review ipDefaultRouterTable mib index. ++ * This structure is used to represent the index for ipDefaultRouterTable. ++ */ ++ typedef struct ipDefaultRouterTable_mib_index_s { ++ ++ /* ++ * ipDefaultRouterAddressType(1)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h ++ */ ++ u_long ipDefaultRouterAddressType; ++ ++ /* ++ * ipDefaultRouterAddress(2)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h ++ */ ++ /** 128 - 2(other indexes) - oid length(10) = 115 */ ++ char ipDefaultRouterAddress[115]; ++ size_t ipDefaultRouterAddress_len; ++ ++ /* ++ * ipDefaultRouterIfIndex(3)/InterfaceIndex/ASN_INTEGER/long(long)//l/a/w/e/R/d/H ++ */ ++ long ipDefaultRouterIfIndex; ++ ++ ++ } ipDefaultRouterTable_mib_index; ++ ++ /* ++ * TODO:121:r: | |-> Review ipDefaultRouterTable max index length. ++ * If you KNOW that your indexes will never exceed a certain ++ * length, update this macro to that length. ++ * ++ * BE VERY CAREFUL TO TAKE INTO ACCOUNT THE MAXIMUM ++ * POSSIBLE LENGHT FOR EVERY VARIABLE LENGTH INDEX! ++ * Guessing 128 - col/entry(2) - oid len(8) ++ */ ++#define MAX_ipDefaultRouterTable_IDX_LEN 118 ++ ++ ++ /* ++ ********************************************************************* ++ * TODO:130:o: |-> Review ipDefaultRouterTable Row request (rowreq) context. ++ * When your functions are called, you will be passed a ++ * ipDefaultRouterTable_rowreq_ctx pointer. ++ */ ++ typedef struct ipDefaultRouterTable_rowreq_ctx_s { ++ ++ /** this must be first for container compare to work */ ++ netsnmp_index oid_idx; ++ oid oid_tmp[MAX_ipDefaultRouterTable_IDX_LEN]; ++ ++ ipDefaultRouterTable_mib_index tbl_idx; ++ ++ ipDefaultRouterTable_data *data; ++ ++ /* ++ * flags per row. Currently, the first (lower) 8 bits are reserved ++ * for the user. See mfd.h for other flags. ++ */ ++ u_int rowreq_flags; ++ ++ /* ++ * TODO:131:o: | |-> Add useful data to ipDefaultRouterTable rowreq context. ++ */ ++ ++ /* ++ * storage for future expansion ++ */ ++ netsnmp_data_list *ipDefaultRouterTable_data_list; ++ ++ } ipDefaultRouterTable_rowreq_ctx; ++ ++ typedef struct ipDefaultRouterTable_ref_rowreq_ctx_s { ++ ipDefaultRouterTable_rowreq_ctx *rowreq_ctx; ++ } ipDefaultRouterTable_ref_rowreq_ctx; ++ ++ /* ++ ********************************************************************* ++ * function prototypes ++ */ ++ int ++ ipDefaultRouterTable_pre_request(ipDefaultRouterTable_registration ++ * user_context); ++ int ++ ipDefaultRouterTable_post_request(ipDefaultRouterTable_registration ++ * user_context, int rc); ++ ++ int ++ ipDefaultRouterTable_rowreq_ctx_init ++ (ipDefaultRouterTable_rowreq_ctx * rowreq_ctx, ++ void *user_init_ctx); ++ void ++ ipDefaultRouterTable_rowreq_ctx_cleanup ++ (ipDefaultRouterTable_rowreq_ctx * rowreq_ctx); ++ ++ ipDefaultRouterTable_data *ipDefaultRouterTable_allocate_data(void); ++ void ++ ipDefaultRouterTable_release_data(ipDefaultRouterTable_data * ++ data); ++ ++ ++ ipDefaultRouterTable_rowreq_ctx ++ *ipDefaultRouterTable_row_find_by_mib_index ++ (ipDefaultRouterTable_mib_index * mib_idx); ++ ++ extern oid ipDefaultRouterTable_oid[]; ++ extern int ipDefaultRouterTable_oid_size; ++ ++ ++#include "ipDefaultRouterTable_interface.h" ++#include "ipDefaultRouterTable_data_access.h" ++#include "ipDefaultRouterTable_data_get.h" ++ ++ /* ++ * DUMMY markers, ignore ++ * ++ * TODO:099:x: ************************************************************* ++ * TODO:199:x: ************************************************************* ++ * TODO:299:x: ************************************************************* ++ * TODO:399:x: ************************************************************* ++ * TODO:499:x: ************************************************************* ++ */ ++ ++#ifdef __cplusplus ++} ++#endif ++#endif /* IPDEFAULTROUTERTABLE_H */ ++/** @} */ +diff --git a/agent/mibgroup/ip-mib/ipDefaultRouterTable/ipDefaultRouterTable_data_access.c b/agent/mibgroup/ip-mib/ipDefaultRouterTable/ipDefaultRouterTable_data_access.c +new file mode 100644 +index 0000000..70e1b23 +--- /dev/null ++++ b/agent/mibgroup/ip-mib/ipDefaultRouterTable/ipDefaultRouterTable_data_access.c +@@ -0,0 +1,420 @@ ++/* ++ * Note: this file originally auto-generated by mib2c using ++ * version : 14170 $ of $ ++ * ++ * $Id:$ ++ */ ++/* ++ * standard Net-SNMP includes ++ */ ++#include ++#include ++#include ++ ++/* ++ * include our parent header ++ */ ++#include "ipDefaultRouterTable.h" ++ ++ ++#include "ipDefaultRouterTable_data_access.h" ++ ++/** @ingroup interface ++ * @addtogroup data_access data_access: Routines to access data ++ * ++ * These routines are used to locate the data used to satisfy ++ * requests. ++ * ++ * @{ ++ */ ++/********************************************************************** ++ ********************************************************************** ++ *** ++ *** Table ipDefaultRouterTable ++ *** ++ ********************************************************************** ++ **********************************************************************/ ++/* ++ * IP-MIB::ipDefaultRouterTable is subid 37 of ip. ++ * Its status is Current. ++ * OID: .1.3.6.1.2.1.4.37, length: 8 ++ */ ++ ++/** ++ * initialization for ipDefaultRouterTable data access ++ * ++ * This function is called during startup to allow you to ++ * allocate any resources you need for the data table. ++ * ++ * @param ipDefaultRouterTable_reg ++ * Pointer to ipDefaultRouterTable_registration ++ * ++ * @retval MFD_SUCCESS : success. ++ * @retval MFD_ERROR : unrecoverable error. ++ */ ++int ++ipDefaultRouterTable_init_data(ipDefaultRouterTable_registration * ++ ipDefaultRouterTable_reg) ++{ ++ DEBUGMSGTL(("verbose:ipDefaultRouterTable:ipDefaultRouterTable_init_data", "called\n")); ++ ++ /* ++ * TODO:303:o: Initialize ipDefaultRouterTable data. ++ */ ++ ++ return MFD_SUCCESS; ++} /* ipDefaultRouterTable_init_data */ ++ ++/** ++ * container overview ++ * ++ */ ++ ++/** ++ * container initialization ++ * ++ * @param container_ptr_ptr A pointer to a container pointer. If you ++ * create a custom container, use this parameter to return it ++ * to the MFD helper. If set to NULL, the MFD helper will ++ * allocate a container for you. ++ * @param cache A pointer to a cache structure. You can set the timeout ++ * and other cache flags using this pointer. ++ * ++ * This function is called at startup to allow you to customize certain ++ * aspects of the access method. For the most part, it is for advanced ++ * users. The default code should suffice for most cases. If no custom ++ * container is allocated, the MFD code will create one for your. ++ * ++ * This is also the place to set up cache behavior. The default, to ++ * simply set the cache timeout, will work well with the default ++ * container. If you are using a custom container, you may want to ++ * look at the cache helper documentation to see if there are any ++ * flags you want to set. ++ * ++ * @remark ++ * This would also be a good place to do any initialization needed ++ * for you data source. For example, opening a connection to another ++ * process that will supply the data, opening a database, etc. ++ */ ++void ++ipDefaultRouterTable_container_init(netsnmp_container ** container_ptr_ptr, ++ netsnmp_cache * cache) ++{ ++ DEBUGMSGTL(("verbose:ipDefaultRouterTable:ipDefaultRouterTable_container_init", "called\n")); ++ ++ if (NULL == container_ptr_ptr) { ++ snmp_log(LOG_ERR, ++ "bad container param to ipDefaultRouterTable_container_init\n"); ++ return; ++ } ++ ++ /* ++ * For advanced users, you can use a custom container. If you ++ * do not create one, one will be created for you. ++ */ ++ *container_ptr_ptr = NULL; ++ ++ if (NULL == cache) { ++ snmp_log(LOG_ERR, ++ "bad cache param to ipDefaultRouterTable_container_init\n"); ++ return; ++ } ++ ++ /* ++ * TODO:345:A: Set up ipDefaultRouterTable cache properties. ++ * ++ * Also for advanced users, you can set parameters for the ++ * cache. Do not change the magic pointer, as it is used ++ * by the MFD helper. To completely disable caching, set ++ * cache->enabled to 0. ++ */ ++ cache->timeout = IPDEFAULTROUTERTABLE_CACHE_TIMEOUT; /* seconds */ ++} /* ipDefaultRouterTable_container_init */ ++ ++/** ++ * container shutdown ++ * ++ * @param container_ptr A pointer to the container. ++ * ++ * This function is called at shutdown to allow you to customize certain ++ * aspects of the access method. For the most part, it is for advanced ++ * users. The default code should suffice for most cases. ++ * ++ * This function is called before ipDefaultRouterTable_container_free(). ++ * ++ * @remark ++ * This would also be a good place to do any cleanup needed ++ * for you data source. For example, closing a connection to another ++ * process that supplied the data, closing a database, etc. ++ */ ++void ++ipDefaultRouterTable_container_shutdown(netsnmp_container * container_ptr) ++{ ++ DEBUGMSGTL(("verbose:ipDefaultRouterTable:ipDefaultRouterTable_container_shutdown", "called\n")); ++ ++ if (NULL == container_ptr) { ++ snmp_log(LOG_ERR, ++ "bad params to ipDefaultRouterTable_container_shutdown\n"); ++ return; ++ } ++ ++} /* ipDefaultRouterTable_container_shutdown */ ++ ++/** ++ * check entry for update ++ */ ++static void ++_check_entry_for_updates(ipDefaultRouterTable_rowreq_ctx * rowreq_ctx, ++ void **magic) ++{ ++ netsnmp_container *defaultrouter_container = magic[0]; ++ netsnmp_container *to_delete = (netsnmp_container *) magic[1]; ++ ++ /* ++ * check for matching entry using secondary index. ++ */ ++ netsnmp_defaultrouter_entry *defaultrouter_entry = ++ CONTAINER_FIND(defaultrouter_container, rowreq_ctx->data); ++ if (NULL == defaultrouter_entry) { ++ DEBUGMSGTL(("ipDefaultRouterTable:access", "removing missing entry\n")); ++ ++ if (NULL == to_delete) { ++ magic[1] = to_delete = netsnmp_container_find("lifo"); ++ if (NULL == to_delete) ++ snmp_log(LOG_ERR, "couldn't create delete container\n"); ++ } ++ if (NULL != to_delete) ++ CONTAINER_INSERT(to_delete, rowreq_ctx); ++ } else { ++ DEBUGMSGTL(("ipDefaultRouterTable:access", "updating existing entry\n")); ++ ++ /* ++ * Check for changes & update ++ */ ++ netsnmp_access_defaultrouter_entry_update(rowreq_ctx->data, ++ defaultrouter_entry); ++ ++ /* ++ * remove entry from ifcontainer ++ */ ++ CONTAINER_REMOVE(defaultrouter_container, defaultrouter_entry); ++ netsnmp_access_defaultrouter_entry_free(defaultrouter_entry); ++ } ++} ++ ++/** ++ * add new entry ++ */ ++static void ++_add_new_entry(netsnmp_defaultrouter_entry *defaultrouter_entry, ++ netsnmp_container *container) ++{ ++ ipDefaultRouterTable_rowreq_ctx *rowreq_ctx; ++ ++ DEBUGMSGTL(("ipDefaultRouterTable:access", "creating new entry\n")); ++ ++ netsnmp_assert(NULL != defaultrouter_entry); ++ netsnmp_assert(NULL != container); ++ ++ /* ++ * allocate an row context and set the index(es) ++ */ ++ rowreq_ctx = ipDefaultRouterTable_allocate_rowreq_ctx(defaultrouter_entry, ++ NULL); ++ if ((NULL != rowreq_ctx) && ++ (MFD_SUCCESS == ++ ipDefaultRouterTable_indexes_set(rowreq_ctx, ++ defaultrouter_entry->dr_addresstype, ++ defaultrouter_entry->dr_address, ++ defaultrouter_entry->dr_address_len, ++ defaultrouter_entry->dr_if_index))) { ++ if (CONTAINER_INSERT(container, rowreq_ctx) < 0) { ++ DEBUGMSGTL(("ipAddressTable:access", ++ "container insert failed for new entry\n")); ++ ipDefaultRouterTable_release_rowreq_ctx(rowreq_ctx); ++ return; ++ } ++ } else { ++ if (NULL != rowreq_ctx) { ++ snmp_log(LOG_ERR, "error setting index while loading " ++ "ipDefaultRouterTable cache.\n"); ++ ipDefaultRouterTable_release_rowreq_ctx(rowreq_ctx); ++ } else { ++ snmp_log(LOG_ERR, "memory allocation failed while loading " ++ "ipDefaultRouterTable cache.\n"); ++ netsnmp_access_defaultrouter_entry_free(defaultrouter_entry); ++ } ++ ++ return; ++ } ++} ++ ++/** ++ * load initial data ++ * ++ * TODO:350:M: Implement ipDefaultRouterTable data load ++ * This function will also be called by the cache helper to load ++ * the container again (after the container free function has been ++ * called to free the previous contents). ++ * ++ * @param container container to which items should be inserted ++ * ++ * @retval MFD_SUCCESS : success. ++ * @retval MFD_RESOURCE_UNAVAILABLE : Can't access data source ++ * @retval MFD_ERROR : other error. ++ * ++ * This function is called to load the index(es) (and data, optionally) ++ * for the every row in the data set. ++ * ++ * @remark ++ * While loading the data, the only important thing is the indexes. ++ * If access to your data is cheap/fast (e.g. you have a pointer to a ++ * structure in memory), it would make sense to update the data here. ++ * If, however, the accessing the data invovles more work (e.g. parsing ++ * some other existing data, or peforming calculations to derive the data), ++ * then you can limit yourself to setting the indexes and saving any ++ * information you will need later. Then use the saved information in ++ * ipDefaultRouterTable_row_prep() for populating data. ++ * ++ * @note ++ * If you need consistency between rows (like you want statistics ++ * for each row to be from the same time frame), you should set all ++ * data here. ++ * ++ */ ++int ++ipDefaultRouterTable_container_load(netsnmp_container * container) ++{ ++ netsnmp_container *defaultrouter_container; ++ void *tmp_ptr[2]; ++ ++ DEBUGMSGTL(("verbose:ipDefaultRouterTable:ipDefaultRouterTable_container_load", "called\n")); ++ ++ /* ++ * TODO:351:M: |-> Load/update data in the ipDefaultRouterTable container. ++ * loop over your ipDefaultRouterTable data, allocate a rowreq context, ++ * set the index(es) [and data, optionally] and insert into ++ * the container. ++ */ ++ defaultrouter_container = ++ netsnmp_access_defaultrouter_container_load(NULL, ++ NETSNMP_ACCESS_DEFAULTROUTER_LOAD_ADDL_IDX_BY_ADDR); ++ ++ if (NULL == defaultrouter_container) ++ return MFD_RESOURCE_UNAVAILABLE; /* msg already logged */ ++ ++ /* ++ * we just got a fresh copy of interface data. compare it to ++ * what we've already got, and make any adjustments, saving ++ * missing addresses to be deleted. ++ */ ++ tmp_ptr[0] = defaultrouter_container->next; ++ tmp_ptr[1] = NULL; ++ CONTAINER_FOR_EACH(container, ++ (netsnmp_container_obj_func *) _check_entry_for_updates, ++ tmp_ptr); ++ ++ /* ++ * now add any new interfaces ++ */ ++ CONTAINER_FOR_EACH(defaultrouter_container, ++ (netsnmp_container_obj_func *) _add_new_entry, ++ container); ++ ++ /* ++ * free the container. we've either claimed each entry, or released it, ++ * so the access function doesn't need to clear the container. ++ */ ++ netsnmp_access_defaultrouter_container_free(defaultrouter_container, ++ NETSNMP_ACCESS_DEFAULTROUTER_FREE_DONT_CLEAR); ++ ++ /* ++ * remove deleted addresses from table container ++ */ ++ if (NULL != tmp_ptr[1]) { ++ netsnmp_container *tmp_container = ++ (netsnmp_container *) tmp_ptr[1]; ++ ipDefaultRouterTable_rowreq_ctx *tmp_ctx; ++ ++ /* ++ * this works because the tmp_container is a linked list, ++ * which can be used like a stack... ++ */ ++ while (CONTAINER_SIZE(tmp_container)) { ++ /* ++ * get from delete list ++ */ ++ tmp_ctx = CONTAINER_FIRST(tmp_container); ++ ++ /* ++ * release context, delete from table container ++ */ ++ CONTAINER_REMOVE(container, tmp_ctx); ++ ipDefaultRouterTable_release_rowreq_ctx(tmp_ctx); ++ ++ /* ++ * pop off delete list ++ */ ++ CONTAINER_REMOVE(tmp_container, NULL); ++ } ++ } ++ ++ DEBUGMSGT(("verbose:ipDefaultRouterTable:ipDefaultRouterTable_container_load", ++ "%d records\n", CONTAINER_SIZE(container))); ++ ++ return MFD_SUCCESS; ++} ++ ++/** ++ * container clean up ++ * ++ * @param container container with all current items ++ * ++ * This optional callback is called prior to all ++ * item's being removed from the container. If you ++ * need to do any processing before that, do it here. ++ * ++ * @note ++ * The MFD helper will take care of releasing all the row contexts. ++ * ++ */ ++void ++ipDefaultRouterTable_container_free(netsnmp_container * container) ++{ ++ DEBUGMSGTL(("verbose:ipDefaultRouterTable:ipDefaultRouterTable_container_free", "called\n")); ++ ++ /* ++ * TODO:380:M: Free ipDefaultRouterTable container data. ++ */ ++} /* ipDefaultRouterTable_container_free */ ++ ++/** ++ * prepare row for processing. ++ * ++ * When the agent has located the row for a request, this function is ++ * called to prepare the row for processing. If you fully populated ++ * the data context during the index setup phase, you may not need to ++ * do anything. ++ * ++ * @param rowreq_ctx pointer to a context. ++ * ++ * @retval MFD_SUCCESS : success. ++ * @retval MFD_ERROR : other error. ++ */ ++int ++ipDefaultRouterTable_row_prep(ipDefaultRouterTable_rowreq_ctx * rowreq_ctx) ++{ ++ DEBUGMSGTL(("verbose:ipDefaultRouterTable:ipDefaultRouterTable_row_prep", "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:390:o: Prepare row for request. ++ * If populating row data was delayed, this is the place to ++ * fill in the row for this request. ++ */ ++ ++ return MFD_SUCCESS; ++} /* ipDefaultRouterTable_row_prep */ ++ ++/** @} */ +diff --git a/agent/mibgroup/ip-mib/ipDefaultRouterTable/ipDefaultRouterTable_data_access.h b/agent/mibgroup/ip-mib/ipDefaultRouterTable/ipDefaultRouterTable_data_access.h +new file mode 100644 +index 0000000..ed033f0 +--- /dev/null ++++ b/agent/mibgroup/ip-mib/ipDefaultRouterTable/ipDefaultRouterTable_data_access.h +@@ -0,0 +1,76 @@ ++/* ++ * Note: this file originally auto-generated by mib2c using ++ * version : 14170 $ of $ ++ * ++ * $Id:$ ++ */ ++#ifndef IPDEFAULTROUTERTABLE_DATA_ACCESS_H ++#define IPDEFAULTROUTERTABLE_DATA_ACCESS_H ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++ ++ /* ++ ********************************************************************* ++ * function declarations ++ */ ++ ++ /* ++ ********************************************************************* ++ * Table declarations ++ */ ++/********************************************************************** ++ ********************************************************************** ++ *** ++ *** Table ipDefaultRouterTable ++ *** ++ ********************************************************************** ++ **********************************************************************/ ++ /* ++ * IP-MIB::ipDefaultRouterTable is subid 37 of ip. ++ * Its status is Current. ++ * OID: .1.3.6.1.2.1.4.37, length: 8 ++ */ ++ ++ ++ int ++ ipDefaultRouterTable_init_data(ipDefaultRouterTable_registration * ++ ipDefaultRouterTable_reg); ++ ++ ++ /* ++ * TODO:180:o: Review ipDefaultRouterTable cache timeout. ++ * The number of seconds before the cache times out ++ */ ++#define IPDEFAULTROUTERTABLE_CACHE_TIMEOUT 60 ++ ++ void ipDefaultRouterTable_container_init(netsnmp_container ++ ** ++ container_ptr_ptr, ++ netsnmp_cache * ++ cache); ++ void ++ ipDefaultRouterTable_container_shutdown(netsnmp_container * ++ container_ptr); ++ ++ int ipDefaultRouterTable_container_load(netsnmp_container * ++ container); ++ void ipDefaultRouterTable_container_free(netsnmp_container * ++ container); ++ ++ int ipDefaultRouterTable_cache_load(netsnmp_container * ++ container); ++ void ipDefaultRouterTable_cache_free(netsnmp_container * ++ container); ++ int ++ ipDefaultRouterTable_row_prep(ipDefaultRouterTable_rowreq_ctx * ++ rowreq_ctx); ++ ++ ++ ++#ifdef __cplusplus ++} ++#endif ++#endif /* IPDEFAULTROUTERTABLE_DATA_ACCESS_H */ +diff --git a/agent/mibgroup/ip-mib/ipDefaultRouterTable/ipDefaultRouterTable_data_get.c b/agent/mibgroup/ip-mib/ipDefaultRouterTable/ipDefaultRouterTable_data_get.c +new file mode 100644 +index 0000000..1177897 +--- /dev/null ++++ b/agent/mibgroup/ip-mib/ipDefaultRouterTable/ipDefaultRouterTable_data_get.c +@@ -0,0 +1,325 @@ ++/* ++ * Note: this file originally auto-generated by mib2c using ++ * version : 12088 $ of $ ++ * ++ * $Id:$ ++ */ ++/* ++ * standard Net-SNMP includes ++ */ ++#include ++#include ++#include ++ ++/* ++ * include our parent header ++ */ ++#include "ipDefaultRouterTable.h" ++ ++ ++/** @defgroup data_get data_get: Routines to get data ++ * ++ * TODO:230:M: Implement ipDefaultRouterTable get routines. ++ * TODO:240:M: Implement ipDefaultRouterTable mapping routines (if any). ++ * ++ * These routine are used to get the value for individual objects. The ++ * row context is passed, along with a pointer to the memory where the ++ * value should be copied. ++ * ++ * @{ ++ */ ++/********************************************************************** ++ ********************************************************************** ++ *** ++ *** Table ipDefaultRouterTable ++ *** ++ ********************************************************************** ++ **********************************************************************/ ++/* ++ * IP-MIB::ipDefaultRouterTable is subid 37 of ip. ++ * Its status is Current. ++ * OID: .1.3.6.1.2.1.4.37, length: 8 ++ */ ++ ++/* ++ * --------------------------------------------------------------------- ++ * * TODO:200:r: Implement ipDefaultRouterTable data context functions. ++ */ ++/* ++ * ipDefaultRouterTable_allocate_data ++ * ++ * Purpose: create new ipDefaultRouterTable_data. ++ */ ++ipDefaultRouterTable_data * ++ipDefaultRouterTable_allocate_data(void) ++{ ++ /* ++ * TODO:201:r: |-> allocate memory for the ipDefaultRouterTable data context. ++ */ ++ ipDefaultRouterTable_data *rtn = ++ netsnmp_access_defaultrouter_entry_create(); ++ ++ DEBUGMSGTL(("verbose:ipDefaultRouterTable:ipDefaultRouterTable_allocate_data", "called\n")); ++ ++ if (NULL == rtn) { ++ snmp_log(LOG_ERR, "unable to malloc memory for new " ++ "ipDefaultRouterTable_data.\n"); ++ } ++ ++ return rtn; ++} /* ipDefaultRouterTable_allocate_data */ ++ ++/* ++ * ipDefaultRouterTable_release_data ++ * ++ * Purpose: release ipDefaultRouterTable data. ++ */ ++void ++ipDefaultRouterTable_release_data(ipDefaultRouterTable_data * data) ++{ ++ DEBUGMSGTL(("verbose:ipDefaultRouterTable:ipDefaultRouterTable_release_data", "called\n")); ++ ++ /* ++ * TODO:202:r: |-> release memory for the ipDefaultRouterTable data context. ++ */ ++ netsnmp_access_defaultrouter_entry_free(data); ++} /* ipDefaultRouterTable_release_data */ ++ ++ ++ ++/** ++ * set mib index(es) ++ * ++ * @param tbl_idx mib index structure ++ * @param ipDefaultRouterAddressType_val ++ * @param ipDefaultRouterAddress_ptr ++ * @param ipDefaultRouterAddress_ptr_len ++ * @param ipDefaultRouterIfIndex_val ++ * ++ * @retval MFD_SUCCESS : success. ++ * @retval MFD_ERROR : other error. ++ * ++ * @remark ++ * This convenience function is useful for setting all the MIB index ++ * components with a single function call. It is assume that the C values ++ * have already been mapped from their native/rawformat to the MIB format. ++ */ ++int ++ipDefaultRouterTable_indexes_set_tbl_idx(ipDefaultRouterTable_mib_index * ++ tbl_idx, ++ u_long ++ ipDefaultRouterAddressType_val, ++ char ++ *ipDefaultRouterAddress_val_ptr, ++ size_t ++ ipDefaultRouterAddress_val_ptr_len, ++ long ipDefaultRouterIfIndex_val) ++{ ++ DEBUGMSGTL(("verbose:ipDefaultRouterTable:ipDefaultRouterTable_indexes_set_tbl_idx", "called\n")); ++ ++ /* ++ * ipDefaultRouterAddressType(1)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h ++ */ ++ /** WARNING: this code might not work for netsnmp_defaultrouter_entry */ ++ tbl_idx->ipDefaultRouterAddressType = ipDefaultRouterAddressType_val; ++ ++ /* ++ * ipDefaultRouterAddress(2)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h ++ */ ++ tbl_idx->ipDefaultRouterAddress_len = sizeof(tbl_idx->ipDefaultRouterAddress) / sizeof(tbl_idx->ipDefaultRouterAddress[0]); /* max length */ ++ /** WARNING: this code might not work for netsnmp_defaultrouter_entry */ ++ /* ++ * make sure there is enough space for ipDefaultRouterAddress data ++ */ ++ if ((NULL == tbl_idx->ipDefaultRouterAddress) || ++ (tbl_idx->ipDefaultRouterAddress_len < ++ (ipDefaultRouterAddress_val_ptr_len))) { ++ snmp_log(LOG_ERR, "not enough space for value\n"); ++ return MFD_ERROR; ++ } ++ tbl_idx->ipDefaultRouterAddress_len = ++ ipDefaultRouterAddress_val_ptr_len; ++ memcpy(tbl_idx->ipDefaultRouterAddress, ipDefaultRouterAddress_val_ptr, ++ ipDefaultRouterAddress_val_ptr_len * ++ sizeof(ipDefaultRouterAddress_val_ptr[0])); ++ ++ /* ++ * ipDefaultRouterIfIndex(3)/InterfaceIndex/ASN_INTEGER/long(long)//l/a/w/e/R/d/H ++ */ ++ /** WARNING: this code might not work for netsnmp_defaultrouter_entry */ ++ tbl_idx->ipDefaultRouterIfIndex = ipDefaultRouterIfIndex_val; ++ ++ ++ return MFD_SUCCESS; ++} /* ipDefaultRouterTable_indexes_set_tbl_idx */ ++ ++/** ++ * @internal ++ * set row context indexes ++ * ++ * @param reqreq_ctx the row context that needs updated indexes ++ * ++ * @retval MFD_SUCCESS : success. ++ * @retval MFD_ERROR : other error. ++ * ++ * @remark ++ * This function sets the mib indexs, then updates the oid indexs ++ * from the mib index. ++ */ ++int ++ipDefaultRouterTable_indexes_set(ipDefaultRouterTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long ipDefaultRouterAddressType_val, ++ char *ipDefaultRouterAddress_val_ptr, ++ size_t ipDefaultRouterAddress_val_ptr_len, ++ long ipDefaultRouterIfIndex_val) ++{ ++ DEBUGMSGTL(("verbose:ipDefaultRouterTable:ipDefaultRouterTable_indexes_set", "called\n")); ++ ++ if (MFD_SUCCESS != ++ ipDefaultRouterTable_indexes_set_tbl_idx(&rowreq_ctx->tbl_idx, ++ ipDefaultRouterAddressType_val, ++ ipDefaultRouterAddress_val_ptr, ++ ipDefaultRouterAddress_val_ptr_len, ++ ipDefaultRouterIfIndex_val)) ++ return MFD_ERROR; ++ ++ /* ++ * convert mib index to oid index ++ */ ++ rowreq_ctx->oid_idx.len = sizeof(rowreq_ctx->oid_tmp) / sizeof(oid); ++ if (0 != ipDefaultRouterTable_index_to_oid(&rowreq_ctx->oid_idx, ++ &rowreq_ctx->tbl_idx)) { ++ return MFD_ERROR; ++ } ++ ++ return MFD_SUCCESS; ++} /* ipDefaultRouterTable_indexes_set */ ++ ++ ++/*--------------------------------------------------------------------- ++ * IP-MIB::ipDefaultRouterEntry.ipDefaultRouterLifetime ++ * ipDefaultRouterLifetime is subid 4 of ipDefaultRouterEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.4.37.1.4 ++ * Description: ++The remaining length of time, in seconds, that this router ++ will continue to be useful as a default router. A value of ++ zero indicates that it is no longer useful as a default ++ router. It is left to the implementer of the MIB as to ++ whether a router with a lifetime of zero is removed from the ++ list. ++ ++ For IPv6, this value should be extracted from the router ++ advertisement messages. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 1 hashint 0 ++ * settable 0 ++ * ++ * Ranges: 0 - 65535; ++ * ++ * Its syntax is UNSIGNED32 (based on perltype UNSIGNED32) ++ * The net-snmp type is ASN_UNSIGNED. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the ipDefaultRouterLifetime data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param ipDefaultRouterLifetime_val_ptr ++ * Pointer to storage for a u_long variable ++ * ++ * @retval MFD_SUCCESS : success ++ * @retval MFD_SKIP : skip this node (no value for now) ++ * @retval MFD_ERROR : Any other error ++ */ ++int ++ipDefaultRouterLifetime_get(ipDefaultRouterTable_rowreq_ctx * rowreq_ctx, ++ u_long * ipDefaultRouterLifetime_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != ipDefaultRouterLifetime_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:ipDefaultRouterTable:ipDefaultRouterLifetime_get", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the ipDefaultRouterLifetime data. ++ * copy (* ipDefaultRouterLifetime_val_ptr ) from rowreq_ctx->data ++ */ ++ (*ipDefaultRouterLifetime_val_ptr) = rowreq_ctx->data->dr_lifetime; ++ ++ return MFD_SUCCESS; ++} /* ipDefaultRouterLifetime_get */ ++ ++/*--------------------------------------------------------------------- ++ * IP-MIB::ipDefaultRouterEntry.ipDefaultRouterPreference ++ * ipDefaultRouterPreference is subid 5 of ipDefaultRouterEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.4.37.1.5 ++ * Description: ++An indication of preference given to this router as a ++ default router as described in he Default Router ++ Preferences document. Treating the value as a ++ 2 bit signed integer allows for simple arithmetic ++ comparisons. ++ ++ For IPv4 routers or IPv6 routers that are not using the ++ updated router advertisement format, this object is set to ++ medium (0). ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 1 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * Enum range: 3/8. Values: reserved(-2), low(-1), medium(0), high(1) ++ * ++ * Its syntax is INTEGER (based on perltype INTEGER) ++ * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long) ++ */ ++/** ++ * Extract the current value of the ipDefaultRouterPreference data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param ipDefaultRouterPreference_val_ptr ++ * Pointer to storage for a long variable ++ * ++ * @retval MFD_SUCCESS : success ++ * @retval MFD_SKIP : skip this node (no value for now) ++ * @retval MFD_ERROR : Any other error ++ */ ++int ++ipDefaultRouterPreference_get(ipDefaultRouterTable_rowreq_ctx * rowreq_ctx, ++ u_long * ipDefaultRouterPreference_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != ipDefaultRouterPreference_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:ipDefaultRouterTable:ipDefaultRouterPreference_get", "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the ipDefaultRouterPreference data. ++ * copy (* ipDefaultRouterPreference_val_ptr ) from rowreq_ctx->data ++ */ ++ (*ipDefaultRouterPreference_val_ptr) = rowreq_ctx->data->dr_preference; ++ ++ return MFD_SUCCESS; ++} /* ipDefaultRouterPreference_get */ ++ ++ ++ ++/** @} */ +diff --git a/agent/mibgroup/ip-mib/ipDefaultRouterTable/ipDefaultRouterTable_data_get.h b/agent/mibgroup/ip-mib/ipDefaultRouterTable/ipDefaultRouterTable_data_get.h +new file mode 100644 +index 0000000..8698675 +--- /dev/null ++++ b/agent/mibgroup/ip-mib/ipDefaultRouterTable/ipDefaultRouterTable_data_get.h +@@ -0,0 +1,84 @@ ++/* ++ * Note: this file originally auto-generated by mib2c using ++ * version : 12088 $ of $ ++ * ++ * $Id:$ ++ * ++ * @file ipDefaultRouterTable_data_get.h ++ * ++ * @addtogroup get ++ * ++ * Prototypes for get functions ++ * ++ * @{ ++ */ ++#ifndef IPDEFAULTROUTERTABLE_DATA_GET_H ++#define IPDEFAULTROUTERTABLE_DATA_GET_H ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++ /* ++ ********************************************************************* ++ * GET function declarations ++ */ ++ ++ /* ++ ********************************************************************* ++ * GET Table declarations ++ */ ++/********************************************************************** ++ ********************************************************************** ++ *** ++ *** Table ipDefaultRouterTable ++ *** ++ ********************************************************************** ++ **********************************************************************/ ++ /* ++ * IP-MIB::ipDefaultRouterTable is subid 37 of ip. ++ * Its status is Current. ++ * OID: .1.3.6.1.2.1.4.37, length: 8 ++ */ ++ /* ++ * indexes ++ */ ++ ++ int ++ ipDefaultRouterLifetime_get(ipDefaultRouterTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long * ++ ipDefaultRouterLifetime_val_ptr); ++ int ++ ipDefaultRouterPreference_get(ipDefaultRouterTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long * ++ ipDefaultRouterPreference_val_ptr); ++ ++ ++ int ++ ipDefaultRouterTable_indexes_set_tbl_idx ++ (ipDefaultRouterTable_mib_index * tbl_idx, ++ u_long ipDefaultRouterAddressType_val, ++ char *ipDefaultRouterAddress_val_ptr, ++ size_t ipDefaultRouterAddress_val_ptr_len, ++ long ipDefaultRouterIfIndex_val); ++ int ++ ipDefaultRouterTable_indexes_set(ipDefaultRouterTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long ++ ipDefaultRouterAddressType_val, ++ char ++ *ipDefaultRouterAddress_val_ptr, ++ size_t ++ ipDefaultRouterAddress_val_ptr_len, ++ long ipDefaultRouterIfIndex_val); ++ ++ ++ ++ ++#ifdef __cplusplus ++} ++#endif ++#endif /* IPDEFAULTROUTERTABLE_DATA_GET_H */ ++/** @} */ +diff --git a/agent/mibgroup/ip-mib/ipDefaultRouterTable/ipDefaultRouterTable_enums.h b/agent/mibgroup/ip-mib/ipDefaultRouterTable/ipDefaultRouterTable_enums.h +new file mode 100644 +index 0000000..bb46d10 +--- /dev/null ++++ b/agent/mibgroup/ip-mib/ipDefaultRouterTable/ipDefaultRouterTable_enums.h +@@ -0,0 +1,93 @@ ++/* ++ * Note: this file originally auto-generated by mib2c using ++ * : generic-table-enums.m2c 12526 2005-07-15 22:41:16Z rstory $ ++ * ++ * $Id:$ ++ */ ++#ifndef IPDEFAULTROUTERTABLE_ENUMS_H ++#define IPDEFAULTROUTERTABLE_ENUMS_H ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++ /* ++ * NOTES on enums ++ * ============== ++ * ++ * Value Mapping ++ * ------------- ++ * If the values for your data type don't exactly match the ++ * possible values defined by the mib, you should map them ++ * below. For example, a boolean flag (1/0) is usually represented ++ * as a TruthValue in a MIB, which maps to the values (1/2). ++ * ++ */ ++/************************************************************************* ++ ************************************************************************* ++ * ++ * enum definitions for table ipDefaultRouterTable ++ * ++ ************************************************************************* ++ *************************************************************************/ ++ ++/************************************************************* ++ * constants for enums for the MIB node ++ * ipDefaultRouterLifetime (UNSIGNED32 / ASN_UNSIGNED) ++ * ++ * since a Textual Convention may be referenced more than once in a ++ * MIB, protect againt redefinitions of the enum values. ++ */ ++#ifndef IPDEFAULTROUTERLIFETIME_ENUMS ++#define IPDEFAULTROUTERLIFETIME_ENUMS ++ ++#define IPDEFAULTROUTERLIFETIME_MIN 0 ++#define IPDEFAULTROUTERLIFETIME_MAX 0xFFFFFFFFUL ++ ++#endif /* IPDEFAULTROUTERLIFETIME_ENUMS */ ++ ++ ++/************************************************************* ++ * constants for enums for the MIB node ++ * ipDefaultRouterAddressType (InetAddressType / ASN_INTEGER) ++ * ++ * since a Textual Convention may be referenced more than once in a ++ * MIB, protect againt redefinitions of the enum values. ++ */ ++#ifndef INETADDRESSTYPE_ENUMS ++#define INETADDRESSTYPE_ENUMS ++ ++#define INETADDRESSTYPE_UNKNOWN 0 ++#define INETADDRESSTYPE_IPV4 1 ++#define INETADDRESSTYPE_IPV6 2 ++#define INETADDRESSTYPE_IPV4Z 3 ++#define INETADDRESSTYPE_IPV6Z 4 ++#define INETADDRESSTYPE_DNS 16 ++ ++#endif /* INETADDRESSTYPE_ENUMS */ ++ ++ ++/************************************************************* ++ * constants for enums for the MIB node ++ * ipDefaultRouterPreference (INTEGER / ASN_INTEGER) ++ * ++ * since a Textual Convention may be referenced more than once in a ++ * MIB, protect againt redefinitions of the enum values. ++ */ ++#ifndef IPDEFAULTROUTERPREFERENCE_ENUMS ++#define IPDEFAULTROUTERPREFERENCE_ENUMS ++ ++#define IPDEFAULTROUTERPREFERENCE_RESERVED -2 ++#define IPDEFAULTROUTERPREFERENCE_LOW -1 ++#define IPDEFAULTROUTERPREFERENCE_MEDIUM 0 ++#define IPDEFAULTROUTERPREFERENCE_HIGH 1 ++ ++#endif /* IPDEFAULTROUTERPREFERENCE_ENUMS */ ++ ++ ++ ++ ++#ifdef __cplusplus ++} ++#endif ++#endif /* IPDEFAULTROUTERTABLE_ENUMS_H */ +diff --git a/agent/mibgroup/ip-mib/ipDefaultRouterTable/ipDefaultRouterTable_interface.c b/agent/mibgroup/ip-mib/ipDefaultRouterTable/ipDefaultRouterTable_interface.c +new file mode 100644 +index 0000000..afe7e57 +--- /dev/null ++++ b/agent/mibgroup/ip-mib/ipDefaultRouterTable/ipDefaultRouterTable_interface.c +@@ -0,0 +1,1018 @@ ++/* ++ * Note: this file originally auto-generated by mib2c using ++ * version : 15899 $ of $ ++ * ++ * $Id:$ ++ */ ++/* ++ * ********************************************************************* ++ * ********************************************************************* ++ * ********************************************************************* ++ * *** *** ++ * *** NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE *** ++ * *** *** ++ * *** *** ++ * *** THIS FILE DOES NOT CONTAIN ANY USER EDITABLE CODE. *** ++ * *** *** ++ * *** *** ++ * *** THE GENERATED CODE IS INTERNAL IMPLEMENTATION, AND *** ++ * *** *** ++ * *** *** ++ * *** IS SUBJECT TO CHANGE WITHOUT WARNING IN FUTURE RELEASES. *** ++ * *** *** ++ * *** *** ++ * ********************************************************************* ++ * ********************************************************************* ++ * ********************************************************************* ++ */ ++ ++/* ++ * standard Net-SNMP includes ++ */ ++#include ++#include ++#include ++ ++/* ++ * include our parent header ++ */ ++#include "ipDefaultRouterTable.h" ++ ++ ++#include ++#include ++ ++#include "ipDefaultRouterTable_interface.h" ++ ++#include ++ ++/********************************************************************** ++ ********************************************************************** ++ *** ++ *** Table ipDefaultRouterTable ++ *** ++ ********************************************************************** ++ **********************************************************************/ ++/* ++ * IP-MIB::ipDefaultRouterTable is subid 37 of ip. ++ * Its status is Current. ++ * OID: .1.3.6.1.2.1.4.37, length: 8 ++ */ ++typedef struct ipDefaultRouterTable_interface_ctx_s { ++ ++ netsnmp_container *container; ++ netsnmp_cache *cache; ++ ++ ipDefaultRouterTable_registration *user_ctx; ++ ++ netsnmp_table_registration_info tbl_info; ++ ++ netsnmp_baby_steps_access_methods access_multiplexer; ++ ++} ipDefaultRouterTable_interface_ctx; ++ ++static ipDefaultRouterTable_interface_ctx ipDefaultRouterTable_if_ctx; ++ ++static void ++_ipDefaultRouterTable_container_init(ipDefaultRouterTable_interface_ctx * ++ if_ctx); ++static void ++_ipDefaultRouterTable_container_shutdown(ipDefaultRouterTable_interface_ctx ++ * if_ctx); ++ ++ ++netsnmp_container * ++ipDefaultRouterTable_container_get(void) ++{ ++ return ipDefaultRouterTable_if_ctx.container; ++} ++ ++ipDefaultRouterTable_registration * ++ipDefaultRouterTable_registration_get(void) ++{ ++ return ipDefaultRouterTable_if_ctx.user_ctx; ++} ++ ++ipDefaultRouterTable_registration * ++ipDefaultRouterTable_registration_set(ipDefaultRouterTable_registration * ++ newreg) ++{ ++ ipDefaultRouterTable_registration *old = ++ ipDefaultRouterTable_if_ctx.user_ctx; ++ ipDefaultRouterTable_if_ctx.user_ctx = newreg; ++ return old; ++} ++ ++int ++ipDefaultRouterTable_container_size(void) ++{ ++ return CONTAINER_SIZE(ipDefaultRouterTable_if_ctx.container); ++} ++ ++/* ++ * mfd multiplexer modes ++ */ ++static Netsnmp_Node_Handler _mfd_ipDefaultRouterTable_pre_request; ++static Netsnmp_Node_Handler _mfd_ipDefaultRouterTable_post_request; ++static Netsnmp_Node_Handler _mfd_ipDefaultRouterTable_object_lookup; ++static Netsnmp_Node_Handler _mfd_ipDefaultRouterTable_get_values; ++/** ++ * @internal ++ * Initialize the table ipDefaultRouterTable ++ * (Define its contents and how it's structured) ++ */ ++void ++_ipDefaultRouterTable_initialize_interface ++ (ipDefaultRouterTable_registration * reg_ptr, u_long flags) ++{ ++ netsnmp_baby_steps_access_methods *access_multiplexer = ++ &ipDefaultRouterTable_if_ctx.access_multiplexer; ++ netsnmp_table_registration_info *tbl_info = ++ &ipDefaultRouterTable_if_ctx.tbl_info; ++ netsnmp_handler_registration *reginfo; ++ netsnmp_mib_handler *handler; ++ int mfd_modes = 0; ++ ++ DEBUGMSGTL(("internal:ipDefaultRouterTable:_ipDefaultRouterTable_initialize_interface", "called\n")); ++ ++ ++ /************************************************* ++ * ++ * save interface context for ipDefaultRouterTable ++ */ ++ /* ++ * Setting up the table's definition ++ */ ++ netsnmp_table_helper_add_indexes(tbl_info, ASN_INTEGER, ++ /** index: ipDefaultRouterAddressType */ ++ ASN_OCTET_STR, ++ /** index: ipDefaultRouterAddress */ ++ ASN_INTEGER, ++ /** index: ipDefaultRouterIfIndex */ ++ 0); ++ ++ /* ++ * Define the minimum and maximum accessible columns. This ++ * optimizes retrival. ++ */ ++ tbl_info->min_column = IPDEFAULTROUTERTABLE_MIN_COL; ++ tbl_info->max_column = IPDEFAULTROUTERTABLE_MAX_COL; ++ ++ /* ++ * save users context ++ */ ++ ipDefaultRouterTable_if_ctx.user_ctx = reg_ptr; ++ ++ /* ++ * call data access initialization code ++ */ ++ ipDefaultRouterTable_init_data(reg_ptr); ++ ++ /* ++ * set up the container ++ */ ++ _ipDefaultRouterTable_container_init(&ipDefaultRouterTable_if_ctx); ++ if (NULL == ipDefaultRouterTable_if_ctx.container) { ++ snmp_log(LOG_ERR, ++ "could not initialize container for ipDefaultRouterTable\n"); ++ return; ++ } ++ ++ /* ++ * access_multiplexer: REQUIRED wrapper for get request handling ++ */ ++ access_multiplexer->object_lookup = ++ _mfd_ipDefaultRouterTable_object_lookup; ++ access_multiplexer->get_values = _mfd_ipDefaultRouterTable_get_values; ++ ++ /* ++ * no wrappers yet ++ */ ++ access_multiplexer->pre_request = ++ _mfd_ipDefaultRouterTable_pre_request; ++ access_multiplexer->post_request = ++ _mfd_ipDefaultRouterTable_post_request; ++ ++ ++ /************************************************* ++ * ++ * Create a registration, save our reg data, register table. ++ */ ++ DEBUGMSGTL(("ipDefaultRouterTable:init_ipDefaultRouterTable", ++ "Registering ipDefaultRouterTable as a mibs-for-dummies table.\n")); ++ handler = ++ netsnmp_baby_steps_access_multiplexer_get(access_multiplexer); ++ reginfo = ++ netsnmp_handler_registration_create("ipDefaultRouterTable", ++ handler, ++ ipDefaultRouterTable_oid, ++ ipDefaultRouterTable_oid_size, ++ HANDLER_CAN_BABY_STEP | ++ HANDLER_CAN_RONLY); ++ if (NULL == reginfo) { ++ snmp_log(LOG_ERR, ++ "error registering table ipDefaultRouterTable\n"); ++ return; ++ } ++ reginfo->my_reg_void = &ipDefaultRouterTable_if_ctx; ++ ++ /************************************************* ++ * ++ * set up baby steps handler, create it and inject it ++ */ ++ if (access_multiplexer->object_lookup) ++ mfd_modes |= BABY_STEP_OBJECT_LOOKUP; ++ if (access_multiplexer->set_values) ++ mfd_modes |= BABY_STEP_SET_VALUES; ++ if (access_multiplexer->irreversible_commit) ++ mfd_modes |= BABY_STEP_IRREVERSIBLE_COMMIT; ++ if (access_multiplexer->object_syntax_checks) ++ mfd_modes |= BABY_STEP_CHECK_OBJECT; ++ ++ if (access_multiplexer->pre_request) ++ mfd_modes |= BABY_STEP_PRE_REQUEST; ++ if (access_multiplexer->post_request) ++ mfd_modes |= BABY_STEP_POST_REQUEST; ++ ++ if (access_multiplexer->undo_setup) ++ mfd_modes |= BABY_STEP_UNDO_SETUP; ++ if (access_multiplexer->undo_cleanup) ++ mfd_modes |= BABY_STEP_UNDO_CLEANUP; ++ if (access_multiplexer->undo_sets) ++ mfd_modes |= BABY_STEP_UNDO_SETS; ++ ++ if (access_multiplexer->row_creation) ++ mfd_modes |= BABY_STEP_ROW_CREATE; ++ if (access_multiplexer->consistency_checks) ++ mfd_modes |= BABY_STEP_CHECK_CONSISTENCY; ++ if (access_multiplexer->commit) ++ mfd_modes |= BABY_STEP_COMMIT; ++ if (access_multiplexer->undo_commit) ++ mfd_modes |= BABY_STEP_UNDO_COMMIT; ++ ++ handler = netsnmp_baby_steps_handler_get(mfd_modes); ++ netsnmp_inject_handler(reginfo, handler); ++ ++ /************************************************* ++ * ++ * inject row_merge helper with prefix rootoid_len + 2 (entry.col) ++ */ ++ handler = netsnmp_get_row_merge_handler(reginfo->rootoid_len + 2); ++ netsnmp_inject_handler(reginfo, handler); ++ ++ /************************************************* ++ * ++ * inject container_table helper ++ */ ++ handler = ++ netsnmp_container_table_handler_get(tbl_info, ++ ipDefaultRouterTable_if_ctx. ++ container, ++ TABLE_CONTAINER_KEY_NETSNMP_INDEX); ++ netsnmp_inject_handler(reginfo, handler); ++ ++ /************************************************* ++ * ++ * inject cache helper ++ */ ++ if (NULL != ipDefaultRouterTable_if_ctx.cache) { ++ handler = ++ netsnmp_cache_handler_get(ipDefaultRouterTable_if_ctx.cache); ++ netsnmp_inject_handler(reginfo, handler); ++ } ++ ++ /* ++ * register table ++ */ ++ netsnmp_register_table(reginfo, tbl_info); ++ ++} /* _ipDefaultRouterTable_initialize_interface */ ++ ++/** ++ * @internal ++ * Shutdown the table ipDefaultRouterTable ++ */ ++void ++_ipDefaultRouterTable_shutdown_interface(ipDefaultRouterTable_registration ++ * reg_ptr) ++{ ++ /* ++ * shutdown the container ++ */ ++ _ipDefaultRouterTable_container_shutdown(&ipDefaultRouterTable_if_ctx); ++} ++ ++void ++ipDefaultRouterTable_valid_columns_set(netsnmp_column_info *vc) ++{ ++ ipDefaultRouterTable_if_ctx.tbl_info.valid_columns = vc; ++} /* ipDefaultRouterTable_valid_columns_set */ ++ ++/** ++ * @internal ++ * convert the index component stored in the context to an oid ++ */ ++int ++ipDefaultRouterTable_index_to_oid(netsnmp_index * oid_idx, ++ ipDefaultRouterTable_mib_index * mib_idx) ++{ ++ int err = SNMP_ERR_NOERROR; ++ ++ /* ++ * temp storage for parsing indexes ++ */ ++ /* ++ * ipDefaultRouterAddressType(1)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h ++ */ ++ netsnmp_variable_list var_ipDefaultRouterAddressType; ++ /* ++ * ipDefaultRouterAddress(2)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h ++ */ ++ netsnmp_variable_list var_ipDefaultRouterAddress; ++ /* ++ * ipDefaultRouterIfIndex(3)/InterfaceIndex/ASN_INTEGER/long(long)//l/a/w/e/R/d/H ++ */ ++ netsnmp_variable_list var_ipDefaultRouterIfIndex; ++ ++ /* ++ * set up varbinds ++ */ ++ memset(&var_ipDefaultRouterAddressType, 0x00, ++ sizeof(var_ipDefaultRouterAddressType)); ++ var_ipDefaultRouterAddressType.type = ASN_INTEGER; ++ memset(&var_ipDefaultRouterAddress, 0x00, ++ sizeof(var_ipDefaultRouterAddress)); ++ var_ipDefaultRouterAddress.type = ASN_OCTET_STR; ++ memset(&var_ipDefaultRouterIfIndex, 0x00, ++ sizeof(var_ipDefaultRouterIfIndex)); ++ var_ipDefaultRouterIfIndex.type = ASN_INTEGER; ++ ++ /* ++ * chain temp index varbinds together ++ */ ++ var_ipDefaultRouterAddressType.next_variable = ++ &var_ipDefaultRouterAddress; ++ var_ipDefaultRouterAddress.next_variable = &var_ipDefaultRouterIfIndex; ++ var_ipDefaultRouterIfIndex.next_variable = NULL; ++ ++ ++ DEBUGMSGTL(("verbose:ipDefaultRouterTable:ipDefaultRouterTable_index_to_oid", "called\n")); ++ ++ /* ++ * ipDefaultRouterAddressType(1)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h ++ */ ++ snmp_set_var_value(&var_ipDefaultRouterAddressType, ++ (u_char *) & mib_idx->ipDefaultRouterAddressType, ++ sizeof(mib_idx->ipDefaultRouterAddressType)); ++ ++ /* ++ * ipDefaultRouterAddress(2)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h ++ */ ++ snmp_set_var_value(&var_ipDefaultRouterAddress, ++ (u_char *) & mib_idx->ipDefaultRouterAddress, ++ mib_idx->ipDefaultRouterAddress_len * ++ sizeof(mib_idx->ipDefaultRouterAddress[0])); ++ ++ /* ++ * ipDefaultRouterIfIndex(3)/InterfaceIndex/ASN_INTEGER/long(long)//l/a/w/e/R/d/H ++ */ ++ snmp_set_var_value(&var_ipDefaultRouterIfIndex, ++ (u_char *) & mib_idx->ipDefaultRouterIfIndex, ++ sizeof(mib_idx->ipDefaultRouterIfIndex)); ++ ++ ++ err = build_oid_noalloc(oid_idx->oids, oid_idx->len, &oid_idx->len, ++ NULL, 0, &var_ipDefaultRouterAddressType); ++ if (err) ++ snmp_log(LOG_ERR, "error %d converting index to oid\n", err); ++ ++ /* ++ * parsing may have allocated memory. free it. ++ */ ++ snmp_reset_var_buffers(&var_ipDefaultRouterAddressType); ++ ++ return err; ++} /* ipDefaultRouterTable_index_to_oid */ ++ ++/** ++ * extract ipDefaultRouterTable indexes from a netsnmp_index ++ * ++ * @retval SNMP_ERR_NOERROR : no error ++ * @retval SNMP_ERR_GENERR : error ++ */ ++int ++ipDefaultRouterTable_index_from_oid(netsnmp_index * oid_idx, ++ ipDefaultRouterTable_mib_index * ++ mib_idx) ++{ ++ int err = SNMP_ERR_NOERROR; ++ ++ /* ++ * temp storage for parsing indexes ++ */ ++ /* ++ * ipDefaultRouterAddressType(1)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h ++ */ ++ netsnmp_variable_list var_ipDefaultRouterAddressType; ++ /* ++ * ipDefaultRouterAddress(2)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h ++ */ ++ netsnmp_variable_list var_ipDefaultRouterAddress; ++ /* ++ * ipDefaultRouterIfIndex(3)/InterfaceIndex/ASN_INTEGER/long(long)//l/a/w/e/R/d/H ++ */ ++ netsnmp_variable_list var_ipDefaultRouterIfIndex; ++ ++ /* ++ * set up varbinds ++ */ ++ memset(&var_ipDefaultRouterAddressType, 0x00, ++ sizeof(var_ipDefaultRouterAddressType)); ++ var_ipDefaultRouterAddressType.type = ASN_INTEGER; ++ memset(&var_ipDefaultRouterAddress, 0x00, ++ sizeof(var_ipDefaultRouterAddress)); ++ var_ipDefaultRouterAddress.type = ASN_OCTET_STR; ++ memset(&var_ipDefaultRouterIfIndex, 0x00, ++ sizeof(var_ipDefaultRouterIfIndex)); ++ var_ipDefaultRouterIfIndex.type = ASN_INTEGER; ++ ++ /* ++ * chain temp index varbinds together ++ */ ++ var_ipDefaultRouterAddressType.next_variable = ++ &var_ipDefaultRouterAddress; ++ var_ipDefaultRouterAddress.next_variable = &var_ipDefaultRouterIfIndex; ++ var_ipDefaultRouterIfIndex.next_variable = NULL; ++ ++ ++ DEBUGMSGTL(("verbose:ipDefaultRouterTable:ipDefaultRouterTable_index_from_oid", "called\n")); ++ ++ /* ++ * parse the oid into the individual index components ++ */ ++ err = parse_oid_indexes(oid_idx->oids, oid_idx->len, ++ &var_ipDefaultRouterAddressType); ++ if (err == SNMP_ERR_NOERROR) { ++ /* ++ * copy out values ++ */ ++ mib_idx->ipDefaultRouterAddressType = ++ *((u_long *) var_ipDefaultRouterAddressType.val.string); ++ /* ++ * NOTE: val_len is in bytes, ipDefaultRouterAddress_len might not be ++ */ ++ if (var_ipDefaultRouterAddress.val_len > ++ sizeof(mib_idx->ipDefaultRouterAddress)) ++ err = SNMP_ERR_GENERR; ++ else { ++ memcpy(mib_idx->ipDefaultRouterAddress, ++ var_ipDefaultRouterAddress.val.string, ++ var_ipDefaultRouterAddress.val_len); ++ mib_idx->ipDefaultRouterAddress_len = ++ var_ipDefaultRouterAddress.val_len / ++ sizeof(mib_idx->ipDefaultRouterAddress[0]); ++ } ++ mib_idx->ipDefaultRouterIfIndex = ++ *((long *) var_ipDefaultRouterIfIndex.val.string); ++ ++ ++ } ++ ++ /* ++ * parsing may have allocated memory. free it. ++ */ ++ snmp_reset_var_buffers(&var_ipDefaultRouterAddressType); ++ ++ return err; ++} /* ipDefaultRouterTable_index_from_oid */ ++ ++ ++/* ++ ********************************************************************* ++ * @internal ++ * allocate resources for a ipDefaultRouterTable_rowreq_ctx ++ */ ++ipDefaultRouterTable_rowreq_ctx * ++ipDefaultRouterTable_allocate_rowreq_ctx(ipDefaultRouterTable_data * data, ++ void *user_init_ctx) ++{ ++ ipDefaultRouterTable_rowreq_ctx *rowreq_ctx = ++ SNMP_MALLOC_TYPEDEF(ipDefaultRouterTable_rowreq_ctx); ++ ++ DEBUGMSGTL(("internal:ipDefaultRouterTable:ipDefaultRouterTable_allocate_rowreq_ctx", "called\n")); ++ ++ if (NULL == rowreq_ctx) { ++ snmp_log(LOG_ERR, "Couldn't allocate memory for a " ++ "ipDefaultRouterTable_rowreq_ctx.\n"); ++ return NULL; ++ } else { ++ if (NULL != data) { ++ /* ++ * track if we got data from user ++ */ ++ rowreq_ctx->rowreq_flags |= MFD_ROW_DATA_FROM_USER; ++ rowreq_ctx->data = data; ++ } else if (NULL == ++ (rowreq_ctx->data = ++ ipDefaultRouterTable_allocate_data())) { ++ SNMP_FREE(rowreq_ctx); ++ return NULL; ++ } ++ } ++ ++ /* ++ * undo context will be allocated when needed (in *_undo_setup) ++ */ ++ ++ rowreq_ctx->oid_idx.oids = rowreq_ctx->oid_tmp; ++ ++ rowreq_ctx->ipDefaultRouterTable_data_list = NULL; ++ ++ /* ++ * if we allocated data, call init routine ++ */ ++ if (!(rowreq_ctx->rowreq_flags & MFD_ROW_DATA_FROM_USER)) { ++ if (SNMPERR_SUCCESS != ++ ipDefaultRouterTable_rowreq_ctx_init(rowreq_ctx, ++ user_init_ctx)) { ++ ipDefaultRouterTable_release_rowreq_ctx(rowreq_ctx); ++ rowreq_ctx = NULL; ++ } ++ } ++ ++ return rowreq_ctx; ++} /* ipDefaultRouterTable_allocate_rowreq_ctx */ ++ ++/* ++ * @internal ++ * release resources for a ipDefaultRouterTable_rowreq_ctx ++ */ ++void ++ipDefaultRouterTable_release_rowreq_ctx(ipDefaultRouterTable_rowreq_ctx * ++ rowreq_ctx) ++{ ++ DEBUGMSGTL(("internal:ipDefaultRouterTable:ipDefaultRouterTable_release_rowreq_ctx", "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ ipDefaultRouterTable_rowreq_ctx_cleanup(rowreq_ctx); ++ ++ /* ++ * for non-transient data, don't free data we got from the user ++ */ ++ if ((rowreq_ctx->data) && ++ !(rowreq_ctx->rowreq_flags & MFD_ROW_DATA_FROM_USER)) ++ ipDefaultRouterTable_release_data(rowreq_ctx->data); ++ ++ /* ++ * free index oid pointer ++ */ ++ if (rowreq_ctx->oid_idx.oids != rowreq_ctx->oid_tmp) ++ free(rowreq_ctx->oid_idx.oids); ++ ++ SNMP_FREE(rowreq_ctx); ++} /* ipDefaultRouterTable_release_rowreq_ctx */ ++ ++/** ++ * @internal ++ * wrapper ++ */ ++static int ++_mfd_ipDefaultRouterTable_pre_request(netsnmp_mib_handler *handler, ++ netsnmp_handler_registration ++ *reginfo, ++ netsnmp_agent_request_info ++ *agtreq_info, ++ netsnmp_request_info *requests) ++{ ++ int rc; ++ ++ DEBUGMSGTL(("internal:ipDefaultRouterTable:_mfd_ipDefaultRouterTable_pre_request", "called\n")); ++ ++ if (1 != netsnmp_row_merge_status_first(reginfo, agtreq_info)) { ++ DEBUGMSGTL(("internal:ipDefaultRouterTable", ++ "skipping additional pre_request\n")); ++ return SNMP_ERR_NOERROR; ++ } ++ ++ rc = ipDefaultRouterTable_pre_request(ipDefaultRouterTable_if_ctx. ++ user_ctx); ++ if (MFD_SUCCESS != rc) { ++ /* ++ * nothing we can do about it but log it ++ */ ++ DEBUGMSGTL(("ipDefaultRouterTable", "error %d from " ++ "ipDefaultRouterTable_pre_request\n", rc)); ++ netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc)); ++ } ++ ++ return SNMP_ERR_NOERROR; ++} /* _mfd_ipDefaultRouterTable_pre_request */ ++ ++/** ++ * @internal ++ * wrapper ++ */ ++static int ++_mfd_ipDefaultRouterTable_post_request(netsnmp_mib_handler *handler, ++ netsnmp_handler_registration ++ *reginfo, ++ netsnmp_agent_request_info ++ *agtreq_info, ++ netsnmp_request_info *requests) ++{ ++ ipDefaultRouterTable_rowreq_ctx *rowreq_ctx = ++ netsnmp_container_table_row_extract(requests); ++ int rc, packet_rc; ++ ++ DEBUGMSGTL(("internal:ipDefaultRouterTable:_mfd_ipDefaultRouterTable_post_request", "called\n")); ++ ++ /* ++ * release row context, if deleted ++ */ ++ if (rowreq_ctx && (rowreq_ctx->rowreq_flags & MFD_ROW_DELETED)) ++ ipDefaultRouterTable_release_rowreq_ctx(rowreq_ctx); ++ ++ /* ++ * wait for last call before calling user ++ */ ++ if (1 != netsnmp_row_merge_status_last(reginfo, agtreq_info)) { ++ DEBUGMSGTL(("internal:ipDefaultRouterTable", ++ "waiting for last post_request\n")); ++ return SNMP_ERR_NOERROR; ++ } ++ ++ packet_rc = netsnmp_check_all_requests_error(agtreq_info->asp, 0); ++ rc = ipDefaultRouterTable_post_request(ipDefaultRouterTable_if_ctx. ++ user_ctx, packet_rc); ++ if (MFD_SUCCESS != rc) { ++ /* ++ * nothing we can do about it but log it ++ */ ++ DEBUGMSGTL(("ipDefaultRouterTable", "error %d from " ++ "ipDefaultRouterTable_post_request\n", rc)); ++ } ++ ++ return SNMP_ERR_NOERROR; ++} /* _mfd_ipDefaultRouterTable_post_request */ ++ ++/** ++ * @internal ++ * wrapper ++ */ ++static int ++_mfd_ipDefaultRouterTable_object_lookup(netsnmp_mib_handler *handler, ++ netsnmp_handler_registration ++ *reginfo, ++ netsnmp_agent_request_info ++ *agtreq_info, ++ netsnmp_request_info *requests) ++{ ++ int rc = SNMP_ERR_NOERROR; ++ ipDefaultRouterTable_rowreq_ctx *rowreq_ctx = ++ netsnmp_container_table_row_extract(requests); ++ ++ DEBUGMSGTL(("internal:ipDefaultRouterTable:_mfd_ipDefaultRouterTable_object_lookup", "called\n")); ++ ++ /* ++ * get our context from mfd ++ * ipDefaultRouterTable_interface_ctx *if_ctx = ++ * (ipDefaultRouterTable_interface_ctx *)reginfo->my_reg_void; ++ */ ++ ++ if (NULL == rowreq_ctx) { ++ rc = SNMP_ERR_NOCREATION; ++ } ++ ++ if (MFD_SUCCESS != rc) ++ netsnmp_request_set_error_all(requests, rc); ++ else ++ ipDefaultRouterTable_row_prep(rowreq_ctx); ++ ++ return SNMP_VALIDATE_ERR(rc); ++} /* _mfd_ipDefaultRouterTable_object_lookup */ ++ ++/*********************************************************************** ++ * ++ * GET processing ++ * ++ ***********************************************************************/ ++/* ++ * @internal ++ * Retrieve the value for a particular column ++ */ ++NETSNMP_STATIC_INLINE int ++_ipDefaultRouterTable_get_column(ipDefaultRouterTable_rowreq_ctx * ++ rowreq_ctx, netsnmp_variable_list * var, ++ int column) ++{ ++ int rc = SNMPERR_SUCCESS; ++ ++ DEBUGMSGTL(("internal:ipDefaultRouterTable:_mfd_ipDefaultRouterTable_get_column", "called for %d\n", column)); ++ ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ switch (column) { ++ ++ /* ++ * ipDefaultRouterLifetime(4)/UNSIGNED32/ASN_UNSIGNED/u_long(u_long)//l/A/w/e/R/d/h ++ */ ++ case COLUMN_IPDEFAULTROUTERLIFETIME: ++ var->val_len = sizeof(u_long); ++ var->type = ASN_UNSIGNED; ++ rc = ipDefaultRouterLifetime_get(rowreq_ctx, ++ (u_long *) var->val.string); ++ break; ++ ++ /* ++ * ipDefaultRouterPreference(5)/INTEGER/ASN_INTEGER/long(u_long)//l/A/w/E/r/d/h ++ */ ++ case COLUMN_IPDEFAULTROUTERPREFERENCE: ++ var->val_len = sizeof(u_long); ++ var->type = ASN_INTEGER; ++ rc = ipDefaultRouterPreference_get(rowreq_ctx, ++ (u_long *) var->val.string); ++ break; ++ ++ default: ++ if (IPDEFAULTROUTERTABLE_MIN_COL <= column ++ && column <= IPDEFAULTROUTERTABLE_MAX_COL) { ++ DEBUGMSGTL(("internal:ipDefaultRouterTable:_mfd_ipDefaultRouterTable_get_column", "assume column %d is reserved\n", column)); ++ rc = MFD_SKIP; ++ } else { ++ snmp_log(LOG_ERR, ++ "unknown column %d in _ipDefaultRouterTable_get_column\n", ++ column); ++ } ++ break; ++ } ++ ++ return rc; ++} /* _ipDefaultRouterTable_get_column */ ++ ++int ++_mfd_ipDefaultRouterTable_get_values(netsnmp_mib_handler *handler, ++ netsnmp_handler_registration *reginfo, ++ netsnmp_agent_request_info ++ *agtreq_info, ++ netsnmp_request_info *requests) ++{ ++ ipDefaultRouterTable_rowreq_ctx *rowreq_ctx = ++ netsnmp_container_table_row_extract(requests); ++ netsnmp_table_request_info *tri; ++ u_char *old_string; ++ void (*dataFreeHook) (void *); ++ int rc; ++ ++ DEBUGMSGTL(("internal:ipDefaultRouterTable:_mfd_ipDefaultRouterTable_get_values", "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ for (; requests; requests = requests->next) { ++ /* ++ * save old pointer, so we can free it if replaced ++ */ ++ old_string = requests->requestvb->val.string; ++ dataFreeHook = requests->requestvb->dataFreeHook; ++ if (NULL == requests->requestvb->val.string) { ++ requests->requestvb->val.string = requests->requestvb->buf; ++ requests->requestvb->val_len = ++ sizeof(requests->requestvb->buf); ++ } else if (requests->requestvb->buf == ++ requests->requestvb->val.string) { ++ if (requests->requestvb->val_len != ++ sizeof(requests->requestvb->buf)) ++ requests->requestvb->val_len = ++ sizeof(requests->requestvb->buf); ++ } ++ ++ /* ++ * get column data ++ */ ++ tri = netsnmp_extract_table_info(requests); ++ if (NULL == tri) ++ continue; ++ ++ rc = _ipDefaultRouterTable_get_column(rowreq_ctx, ++ requests->requestvb, ++ tri->colnum); ++ if (rc) { ++ if (MFD_SKIP == rc) { ++ requests->requestvb->type = SNMP_NOSUCHINSTANCE; ++ rc = SNMP_ERR_NOERROR; ++ } ++ } else if (NULL == requests->requestvb->val.string) { ++ snmp_log(LOG_ERR, "NULL varbind data pointer!\n"); ++ rc = SNMP_ERR_GENERR; ++ } ++ if (rc) ++ netsnmp_request_set_error(requests, SNMP_VALIDATE_ERR(rc)); ++ ++ /* ++ * if the buffer wasn't used previously for the old data (i.e. it ++ * was allcoated memory) and the get routine replaced the pointer, ++ * we need to free the previous pointer. ++ */ ++ if (old_string && (old_string != requests->requestvb->buf) && ++ (requests->requestvb->val.string != old_string)) { ++ if (dataFreeHook) ++ (*dataFreeHook) (old_string); ++ else ++ free(old_string); ++ } ++ } /* for results */ ++ ++ return SNMP_ERR_NOERROR; ++} /* _mfd_ipDefaultRouterTable_get_values */ ++ ++ ++/*********************************************************************** ++ * ++ * SET processing ++ * ++ ***********************************************************************/ ++ ++/* ++ * SET PROCESSING NOT APPLICABLE (per MIB or user setting) ++ */ ++/*********************************************************************** ++ * ++ * DATA ACCESS ++ * ++ ***********************************************************************/ ++static void _container_free(netsnmp_container * container); ++ ++/** ++ * @internal ++ */ ++static int ++_cache_load(netsnmp_cache * cache, void *vmagic) ++{ ++ DEBUGMSGTL(("internal:ipDefaultRouterTable:_cache_load", "called\n")); ++ ++ if ((NULL == cache) || (NULL == cache->magic)) { ++ snmp_log(LOG_ERR, ++ "invalid cache for ipDefaultRouterTable_cache_load\n"); ++ return -1; ++ } ++ ++ /** should only be called for an invalid or expired cache */ ++ netsnmp_assert((0 == cache->valid) || (1 == cache->expired)); ++ ++ /* ++ * call user code ++ */ ++ return ipDefaultRouterTable_container_load((netsnmp_container *) ++ cache->magic); ++} /* _cache_load */ ++ ++/** ++ * @internal ++ */ ++static void ++_cache_free(netsnmp_cache * cache, void *magic) ++{ ++ netsnmp_container *container; ++ ++ DEBUGMSGTL(("internal:ipDefaultRouterTable:_cache_free", "called\n")); ++ ++ if ((NULL == cache) || (NULL == cache->magic)) { ++ snmp_log(LOG_ERR, ++ "invalid cache in ipDefaultRouterTable_cache_free\n"); ++ return; ++ } ++ ++ container = (netsnmp_container *) cache->magic; ++ ++ _container_free(container); ++} /* _cache_free */ ++ ++/** ++ * @internal ++ */ ++static void ++_container_item_free(ipDefaultRouterTable_rowreq_ctx * rowreq_ctx, ++ void *context) ++{ ++ DEBUGMSGTL(("internal:ipDefaultRouterTable:_container_item_free", ++ "called\n")); ++ ++ if (NULL == rowreq_ctx) ++ return; ++ ++ ipDefaultRouterTable_release_rowreq_ctx(rowreq_ctx); ++} /* _container_item_free */ ++ ++/** ++ * @internal ++ */ ++static void ++_container_free(netsnmp_container * container) ++{ ++ DEBUGMSGTL(("internal:ipDefaultRouterTable:_container_free", ++ "called\n")); ++ ++ if (NULL == container) { ++ snmp_log(LOG_ERR, ++ "invalid container in ipDefaultRouterTable_container_free\n"); ++ return; ++ } ++ ++ /* ++ * call user code ++ */ ++ ipDefaultRouterTable_container_free(container); ++ ++ /* ++ * free all items. inefficient, but easy. ++ */ ++ CONTAINER_CLEAR(container, ++ (netsnmp_container_obj_func *) _container_item_free, ++ NULL); ++} /* _container_free */ ++ ++/** ++ * @internal ++ * initialize the container with functions or wrappers ++ */ ++void ++_ipDefaultRouterTable_container_init(ipDefaultRouterTable_interface_ctx * ++ if_ctx) ++{ ++ DEBUGMSGTL(("internal:ipDefaultRouterTable:_ipDefaultRouterTable_container_init", "called\n")); ++ ++ /* ++ * cache init ++ */ ++ if_ctx->cache = netsnmp_cache_create(30, /* timeout in seconds */ ++ _cache_load, _cache_free, ++ ipDefaultRouterTable_oid, ++ ipDefaultRouterTable_oid_size); ++ ++ if (NULL == if_ctx->cache) { ++ snmp_log(LOG_ERR, ++ "error creating cache for ipDefaultRouterTable\n"); ++ return; ++ } ++ ++ if_ctx->cache->flags = NETSNMP_CACHE_DONT_INVALIDATE_ON_SET; ++ ++ ipDefaultRouterTable_container_init(&if_ctx->container, if_ctx->cache); ++ if (NULL == if_ctx->container) ++ if_ctx->container = ++ netsnmp_container_find("ipDefaultRouterTable:table_container"); ++ if (NULL == if_ctx->container) { ++ snmp_log(LOG_ERR, "error creating container in " ++ "ipDefaultRouterTable_container_init\n"); ++ return; ++ } ++ ++ if (NULL != if_ctx->cache) ++ if_ctx->cache->magic = (void *) if_ctx->container; ++} /* _ipDefaultRouterTable_container_init */ ++ ++/** ++ * @internal ++ * shutdown the container with functions or wrappers ++ */ ++void ++_ipDefaultRouterTable_container_shutdown(ipDefaultRouterTable_interface_ctx ++ * if_ctx) ++{ ++ DEBUGMSGTL(("internal:ipDefaultRouterTable:_ipDefaultRouterTable_container_shutdown", "called\n")); ++ ++ ipDefaultRouterTable_container_shutdown(if_ctx->container); ++ ++ _container_free(if_ctx->container); ++ ++} /* _ipDefaultRouterTable_container_shutdown */ ++ ++ ++ipDefaultRouterTable_rowreq_ctx * ++ipDefaultRouterTable_row_find_by_mib_index(ipDefaultRouterTable_mib_index * ++ mib_idx) ++{ ++ ipDefaultRouterTable_rowreq_ctx *rowreq_ctx; ++ oid oid_tmp[MAX_OID_LEN]; ++ netsnmp_index oid_idx; ++ int rc; ++ ++ /* ++ * set up storage for OID ++ */ ++ oid_idx.oids = oid_tmp; ++ oid_idx.len = sizeof(oid_tmp) / sizeof(oid); ++ ++ /* ++ * convert ++ */ ++ rc = ipDefaultRouterTable_index_to_oid(&oid_idx, mib_idx); ++ if (MFD_SUCCESS != rc) ++ return NULL; ++ ++ rowreq_ctx = ++ CONTAINER_FIND(ipDefaultRouterTable_if_ctx.container, &oid_idx); ++ ++ return rowreq_ctx; ++} +diff --git a/agent/mibgroup/ip-mib/ipDefaultRouterTable/ipDefaultRouterTable_interface.h b/agent/mibgroup/ip-mib/ipDefaultRouterTable/ipDefaultRouterTable_interface.h +new file mode 100644 +index 0000000..a780491 +--- /dev/null ++++ b/agent/mibgroup/ip-mib/ipDefaultRouterTable/ipDefaultRouterTable_interface.h +@@ -0,0 +1,99 @@ ++/* ++ * Note: this file originally auto-generated by mib2c using ++ * version : 15899 $ of $ ++ * ++ * $Id:$ ++ */ ++/** @ingroup interface: Routines to interface to Net-SNMP ++ * ++ * \warning This code should not be modified, called directly, ++ * or used to interpret functionality. It is subject to ++ * change at any time. ++ * ++ * @{ ++ */ ++/* ++ * ********************************************************************* ++ * ********************************************************************* ++ * ********************************************************************* ++ * *** *** ++ * *** NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE *** ++ * *** *** ++ * *** *** ++ * *** THIS FILE DOES NOT CONTAIN ANY USER EDITABLE CODE. *** ++ * *** *** ++ * *** *** ++ * *** THE GENERATED CODE IS INTERNAL IMPLEMENTATION, AND *** ++ * *** *** ++ * *** *** ++ * *** IS SUBJECT TO CHANGE WITHOUT WARNING IN FUTURE RELEASES. *** ++ * *** *** ++ * *** *** ++ * ********************************************************************* ++ * ********************************************************************* ++ * ********************************************************************* ++ */ ++#ifndef IPDEFAULTROUTERTABLE_INTERFACE_H ++#define IPDEFAULTROUTERTABLE_INTERFACE_H ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++ ++#include "ipDefaultRouterTable.h" ++ ++ ++ /* ++ ******************************************************************** ++ * Table declarations ++ */ ++ ++ /* ++ * PUBLIC interface initialization routine ++ */ ++ void ++ _ipDefaultRouterTable_initialize_interface ++ (ipDefaultRouterTable_registration * user_ctx, u_long flags); ++ void ++ _ipDefaultRouterTable_shutdown_interface ++ (ipDefaultRouterTable_registration * user_ctx); ++ ++ ipDefaultRouterTable_registration ++ *ipDefaultRouterTable_registration_get(void); ++ ++ ipDefaultRouterTable_registration ++ *ipDefaultRouterTable_registration_set ++ (ipDefaultRouterTable_registration * newreg); ++ ++ netsnmp_container *ipDefaultRouterTable_container_get(void); ++ int ipDefaultRouterTable_container_size(void); ++ ++ ipDefaultRouterTable_rowreq_ctx ++ *ipDefaultRouterTable_allocate_rowreq_ctx(ipDefaultRouterTable_data ++ *, void *); ++ void ++ ipDefaultRouterTable_release_rowreq_ctx ++ (ipDefaultRouterTable_rowreq_ctx * rowreq_ctx); ++ ++ int ipDefaultRouterTable_index_to_oid(netsnmp_index * ++ oid_idx, ++ ipDefaultRouterTable_mib_index ++ * mib_idx); ++ int ipDefaultRouterTable_index_from_oid(netsnmp_index * ++ oid_idx, ++ ipDefaultRouterTable_mib_index ++ * mib_idx); ++ ++ /* ++ * access to certain internals. use with caution! ++ */ ++ void ++ ipDefaultRouterTable_valid_columns_set(netsnmp_column_info *vc); ++ ++ ++#ifdef __cplusplus ++} ++#endif ++#endif /* IPDEFAULTROUTERTABLE_INTERFACE_H */ ++/** @} */ +diff --git a/agent/mibgroup/ip-mib/ipDefaultRouterTable/ipDefaultRouterTable_oids.h b/agent/mibgroup/ip-mib/ipDefaultRouterTable/ipDefaultRouterTable_oids.h +new file mode 100644 +index 0000000..6914e71 +--- /dev/null ++++ b/agent/mibgroup/ip-mib/ipDefaultRouterTable/ipDefaultRouterTable_oids.h +@@ -0,0 +1,39 @@ ++/* ++ * Note: this file originally auto-generated by mib2c using ++ * : generic-table-oids.m2c 12855 2005-09-27 15:56:08Z rstory $ ++ * ++ * $Id:$ ++ */ ++#ifndef IPDEFAULTROUTERTABLE_OIDS_H ++#define IPDEFAULTROUTERTABLE_OIDS_H ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++ ++ /* ++ * column number definitions for table ipDefaultRouterTable ++ */ ++#define IPDEFAULTROUTERTABLE_OID 1,3,6,1,2,1,4,37 ++ ++#define COLUMN_IPDEFAULTROUTERADDRESSTYPE 1 ++ ++#define COLUMN_IPDEFAULTROUTERADDRESS 2 ++ ++#define COLUMN_IPDEFAULTROUTERIFINDEX 3 ++ ++#define COLUMN_IPDEFAULTROUTERLIFETIME 4 ++ ++#define COLUMN_IPDEFAULTROUTERPREFERENCE 5 ++ ++ ++#define IPDEFAULTROUTERTABLE_MIN_COL COLUMN_IPDEFAULTROUTERLIFETIME ++#define IPDEFAULTROUTERTABLE_MAX_COL COLUMN_IPDEFAULTROUTERPREFERENCE ++ ++ ++ ++#ifdef __cplusplus ++} ++#endif ++#endif /* IPDEFAULTROUTERTABLE_OIDS_H */ +diff --git a/agent/mibgroup/mibII/var_route.c b/agent/mibgroup/mibII/var_route.c +index 0a811f3..3fa02ba 100644 +--- a/agent/mibgroup/mibII/var_route.c ++++ b/agent/mibgroup/mibII/var_route.c +@@ -87,6 +87,7 @@ static size_t all_routes_size; + extern const struct sockaddr *get_address(const void *, int, int); + extern const struct in_addr *get_in_address(const void *, int, int); + ++ + /* + * var_ipRouteEntry(... + * Arguments: +diff --git a/configure.in b/configure.in +index 3ad7955..c5e05ba 100644 +--- a/configure.in ++++ b/configure.in +@@ -3342,6 +3342,29 @@ typedef __u32 u32; /* ditto */ + typedef __u16 u16; /* ditto */ + typedef __u8 u8; /* ditto */ + ]]) ++# linux netlink ++AC_CHECK_HEADERS(linux/netlink.h,,, ++[[ ++#if HAVE_ASM_TYPES_H ++#include ++#endif ++#if HAVE_SYS_SOCKET_H ++#include ++#endif ++]]) ++# linux rtnetlink ++AC_CHECK_HEADERS(linux/rtnetlink.h,,, ++[[ ++#if HAVE_ASM_TYPES_H ++#include ++#endif ++#if HAVE_SYS_SOCKET_H ++#include ++#endif ++#if HAVE_LINUX_NETLINK_H ++#include ++#endif ++]]) + # BSDi3 headers + AC_CHECK_HEADERS(sys/stat.h) + # BSDi3/IRIX headers +diff --git a/include/net-snmp/data_access/defaultrouter.h b/include/net-snmp/data_access/defaultrouter.h +new file mode 100644 +index 0000000..93ac18f +--- /dev/null ++++ b/include/net-snmp/data_access/defaultrouter.h +@@ -0,0 +1,114 @@ ++/* ++ * defaultrouter data access header ++ * ++ * $Id:$ ++ */ ++#ifndef NETSNMP_ACCESS_DEFAULTROUTER_H ++#define NETSNMP_ACCESS_DEFAULTROUTER_H ++ ++# ifdef __cplusplus ++extern "C" { ++#endif ++ ++/**---------------------------------------------------------------------*/ ++/* ++ * structure definitions ++ */ ++#if defined( NETSNMP_ENABLE_IPV6 ) ++# define NETSNMP_ACCESS_DEFAULTROUTER_BUF_SIZE 16 /* XXX: 20, for ip6z? */ ++#else ++# define NETSNMP_ACCESS_DEFAULTROUTER_BUF_SIZE 4 ++#endif ++ ++ ++/* ++ * netsnmp_default_route_entry ++ */ ++typedef struct netsnmp_defaultrouter_s { ++ ++ netsnmp_index oid_index; /* MUST BE FIRST!! for container use */ ++ oid ns_dr_index; /* arbitrary index */ ++ ++ int flags; /* for net-snmp use */ ++ ++ /* ++ * mib related data ++ */ ++ u_char dr_addresstype; /* ipDefaultRouterAddressType */ ++ char dr_address[NETSNMP_ACCESS_DEFAULTROUTER_BUF_SIZE]; /* ipDefaultRouterAddress */ ++ size_t dr_address_len; /* length of ipDefaultRouterAddress */ ++ oid dr_if_index; /* ipDefaultRouterIfIndex */ ++ uint32_t dr_lifetime; /* ipDefaultRouterLifetime (0-65535) */ ++ char dr_preference; /* ipDefaultRouterPreference (-2,-1,0,1) */ ++ ++} netsnmp_defaultrouter_entry; ++ ++ ++/**---------------------------------------------------------------------*/ ++/* ++ * ACCESS function prototypes ++ */ ++/* ++ * container init ++ */ ++netsnmp_container * ++netsnmp_access_defaultrouter_container_init(u_int flags); ++#define NETSNMP_ACCESS_DEFAULTROUTER_INIT_NOFLAGS 0x0000 ++#define NETSNMP_ACCESS_DEFAULTROUTER_INIT_ADDL_IDX_BY_ADDR 0x0001 ++ ++/* ++ * container load ++ */ ++netsnmp_container* ++netsnmp_access_defaultrouter_container_load(netsnmp_container* container, ++ u_int load_flags); ++#define NETSNMP_ACCESS_DEFAULTROUTER_LOAD_NOFLAGS 0x0000 ++#define NETSNMP_ACCESS_DEFAULTROUTER_LOAD_IPV4_ONLY 0x0001 ++#define NETSNMP_ACCESS_DEFAULTROUTER_LOAD_IPV6_ONLY 0x0002 ++#define NETSNMP_ACCESS_DEFAULTROUTER_LOAD_ADDL_IDX_BY_ADDR 0x0004 ++ ++/* ++ * container free ++ */ ++void ++netsnmp_access_defaultrouter_container_free(netsnmp_container *container, ++ u_int free_flags); ++#define NETSNMP_ACCESS_DEFAULTROUTER_FREE_NOFLAGS 0x0000 ++#define NETSNMP_ACCESS_DEFAULTROUTER_FREE_DONT_CLEAR 0x0001 ++#define NETSNMP_ACCESS_DEFAULTROUTER_FREE_KEEP_CONTAINER 0x0002 ++ ++/* ++ * entry create ++ */ ++netsnmp_defaultrouter_entry * ++netsnmp_access_defaultrouter_entry_create(void); ++ ++/* ++ * entry load ++ */ ++int ++netsnmp_access_defaultrouter_entry_load(size_t *num_entries, ++ netsnmp_defaultrouter_entry **entries); ++ ++/* ++ * entry update ++ */ ++int ++netsnmp_access_defaultrouter_entry_update(netsnmp_defaultrouter_entry *lhs, ++ netsnmp_defaultrouter_entry *rhs); ++ ++/* ++ * entry free ++ */ ++void ++netsnmp_access_defaultrouter_entry_free(netsnmp_defaultrouter_entry *entry); ++ ++ ++ ++/**---------------------------------------------------------------------*/ ++ ++# ifdef __cplusplus ++} ++#endif ++ ++#endif /* NETSNMP_ACCESS_DEFAULTROUTER_H */ +-- +1.6.0.2 + diff --git a/Add-ICMP-Statistics-Tables-support.patch b/Add-ICMP-Statistics-Tables-support.patch new file mode 100644 index 0000000..5921473 --- /dev/null +++ b/Add-ICMP-Statistics-Tables-support.patch @@ -0,0 +1,1477 @@ +From f691d90915f55027107270245494e1d25e340e20 Mon Sep 17 00:00:00 2001 +From: Mitsuru Chinen +Date: Mon, 20 Oct 2008 16:43:13 +0900 +Subject: [PATCH] Add ICMP Statistics Tables support + +From net-snmp patch tracker: +[ 1702361 ] Add ability to retrieve /proc/net/snmp6 under linux +http://sourceforge.net/tracker/index.php?func=detail&aid=1702361&group_id=12694&atid=312694 + +[ 1702366 ] add support for icmpStatsTable oid under linux +http://sourceforge.net/tracker/index.php?func=detail&aid=1702366&group_id=12694&atid=312694 + +[ 1703004 ] consolidate snmp6 caching in mibII read for linux +http://sourceforge.net/tracker/index.php?func=detail&aid=1703004&group_id=12694&atid=312694 + +[ 1715395 ] Fix the output form of icmpStatsTable on Linux +http://sourceforge.net/tracker/index.php?func=detail&aid=1715395&group_id=12694&atid=312694 + +[ 1721096 ] [Linux] Reply icmpStatsTable with old kernel +http://sourceforge.net/tracker/index.php?func=detail&aid=1721096&group_id=12694&atid=312694 + +[ 1823465 ] fix icmp registration and caches +http://sourceforge.net/tracker/index.php?func=detail&aid=1823465&group_id=12694&atid=312694 + +[ 1927751 ] Update icmpMsgStatsTable, Take IV +http://sourceforge.net/tracker/index.php?func=detail&aid=1927751&group_id=12694&atid=312694 + +Signed-off-by: Mitsuru Chinen +--- + agent/mibgroup/mibII/icmp.c | 578 +++++++++++++++++++++++++++++++++ + agent/mibgroup/mibII/icmp.h | 15 + + agent/mibgroup/mibII/ipv6.c | 2 +- + agent/mibgroup/mibII/kernel_linux.c | 483 +++++++++++++++++++++++++--- + agent/mibgroup/mibII/kernel_linux.h | 86 +++++ + configure | 5 +- + configure.in | 5 +- + include/net-snmp/net-snmp-config.h.in | 3 + + win32/net-snmp/net-snmp-config.h.in | 3 + + 9 files changed, 1138 insertions(+), 42 deletions(-) + +diff --git a/agent/mibgroup/mibII/icmp.c b/agent/mibgroup/mibII/icmp.c +index f3fbb82..50daac1 100644 +--- a/agent/mibgroup/mibII/icmp.c ++++ b/agent/mibgroup/mibII/icmp.c +@@ -9,6 +9,13 @@ + #if HAVE_NETINET_IP_ICMP_H + #include + #endif ++ ++#ifdef NETSNMP_ENABLE_IPV6 ++#if HAVE_NETINET_ICMP6_H ++#include ++#endif ++#endif /* NETSNMP_ENABLE_IPV6 */ ++ + #if HAVE_NETINET_ICMP_VAR_H + #include + #endif +@@ -60,16 +67,388 @@ perfstat_id_t ps_name; + * registering underneath + */ + oid icmp_oid[] = { SNMP_OID_MIB2, 5 }; ++oid icmp_stats_tbl_oid[] = { SNMP_OID_MIB2, 5, 29 }; ++oid icmp_msg_stats_tbl_oid[] = { SNMP_OID_MIB2, 5, 30 }; + #ifdef USING_MIBII_IP_MODULE + extern oid ip_module_oid[]; + extern int ip_module_oid_len; + extern int ip_module_count; + #endif + ++#ifdef linux ++struct icmp_stats_table_entry { ++ __uint32_t ipVer; ++ __uint32_t icmpStatsInMsgs; ++ __uint32_t icmpStatsInErrors; ++ __uint32_t icmpStatsOutMsgs; ++ __uint32_t icmpStatsOutErrors; ++}; ++ ++struct icmp_stats_table_entry icmp_stats_table[2]; ++ ++#define ICMP_MSG_STATS_HAS_IN 1 ++#define ICMP_MSG_STATS_HAS_OUT 2 ++ ++struct icmp_msg_stats_table_entry { ++ uint32_t ipVer; ++ uint32_t icmpMsgStatsType; ++ uint32_t icmpMsgStatsInPkts; ++ uint32_t icmpMsgStatsOutPkts; ++ int flags; ++}; ++ ++#define ICMP_MSG_STATS_IPV4_COUNT 11 ++ ++#ifdef NETSNMP_ENABLE_IPV6 ++#define ICMP_MSG_STATS_IPV6_COUNT 14 ++#else ++#define ICMP_MSG_STATS_IPV6_COUNT 0 ++#endif /* NETSNMP_ENABLE_IPV6 */ ++ ++struct icmp_msg_stats_table_entry icmp_msg_stats_table[ICMP_MSG_STATS_IPV4_COUNT + ICMP_MSG_STATS_IPV6_COUNT]; ++ ++int ++icmp_stats_load(netsnmp_cache *cache, void *vmagic) ++{ ++ ++ /* ++ * note don't bother using the passed in cache ++ * and vmagic pointers. They are useless as they ++ * currently point to the icmp system stats cache ++ * since I see little point in registering another ++ * cache for this table. Its not really needed ++ */ ++ ++ int i; ++ struct icmp_mib v4icmp; ++ struct icmp6_mib v6icmp; ++ for(i=0;i<2;i++) { ++ switch(i) { ++ case 0: ++ linux_read_icmp_stat(&v4icmp); ++ icmp_stats_table[i].icmpStatsInMsgs = v4icmp.icmpInMsgs; ++ icmp_stats_table[i].icmpStatsInErrors = v4icmp.icmpInErrors; ++ icmp_stats_table[i].icmpStatsOutMsgs = v4icmp.icmpOutMsgs; ++ icmp_stats_table[i].icmpStatsOutErrors = v4icmp.icmpOutErrors; ++ break; ++ default: ++ memset(&icmp_stats_table[i],0, ++ sizeof(struct icmp_stats_table_entry)); ++ linux_read_icmp6_stat(&v6icmp); ++ icmp_stats_table[i].icmpStatsInMsgs = v6icmp.icmp6InMsgs; ++ icmp_stats_table[i].icmpStatsInErrors = v6icmp.icmp6InErrors; ++ icmp_stats_table[i].icmpStatsOutMsgs = v6icmp.icmp6OutMsgs; ++ icmp_stats_table[i].icmpStatsOutErrors = v6icmp.icmp6OutDestUnreachs + ++ v6icmp.icmp6OutPktTooBigs + v6icmp.icmp6OutTimeExcds + ++ v6icmp.icmp6OutParmProblems; ++ break; ++ } ++ icmp_stats_table[i].ipVer=i+1; ++ } ++ ++ return 0; ++} ++ ++int ++icmp_msg_stats_load(netsnmp_cache *cache, void *vmagic) ++{ ++ struct icmp_mib v4icmp; ++ struct icmp4_msg_mib v4icmpmsg; ++ struct icmp6_mib v6icmp; ++ struct icmp6_msg_mib v6icmpmsg; ++ int i, j, k, flag, inc; ++ ++ memset(&icmp_msg_stats_table, 0, sizeof(icmp_msg_stats_table)); ++ ++ i = 0; ++ flag = 0; ++ k = 0; ++ inc = 0; ++ linux_read_icmp_msg_stat(&v4icmp, &v4icmpmsg, &flag); ++ if (flag) { ++ while (254 != k) { ++ if (v4icmpmsg.vals[k].InType) { ++ icmp_msg_stats_table[i].ipVer = 1; ++ icmp_msg_stats_table[i].icmpMsgStatsType = k; ++ icmp_msg_stats_table[i].icmpMsgStatsInPkts = v4icmpmsg.vals[k].InType; ++ icmp_msg_stats_table[i].flags = icmp_msg_stats_table[i].flags | ICMP_MSG_STATS_HAS_IN; ++ inc = 1; /* Set this if we found a valid entry */ ++ } ++ if (v4icmpmsg.vals[k].OutType) { ++ icmp_msg_stats_table[i].ipVer = 1; ++ icmp_msg_stats_table[i].icmpMsgStatsType = k; ++ icmp_msg_stats_table[i].icmpMsgStatsOutPkts = v4icmpmsg.vals[k].OutType; ++ icmp_msg_stats_table[i].flags = icmp_msg_stats_table[i].flags | ICMP_MSG_STATS_HAS_OUT; ++ inc = 1; /* Set this if we found a valid entry */ ++ } ++ if (inc) { ++ i++; ++ inc = 0; ++ } ++ k++; ++ } ++ } else { ++ icmp_msg_stats_table[i].icmpMsgStatsType = ICMP_ECHOREPLY; ++ icmp_msg_stats_table[i].icmpMsgStatsInPkts = v4icmp.icmpInEchoReps; ++ icmp_msg_stats_table[i].icmpMsgStatsOutPkts = v4icmp.icmpOutEchoReps; ++ i++; ++ ++ icmp_msg_stats_table[i].icmpMsgStatsType = ICMP_DEST_UNREACH; ++ icmp_msg_stats_table[i].icmpMsgStatsInPkts = v4icmp.icmpInDestUnreachs; ++ icmp_msg_stats_table[i].icmpMsgStatsOutPkts = v4icmp.icmpOutDestUnreachs; ++ i++; ++ ++ icmp_msg_stats_table[i].icmpMsgStatsType = ICMP_SOURCE_QUENCH; ++ icmp_msg_stats_table[i].icmpMsgStatsInPkts = v4icmp.icmpInSrcQuenchs; ++ icmp_msg_stats_table[i].icmpMsgStatsOutPkts = v4icmp.icmpOutSrcQuenchs; ++ i++; ++ ++ icmp_msg_stats_table[i].icmpMsgStatsType = ICMP_REDIRECT; ++ icmp_msg_stats_table[i].icmpMsgStatsInPkts = v4icmp.icmpInRedirects; ++ icmp_msg_stats_table[i].icmpMsgStatsOutPkts = v4icmp.icmpOutRedirects; ++ i++; ++ ++ icmp_msg_stats_table[i].icmpMsgStatsType = ICMP_ECHO; ++ icmp_msg_stats_table[i].icmpMsgStatsInPkts = v4icmp.icmpInEchos; ++ icmp_msg_stats_table[i].icmpMsgStatsOutPkts = v4icmp.icmpOutEchos; ++ i++; ++ ++ icmp_msg_stats_table[i].icmpMsgStatsType = ICMP_TIME_EXCEEDED; ++ icmp_msg_stats_table[i].icmpMsgStatsInPkts = v4icmp.icmpInTimeExcds; ++ icmp_msg_stats_table[i].icmpMsgStatsOutPkts = v4icmp.icmpOutTimeExcds; ++ i++; ++ ++ icmp_msg_stats_table[i].icmpMsgStatsType = ICMP_PARAMETERPROB; ++ icmp_msg_stats_table[i].icmpMsgStatsInPkts = v4icmp.icmpInParmProbs; ++ icmp_msg_stats_table[i].icmpMsgStatsOutPkts = v4icmp.icmpOutParmProbs; ++ i++; ++ ++ icmp_msg_stats_table[i].icmpMsgStatsType = ICMP_TIMESTAMP; ++ icmp_msg_stats_table[i].icmpMsgStatsInPkts = v4icmp.icmpInTimestamps; ++ icmp_msg_stats_table[i].icmpMsgStatsOutPkts = v4icmp.icmpOutTimestamps; ++ i++; ++ ++ icmp_msg_stats_table[i].icmpMsgStatsType = ICMP_TIMESTAMPREPLY; ++ icmp_msg_stats_table[i].icmpMsgStatsInPkts = v4icmp.icmpInTimestampReps; ++ icmp_msg_stats_table[i].icmpMsgStatsOutPkts = v4icmp.icmpOutTimestampReps; ++ i++; ++ ++ icmp_msg_stats_table[i].icmpMsgStatsType = ICMP_ADDRESS; ++ icmp_msg_stats_table[i].icmpMsgStatsInPkts = v4icmp.icmpInAddrMasks; ++ icmp_msg_stats_table[i].icmpMsgStatsOutPkts = v4icmp.icmpOutAddrMasks; ++ i++; ++ ++ icmp_msg_stats_table[i].icmpMsgStatsType = ICMP_ADDRESSREPLY; ++ icmp_msg_stats_table[i].icmpMsgStatsInPkts = v4icmp.icmpInAddrMaskReps; ++ icmp_msg_stats_table[i].icmpMsgStatsOutPkts = v4icmp.icmpOutAddrMaskReps; ++ i++; ++ ++ /* set the IP version and default flags */ ++ for (j = 0; j < ICMP_MSG_STATS_IPV4_COUNT; j++) { ++ icmp_msg_stats_table[j].ipVer = 1; ++ icmp_msg_stats_table[j].flags = ICMP_MSG_STATS_HAS_IN | ICMP_MSG_STATS_HAS_OUT; ++ } ++ } ++ ++#ifdef NETSNMP_ENABLE_IPV6 ++ flag = 0; ++ k = 0; ++ inc = 0; ++ linux_read_icmp6_msg_stat(&v6icmp, &v6icmpmsg, &flag); ++ if (flag) { ++ while (254 != k) { ++ if (v6icmpmsg.vals[k].InType) { ++ icmp_msg_stats_table[i].ipVer = 2; ++ icmp_msg_stats_table[i].icmpMsgStatsType = k; ++ icmp_msg_stats_table[i].icmpMsgStatsInPkts = v6icmpmsg.vals[k].InType; ++ icmp_msg_stats_table[i].flags = icmp_msg_stats_table[i].flags | ICMP_MSG_STATS_HAS_IN; ++ inc = 1; /* Set this if we found a valid entry */ ++ } ++ if (v6icmpmsg.vals[k].OutType) { ++ icmp_msg_stats_table[i].ipVer = 2; ++ icmp_msg_stats_table[i].icmpMsgStatsType = k; ++ icmp_msg_stats_table[i].icmpMsgStatsOutPkts = v6icmpmsg.vals[k].OutType; ++ icmp_msg_stats_table[i].flags = icmp_msg_stats_table[i].flags | ICMP_MSG_STATS_HAS_OUT; ++ inc = 1; /* Set this if we found a valid entry */ ++ } ++ if (inc) { ++ i++; ++ inc = 0; ++ } ++ k++; ++ } ++ } else { ++ icmp_msg_stats_table[i].icmpMsgStatsType = ICMP6_DST_UNREACH; ++ icmp_msg_stats_table[i].icmpMsgStatsInPkts = v6icmp.icmp6InDestUnreachs; ++ icmp_msg_stats_table[i].icmpMsgStatsOutPkts = v6icmp.icmp6OutDestUnreachs; ++ i++; ++ ++ icmp_msg_stats_table[i].icmpMsgStatsType = ICMP6_PACKET_TOO_BIG; ++ icmp_msg_stats_table[i].icmpMsgStatsInPkts = v6icmp.icmp6InPktTooBigs; ++ icmp_msg_stats_table[i].icmpMsgStatsOutPkts = v6icmp.icmp6OutPktTooBigs; ++ i++; ++ ++ icmp_msg_stats_table[i].icmpMsgStatsType = ICMP6_TIME_EXCEEDED; ++ icmp_msg_stats_table[i].icmpMsgStatsInPkts = v6icmp.icmp6InTimeExcds; ++ icmp_msg_stats_table[i].icmpMsgStatsOutPkts = v6icmp.icmp6OutTimeExcds; ++ i++; ++ ++ icmp_msg_stats_table[i].icmpMsgStatsType = ICMP6_PARAM_PROB; ++ icmp_msg_stats_table[i].icmpMsgStatsInPkts = v6icmp.icmp6InParmProblems; ++ icmp_msg_stats_table[i].icmpMsgStatsOutPkts = v6icmp.icmp6OutParmProblems; ++ i++; ++ ++ icmp_msg_stats_table[i].icmpMsgStatsType = ICMP6_ECHO_REQUEST; ++ icmp_msg_stats_table[i].icmpMsgStatsInPkts = v6icmp.icmp6InEchos; ++ icmp_msg_stats_table[i].icmpMsgStatsOutPkts = 0; ++ icmp_msg_stats_table[i].flags = ICMP_MSG_STATS_HAS_IN; ++ i++; ++ ++ icmp_msg_stats_table[i].icmpMsgStatsType = ICMP6_ECHO_REPLY; ++ icmp_msg_stats_table[i].icmpMsgStatsInPkts = v6icmp.icmp6InEchoReplies; ++ icmp_msg_stats_table[i].icmpMsgStatsOutPkts = v6icmp.icmp6OutEchoReplies; ++ i++; ++ ++ icmp_msg_stats_table[i].icmpMsgStatsType = MLD_LISTENER_QUERY; ++ icmp_msg_stats_table[i].icmpMsgStatsInPkts = v6icmp.icmp6InGroupMembQueries; ++ icmp_msg_stats_table[i].icmpMsgStatsOutPkts = 0; ++ icmp_msg_stats_table[i].flags = ICMP_MSG_STATS_HAS_IN; ++ i++; ++ icmp_msg_stats_table[i].icmpMsgStatsType = MLD_LISTENER_REPORT; ++ icmp_msg_stats_table[i].icmpMsgStatsInPkts = v6icmp.icmp6InGroupMembResponses; ++ icmp_msg_stats_table[i].icmpMsgStatsOutPkts = v6icmp.icmp6OutGroupMembResponses; ++ i++; ++ ++ icmp_msg_stats_table[i].icmpMsgStatsType = MLD_LISTENER_REDUCTION; ++ icmp_msg_stats_table[i].icmpMsgStatsInPkts = v6icmp.icmp6InGroupMembReductions; ++ icmp_msg_stats_table[i].icmpMsgStatsOutPkts = v6icmp.icmp6OutGroupMembReductions; ++ i++; ++ ++ icmp_msg_stats_table[i].icmpMsgStatsType = ND_ROUTER_SOLICIT; ++ icmp_msg_stats_table[i].icmpMsgStatsInPkts = v6icmp.icmp6InRouterSolicits; ++ icmp_msg_stats_table[i].icmpMsgStatsOutPkts = v6icmp.icmp6OutRouterSolicits; ++ i++; ++ ++ icmp_msg_stats_table[i].icmpMsgStatsType = ND_ROUTER_ADVERT; ++ icmp_msg_stats_table[i].icmpMsgStatsInPkts = v6icmp.icmp6InRouterAdvertisements; ++ icmp_msg_stats_table[i].icmpMsgStatsOutPkts = 0; ++ icmp_msg_stats_table[i].flags = ICMP_MSG_STATS_HAS_IN; ++ i++; ++ ++ icmp_msg_stats_table[i].icmpMsgStatsType = ND_NEIGHBOR_SOLICIT; ++ icmp_msg_stats_table[i].icmpMsgStatsInPkts = v6icmp.icmp6InNeighborSolicits; ++ icmp_msg_stats_table[i].icmpMsgStatsOutPkts = v6icmp.icmp6OutNeighborSolicits; ++ i++; ++ ++ icmp_msg_stats_table[i].icmpMsgStatsType = ND_NEIGHBOR_ADVERT; ++ icmp_msg_stats_table[i].icmpMsgStatsInPkts = v6icmp.icmp6InNeighborAdvertisements; ++ icmp_msg_stats_table[i].icmpMsgStatsOutPkts = v6icmp.icmp6OutNeighborAdvertisements; ++ i++; ++ ++ icmp_msg_stats_table[i].icmpMsgStatsType = ND_REDIRECT; ++ icmp_msg_stats_table[i].icmpMsgStatsInPkts = v6icmp.icmp6InRedirects; ++ icmp_msg_stats_table[i].icmpMsgStatsOutPkts = v6icmp.icmp6OutRedirects; ++ ++ for (j = 0; j < ICMP_MSG_STATS_IPV6_COUNT; j++) { ++ icmp_msg_stats_table[ICMP_MSG_STATS_IPV4_COUNT + j].ipVer = 2; ++ icmp_msg_stats_table[ICMP_MSG_STATS_IPV4_COUNT + j].flags = ICMP_MSG_STATS_HAS_IN | ICMP_MSG_STATS_HAS_OUT; ++ } ++#endif /* NETSNMP_ENABLE_IPV6 */ ++ } ++ return 0; ++} ++ ++netsnmp_variable_list * ++icmp_stats_next_entry( void **loop_context, ++ void **data_context, ++ netsnmp_variable_list *index, ++ netsnmp_iterator_info *data) ++{ ++ int i = (int)(*loop_context); ++ netsnmp_variable_list *idx = index; ++ ++ if(i > 1) ++ return NULL; ++ ++ ++ /* ++ *set IP version ++ */ ++ snmp_set_var_typed_value(idx, ASN_INTEGER, (u_char *)&icmp_stats_table[i].ipVer, ++ sizeof(__uint32_t)); ++ idx = idx->next_variable; ++ ++ *data_context = &icmp_stats_table[i]; ++ ++ *loop_context = (void *)(++i); ++ ++ return index; ++} ++ ++ ++netsnmp_variable_list * ++icmp_stats_first_entry( void **loop_context, ++ void **data_context, ++ netsnmp_variable_list *index, ++ netsnmp_iterator_info *data) ++{ ++ ++ *loop_context = 0; ++ *data_context = NULL; ++ return icmp_stats_next_entry(loop_context, data_context, index, data); ++} ++ ++netsnmp_variable_list * ++icmp_msg_stats_next_entry(void **loop_context, ++ void **data_context, ++ netsnmp_variable_list *index, ++ netsnmp_iterator_info *data) ++{ ++ int i = (int)(*loop_context); ++ netsnmp_variable_list *idx = index; ++ ++ if(i >= ICMP_MSG_STATS_IPV4_COUNT + ICMP_MSG_STATS_IPV6_COUNT) ++ return NULL; ++ ++ /* set IP version */ ++ snmp_set_var_typed_value(idx, ASN_INTEGER, ++ (u_char *)&icmp_msg_stats_table[i].ipVer, ++ sizeof(uint32_t)); ++ ++ /* set packet type */ ++ idx = idx->next_variable; ++ snmp_set_var_typed_value(idx, ASN_INTEGER, ++ (u_char *)&icmp_msg_stats_table[i].icmpMsgStatsType, ++ sizeof(uint32_t)); ++ ++ *data_context = &icmp_msg_stats_table[i]; ++ *loop_context = (void *)(++i); ++ ++ return index; ++} ++ ++ ++netsnmp_variable_list * ++icmp_msg_stats_first_entry(void **loop_context, ++ void **data_context, ++ netsnmp_variable_list *index, ++ netsnmp_iterator_info *data) ++{ ++ *loop_context = 0; ++ *data_context = NULL; ++ return icmp_msg_stats_next_entry(loop_context, data_context, index, data); ++} ++#endif ++ + void + init_icmp(void) + { + netsnmp_handler_registration *reginfo; ++ netsnmp_handler_registration *msg_stats_reginfo; ++ netsnmp_iterator_info *iinfo; ++ netsnmp_iterator_info *msg_stats_iinfo; ++ netsnmp_table_registration_info *table_info; ++ netsnmp_table_registration_info *msg_stats_table_info; + + /* + * register ourselves with the agent as a group of scalars... +@@ -89,6 +468,68 @@ init_icmp(void) + icmp_oid, OID_LENGTH(icmp_oid))); + #endif + ++#ifdef linux ++ ++ /* register icmpStatsTable */ ++ reginfo = netsnmp_create_handler_registration("icmpStatsTable", ++ icmp_stats_table_handler, icmp_stats_tbl_oid, ++ OID_LENGTH(icmp_stats_tbl_oid), HANDLER_CAN_RONLY); ++ ++ table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info); ++ if (!table_info) { ++ return; ++ } ++ ++ netsnmp_table_helper_add_indexes(table_info, ASN_INTEGER, 0); ++ table_info->min_column = ICMP_STAT_INMSG; ++ table_info->max_column = ICMP_STAT_OUTERR; ++ ++ ++ iinfo = SNMP_MALLOC_TYPEDEF(netsnmp_iterator_info); ++ if (!iinfo) { ++ return; ++ } ++ iinfo->get_first_data_point = icmp_stats_first_entry; ++ iinfo->get_next_data_point = icmp_stats_next_entry; ++ iinfo->table_reginfo = table_info; ++ ++ netsnmp_register_table_iterator(reginfo, iinfo); ++ ++ /* register icmpMsgStatsTable */ ++ msg_stats_reginfo = netsnmp_create_handler_registration("icmpMsgStatsTable", ++ icmp_msg_stats_table_handler, icmp_msg_stats_tbl_oid, ++ OID_LENGTH(icmp_msg_stats_tbl_oid), HANDLER_CAN_RONLY); ++ ++ msg_stats_table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info); ++ if (!msg_stats_table_info) { ++ return; ++ } ++ ++ netsnmp_table_helper_add_indexes(msg_stats_table_info, ASN_INTEGER, ASN_INTEGER, 0); ++ msg_stats_table_info->min_column = ICMP_MSG_STAT_IN_PKTS; ++ msg_stats_table_info->max_column = ICMP_MSG_STAT_OUT_PKTS; ++ ++ msg_stats_iinfo = SNMP_MALLOC_TYPEDEF(netsnmp_iterator_info); ++ if (!msg_stats_iinfo) { ++ return; ++ } ++ msg_stats_iinfo->get_first_data_point = icmp_msg_stats_first_entry; ++ msg_stats_iinfo->get_next_data_point = icmp_msg_stats_next_entry; ++ msg_stats_iinfo->table_reginfo = msg_stats_table_info; ++ ++ netsnmp_register_table_iterator(msg_stats_reginfo, msg_stats_iinfo); ++ netsnmp_inject_handler( msg_stats_reginfo, ++ netsnmp_get_cache_handler(ICMP_STATS_CACHE_TIMEOUT, ++ icmp_load, icmp_free, ++ icmp_msg_stats_tbl_oid, OID_LENGTH(icmp_msg_stats_tbl_oid))); ++#ifndef hpux11 ++ netsnmp_inject_handler( reginfo, ++ netsnmp_get_cache_handler(ICMP_STATS_CACHE_TIMEOUT, ++ icmp_load, icmp_free, ++ icmp_stats_tbl_oid, OID_LENGTH(icmp_stats_tbl_oid))); ++#endif /* ! hpux11 */ ++#endif /* linux */ ++ + #ifdef USING_MIBII_IP_MODULE + if (++ip_module_count == 2) + REGISTER_SYSOR_TABLE(ip_module_oid, ip_module_oid_len, +@@ -550,6 +991,141 @@ icmp_handler(netsnmp_mib_handler *handler, + return SNMP_ERR_NOERROR; + } + ++int ++icmp_msg_stats_table_handler(netsnmp_mib_handler *handler, ++ netsnmp_handler_registration *reginfo, ++ netsnmp_agent_request_info *reqinfo, ++ netsnmp_request_info *requests) ++{ ++ netsnmp_request_info *request; ++ netsnmp_variable_list *requestvb; ++ netsnmp_table_request_info *table_info; ++ struct icmp_msg_stats_table_entry *entry; ++ oid subid; ++ ++ switch (reqinfo->mode) { ++ case MODE_GET: ++ for (request = requests; request; request = request->next) { ++ requestvb = request->requestvb; ++ entry = (struct icmp_msg_stats_table_entry *)netsnmp_extract_iterator_context(request); ++ if (!entry) ++ continue; ++ table_info = netsnmp_extract_table_info(request); ++ subid = table_info->colnum; ++ ++ switch (subid) { ++ case ICMP_MSG_STAT_IN_PKTS: ++ if (entry->flags & ICMP_MSG_STATS_HAS_IN) { ++ snmp_set_var_typed_value(requestvb, ASN_COUNTER, ++ (u_char *)&entry->icmpMsgStatsInPkts, sizeof(uint32_t)); ++ } else { ++ requestvb->type = SNMP_NOSUCHINSTANCE; ++ } ++ break; ++ case ICMP_MSG_STAT_OUT_PKTS: ++ if (entry->flags & ICMP_MSG_STATS_HAS_OUT) { ++ snmp_set_var_typed_value(requestvb, ASN_COUNTER, ++ (u_char *)&entry->icmpMsgStatsOutPkts, sizeof(uint32_t)); ++ } else { ++ requestvb->type = SNMP_NOSUCHINSTANCE; ++ } ++ break; ++ default: ++ snmp_log(LOG_WARNING, "mibII/icmpMsgStatsTable: Unrecognised column (%d)\n",(int)subid); ++ } ++ } ++ break; ++ case MODE_GETNEXT: ++ case MODE_GETBULK: ++ case MODE_SET_RESERVE1: ++ case MODE_SET_RESERVE2: ++ case MODE_SET_ACTION: ++ case MODE_SET_COMMIT: ++ case MODE_SET_FREE: ++ case MODE_SET_UNDO: ++ snmp_log(LOG_WARNING, "mibII/icmpStatsTable: Unsupported mode (%d)\n", ++ reqinfo->mode); ++ break; ++ default: ++ snmp_log(LOG_WARNING, "mibII/icmpStatsTable: Unrecognised mode (%d)\n", ++ reqinfo->mode); ++ break; ++ ++ } ++ ++ return SNMP_ERR_NOERROR; ++} ++ ++int ++icmp_stats_table_handler(netsnmp_mib_handler *handler, ++ netsnmp_handler_registration *reginfo, ++ netsnmp_agent_request_info *reqinfo, ++ netsnmp_request_info *requests) ++{ ++ netsnmp_request_info *request; ++ netsnmp_variable_list *requestvb; ++ netsnmp_table_request_info *table_info; ++ struct icmp_stats_table_entry *entry; ++ oid subid; ++#ifndef hpux11 ++ if (!netsnmp_cache_is_valid(reqinfo, reginfo->handlerName)) { ++ netsnmp_assert(!"cache == valid"); /* always false */ ++ icmp_load( NULL, NULL ); /* XXX - check for failure */ ++ } ++#endif ++ ++ switch (reqinfo->mode) { ++ case MODE_GET: ++ for (request=requests; request; request=request->next) { ++ requestvb = request->requestvb; ++ entry = (struct icmp_stats_table_entry *)netsnmp_extract_iterator_context(request); ++ if (!entry) ++ continue; ++ table_info = netsnmp_extract_table_info(request); ++ subid = table_info->colnum; ++ ++ switch (subid) { ++ case ICMP_STAT_INMSG: ++ snmp_set_var_typed_value(requestvb, ASN_COUNTER, ++ (u_char *)&entry->icmpStatsInMsgs, sizeof(__uint32_t)); ++ break; ++ case ICMP_STAT_INERR: ++ snmp_set_var_typed_value(requestvb, ASN_COUNTER, ++ (u_char *)&entry->icmpStatsInErrors, sizeof(__uint32_t)); ++ break; ++ case ICMP_STAT_OUTMSG: ++ snmp_set_var_typed_value(requestvb, ASN_COUNTER, ++ (u_char *)&entry->icmpStatsOutMsgs, sizeof(__uint32_t)); ++ break; ++ case ICMP_STAT_OUTERR: ++ snmp_set_var_typed_value(requestvb, ASN_COUNTER, ++ (u_char *)&entry->icmpStatsOutErrors, sizeof(__uint32_t)); ++ break; ++ default: ++ snmp_log(LOG_WARNING, "mibII/icmpStatsTable: Unrecognised column (%d)\n",(int)subid); ++ } ++ } ++ break; ++ case MODE_GETNEXT: ++ case MODE_GETBULK: ++ case MODE_SET_RESERVE1: ++ case MODE_SET_RESERVE2: ++ case MODE_SET_ACTION: ++ case MODE_SET_COMMIT: ++ case MODE_SET_FREE: ++ case MODE_SET_UNDO: ++ snmp_log(LOG_WARNING, "mibII/icmpStatsTable: Unsupported mode (%d)\n", ++ reqinfo->mode); ++ break; ++ default: ++ snmp_log(LOG_WARNING, "mibII/icmpStatsTable: Unrecognised mode (%d)\n", ++ reqinfo->mode); ++ break; ++ ++ } ++ ++ return SNMP_ERR_NOERROR; ++} + + /********************* + * +@@ -680,6 +1256,8 @@ icmp_load(netsnmp_cache *cache, void *vmagic) + } else { + DEBUGMSGTL(("mibII/icmp", "Loaded ICMP Group (linux)\n")); + } ++ icmp_stats_load(cache, vmagic); ++ icmp_msg_stats_load(cache, vmagic); + return ret_value; + } + #elif defined(solaris2) +diff --git a/agent/mibgroup/mibII/icmp.h b/agent/mibgroup/mibII/icmp.h +index 7417639..4a780ac 100644 +--- a/agent/mibgroup/mibII/icmp.h ++++ b/agent/mibgroup/mibII/icmp.h +@@ -12,6 +12,8 @@ config_arch_require(linux, mibII/kernel_linux) + + extern void init_icmp(void); + extern Netsnmp_Node_Handler icmp_handler; ++extern Netsnmp_Node_Handler icmp_stats_table_handler; ++extern Netsnmp_Node_Handler icmp_msg_stats_table_handler; + extern NetsnmpCacheLoad icmp_load; + extern NetsnmpCacheFree icmp_free; + +@@ -42,4 +44,17 @@ extern NetsnmpCacheFree icmp_free; + #define ICMPOUTADDRMASKS 25 + #define ICMPOUTADDRMASKREPS 26 + ++#define ICMPSTATSTABLE 29 ++#define ICMP_STAT_IPVER 1 ++#define ICMP_STAT_INMSG 2 ++#define ICMP_STAT_INERR 3 ++#define ICMP_STAT_OUTMSG 4 ++#define ICMP_STAT_OUTERR 5 ++ ++#define ICMPMSGSTATSTABLE 30 ++#define ICMP_MSG_STAT_IPVER 1 ++#define ICMP_MSG_STAT_TYPE 2 ++#define ICMP_MSG_STAT_IN_PKTS 3 ++#define ICMP_MSG_STAT_OUT_PKTS 4 ++ + #endif /* _MIBGROUP_ICMP_H */ +diff --git a/agent/mibgroup/mibII/ipv6.c b/agent/mibgroup/mibII/ipv6.c +index 1e24989..ac64ad5 100644 +--- a/agent/mibgroup/mibII/ipv6.c ++++ b/agent/mibgroup/mibII/ipv6.c +@@ -1851,7 +1851,7 @@ linux_read_ip6_stat_ulong(const char *file) + return value; + } + +-void ++static void + linux_read_ip6_stat(struct ip6_mib *ip6stat) + { + if (!ip6stat) +diff --git a/agent/mibgroup/mibII/kernel_linux.c b/agent/mibgroup/mibII/kernel_linux.c +index bb6f867..7b47d9c 100644 +--- a/agent/mibgroup/mibII/kernel_linux.c ++++ b/agent/mibgroup/mibII/kernel_linux.c +@@ -16,43 +16,109 @@ + #if HAVE_SYS_PARAM_H + #include + #endif ++#include + + #include "kernel_linux.h" + + struct ip_mib cached_ip_mib; ++struct ip6_mib cached_ip6_mib; + struct icmp_mib cached_icmp_mib; ++struct icmp6_mib cached_icmp6_mib; ++struct icmp4_msg_mib cached_icmp4_msg_mib; ++struct tcp_mib cached_tcp_mib; + struct tcp_mib cached_tcp_mib; + struct udp_mib cached_udp_mib; ++struct udp6_mib cached_udp6_mib; + + #define IP_STATS_LINE "Ip: %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu" + #define ICMP_STATS_LINE "Icmp: %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu" ++#define ICMP_MSG_STATS_LINE "IcmpMsg: " + #define TCP_STATS_LINE "Tcp: %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu" + #define UDP_STATS_LINE "Udp: %lu %lu %lu %lu" ++#define IP6_STATS_LINE "Ip6" ++#define ICMP6_STATS_LINE "Icmp6" + #define UDP6_STATS_LINE "Udp6" + + #define IP_STATS_PREFIX_LEN 4 + #define ICMP_STATS_PREFIX_LEN 6 ++#define ICMP_MSG_STATS_PREFIX_LEN 9 + #define TCP_STATS_PREFIX_LEN 5 + #define UDP_STATS_PREFIX_LEN 5 ++#define IP6_STATS_PREFIX_LEN 3 ++#define ICMP6_STATS_PREFIX_LEN 5 + #define UDP6_STATS_PREFIX_LEN 4 + ++int ++decode_icmp_msg(char *line, char *data, struct icmp4_msg_mib *msg) ++{ ++ char *token, *saveptr, *lineptr, *saveptr1, *dataptr, *delim = NULL; ++ char line_cpy[1024]; ++ char data_cpy[1024]; ++ long index; ++ ++ if(data == NULL) ++ return -1; ++ ++ /* ++ * Since we are using strtok, there is a possiblity of the orginal data ++ * getting modified. So we take a local copy for this purpose even though ++ * its expensive. ++ */ ++ strncpy(line_cpy, line, sizeof(line_cpy)); ++ strncpy(data_cpy, data, sizeof(data_cpy)); ++ ++ lineptr = line_cpy; ++ dataptr = data_cpy; ++ saveptr1 = NULL; ++ while (1) { ++ if(NULL == (token = strtok_r(lineptr, " ", &saveptr))) ++ break; ++ lineptr = NULL; ++ errno = 0; ++ if (0 == strncmp(strsep(&token, "e"), "OutTyp", 6)) { ++ index = strtol(token, &delim, 0); ++ if (ERANGE == errno) { ++ continue; ++ } else if (index > LONG_MAX) { ++ continue; ++ } else if (index < LONG_MIN) { ++ continue; ++ } ++ if (NULL == (token = strtok_r(dataptr, " ", &saveptr1))) ++ break; ++ dataptr = NULL; ++ msg->vals[index].OutType = atoi(token); ++ } else { ++ index = strtol(token, &delim, 0); ++ if (ERANGE == errno) { ++ continue; ++ } else if (index > LONG_MAX) { ++ continue; ++ } else if (index < LONG_MIN) { ++ continue; ++ } ++ if(NULL == (token = strtok_r(dataptr, " ", &saveptr1))) ++ break; ++ dataptr = NULL; ++ msg->vals[index].InType = atoi(token); ++ } ++ } ++ return 0; ++} + + int + linux_read_mibII_stats(void) + { + FILE *in = fopen("/proc/net/snmp", "r"); +-#ifdef NETSNMP_ENABLE_IPV6 +- FILE *in6; +- unsigned long value; +-#endif +- char line[1024]; +- ++ char line[1024], data[1024]; ++ int ret = 0; + if (!in) { + DEBUGMSGTL(("mibII/kernel_linux","Unable to open /proc/net/snmp")); + return -1; + } + +- ++ memset(line, '\0', sizeof(line)); ++ memset(data, '\0', sizeof(data)); + while (line == fgets(line, sizeof(line), in)) { + if (!strncmp(line, IP_STATS_LINE, IP_STATS_PREFIX_LEN)) { + sscanf(line, IP_STATS_LINE, +@@ -104,6 +170,19 @@ linux_read_mibII_stats(void) + &cached_icmp_mib.icmpOutTimestampReps, + &cached_icmp_mib.icmpOutAddrMasks, + &cached_icmp_mib.icmpOutAddrMaskReps); ++ } else if (!strncmp(line, ICMP_MSG_STATS_LINE, ICMP_MSG_STATS_PREFIX_LEN)) { ++ /* ++ * Note: We have to do this differently from other stats as the ++ * counters to this stats are dynamic. So we will not know the ++ * number of counters at a given time. ++ */ ++ fgets(data, sizeof(data), in); ++ if(decode_icmp_msg(line + ICMP_MSG_STATS_PREFIX_LEN, ++ data + ICMP_MSG_STATS_PREFIX_LEN, ++ &cached_icmp4_msg_mib) < 0) { ++ continue; ++ } ++ ret = 1; + } else if (!strncmp(line, TCP_STATS_LINE, TCP_STATS_PREFIX_LEN)) { + int ret = sscanf(line, TCP_STATS_LINE, + &cached_tcp_mib.tcpRtoAlgorithm, +@@ -132,35 +211,6 @@ linux_read_mibII_stats(void) + } + fclose(in); + +-#ifdef NETSNMP_ENABLE_IPV6 +- in6 = fopen("/proc/net/snmp6", "r"); +- if (in6) { +- +- while (line == fgets(line, sizeof(line), in6)) { +- +- if (('U' != line[0]) || +- (0 != strncmp(line, UDP6_STATS_LINE, UDP6_STATS_PREFIX_LEN))) +- continue; +- +- sscanf(line, "%*s %lu" , &value); +- +- if ('O' == line[4]) /* Udp6OutDatagrams */ +- cached_udp_mib.udpOutDatagrams += value; +- else if ('N' == line[4]) /* Udp6NoPorts */ +- cached_udp_mib.udpNoPorts += value; +- else if ('D' == line[6]) /* Udp6InDatagrams */ +- cached_udp_mib.udpInDatagrams += value; +- else if ('E' == line[6]) /* Udp6InErrors */ +- cached_udp_mib.udpInErrors += value; +- +- } +- fclose(in6); +- } else { +- DEBUGMSGTL(("mibII/kernel_linux","Unable to open /proc/net/snmp6")); +- } +- +-#endif +- + /* + * Tweak illegal values: + * +@@ -176,7 +226,8 @@ linux_read_mibII_stats(void) + */ + if (!cached_tcp_mib.tcpRtoAlgorithm) + cached_tcp_mib.tcpRtoAlgorithm = 1; +- return 0; ++ ++ return ret; + } + + int +@@ -189,18 +240,305 @@ linux_read_ip_stat(struct ip_mib *ipstat) + return 0; + } + ++int linux_read_ip6_stat( struct ip6_mib *ip6stat) ++{ ++#ifdef NETSNMP_ENABLE_IPV6 ++ FILE *in; ++ char line[1024]; ++ unsigned long stats; ++ char *endp; ++ int match; ++#endif ++ ++ memset((char *) ip6stat, (0), sizeof(*ip6stat)); ++ ++#ifdef NETSNMP_ENABLE_IPV6 ++ DEBUGMSGTL(("mibII/kernel_linux/ip6stats", ++ "Reading /proc/net/snmp6 stats\n")); ++ if (NULL == (in = fopen("/proc/net/snmp6", "r"))) { ++ DEBUGMSGTL(("mibII/kernel_linux/ip6stats", ++ "Failed to open /proc/net/snmp6\n")); ++ return -1; ++ } ++ ++ while (NULL != fgets(line, sizeof(line), in)) { ++ if (0 != strncmp(line, IP6_STATS_LINE, IP6_STATS_PREFIX_LEN)) ++ continue; ++ ++ if (1 != sscanf(line, "%*s %lu", &stats)) ++ continue; ++ ++ endp = strchr(line, ' '); ++ *endp = '\0'; ++ DEBUGMSGTL(("mibII/kernel_linux/ip6stats", "Find tag: %s\n", line)); ++ ++ match = 1; ++ if (0 == strncmp(line + 3, "In", 2)) { /* In */ ++ if (0 == strcmp(line + 5, "AddrErrors")) { ++ cached_ip6_mib.ip6InAddrErrors = stats; ++ } else if (0 == strcmp(line + 5, "Delivers")) { ++ cached_ip6_mib.ip6InDelivers = stats; ++ } else if (0 == strcmp(line + 5, "Discards")) { ++ cached_ip6_mib.ip6InDiscards = stats; ++ } else if (0 == strcmp(line + 5, "HdrErrors")) { ++ cached_ip6_mib.ip6InHdrErrors = stats; ++ } else if (0 == strcmp(line + 5, "McastPkts")) { ++ cached_ip6_mib.ip6InMcastPkts = stats; ++ } else if (0 == strcmp(line + 5, "NoRoutes")) { ++ cached_ip6_mib.ip6InNoRoutes = stats; ++ } else if (0 == strcmp(line + 5, "Receives")) { ++ cached_ip6_mib.ip6InReceives = stats; ++ } else if (0 == strcmp(line + 5, "TruncatedPkts")) { ++ cached_ip6_mib.ip6InTruncatedPkts = stats; ++ } else if (0 == strcmp(line + 5, "TooBigErrors")) { ++ cached_ip6_mib.ip6InTooBigErrors = stats; ++ } else if (0 == strcmp(line + 5, "UnknownProtos")) { ++ cached_ip6_mib.ip6InUnknownProtos = stats; ++ } else { ++ match = 0; ++ } ++ } else if (0 == strncmp(line + 3, "Out", 3)) { /* Out */ ++ if (0 == strcmp(line + 6, "Discards")) { ++ cached_ip6_mib.ip6OutDiscards = stats; ++ } else if (0 == strcmp(line + 6, "ForwDatagrams")) { ++ cached_ip6_mib.ip6OutForwDatagrams = stats; ++ } else if (0 == strcmp(line + 6, "McastPkts")) { ++ cached_ip6_mib.ip6OutMcastPkts = stats; ++ } else if (0 == strcmp(line + 6, "NoRoutes")) { ++ cached_ip6_mib.ip6OutNoRoutes = stats; ++ } else if (0 == strcmp(line + 6, "Requests")) { ++ cached_ip6_mib.ip6OutRequests = stats; ++ } else { ++ match = 0; ++ } ++ } else if (0 == strncmp(line + 3, "Reasm", 5)) { /* Reasm */ ++ if (0 == strcmp(line + 8, "Fails")) { ++ cached_ip6_mib.ip6ReasmFails = stats; ++ } else if (0 == strcmp(line + 8, "OKs")) { ++ cached_ip6_mib.ip6ReasmOKs = stats; ++ } else if (0 == strcmp(line + 8, "Reqds")) { ++ cached_ip6_mib.ip6ReasmReqds = stats; ++ } else if (0 == strcmp(line + 8, "Timeout")) { ++ cached_ip6_mib.ip6ReasmTimeout = stats; ++ } else { ++ match = 0; ++ } ++ } else if (0 == strncmp(line + 3, "Frag", 4)) { /* Frag */ ++ if (0 == strcmp(line + 7, "Creates")) { ++ cached_ip6_mib.ip6FragCreates = stats; ++ } else if (0 == strcmp(line + 7, "Fails")) { ++ cached_ip6_mib.ip6FragFails = stats; ++ } else if (0 == strcmp(line + 7, "OKs")) { ++ cached_ip6_mib.ip6FragOKs = stats; ++ } else { ++ match = 0; ++ } ++ } else { ++ match = 0; ++ } ++ ++ if(!match) ++ DEBUGMSGTL(("mibII/kernel_linux/ip6stats", ++ "%s is an unknown tag\n", line)); ++ } ++ ++ fclose(in); ++#endif ++ ++ memcpy((char *) ip6stat, (char *) &cached_ip6_mib, sizeof(*ip6stat)); ++ return 0; ++} ++ ++int ++linux_read_icmp_msg_stat(struct icmp_mib *icmpstat, ++ struct icmp4_msg_mib *icmpmsgstat, ++ int *flag) ++{ ++ int ret; ++ ++ memset(icmpstat, 0, sizeof(*icmpstat)); ++ memset(icmpmsgstat, 0, sizeof(*icmpmsgstat)); ++ ++ if ((ret = linux_read_mibII_stats()) == -1) { ++ return -1; ++ } else if (ret) { ++ memcpy(icmpmsgstat, &cached_icmp4_msg_mib, sizeof(*icmpmsgstat)); ++ *flag = 1; /* We have a valid icmpmsg */ ++ } ++ ++ memcpy(icmpstat, &cached_icmp_mib, sizeof(*icmpstat)); ++ return 0; ++} ++ ++ ++ ++int ++linux_read_icmp6_parse(struct icmp6_mib *icmp6stat, ++ struct icmp6_msg_mib *icmp6msgstat, ++ int *support) ++{ ++#ifdef NETSNMP_ENABLE_IPV6 ++ FILE *in; ++ char line[1024]; ++ char name[255]; ++ unsigned long stats; ++ char *endp ,*token, *vals; ++ int match; ++#endif ++ ++ memset(icmp6stat, 0, sizeof(*icmp6stat)); ++ if (NULL != icmp6msgstat) ++ memset(icmp6msgstat, 0, sizeof(*icmp6msgstat)); ++ ++#ifdef NETSNMP_ENABLE_IPV6 ++ DEBUGMSGTL(("mibII/kernel_linux/icmp6stats", ++ "Reading /proc/net/snmp6 stats\n")); ++ if (NULL == (in = fopen("/proc/net/snmp6", "r"))) { ++ DEBUGMSGTL(("mibII/kernel_linux/icmp6stats", ++ "Failed to open /proc/net/snmp6\n")); ++ return -1; ++ } ++ ++ while (NULL != fgets(line, sizeof(line), in)) { ++ if (0 != strncmp(line, ICMP6_STATS_LINE, ICMP6_STATS_PREFIX_LEN)) ++ continue; ++ ++ if (2 != sscanf(line, "%s %lu", name, &stats)) ++ continue; ++ ++ endp = strchr(line, ' '); ++ *endp = '\0'; ++ DEBUGMSGTL(("mibII/kernel_linux/icmp6stats", "Find tag: %s\n", line)); ++ ++ vals = name; ++ if (NULL != icmp6msgstat) { ++ if (0 == strncmp(name, "Icmp6OutType", 12)) { ++ token = strsep(&vals, "e"); ++ icmp6msgstat->vals[atoi(vals)].OutType = stats; ++ *support = 1; ++ continue; ++ } else if (0 == strncmp(name, "Icmp6InType", 11)) { ++ token = strsep(&vals, "e"); ++ icmp6msgstat->vals[atoi(vals)].InType = stats; ++ *support = 1; ++ continue; ++ } ++ } ++ ++ match = 1; ++ if (0 == strncmp(line + 5, "In", 2)) { /* In */ ++ if (0 == strcmp(line + 7, "DestUnreachs")) { ++ cached_icmp6_mib.icmp6InDestUnreachs = stats; ++ } else if (0 == strcmp(line + 7, "Echos")) { ++ cached_icmp6_mib.icmp6InEchos = stats; ++ } else if (0 == strcmp(line + 7, "EchoReplies")) { ++ cached_icmp6_mib.icmp6InEchoReplies = stats; ++ } else if (0 == strcmp(line + 7, "Errors")) { ++ cached_icmp6_mib.icmp6InErrors = stats; ++ } else if (0 == strcmp(line + 7, "GroupMembQueries")) { ++ cached_icmp6_mib.icmp6InGroupMembQueries = stats; ++ } else if (0 == strcmp(line + 7, "GroupMembReductions")) { ++ cached_icmp6_mib.icmp6InGroupMembReductions = stats; ++ } else if (0 == strcmp(line + 7, "GroupMembResponses")) { ++ cached_icmp6_mib.icmp6InGroupMembResponses = stats; ++ } else if (0 == strcmp(line + 7, "Msgs")) { ++ cached_icmp6_mib.icmp6InMsgs = stats; ++ } else if (0 == strcmp(line + 7, "NeighborAdvertisements")) { ++ cached_icmp6_mib.icmp6InNeighborAdvertisements = stats; ++ } else if (0 == strcmp(line + 7, "NeighborSolicits")) { ++ cached_icmp6_mib.icmp6InNeighborSolicits = stats; ++ } else if (0 == strcmp(line + 7, "PktTooBigs")) { ++ cached_icmp6_mib.icmp6InPktTooBigs = stats; ++ } else if (0 == strcmp(line + 7, "ParmProblems")) { ++ cached_icmp6_mib.icmp6InParmProblems = stats; ++ } else if (0 == strcmp(line + 7, "Redirects")) { ++ cached_icmp6_mib.icmp6InRedirects = stats; ++ } else if (0 == strcmp(line + 7, "RouterAdvertisements")) { ++ cached_icmp6_mib.icmp6InRouterAdvertisements = stats; ++ } else if (0 == strcmp(line + 7, "RouterSolicits")) { ++ cached_icmp6_mib.icmp6InRouterSolicits = stats; ++ } else if (0 == strcmp(line + 7, "TimeExcds")) { ++ cached_icmp6_mib.icmp6InTimeExcds = stats; ++ } else { ++ match = 0; ++ } ++ } else if (0 == strncmp(line + 5, "Out", 3)) { /* Out */ ++ if (0 == strcmp(line + 8, "DestUnreachs")) { ++ cached_icmp6_mib.icmp6OutDestUnreachs = stats; ++ } else if (0 == strcmp(line + 8, "EchoReplies")) { ++ cached_icmp6_mib.icmp6OutEchoReplies = stats; ++ } else if (0 == strcmp(line + 8, "GroupMembReductions")) { ++ cached_icmp6_mib.icmp6OutGroupMembReductions = stats; ++ } else if (0 == strcmp(line + 8, "GroupMembResponses")) { ++ cached_icmp6_mib.icmp6OutGroupMembResponses = stats; ++ } else if (0 == strcmp(line + 8, "Msgs")) { ++ cached_icmp6_mib.icmp6OutMsgs = stats; ++ } else if (0 == strcmp(line + 8, "NeighborAdvertisements")) { ++ cached_icmp6_mib.icmp6OutNeighborAdvertisements = stats; ++ } else if (0 == strcmp(line + 8, "NeighborSolicits")) { ++ cached_icmp6_mib.icmp6OutNeighborSolicits = stats; ++ } else if (0 == strcmp(line + 8, "PktTooBigs")) { ++ cached_icmp6_mib.icmp6OutPktTooBigs = stats; ++ } else if (0 == strcmp(line + 8, "ParmProblems")) { ++ cached_icmp6_mib.icmp6OutParmProblems = stats; ++ } else if (0 == strcmp(line + 8, "Redirects")) { ++ cached_icmp6_mib.icmp6OutRedirects = stats; ++ } else if (0 == strcmp(line + 8, "RouterSolicits")) { ++ cached_icmp6_mib.icmp6OutRouterSolicits = stats; ++ } else if (0 == strcmp(line + 8, "TimeExcds")) { ++ cached_icmp6_mib.icmp6OutTimeExcds = stats; ++ } else { ++ match = 0; ++ } ++ } else { ++ match = 0; ++ } ++ if(!match) ++ DEBUGMSGTL(("mibII/kernel_linux/icmp6stats", ++ "%s is an unknown tag\n", line)); ++ } ++ ++ fclose(in); ++#endif ++ ++ memcpy((char *) icmp6stat, (char *) &cached_icmp6_mib, ++ sizeof(*icmp6stat)); ++ return 0; ++} ++ ++int ++linux_read_icmp6_msg_stat(struct icmp6_mib *icmp6stat, ++ struct icmp6_msg_mib *icmp6msgstat, ++ int *support) ++{ ++ if (linux_read_icmp6_parse(icmp6stat, icmp6msgstat, support) < 0) ++ return -1; ++ else ++ return 0; ++} ++ + int + linux_read_icmp_stat(struct icmp_mib *icmpstat) + { + memset((char *) icmpstat, (0), sizeof(*icmpstat)); + if (linux_read_mibII_stats() == -1) +- return -1; ++ return -1; ++ + memcpy((char *) icmpstat, (char *) &cached_icmp_mib, +- sizeof(*icmpstat)); ++ sizeof(*icmpstat)); + return 0; + } + + int ++linux_read_icmp6_stat(struct icmp6_mib *icmp6stat) ++{ ++ if (linux_read_icmp6_parse(icmp6stat, NULL, NULL) < 0) ++ return -1; ++ else ++ return 0; ++} ++ ++int + linux_read_tcp_stat(struct tcp_mib *tcpstat) + { + memset((char *) tcpstat, (0), sizeof(*tcpstat)); +@@ -216,6 +554,73 @@ linux_read_udp_stat(struct udp_mib *udpstat) + memset((char *) udpstat, (0), sizeof(*udpstat)); + if (linux_read_mibII_stats() == -1) + return -1; ++ ++#ifdef NETSNMP_ENABLE_IPV6 ++ { ++ struct udp6_mib udp6stat; ++ memset(&udp6stat, 0, sizeof(udp6stat)); ++ ++ if (linux_read_udp6_stat(&udp6stat) == 0) { ++ cached_udp_mib.udpOutDatagrams += udp6stat.udp6OutDatagrams; ++ cached_udp_mib.udpNoPorts += udp6stat.udp6NoPorts; ++ cached_udp_mib.udpInDatagrams += udp6stat.udp6InDatagrams; ++ cached_udp_mib.udpInErrors += udp6stat.udp6InErrors; ++ } ++ } ++#endif + memcpy((char *) udpstat, (char *) &cached_udp_mib, sizeof(*udpstat)); + return 0; + } ++ ++int ++linux_read_udp6_stat(struct udp6_mib *udp6stat) ++{ ++#ifdef NETSNMP_ENABLE_IPV6 ++ FILE *in; ++ char line[1024]; ++ unsigned long stats; ++ char *endp; ++#endif ++ ++ memset(udp6stat, 0, sizeof(*udp6stat)); ++ ++#ifdef NETSNMP_ENABLE_IPV6 ++ DEBUGMSGTL(("mibII/kernel_linux/udp6stats", ++ "Reading /proc/net/snmp6 stats\n")); ++ if (NULL == (in = fopen("/proc/net/snmp6", "r"))) { ++ DEBUGMSGTL(("mibII/kernel_linux/udp6stats", ++ "Failed to open /proc/net/snmp6\n")); ++ return -1; ++ } ++ ++ while (NULL != fgets(line, sizeof(line), in)) { ++ if (0 != strncmp(line, UDP6_STATS_LINE, UDP6_STATS_PREFIX_LEN)) ++ continue; ++ ++ if (1 != sscanf(line, "%*s %lu", &stats)) ++ continue; ++ ++ endp = strchr(line, ' '); ++ *endp = '\0'; ++ DEBUGMSGTL(("mibII/kernel_linux/udp6stats", "Find tag: %s\n", line)); ++ ++ if (0 == strcmp(line + 4, "OutDatagrams")) { ++ cached_udp6_mib.udp6OutDatagrams = stats; ++ } else if (0 == strcmp(line + 4, "NoPorts")) { ++ cached_udp6_mib.udp6NoPorts = stats; ++ } else if (0 == strcmp(line + 4, "InDatagrams")) { ++ cached_udp6_mib.udp6InDatagrams = stats; ++ } else if (0 == strcmp(line + 4, "InErrors")) { ++ cached_udp6_mib.udp6InErrors = stats; ++ } else { ++ DEBUGMSGTL(("mibII/kernel_linux/udp6stats", ++ "%s is an unknown tag\n", line)); ++ } ++ } ++ ++ fclose(in); ++#endif ++ ++ memcpy((char *) udp6stat, (char *) &cached_udp6_mib, sizeof(*udp6stat)); ++ return 0; ++} +diff --git a/agent/mibgroup/mibII/kernel_linux.h b/agent/mibgroup/mibII/kernel_linux.h +index fb7db96..6bf5d47 100644 +--- a/agent/mibgroup/mibII/kernel_linux.h ++++ b/agent/mibgroup/mibII/kernel_linux.h +@@ -29,6 +29,31 @@ struct ip_mib { + unsigned long ipRoutingDiscards; + }; + ++struct ip6_mib { ++ unsigned long ip6InReceives; ++ unsigned long ip6InHdrErrors; ++ unsigned long ip6InTooBigErrors; ++ unsigned long ip6InNoRoutes; ++ unsigned long ip6InAddrErrors; ++ unsigned long ip6InUnknownProtos; ++ unsigned long ip6InTruncatedPkts; ++ unsigned long ip6InDiscards; ++ unsigned long ip6InDelivers; ++ unsigned long ip6OutForwDatagrams; ++ unsigned long ip6OutRequests; ++ unsigned long ip6OutDiscards; ++ unsigned long ip6OutNoRoutes; ++ unsigned long ip6ReasmTimeout; ++ unsigned long ip6ReasmReqds; ++ unsigned long ip6ReasmOKs; ++ unsigned long ip6ReasmFails; ++ unsigned long ip6FragOKs; ++ unsigned long ip6FragFails; ++ unsigned long ip6FragCreates; ++ unsigned long ip6InMcastPkts; ++ unsigned long ip6OutMcastPkts; ++}; ++ + struct icmp_mib { + unsigned long icmpInMsgs; + unsigned long icmpInErrors; +@@ -58,6 +83,51 @@ struct icmp_mib { + unsigned long icmpOutAddrMaskReps; + }; + ++struct icmp6_mib { ++ unsigned long icmp6InMsgs; ++ unsigned long icmp6InErrors; ++ unsigned long icmp6InDestUnreachs; ++ unsigned long icmp6InPktTooBigs; ++ unsigned long icmp6InTimeExcds; ++ unsigned long icmp6InParmProblems; ++ unsigned long icmp6InEchos; ++ unsigned long icmp6InEchoReplies; ++ unsigned long icmp6InGroupMembQueries; ++ unsigned long icmp6InGroupMembResponses; ++ unsigned long icmp6InGroupMembReductions; ++ unsigned long icmp6InRouterSolicits; ++ unsigned long icmp6InRouterAdvertisements; ++ unsigned long icmp6InNeighborSolicits; ++ unsigned long icmp6InNeighborAdvertisements; ++ unsigned long icmp6InRedirects; ++ unsigned long icmp6OutMsgs; ++ unsigned long icmp6OutDestUnreachs; ++ unsigned long icmp6OutPktTooBigs; ++ unsigned long icmp6OutTimeExcds; ++ unsigned long icmp6OutParmProblems; ++ unsigned long icmp6OutEchoReplies; ++ unsigned long icmp6OutRouterSolicits; ++ unsigned long icmp6OutNeighborSolicits; ++ unsigned long icmp6OutNeighborAdvertisements; ++ unsigned long icmp6OutRedirects; ++ unsigned long icmp6OutGroupMembResponses; ++ unsigned long icmp6OutGroupMembReductions; ++}; ++ ++struct icmp_msg_mib { ++ unsigned long InType; ++ unsigned long OutType; ++}; ++ ++/* Lets use wrapper structures for future expansion */ ++struct icmp4_msg_mib { ++ struct icmp_msg_mib vals[255]; ++}; ++ ++struct icmp6_msg_mib { ++ struct icmp_msg_mib vals[255]; ++}; ++ + struct udp_mib { + unsigned long udpInDatagrams; + unsigned long udpNoPorts; +@@ -65,6 +135,13 @@ struct udp_mib { + unsigned long udpOutDatagrams; + }; + ++struct udp6_mib { ++ unsigned long udp6InDatagrams; ++ unsigned long udp6NoPorts; ++ unsigned long udp6InErrors; ++ unsigned long udp6OutDatagrams; ++}; ++ + struct tcp_mib { + unsigned long tcpRtoAlgorithm; + unsigned long tcpRtoMin; +@@ -86,8 +163,17 @@ struct tcp_mib { + + + int linux_read_ip_stat(struct ip_mib *); ++int linux_read_ip6_stat(struct ip6_mib *); + int linux_read_icmp_stat(struct icmp_mib *); ++int linux_read_icmp6_stat(struct icmp6_mib *); + int linux_read_udp_stat(struct udp_mib *); ++int linux_read_udp6_stat(struct udp6_mib *); + int linux_read_tcp_stat(struct tcp_mib *); ++int linux_read_icmp_msg_stat(struct icmp_mib *, ++ struct icmp4_msg_mib *, ++ int *flag); ++int linux_read_icmp6_msg_stat(struct icmp6_mib *, ++ struct icmp6_msg_mib *, ++ int *support); + + #endif /* _MIBGROUP_KERNEL_LINUX_H */ +diff --git a/configure b/configure +index 322d5ac..1b062bf 100755 +--- a/configure ++++ b/configure +@@ -33746,7 +33746,7 @@ done + + + +-for ac_header in arpa/inet.h netinet/in_systm.h netinet/in.h netinet/ip_var.h netinet/tcp.h netinet/tcpip.h netinet/udp.h net/if.h netinet/in_var.h netinet/ip.h netinet/ip_icmp.h net/if_arp.h net/if_mib.h net/if_var.h netinet/if_ether.h netinet/tcp_timer.h netinet/tcp_var.h netinet/udp_var.h netinet/icmp_var.h netdb.h net/route.h ++for ac_header in arpa/inet.h netinet/in_systm.h netinet/in.h netinet/ip_var.h netinet/tcp.h netinet/tcpip.h netinet/udp.h net/if.h netinet/in_var.h netinet/ip.h netinet/ip_icmp.h netinet/icmp6.h net/if_arp.h net/if_mib.h net/if_var.h netinet/if_ether.h netinet/tcp_timer.h netinet/tcp_var.h netinet/udp_var.h netinet/icmp_var.h netdb.h net/route.h + do + as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` + echo "$as_me:$LINENO: checking for $ac_header" >&5 +@@ -33794,6 +33794,9 @@ cat >>conftest.$ac_ext <<_ACEOF + #if HAVE_NETINET_IP_ICMP_H + #include + #endif ++#if HAVE_NETINET_ICMP6_H ++#include ++#endif + #if HAVE_NETINET_TCP_H + #include + #endif +diff --git a/configure.in b/configure.in +index 82c22b8..3ad7955 100644 +--- a/configure.in ++++ b/configure.in +@@ -3247,7 +3247,7 @@ AC_INCLUDES_DEFAULT([]) + ]) + AC_CHECK_HEADERS(sys/timeout.h sys/un.h fstab.h sys/fs.h mtab.h ufs/fs.h sys/fixpoint.h machine/param.h sys/vm.h vm/vm.h sys/vmmeter.h sys/vmparam.h sys/vmmac.h sys/vmsystm.h sys/time.h sys/times.h sys/statvfs.h sys/vfs.h sys/mnttab.h sys/select.h mntent.h sys/mntent.h kstat.h utsname.h sys/utsname.h sys/cdefs.h getopt.h locale.h pthread.h sys/loadavg.h regex.h linux/tasks.h pwd.h grp.h utmpx.h) + # Network headers +-AC_CHECK_HEADERS(arpa/inet.h netinet/in_systm.h netinet/in.h netinet/ip_var.h netinet/tcp.h netinet/tcpip.h netinet/udp.h net/if.h netinet/in_var.h netinet/ip.h netinet/ip_icmp.h net/if_arp.h net/if_mib.h net/if_var.h netinet/if_ether.h netinet/tcp_timer.h netinet/tcp_var.h netinet/udp_var.h netinet/icmp_var.h netdb.h net/route.h,,, ++AC_CHECK_HEADERS(arpa/inet.h netinet/in_systm.h netinet/in.h netinet/ip_var.h netinet/tcp.h netinet/tcpip.h netinet/udp.h net/if.h netinet/in_var.h netinet/ip.h netinet/ip_icmp.h netinet/icmp6.h net/if_arp.h net/if_mib.h net/if_var.h netinet/if_ether.h netinet/tcp_timer.h netinet/tcp_var.h netinet/udp_var.h netinet/icmp_var.h netdb.h net/route.h,,, + [[ + #if HAVE_SYS_TYPES_H + #include +@@ -3282,6 +3282,9 @@ AC_CHECK_HEADERS(arpa/inet.h netinet/in_systm.h netinet/in.h netinet/ip_var.h ne + #if HAVE_NETINET_IP_ICMP_H + #include + #endif ++#if HAVE_NETINET_ICMP6_H ++#include ++#endif + #if HAVE_NETINET_TCP_H + #include + #endif +diff --git a/include/net-snmp/net-snmp-config.h.in b/include/net-snmp/net-snmp-config.h.in +index 1be4ca4..2c93d11 100644 +--- a/include/net-snmp/net-snmp-config.h.in ++++ b/include/net-snmp/net-snmp-config.h.in +@@ -588,6 +588,9 @@ + /* Define to 1 if you have the header file. */ + #undef HAVE_NETINET_IP_ICMP_H + ++/* Define to 1 if you have the header file. */ ++#undef HAVE_NETINET_ICMP6_H ++ + /* Define to 1 if you have the header file. */ + #undef HAVE_NETINET_IP_VAR_H + +diff --git a/win32/net-snmp/net-snmp-config.h.in b/win32/net-snmp/net-snmp-config.h.in +index bf2d2dc..1654562 100644 +--- a/win32/net-snmp/net-snmp-config.h.in ++++ b/win32/net-snmp/net-snmp-config.h.in +@@ -486,6 +486,9 @@ + /* Define to 1 if you have the header file. */ + /* #undef HAVE_NETINET_IP_ICMP_H */ + ++/* Define to 1 if you have the header file. */ ++/* #undef HAVE_NETINET_ICMP6_H */ ++ + /* Define to 1 if you have the header file. */ + /* #undef HAVE_NETINET_IP_VAR_H */ + +-- +1.6.0.2 + diff --git a/Add-IPv6-Scope-Zone-Index.patch b/Add-IPv6-Scope-Zone-Index.patch new file mode 100644 index 0000000..cc166f5 --- /dev/null +++ b/Add-IPv6-Scope-Zone-Index.patch @@ -0,0 +1,3481 @@ +From 4d63cceb36d6a178aecd4a8e134b6eae795dfdab Mon Sep 17 00:00:00 2001 +From: Mitsuru Chinen +Date: Mon, 20 Oct 2008 17:51:43 +0900 +Subject: [PATCH] Add IPv6 Scope Zone Index + +[ 1715405 ] Adding ipv6ScopeZoneIndexTable +http://sourceforge.net/tracker/index.php?func=detail&aid=1715405&group_id=12694&atid=312694 + +[ 1897883 ] Fix ipv6ScopeZoneIndexTable on Linux +http://sourceforge.net/tracker/index.php?func=detail&aid=1897883&group_id=12694&atid=312694 + +Signed-off-by: Mitsuru Chinen +--- + agent/mibgroup/ip-mib/data_access/ipv6scopezone.h | 30 + + .../ip-mib/data_access/ipv6scopezone_common.c | 152 +++ + .../ip-mib/data_access/ipv6scopezone_linux.c | 141 +++ + agent/mibgroup/ip-mib/ipv6ScopeZoneIndexTable.h | 5 + + .../ipv6ScopeZoneIndexTable.c | 1004 +++++++++++++++++ + .../ipv6ScopeZoneIndexTable.h | 269 +++++ + .../ipv6ScopeZoneIndexTable_data_access.c | 304 ++++++ + .../ipv6ScopeZoneIndexTable_data_access.h | 70 ++ + .../ipv6ScopeZoneIndexTable_enums.h | 39 + + .../ipv6ScopeZoneIndexTable_interface.c | 1124 ++++++++++++++++++++ + .../ipv6ScopeZoneIndexTable_interface.h | 98 ++ + .../ipv6ScopeZoneIndexTable_oids.h | 55 + + include/net-snmp/data_access/scopezone.h | 68 ++ + 13 files changed, 3359 insertions(+), 0 deletions(-) + create mode 100644 agent/mibgroup/ip-mib/data_access/ipv6scopezone.h + create mode 100644 agent/mibgroup/ip-mib/data_access/ipv6scopezone_common.c + create mode 100644 agent/mibgroup/ip-mib/data_access/ipv6scopezone_linux.c + create mode 100644 agent/mibgroup/ip-mib/ipv6ScopeZoneIndexTable.h + create mode 100644 agent/mibgroup/ip-mib/ipv6ScopeZoneIndexTable/ipv6ScopeZoneIndexTable.c + create mode 100644 agent/mibgroup/ip-mib/ipv6ScopeZoneIndexTable/ipv6ScopeZoneIndexTable.h + create mode 100644 agent/mibgroup/ip-mib/ipv6ScopeZoneIndexTable/ipv6ScopeZoneIndexTable_data_access.c + create mode 100644 agent/mibgroup/ip-mib/ipv6ScopeZoneIndexTable/ipv6ScopeZoneIndexTable_data_access.h + create mode 100644 agent/mibgroup/ip-mib/ipv6ScopeZoneIndexTable/ipv6ScopeZoneIndexTable_enums.h + create mode 100644 agent/mibgroup/ip-mib/ipv6ScopeZoneIndexTable/ipv6ScopeZoneIndexTable_interface.c + create mode 100644 agent/mibgroup/ip-mib/ipv6ScopeZoneIndexTable/ipv6ScopeZoneIndexTable_interface.h + create mode 100644 agent/mibgroup/ip-mib/ipv6ScopeZoneIndexTable/ipv6ScopeZoneIndexTable_oids.h + create mode 100644 include/net-snmp/data_access/scopezone.h + +diff --git a/agent/mibgroup/ip-mib/data_access/ipv6scopezone.h b/agent/mibgroup/ip-mib/data_access/ipv6scopezone.h +new file mode 100644 +index 0000000..8d81b3f +--- /dev/null ++++ b/agent/mibgroup/ip-mib/data_access/ipv6scopezone.h +@@ -0,0 +1,30 @@ ++/* ++ * scopezone data access header ++ * ++ * $Id: ipv6scopezone.h 14170 2007-04-29 02:22:12Z varun_c $ ++ */ ++/**---------------------------------------------------------------------*/ ++/* ++ * configure required files ++ * ++ * Notes: ++ * ++ * 1) prefer functionality over platform, where possible. If a method ++ * is available for multiple platforms, test that first. That way ++ * when a new platform is ported, it won't need a new test here. ++ * ++ * 2) don't do detail requirements here. If, for example, ++ * HPUX11 had different reuirements than other HPUX, that should ++ * be handled in the *_hpux.h header file. ++ */ ++config_require(ip-mib/data_access/ipv6scopezone_common) ++#if defined( linux ) ++config_require(ip-mib/data_access/ipv6scopezone_linux) ++#else ++/* ++ * couldn't determine the correct file! ++ * require a bogus file to generate an error. ++ */ ++config_require(ip-mib/data_access/ipv6scopezone-unknown-arch); ++#endif ++ +diff --git a/agent/mibgroup/ip-mib/data_access/ipv6scopezone_common.c b/agent/mibgroup/ip-mib/data_access/ipv6scopezone_common.c +new file mode 100644 +index 0000000..fdf712b +--- /dev/null ++++ b/agent/mibgroup/ip-mib/data_access/ipv6scopezone_common.c +@@ -0,0 +1,152 @@ ++/* ++ * ipv6ScopeIndexTable MIB architecture support ++ * ++ * $Id: ipv6scopezone_common.c 14170 2007-04-29 02:22:12Z varun_c $ ++ */ ++#include ++#include ++ ++#include ++#include ++/* ++ * local static prototypes ++ */ ++static void _entry_release(netsnmp_v6scopezone_entry * entry, void *unused); ++ ++ ++/**---------------------------------------------------------------------*/ ++/* ++ * external per-architecture functions prototypes ++ * ++ * These shouldn't be called by the general public, so they aren't in ++ * the header file. ++ */ ++extern int ++netsnmp_access_scopezone_container_arch_load(netsnmp_container* container, ++ u_int load_flags); ++extern void ++netsnmp_access_scopezone_arch_init(void); ++ ++/** ++ * initialize systemstats container ++ */ ++netsnmp_container * ++netsnmp_access_scopezone_container_init(u_int flags) ++{ ++ netsnmp_container *container; ++ ++ DEBUGMSGTL(("access:scopezone:container", "init\n")); ++ /* ++ * create the containers. one indexed by ifIndex, the other ++ * indexed by ifName. ++ */ ++ container = netsnmp_container_find("access_scopezone:table_container"); ++ if (NULL == container) ++ return NULL; ++ ++ return container; ++} ++ ++/** ++ * load scopezone information in specified container ++ * ++ * @param container empty container, or NULL to have one created for you ++ * @param load_flags flags to modify behaviour. ++ * ++ * @retval NULL error ++ * @retval !NULL pointer to container ++ */ ++netsnmp_container* ++netsnmp_access_scopezone_container_load(netsnmp_container* container, u_int load_flags) ++{ ++ int rc; ++ ++ DEBUGMSGTL(("access:scopezone:container", "load\n")); ++ ++ if (NULL == container) ++ container = netsnmp_access_scopezone_container_init(load_flags); ++ if (NULL == container) { ++ snmp_log(LOG_ERR, "no container specified/found for access_scopezone\n"); ++ return NULL; ++ } ++ ++ rc = netsnmp_access_scopezone_container_arch_load(container, load_flags); ++ if (0 != rc) { ++ netsnmp_access_scopezone_container_free(container, ++ NETSNMP_ACCESS_SCOPEZONE_FREE_NOFLAGS); ++ container = NULL; ++ } ++ ++ return container; ++} ++ ++void ++netsnmp_access_scopezone_container_free(netsnmp_container *container, u_int free_flags) ++{ ++ DEBUGMSGTL(("access:scopezone:container", "free\n")); ++ ++ if (NULL == container) { ++ snmp_log(LOG_ERR, "invalid container for netsnmp_access_scopezone_free\n"); ++ return; ++ } ++ ++ if(! (free_flags & NETSNMP_ACCESS_SCOPEZONE_FREE_DONT_CLEAR)) { ++ /* ++ * free all items. ++ */ ++ CONTAINER_CLEAR(container, ++ (netsnmp_container_obj_func*)_entry_release, ++ NULL); ++ } ++ ++ CONTAINER_FREE(container); ++} ++ ++/** ++ */ ++netsnmp_v6scopezone_entry * ++netsnmp_access_scopezone_entry_create(void) ++{ ++ netsnmp_v6scopezone_entry *entry = ++ SNMP_MALLOC_TYPEDEF(netsnmp_v6scopezone_entry); ++ ++ DEBUGMSGTL(("access:scopezone:entry", "create\n")); ++ ++ if(NULL == entry) ++ return NULL; ++ ++ ++ entry->oid_index.len = 1; ++ entry->oid_index.oids = &entry->ns_scopezone_index; ++ ++ return entry; ++} ++ ++/** ++ */ ++void ++netsnmp_access_scopezone_entry_free(netsnmp_v6scopezone_entry * entry) ++{ ++ DEBUGMSGTL(("access:scopezone:entry", "free\n")); ++ ++ if (NULL == entry) ++ return; ++ ++ ++ free(entry); ++} ++ ++/**---------------------------------------------------------------------*/ ++/* ++ * Utility routines ++ */ ++ ++/** ++ * \internal ++ */ ++static void ++_entry_release(netsnmp_v6scopezone_entry * entry, void *context) ++{ ++ netsnmp_access_scopezone_entry_free(entry); ++} ++ +diff --git a/agent/mibgroup/ip-mib/data_access/ipv6scopezone_linux.c b/agent/mibgroup/ip-mib/data_access/ipv6scopezone_linux.c +new file mode 100644 +index 0000000..d89f53c +--- /dev/null ++++ b/agent/mibgroup/ip-mib/data_access/ipv6scopezone_linux.c +@@ -0,0 +1,141 @@ ++/* ++ * Interface MIB architecture support ++ * ++ * $Id: ipv6scopezone_linux.c 14170 2007-04-29 02:22:12Z varun_c $ ++ */ ++#include ++#include ++ ++#include ++#include ++ ++#if defined (NETSNMP_ENABLE_IPV6) ++static int _scopezone_v6(netsnmp_container* container, int idx_offset); ++#endif ++ ++/* ++ * ++ * @retval 0 success ++ * @retval -1 no container specified ++ * @retval -2 could not open file ++ * @retval -3 could not create entry (probably malloc) ++ * @retval -4 file format error ++ */ ++int ++netsnmp_access_scopezone_container_arch_load(netsnmp_container* container, ++ u_int load_flags) ++{ ++ int rc1 = 0, idx_offset = 0; ++#if defined (NETSNMP_ENABLE_IPV6) ++ ++ if (NULL == container) { ++ snmp_log(LOG_ERR, "no container specified/found for access_scopezone_\n"); ++ return -1; ++ } ++ ++ rc1 = _scopezone_v6(container, idx_offset); ++#endif ++ if(rc1 > 0) ++ rc1 = 0; ++ return rc1; ++} ++ ++#if defined (NETSNMP_ENABLE_IPV6) ++ ++/* scope identifiers, from kernel - include/net/ipv6.h */ ++#define IPV6_ADDR_LOOPBACK 0x0010U ++#define IPV6_ADDR_LINKLOCAL 0x0020U ++#define IPV6_ADDR_SITELOCAL 0x0040U ++ ++static int ++_scopezone_v6(netsnmp_container* container, int idx_offset) ++{ ++ ++ /* ++ * On Linux, we support only link-local scope zones. ++ * Each interface, which has link-local address, gets unique scope ++ * zone index. ++ */ ++ FILE *in; ++ char line[80], addr[40]; ++ int if_index, pfx_len, scope, flags, rc = 0; ++ int last_if_index = -1; ++ netsnmp_v6scopezone_entry *entry; ++ static int log_open_err = 1; ++ ++ netsnmp_assert(NULL != container); ++ ++#define PROCFILE "/proc/net/if_inet6" ++ if (!(in = fopen(PROCFILE, "r"))) { ++ if (1 == log_open_err) { ++ snmp_log(LOG_ERR,"could not open " PROCFILE "\n"); ++ log_open_err = 0; ++ } ++ return -2; ++ } ++ /* ++ * if we hadn't been able to open file and turned of err logging, ++ * turn it back on now that we opened the file. ++ */ ++ if (0 == log_open_err) ++ log_open_err = 1; ++ ++ /* ++ * address index prefix_len scope status if_name ++ */ ++ while (fgets(line, sizeof(line), in)) { ++ /* ++ * fe800000000000000200e8fffe5b5c93 05 40 20 80 eth0 ++ * A D P S F I ++ * A: address ++ * D: device number ++ * P: prefix len ++ * S: scope (see include/net/ipv6.h, net/ipv6/addrconf.c) ++ * F: flags (see include/linux/rtnetlink.h, net/ipv6/addrconf.c) ++ * I: interface ++ */ ++ rc = sscanf(line, "%39s %02x %02x %02x %02x\n", ++ addr, &if_index, &pfx_len, &scope, &flags); ++ if( 5 != rc ) { ++ snmp_log(LOG_ERR, PROCFILE " data format error (%d!=5), line ==|%s|\n", ++ rc, line); ++ continue; ++ } ++ DEBUGMSGTL(("access:scopezone:container", ++ "addr %s, index %d, pfx %d, scope %d, flags 0x%X\n", ++ addr, if_index, pfx_len, scope, flags)); ++ ++ if (! (scope & IPV6_ADDR_LINKLOCAL)) { ++ DEBUGMSGTL(("access:scopezone:container", ++ "The address is not link-local, skipping\n")); ++ continue; ++ } ++ /* ++ * Check that the interface was not inserted before, just in case ++ * one interface has two or more link-local addresses. ++ */ ++ if (last_if_index == if_index) { ++ DEBUGMSGTL(("access:scopezone:container", ++ "The interface was already inserted, skipping\n")); ++ continue; ++ } ++ ++ last_if_index = if_index; ++ entry = netsnmp_access_scopezone_entry_create(); ++ if(NULL == entry) { ++ rc = -3; ++ break; ++ } ++ entry->ns_scopezone_index = ++idx_offset; ++ entry->index = if_index; ++ entry->scopezone_linklocal = if_index; ++ ++ CONTAINER_INSERT(container, entry); ++ } ++ fclose(in); ++ if(rc<0) ++ return rc; ++ ++ return idx_offset; ++} ++#endif +diff --git a/agent/mibgroup/ip-mib/ipv6ScopeZoneIndexTable.h b/agent/mibgroup/ip-mib/ipv6ScopeZoneIndexTable.h +new file mode 100644 +index 0000000..779bd75 +--- /dev/null ++++ b/agent/mibgroup/ip-mib/ipv6ScopeZoneIndexTable.h +@@ -0,0 +1,5 @@ ++/* ++ * module to include the modules ++ */ ++ ++config_require(ip-mib/ipv6ScopeZoneIndexTable/ipv6ScopeZoneIndexTable) +diff --git a/agent/mibgroup/ip-mib/ipv6ScopeZoneIndexTable/ipv6ScopeZoneIndexTable.c b/agent/mibgroup/ip-mib/ipv6ScopeZoneIndexTable/ipv6ScopeZoneIndexTable.c +new file mode 100644 +index 0000000..edd6586 +--- /dev/null ++++ b/agent/mibgroup/ip-mib/ipv6ScopeZoneIndexTable/ipv6ScopeZoneIndexTable.c +@@ -0,0 +1,1004 @@ ++/* ++ * Note: this file originally auto-generated by mib2c using ++ * version : 14170 $ of $ ++ * ++ * $Id:ipv6ScopeZoneIndexTable.c 14170 2007-04-29 00:12:32Z varun_c$ ++ */ ++/** \page MFD helper for ipv6ScopeZoneIndexTable ++ * ++ * \section intro Introduction ++ * Introductory text. ++ * ++ */ ++/* ++ * standard Net-SNMP includes ++ */ ++#include ++#include ++#include ++ ++/* ++ * include our parent header ++ */ ++#include "ipv6ScopeZoneIndexTable.h" ++ ++#include ++ ++#include "ipv6ScopeZoneIndexTable_interface.h" ++ ++oid ipv6ScopeZoneIndexTable_oid[] = ++ { IPV6SCOPEZONEINDEXTABLE_OID }; ++int ipv6ScopeZoneIndexTable_oid_size = ++OID_LENGTH(ipv6ScopeZoneIndexTable_oid); ++ ++ipv6ScopeZoneIndexTable_registration ipv6ScopeZoneIndexTable_user_context; ++ ++void initialize_table_ipv6ScopeZoneIndexTable(void); ++void shutdown_table_ipv6ScopeZoneIndexTable(void); ++ ++ ++/** ++ * Initializes the ipv6ScopeZoneIndexTable module ++ */ ++void ++init_ipv6ScopeZoneIndexTable(void) ++{ ++ DEBUGMSGTL(("verbose:ipv6ScopeZoneIndexTable:init_ipv6ScopeZoneIndexTable", "called\n")); ++ ++ /* ++ * TODO:300:o: Perform ipv6ScopeZoneIndexTable one-time module initialization. ++ */ ++ ++ /* ++ * here we initialize all the tables we're planning on supporting ++ */ ++ if (should_init("ipv6ScopeZoneIndexTable")) ++ initialize_table_ipv6ScopeZoneIndexTable(); ++ ++} /* init_ipv6ScopeZoneIndexTable */ ++ ++/** ++ * Shut-down the ipv6ScopeZoneIndexTable module (agent is exiting) ++ */ ++void ++shutdown_ipv6ScopeZoneIndexTable(void) ++{ ++ if (should_init("ipv6ScopeZoneIndexTable")) ++ shutdown_table_ipv6ScopeZoneIndexTable(); ++ ++} ++ ++/** ++ * Initialize the table ipv6ScopeZoneIndexTable ++ * (Define its contents and how it's structured) ++ */ ++void ++initialize_table_ipv6ScopeZoneIndexTable(void) ++{ ++ ipv6ScopeZoneIndexTable_registration *user_context; ++ u_long flags; ++ ++ DEBUGMSGTL(("verbose:ipv6ScopeZoneIndexTable:initialize_table_ipv6ScopeZoneIndexTable", "called\n")); ++ ++ /* ++ * TODO:301:o: Perform ipv6ScopeZoneIndexTable one-time table initialization. ++ */ ++ ++ /* ++ * TODO:302:o: |->Initialize ipv6ScopeZoneIndexTable user context ++ * if you'd like to pass in a pointer to some data for this ++ * table, allocate or set it up here. ++ */ ++ /* ++ * a netsnmp_data_list is a simple way to store void pointers. A simple ++ * string token is used to add, find or remove pointers. ++ */ ++ user_context = ++ netsnmp_create_data_list("ipv6ScopeZoneIndexTable", NULL, NULL); ++ ++ /* ++ * No support for any flags yet, but in the future you would ++ * set any flags here. ++ */ ++ flags = 0; ++ ++ /* ++ * call interface initialization code ++ */ ++ _ipv6ScopeZoneIndexTable_initialize_interface(user_context, flags); ++} /* initialize_table_ipv6ScopeZoneIndexTable */ ++ ++/** ++ * Shutdown the table ipv6ScopeZoneIndexTable ++ */ ++void ++shutdown_table_ipv6ScopeZoneIndexTable(void) ++{ ++ /* ++ * call interface shutdown code ++ */ ++ _ipv6ScopeZoneIndexTable_shutdown_interface ++ (&ipv6ScopeZoneIndexTable_user_context); ++} ++ ++/** ++ * extra context initialization (eg default values) ++ * ++ * @param rowreq_ctx : row request context ++ * @param user_init_ctx : void pointer for user (parameter to rowreq_ctx_allocate) ++ * ++ * @retval MFD_SUCCESS : no errors ++ * @retval MFD_ERROR : error (context allocate will fail) ++ */ ++int ++ipv6ScopeZoneIndexTable_rowreq_ctx_init(ipv6ScopeZoneIndexTable_rowreq_ctx ++ * rowreq_ctx, void *user_init_ctx) ++{ ++ DEBUGMSGTL(("verbose:ipv6ScopeZoneIndexTable:ipv6ScopeZoneIndexTable_rowreq_ctx_init", "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:210:o: |-> Perform extra ipv6ScopeZoneIndexTable rowreq initialization. (eg DEFVALS) ++ */ ++ return MFD_SUCCESS; ++} /* ipv6ScopeZoneIndexTable_rowreq_ctx_init */ ++ ++/** ++ * extra context cleanup ++ * ++ */ ++void ++ipv6ScopeZoneIndexTable_rowreq_ctx_cleanup ++ (ipv6ScopeZoneIndexTable_rowreq_ctx * rowreq_ctx) ++{ ++ DEBUGMSGTL(("verbose:ipv6ScopeZoneIndexTable:ipv6ScopeZoneIndexTable_rowreq_ctx_cleanup", "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:211:o: |-> Perform extra ipv6ScopeZoneIndexTable rowreq cleanup. ++ */ ++} /* ipv6ScopeZoneIndexTable_rowreq_ctx_cleanup */ ++ ++/** ++ * pre-request callback ++ * ++ * ++ * @retval MFD_SUCCESS : success. ++ * @retval MFD_ERROR : other error ++ */ ++int ++ipv6ScopeZoneIndexTable_pre_request(ipv6ScopeZoneIndexTable_registration * ++ user_context) ++{ ++ DEBUGMSGTL(("verbose:ipv6ScopeZoneIndexTable:ipv6ScopeZoneIndexTable_pre_request", "called\n")); ++ ++ /* ++ * TODO:510:o: Perform ipv6ScopeZoneIndexTable pre-request actions. ++ */ ++ ++ return MFD_SUCCESS; ++} /* ipv6ScopeZoneIndexTable_pre_request */ ++ ++/** ++ * post-request callback ++ * ++ * Note: ++ * New rows have been inserted into the container, and ++ * deleted rows have been removed from the container and ++ * released. ++ * ++ * @param user_context ++ * @param rc : MFD_SUCCESS if all requests succeeded ++ * ++ * @retval MFD_SUCCESS : success. ++ * @retval MFD_ERROR : other error (ignored) ++ */ ++int ++ipv6ScopeZoneIndexTable_post_request(ipv6ScopeZoneIndexTable_registration * ++ user_context, int rc) ++{ ++ DEBUGMSGTL(("verbose:ipv6ScopeZoneIndexTable:ipv6ScopeZoneIndexTable_post_request", "called\n")); ++ ++ /* ++ * TODO:511:o: Perform ipv6ScopeZoneIndexTable post-request actions. ++ */ ++ ++ return MFD_SUCCESS; ++} /* ipv6ScopeZoneIndexTable_post_request */ ++ ++/* ++ * ipv6ScopeZoneIndexTable_allocate_data ++ * ++ * Purpose: create new ipv6ScopeZoneIndexTable_data. ++ */ ++ipv6ScopeZoneIndexTable_data * ++ipv6ScopeZoneIndexTable_allocate_data(void) ++{ ++ /* ++ * TODO:201:r: |-> allocate memory for the ipv6ScopeZoneIndexTable data context. ++ */ ++ ipv6ScopeZoneIndexTable_data *rtn = netsnmp_access_scopezone_entry_create(); ++ ++ DEBUGMSGTL(("verbose:ipv6ScopeZoneIndexTable:ipv6ScopeZoneIndexTable_allocate_data", "called\n")); ++ ++ if (NULL == rtn) { ++ snmp_log(LOG_ERR, "unable to malloc memory for new " ++ "ipv6ScopeZoneIndexTable_data.\n"); ++ } ++ ++ return rtn; ++} /* ipv6ScopeZoneIndexTable_allocate_data */ ++ ++/* ++ * ipv6ScopeZoneIndexTable_release_data ++ * ++ * Purpose: release ipv6ScopeZoneIndexTable data. ++ */ ++void ++ipv6ScopeZoneIndexTable_release_data(ipv6ScopeZoneIndexTable_data * data) ++{ ++ DEBUGMSGTL(("verbose:ipv6ScopeZoneIndexTable:ipv6ScopeZoneIndexTable_release_data", "called\n")); ++ ++ /* ++ * TODO:202:r: |-> release memory for the ipv6ScopeZoneIndexTable data context. ++ */ ++ netsnmp_access_scopezone_entry_free(data); ++} /* ipv6ScopeZoneIndexTable_release_data */ ++ ++/** @defgroup data_get data_get: Routines to get data ++ * ++ * TODO:230:M: Implement ipv6ScopeZoneIndexTable get routines. ++ * TODO:240:M: Implement ipv6ScopeZoneIndexTable mapping routines (if any). ++ * ++ * These routine are used to get the value for individual objects. The ++ * row context is passed, along with a pointer to the memory where the ++ * value should be copied. ++ * ++ * @{ ++ */ ++/********************************************************************** ++ ********************************************************************** ++ *** ++ *** Table ipv6ScopeZoneIndexTable ++ *** ++ ********************************************************************** ++ **********************************************************************/ ++/* ++ * IP-MIB::ipv6ScopeZoneIndexTable is subid 36 of ip. ++ * Its status is Current. ++ * OID: .1.3.6.1.2.1.4.36, length: 8 ++ */ ++ ++/* ++ * --------------------------------------------------------------------- ++ * * TODO:200:r: Implement ipv6ScopeZoneIndexTable data context functions. ++ */ ++ ++ ++/** ++ * set mib index(es) ++ * ++ * @param tbl_idx mib index structure ++ * @param ipv6ScopeZoneIndexIfIndex_val ++ * ++ * @retval MFD_SUCCESS : success. ++ * @retval MFD_ERROR : other error. ++ * ++ * @remark ++ * This convenience function is useful for setting all the MIB index ++ * components with a single function call. It is assume that the C values ++ * have already been mapped from their native/rawformat to the MIB format. ++ */ ++int ++ipv6ScopeZoneIndexTable_indexes_set_tbl_idx ++ (ipv6ScopeZoneIndexTable_mib_index * tbl_idx, ++ long ipv6ScopeZoneIndexIfIndex_val) ++{ ++ DEBUGMSGTL(("verbose:ipv6ScopeZoneIndexTable:ipv6ScopeZoneIndexTable_indexes_set_tbl_idx", "called\n")); ++ ++ /* ++ * ipv6ScopeZoneIndexIfIndex(1)/InterfaceIndex/ASN_INTEGER/long(long)//l/a/w/e/R/d/H ++ */ ++ tbl_idx->ipv6ScopeZoneIndexIfIndex = ipv6ScopeZoneIndexIfIndex_val; ++ ++ ++ return MFD_SUCCESS; ++} /* ipv6ScopeZoneIndexTable_indexes_set_tbl_idx */ ++ ++/** ++ * @internal ++ * set row context indexes ++ * ++ * @param reqreq_ctx the row context that needs updated indexes ++ * ++ * @retval MFD_SUCCESS : success. ++ * @retval MFD_ERROR : other error. ++ * ++ * @remark ++ * This function sets the mib indexs, then updates the oid indexs ++ * from the mib index. ++ */ ++int ++ipv6ScopeZoneIndexTable_indexes_set(ipv6ScopeZoneIndexTable_rowreq_ctx * ++ rowreq_ctx, ++ long ipv6ScopeZoneIndexIfIndex_val) ++{ ++ DEBUGMSGTL(("verbose:ipv6ScopeZoneIndexTable:ipv6ScopeZoneIndexTable_indexes_set", "called\n")); ++ ++ if (MFD_SUCCESS != ++ ipv6ScopeZoneIndexTable_indexes_set_tbl_idx(&rowreq_ctx->tbl_idx, ++ ipv6ScopeZoneIndexIfIndex_val)) ++ return MFD_ERROR; ++ ++ /* ++ * convert mib index to oid index ++ */ ++ rowreq_ctx->oid_idx.len = sizeof(rowreq_ctx->oid_tmp) / sizeof(oid); ++ if (0 != ipv6ScopeZoneIndexTable_index_to_oid(&rowreq_ctx->oid_idx, ++ &rowreq_ctx->tbl_idx)) { ++ return MFD_ERROR; ++ } ++ ++ return MFD_SUCCESS; ++} /* ipv6ScopeZoneIndexTable_indexes_set */ ++ ++ ++/*--------------------------------------------------------------------- ++ * IP-MIB::ipv6ScopeZoneIndexEntry.ipv6ScopeZoneIndexLinkLocal ++ * ipv6ScopeZoneIndexLinkLocal is subid 2 of ipv6ScopeZoneIndexEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.4.36.1.2 ++ * Description: ++The zone index for the link-local scope on this interface. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 1 ++ * settable 0 ++ * hint: d ++ * ++ * ++ * Its syntax is InetZoneIndex (based on perltype UNSIGNED32) ++ * The net-snmp type is ASN_UNSIGNED. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the ipv6ScopeZoneIndexLinkLocal data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param ipv6ScopeZoneIndexLinkLocal_val_ptr ++ * Pointer to storage for a u_long variable ++ * ++ * @retval MFD_SUCCESS : success ++ * @retval MFD_SKIP : skip this node (no value for now) ++ * @retval MFD_ERROR : Any other error ++ */ ++int ++ipv6ScopeZoneIndexLinkLocal_get(ipv6ScopeZoneIndexTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long * ++ ipv6ScopeZoneIndexLinkLocal_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != ipv6ScopeZoneIndexLinkLocal_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:ipv6ScopeZoneIndexTable:ipv6ScopeZoneIndexLinkLocal_get", "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the ipv6ScopeZoneIndexLinkLocal data. ++ * copy (* ipv6ScopeZoneIndexLinkLocal_val_ptr ) from rowreq_ctx->data ++ */ ++ (*ipv6ScopeZoneIndexLinkLocal_val_ptr) = ++ rowreq_ctx->data->scopezone_linklocal; ++ ++ return MFD_SUCCESS; ++} /* ipv6ScopeZoneIndexLinkLocal_get */ ++ ++/*--------------------------------------------------------------------- ++ * IP-MIB::ipv6ScopeZoneIndexEntry.ipv6ScopeZoneIndex3 ++ * ipv6ScopeZoneIndex3 is subid 3 of ipv6ScopeZoneIndexEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.4.36.1.3 ++ * Description: ++The zone index for scope 3 on this interface. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 1 ++ * settable 0 ++ * hint: d ++ * ++ * ++ * Its syntax is InetZoneIndex (based on perltype UNSIGNED32) ++ * The net-snmp type is ASN_UNSIGNED. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the ipv6ScopeZoneIndex3 data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param ipv6ScopeZoneIndex3_val_ptr ++ * Pointer to storage for a u_long variable ++ * ++ * @retval MFD_SUCCESS : success ++ * @retval MFD_SKIP : skip this node (no value for now) ++ * @retval MFD_ERROR : Any other error ++ */ ++int ++ipv6ScopeZoneIndex3_get(ipv6ScopeZoneIndexTable_rowreq_ctx * rowreq_ctx, ++ u_long * ipv6ScopeZoneIndex3_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != ipv6ScopeZoneIndex3_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:ipv6ScopeZoneIndexTable:ipv6ScopeZoneIndex3_get", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the ipv6ScopeZoneIndex3 data. ++ * copy (* ipv6ScopeZoneIndex3_val_ptr ) from rowreq_ctx->data ++ */ ++ (*ipv6ScopeZoneIndex3_val_ptr) = 0; ++ ++ ++ return MFD_SUCCESS; ++} /* ipv6ScopeZoneIndex3_get */ ++ ++/*--------------------------------------------------------------------- ++ * IP-MIB::ipv6ScopeZoneIndexEntry.ipv6ScopeZoneIndexAdminLocal ++ * ipv6ScopeZoneIndexAdminLocal is subid 4 of ipv6ScopeZoneIndexEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.4.36.1.4 ++ * Description: ++The zone index for the admin-local scope on this interface. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 1 ++ * settable 0 ++ * hint: d ++ * ++ * ++ * Its syntax is InetZoneIndex (based on perltype UNSIGNED32) ++ * The net-snmp type is ASN_UNSIGNED. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the ipv6ScopeZoneIndexAdminLocal data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param ipv6ScopeZoneIndexAdminLocal_val_ptr ++ * Pointer to storage for a u_long variable ++ * ++ * @retval MFD_SUCCESS : success ++ * @retval MFD_SKIP : skip this node (no value for now) ++ * @retval MFD_ERROR : Any other error ++ */ ++int ++ipv6ScopeZoneIndexAdminLocal_get(ipv6ScopeZoneIndexTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long * ++ ipv6ScopeZoneIndexAdminLocal_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != ipv6ScopeZoneIndexAdminLocal_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:ipv6ScopeZoneIndexTable:ipv6ScopeZoneIndexAdminLocal_get", "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the ipv6ScopeZoneIndexAdminLocal data. ++ * copy (* ipv6ScopeZoneIndexAdminLocal_val_ptr ) from rowreq_ctx->data ++ */ ++ (*ipv6ScopeZoneIndexAdminLocal_val_ptr) = 0; ++ ++ return MFD_SUCCESS; ++} /* ipv6ScopeZoneIndexAdminLocal_get */ ++ ++/*--------------------------------------------------------------------- ++ * IP-MIB::ipv6ScopeZoneIndexEntry.ipv6ScopeZoneIndexSiteLocal ++ * ipv6ScopeZoneIndexSiteLocal is subid 5 of ipv6ScopeZoneIndexEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.4.36.1.5 ++ * Description: ++The zone index for the site-local scope on this interface. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 1 ++ * settable 0 ++ * hint: d ++ * ++ * ++ * Its syntax is InetZoneIndex (based on perltype UNSIGNED32) ++ * The net-snmp type is ASN_UNSIGNED. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the ipv6ScopeZoneIndexSiteLocal data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param ipv6ScopeZoneIndexSiteLocal_val_ptr ++ * Pointer to storage for a u_long variable ++ * ++ * @retval MFD_SUCCESS : success ++ * @retval MFD_SKIP : skip this node (no value for now) ++ * @retval MFD_ERROR : Any other error ++ */ ++int ++ipv6ScopeZoneIndexSiteLocal_get(ipv6ScopeZoneIndexTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long * ++ ipv6ScopeZoneIndexSiteLocal_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != ipv6ScopeZoneIndexSiteLocal_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:ipv6ScopeZoneIndexTable:ipv6ScopeZoneIndexSiteLocal_get", "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the ipv6ScopeZoneIndexSiteLocal data. ++ * copy (* ipv6ScopeZoneIndexSiteLocal_val_ptr ) from rowreq_ctx->data ++ */ ++ (*ipv6ScopeZoneIndexSiteLocal_val_ptr) = 0; ++ ++ return MFD_SUCCESS; ++} /* ipv6ScopeZoneIndexSiteLocal_get */ ++ ++/*--------------------------------------------------------------------- ++ * IP-MIB::ipv6ScopeZoneIndexEntry.ipv6ScopeZoneIndex6 ++ * ipv6ScopeZoneIndex6 is subid 6 of ipv6ScopeZoneIndexEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.4.36.1.6 ++ * Description: ++The zone index for scope 6 on this interface. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 1 ++ * settable 0 ++ * hint: d ++ * ++ * ++ * Its syntax is InetZoneIndex (based on perltype UNSIGNED32) ++ * The net-snmp type is ASN_UNSIGNED. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the ipv6ScopeZoneIndex6 data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param ipv6ScopeZoneIndex6_val_ptr ++ * Pointer to storage for a u_long variable ++ * ++ * @retval MFD_SUCCESS : success ++ * @retval MFD_SKIP : skip this node (no value for now) ++ * @retval MFD_ERROR : Any other error ++ */ ++int ++ipv6ScopeZoneIndex6_get(ipv6ScopeZoneIndexTable_rowreq_ctx * rowreq_ctx, ++ u_long * ipv6ScopeZoneIndex6_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != ipv6ScopeZoneIndex6_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:ipv6ScopeZoneIndexTable:ipv6ScopeZoneIndex6_get", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the ipv6ScopeZoneIndex6 data. ++ * copy (* ipv6ScopeZoneIndex6_val_ptr ) from rowreq_ctx->data ++ */ ++ (*ipv6ScopeZoneIndex6_val_ptr) = 0; ++ ++ return MFD_SUCCESS; ++} /* ipv6ScopeZoneIndex6_get */ ++ ++/*--------------------------------------------------------------------- ++ * IP-MIB::ipv6ScopeZoneIndexEntry.ipv6ScopeZoneIndex7 ++ * ipv6ScopeZoneIndex7 is subid 7 of ipv6ScopeZoneIndexEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.4.36.1.7 ++ * Description: ++The zone index for scope 7 on this interface. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 1 ++ * settable 0 ++ * hint: d ++ * ++ * ++ * Its syntax is InetZoneIndex (based on perltype UNSIGNED32) ++ * The net-snmp type is ASN_UNSIGNED. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the ipv6ScopeZoneIndex7 data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param ipv6ScopeZoneIndex7_val_ptr ++ * Pointer to storage for a u_long variable ++ * ++ * @retval MFD_SUCCESS : success ++ * @retval MFD_SKIP : skip this node (no value for now) ++ * @retval MFD_ERROR : Any other error ++ */ ++int ++ipv6ScopeZoneIndex7_get(ipv6ScopeZoneIndexTable_rowreq_ctx * rowreq_ctx, ++ u_long * ipv6ScopeZoneIndex7_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != ipv6ScopeZoneIndex7_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:ipv6ScopeZoneIndexTable:ipv6ScopeZoneIndex7_get", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the ipv6ScopeZoneIndex7 data. ++ * copy (* ipv6ScopeZoneIndex7_val_ptr ) from rowreq_ctx->data ++ */ ++ (*ipv6ScopeZoneIndex7_val_ptr) = 0; ++ ++ return MFD_SUCCESS; ++} /* ipv6ScopeZoneIndex7_get */ ++ ++/*--------------------------------------------------------------------- ++ * IP-MIB::ipv6ScopeZoneIndexEntry.ipv6ScopeZoneIndexOrganizationLocal ++ * ipv6ScopeZoneIndexOrganizationLocal is subid 8 of ipv6ScopeZoneIndexEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.4.36.1.8 ++ * Description: ++The zone index for the organization-local scope on this ++ interface. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 1 ++ * settable 0 ++ * hint: d ++ * ++ * ++ * Its syntax is InetZoneIndex (based on perltype UNSIGNED32) ++ * The net-snmp type is ASN_UNSIGNED. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the ipv6ScopeZoneIndexOrganizationLocal data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param ipv6ScopeZoneIndexOrganizationLocal_val_ptr ++ * Pointer to storage for a u_long variable ++ * ++ * @retval MFD_SUCCESS : success ++ * @retval MFD_SKIP : skip this node (no value for now) ++ * @retval MFD_ERROR : Any other error ++ */ ++int ++ipv6ScopeZoneIndexOrganizationLocal_get(ipv6ScopeZoneIndexTable_rowreq_ctx ++ * rowreq_ctx, ++ u_long * ++ ipv6ScopeZoneIndexOrganizationLocal_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != ipv6ScopeZoneIndexOrganizationLocal_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:ipv6ScopeZoneIndexTable:ipv6ScopeZoneIndexOrganizationLocal_get", "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the ipv6ScopeZoneIndexOrganizationLocal data. ++ * copy (* ipv6ScopeZoneIndexOrganizationLocal_val_ptr ) from rowreq_ctx->data ++ */ ++ (*ipv6ScopeZoneIndexOrganizationLocal_val_ptr) = 0; ++ ++ return MFD_SUCCESS; ++} /* ipv6ScopeZoneIndexOrganizationLocal_get */ ++ ++/*--------------------------------------------------------------------- ++ * IP-MIB::ipv6ScopeZoneIndexEntry.ipv6ScopeZoneIndex9 ++ * ipv6ScopeZoneIndex9 is subid 9 of ipv6ScopeZoneIndexEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.4.36.1.9 ++ * Description: ++The zone index for scope 9 on this interface. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 1 ++ * settable 0 ++ * hint: d ++ * ++ * ++ * Its syntax is InetZoneIndex (based on perltype UNSIGNED32) ++ * The net-snmp type is ASN_UNSIGNED. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the ipv6ScopeZoneIndex9 data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param ipv6ScopeZoneIndex9_val_ptr ++ * Pointer to storage for a u_long variable ++ * ++ * @retval MFD_SUCCESS : success ++ * @retval MFD_SKIP : skip this node (no value for now) ++ * @retval MFD_ERROR : Any other error ++ */ ++int ++ipv6ScopeZoneIndex9_get(ipv6ScopeZoneIndexTable_rowreq_ctx * rowreq_ctx, ++ u_long * ipv6ScopeZoneIndex9_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != ipv6ScopeZoneIndex9_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:ipv6ScopeZoneIndexTable:ipv6ScopeZoneIndex9_get", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the ipv6ScopeZoneIndex9 data. ++ * copy (* ipv6ScopeZoneIndex9_val_ptr ) from rowreq_ctx->data ++ */ ++ (*ipv6ScopeZoneIndex9_val_ptr) = 0; ++ ++ return MFD_SUCCESS; ++} /* ipv6ScopeZoneIndex9_get */ ++ ++/*--------------------------------------------------------------------- ++ * IP-MIB::ipv6ScopeZoneIndexEntry.ipv6ScopeZoneIndexA ++ * ipv6ScopeZoneIndexA is subid 10 of ipv6ScopeZoneIndexEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.4.36.1.10 ++ * Description: ++The zone index for scope A on this interface. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 1 ++ * settable 0 ++ * hint: d ++ * ++ * ++ * Its syntax is InetZoneIndex (based on perltype UNSIGNED32) ++ * The net-snmp type is ASN_UNSIGNED. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the ipv6ScopeZoneIndexA data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param ipv6ScopeZoneIndexA_val_ptr ++ * Pointer to storage for a u_long variable ++ * ++ * @retval MFD_SUCCESS : success ++ * @retval MFD_SKIP : skip this node (no value for now) ++ * @retval MFD_ERROR : Any other error ++ */ ++int ++ipv6ScopeZoneIndexA_get(ipv6ScopeZoneIndexTable_rowreq_ctx * rowreq_ctx, ++ u_long * ipv6ScopeZoneIndexA_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != ipv6ScopeZoneIndexA_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:ipv6ScopeZoneIndexTable:ipv6ScopeZoneIndexA_get", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the ipv6ScopeZoneIndexA data. ++ * copy (* ipv6ScopeZoneIndexA_val_ptr ) from rowreq_ctx->data ++ */ ++ (*ipv6ScopeZoneIndexA_val_ptr) = 0; ++ ++ return MFD_SUCCESS; ++} /* ipv6ScopeZoneIndexA_get */ ++ ++/*--------------------------------------------------------------------- ++ * IP-MIB::ipv6ScopeZoneIndexEntry.ipv6ScopeZoneIndexB ++ * ipv6ScopeZoneIndexB is subid 11 of ipv6ScopeZoneIndexEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.4.36.1.11 ++ * Description: ++The zone index for scope B on this interface. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 1 ++ * settable 0 ++ * hint: d ++ * ++ * ++ * Its syntax is InetZoneIndex (based on perltype UNSIGNED32) ++ * The net-snmp type is ASN_UNSIGNED. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the ipv6ScopeZoneIndexB data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param ipv6ScopeZoneIndexB_val_ptr ++ * Pointer to storage for a u_long variable ++ * ++ * @retval MFD_SUCCESS : success ++ * @retval MFD_SKIP : skip this node (no value for now) ++ * @retval MFD_ERROR : Any other error ++ */ ++int ++ipv6ScopeZoneIndexB_get(ipv6ScopeZoneIndexTable_rowreq_ctx * rowreq_ctx, ++ u_long * ipv6ScopeZoneIndexB_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != ipv6ScopeZoneIndexB_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:ipv6ScopeZoneIndexTable:ipv6ScopeZoneIndexB_get", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the ipv6ScopeZoneIndexB data. ++ * copy (* ipv6ScopeZoneIndexB_val_ptr ) from rowreq_ctx->data ++ */ ++ (*ipv6ScopeZoneIndexB_val_ptr) = 0; ++ ++ return MFD_SUCCESS; ++} /* ipv6ScopeZoneIndexB_get */ ++ ++/*--------------------------------------------------------------------- ++ * IP-MIB::ipv6ScopeZoneIndexEntry.ipv6ScopeZoneIndexC ++ * ipv6ScopeZoneIndexC is subid 12 of ipv6ScopeZoneIndexEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.4.36.1.12 ++ * Description: ++The zone index for scope C on this interface. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 1 ++ * settable 0 ++ * hint: d ++ * ++ * ++ * Its syntax is InetZoneIndex (based on perltype UNSIGNED32) ++ * The net-snmp type is ASN_UNSIGNED. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the ipv6ScopeZoneIndexC data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param ipv6ScopeZoneIndexC_val_ptr ++ * Pointer to storage for a u_long variable ++ * ++ * @retval MFD_SUCCESS : success ++ * @retval MFD_SKIP : skip this node (no value for now) ++ * @retval MFD_ERROR : Any other error ++ */ ++int ++ipv6ScopeZoneIndexC_get(ipv6ScopeZoneIndexTable_rowreq_ctx * rowreq_ctx, ++ u_long * ipv6ScopeZoneIndexC_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != ipv6ScopeZoneIndexC_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:ipv6ScopeZoneIndexTable:ipv6ScopeZoneIndexC_get", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the ipv6ScopeZoneIndexC data. ++ * copy (* ipv6ScopeZoneIndexC_val_ptr ) from rowreq_ctx->data ++ */ ++ (*ipv6ScopeZoneIndexC_val_ptr) = 0; ++ ++ return MFD_SUCCESS; ++} /* ipv6ScopeZoneIndexC_get */ ++ ++/*--------------------------------------------------------------------- ++ * IP-MIB::ipv6ScopeZoneIndexEntry.ipv6ScopeZoneIndexD ++ * ipv6ScopeZoneIndexD is subid 13 of ipv6ScopeZoneIndexEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.4.36.1.13 ++ * Description: ++The zone index for scope D on this interface. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 1 ++ * settable 0 ++ * hint: d ++ * ++ * ++ * Its syntax is InetZoneIndex (based on perltype UNSIGNED32) ++ * The net-snmp type is ASN_UNSIGNED. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the ipv6ScopeZoneIndexD data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param ipv6ScopeZoneIndexD_val_ptr ++ * Pointer to storage for a u_long variable ++ * ++ * @retval MFD_SUCCESS : success ++ * @retval MFD_SKIP : skip this node (no value for now) ++ * @retval MFD_ERROR : Any other error ++ */ ++int ++ipv6ScopeZoneIndexD_get(ipv6ScopeZoneIndexTable_rowreq_ctx * rowreq_ctx, ++ u_long * ipv6ScopeZoneIndexD_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != ipv6ScopeZoneIndexD_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:ipv6ScopeZoneIndexTable:ipv6ScopeZoneIndexD_get", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the ipv6ScopeZoneIndexD data. ++ * copy (* ipv6ScopeZoneIndexD_val_ptr ) from rowreq_ctx->data ++ */ ++ (*ipv6ScopeZoneIndexD_val_ptr) = 0; ++ ++ return MFD_SUCCESS; ++} /* ipv6ScopeZoneIndexD_get */ ++ ++ ++/** @{ */ +diff --git a/agent/mibgroup/ip-mib/ipv6ScopeZoneIndexTable/ipv6ScopeZoneIndexTable.h b/agent/mibgroup/ip-mib/ipv6ScopeZoneIndexTable/ipv6ScopeZoneIndexTable.h +new file mode 100644 +index 0000000..bced5af +--- /dev/null ++++ b/agent/mibgroup/ip-mib/ipv6ScopeZoneIndexTable/ipv6ScopeZoneIndexTable.h +@@ -0,0 +1,269 @@ ++/* ++ * Note: this file originally auto-generated by mib2c using ++ * version : 14170 $ of $ ++ * ++ * $Id:ipv6ScopeZoneIndexTable.h 14170 2007-04-29 00:12:32Z varun_c$ ++ */ ++#ifndef IPV6SCOPEZONEINDEXTABLE_H ++#define IPV6SCOPEZONEINDEXTABLE_H ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++ ++/** @addtogroup misc misc: Miscellaneous routines ++ * ++ * @{ ++ */ ++#include ++#include ++ /* ++ * other required module components ++ */ ++ /* *INDENT-OFF* */ ++config_require(ip-mib/data_access/ipv6scopezone) ++config_require(ip-mib/ipv6ScopeZoneIndexTable/ipv6ScopeZoneIndexTable_interface) ++config_require(ip-mib/ipv6ScopeZoneIndexTable/ipv6ScopeZoneIndexTable_data_access) ++ /* *INDENT-ON* */ ++ ++ /* ++ * OID and column number definitions for ipv6ScopeZoneIndexTable ++ */ ++#include "ipv6ScopeZoneIndexTable_oids.h" ++ ++ /* ++ * enum definions ++ */ ++#include "ipv6ScopeZoneIndexTable_enums.h" ++ ++ /* ++ ********************************************************************* ++ * function declarations ++ */ ++ void init_ipv6ScopeZoneIndexTable(void); ++ void shutdown_ipv6ScopeZoneIndexTable(void); ++ ++ /* ++ ********************************************************************* ++ * Table declarations ++ */ ++/********************************************************************** ++ ********************************************************************** ++ *** ++ *** Table ipv6ScopeZoneIndexTable ++ *** ++ ********************************************************************** ++ **********************************************************************/ ++ /* ++ * IP-MIB::ipv6ScopeZoneIndexTable is subid 36 of ip. ++ * Its status is Current. ++ * OID: .1.3.6.1.2.1.4.36, length: 8 ++ */ ++ /* ++ ********************************************************************* ++ * When you register your mib, you get to provide a generic ++ * pointer that will be passed back to you for most of the ++ * functions calls. ++ * ++ * TODO:100:r: Review all context structures ++ */ ++ /* ++ * TODO:101:o: |-> Review ipv6ScopeZoneIndexTable registration context. ++ */ ++ typedef netsnmp_data_list ipv6ScopeZoneIndexTable_registration; ++/**********************************************************************/ ++ /* ++ * TODO:110:r: |-> Review ipv6ScopeZoneTable data context structure. ++ * This structure is used to represent the data for ipv6ScopeZoneTable. ++ */ ++ typedef netsnmp_v6scopezone_entry ipv6ScopeZoneIndexTable_data; ++ ++ ++ /* ++ * TODO:120:r: |-> Review ipv6ScopeZoneIndexTable mib index. ++ * This structure is used to represent the index for ipv6ScopeZoneIndexTable. ++ */ ++ typedef struct ipv6ScopeZoneIndexTable_mib_index_s { ++ ++ /* ++ * ipv6ScopeZoneIndexIfIndex(1)/InterfaceIndex/ASN_INTEGER/long(long)//l/a/w/e/R/d/H ++ */ ++ long ipv6ScopeZoneIndexIfIndex; ++ ++ ++ } ipv6ScopeZoneIndexTable_mib_index; ++ ++ /* ++ * TODO:121:r: | |-> Review ipv6ScopeZoneIndexTable max index length. ++ * If you KNOW that your indexes will never exceed a certain ++ * length, update this macro to that length. ++ */ ++#define MAX_ipv6ScopeZoneIndexTable_IDX_LEN 1 ++ ++ /* ++ ********************************************************************* ++ * TODO:130:o: |-> Review ipv6ScopeZoneIndexTable Row request (rowreq) context. ++ * When your functions are called, you will be passed a ++ * ipv6ScopeZoneIndexTable_rowreq_ctx pointer. ++ */ ++ typedef struct ipv6ScopeZoneIndexTable_rowreq_ctx_s { ++ ++ /** this must be first for container compare to work */ ++ netsnmp_index oid_idx; ++ oid oid_tmp[MAX_ipv6ScopeZoneIndexTable_IDX_LEN]; ++ ++ ipv6ScopeZoneIndexTable_mib_index tbl_idx; ++ ++ ipv6ScopeZoneIndexTable_data *data; ++ ++ /* ++ * flags per row. Currently, the first (lower) 8 bits are reserved ++ * for the user. See mfd.h for other flags. ++ */ ++ u_int rowreq_flags; ++ ++ /* ++ * TODO:131:o: | |-> Add useful data to ipv6ScopeZoneIndexTable rowreq context. ++ */ ++ ++ /* ++ * storage for future expansion ++ */ ++ netsnmp_data_list *ipv6ScopeZoneIndexTable_data_list; ++ ++ } ipv6ScopeZoneIndexTable_rowreq_ctx; ++ ++ typedef struct ipv6ScopeZoneIndexTable_ref_rowreq_ctx_s { ++ ipv6ScopeZoneIndexTable_rowreq_ctx *rowreq_ctx; ++ } ipv6ScopeZoneIndexTable_ref_rowreq_ctx; ++ ++ /* ++ ********************************************************************* ++ * function prototypes ++ */ ++ int ++ ipv6ScopeZoneIndexTable_pre_request ++ (ipv6ScopeZoneIndexTable_registration * user_context); ++ int ++ ipv6ScopeZoneIndexTable_post_request ++ (ipv6ScopeZoneIndexTable_registration * user_context, int rc); ++ ++ int ++ ipv6ScopeZoneIndexTable_rowreq_ctx_init ++ (ipv6ScopeZoneIndexTable_rowreq_ctx * rowreq_ctx, ++ void *user_init_ctx); ++ void ++ ipv6ScopeZoneIndexTable_rowreq_ctx_cleanup ++ (ipv6ScopeZoneIndexTable_rowreq_ctx * rowreq_ctx); ++ ++ ++ ipv6ScopeZoneIndexTable_rowreq_ctx ++ *ipv6ScopeZoneIndexTable_row_find_by_mib_index ++ (ipv6ScopeZoneIndexTable_mib_index * mib_idx); ++ ++ ipv6ScopeZoneIndexTable_data * ++ ipv6ScopeZoneIndexTable_allocate_data(void); ++ ++ void ++ ipv6ScopeZoneIndexTable_release_data(ipv6ScopeZoneIndexTable_data * data); ++ ++ extern oid ipv6ScopeZoneIndexTable_oid[]; ++ extern int ipv6ScopeZoneIndexTable_oid_size; ++ ++ ++#include "ipv6ScopeZoneIndexTable_interface.h" ++#include "ipv6ScopeZoneIndexTable_data_access.h" ++/********************************************************************** ++ ********************************************************************** ++ *** ++ *** Table ipv6ScopeZoneIndexTable ++ *** ++ ********************************************************************** ++ **********************************************************************/ ++ /* ++ * IP-MIB::ipv6ScopeZoneIndexTable is subid 36 of ip. ++ * Its status is Current. ++ * OID: .1.3.6.1.2.1.4.36, length: 8 ++ */ ++ /* ++ * indexes ++ */ ++ ++ int ++ ipv6ScopeZoneIndexLinkLocal_get(ipv6ScopeZoneIndexTable_rowreq_ctx ++ * rowreq_ctx, ++ u_long * ++ ipv6ScopeZoneIndexLinkLocal_val_ptr); ++ int ++ ipv6ScopeZoneIndex3_get(ipv6ScopeZoneIndexTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long * ipv6ScopeZoneIndex3_val_ptr); ++ int ++ ipv6ScopeZoneIndexAdminLocal_get(ipv6ScopeZoneIndexTable_rowreq_ctx ++ * rowreq_ctx, ++ u_long * ++ ipv6ScopeZoneIndexAdminLocal_val_ptr); ++ int ++ ipv6ScopeZoneIndexSiteLocal_get(ipv6ScopeZoneIndexTable_rowreq_ctx ++ * rowreq_ctx, ++ u_long * ++ ipv6ScopeZoneIndexSiteLocal_val_ptr); ++ int ++ ipv6ScopeZoneIndex6_get(ipv6ScopeZoneIndexTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long * ipv6ScopeZoneIndex6_val_ptr); ++ int ++ ipv6ScopeZoneIndex7_get(ipv6ScopeZoneIndexTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long * ipv6ScopeZoneIndex7_val_ptr); ++ int ++ ipv6ScopeZoneIndexOrganizationLocal_get ++ (ipv6ScopeZoneIndexTable_rowreq_ctx * rowreq_ctx, ++ u_long * ipv6ScopeZoneIndexOrganizationLocal_val_ptr); ++ int ++ ipv6ScopeZoneIndex9_get(ipv6ScopeZoneIndexTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long * ipv6ScopeZoneIndex9_val_ptr); ++ int ++ ipv6ScopeZoneIndexA_get(ipv6ScopeZoneIndexTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long * ipv6ScopeZoneIndexA_val_ptr); ++ int ++ ipv6ScopeZoneIndexB_get(ipv6ScopeZoneIndexTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long * ipv6ScopeZoneIndexB_val_ptr); ++ int ++ ipv6ScopeZoneIndexC_get(ipv6ScopeZoneIndexTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long * ipv6ScopeZoneIndexC_val_ptr); ++ int ++ ipv6ScopeZoneIndexD_get(ipv6ScopeZoneIndexTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long * ipv6ScopeZoneIndexD_val_ptr); ++ ++ ++ int ++ ipv6ScopeZoneIndexTable_indexes_set_tbl_idx ++ (ipv6ScopeZoneIndexTable_mib_index * tbl_idx, ++ long ipv6ScopeZoneIndexIfIndex_val); ++ int ++ ipv6ScopeZoneIndexTable_indexes_set ++ (ipv6ScopeZoneIndexTable_rowreq_ctx * rowreq_ctx, ++ long ipv6ScopeZoneIndexIfIndex_val); ++ ++ /* ++ * DUMMY markers, ignore ++ * ++ * TODO:099:x: ************************************************************* ++ * TODO:199:x: ************************************************************* ++ * TODO:299:x: ************************************************************* ++ * TODO:399:x: ************************************************************* ++ * TODO:499:x: ************************************************************* ++ */ ++ ++#ifdef __cplusplus ++} ++#endif ++#endif /* IPV6SCOPEZONEINDEXTABLE_H */ ++/** @} */ +diff --git a/agent/mibgroup/ip-mib/ipv6ScopeZoneIndexTable/ipv6ScopeZoneIndexTable_data_access.c b/agent/mibgroup/ip-mib/ipv6ScopeZoneIndexTable/ipv6ScopeZoneIndexTable_data_access.c +new file mode 100644 +index 0000000..7105dbf +--- /dev/null ++++ b/agent/mibgroup/ip-mib/ipv6ScopeZoneIndexTable/ipv6ScopeZoneIndexTable_data_access.c +@@ -0,0 +1,304 @@ ++/* ++ * Note: this file originally auto-generated by mib2c using ++ * version : 14170 $ of $ ++ * ++ * $Id:ipv6ScopeZoneIndexTable_data_access.c 14170 2007-04-29 00:12:32Z varun_c$ ++ */ ++/* ++ * standard Net-SNMP includes ++ */ ++#include ++#include ++#include ++ ++/* ++ * include our parent header ++ */ ++#include "ipv6ScopeZoneIndexTable.h" ++ ++ ++#include "ipv6ScopeZoneIndexTable_data_access.h" ++ ++/** @ingroup interface ++ * @addtogroup data_access data_access: Routines to access data ++ * ++ * These routines are used to locate the data used to satisfy ++ * requests. ++ * ++ * @{ ++ */ ++/********************************************************************** ++ ********************************************************************** ++ *** ++ *** Table ipv6ScopeZoneIndexTable ++ *** ++ ********************************************************************** ++ **********************************************************************/ ++/* ++ * IP-MIB::ipv6ScopeZoneIndexTable is subid 36 of ip. ++ * Its status is Current. ++ * OID: .1.3.6.1.2.1.4.36, length: 8 ++ */ ++ ++/** ++ * initialization for ipv6ScopeZoneIndexTable data access ++ * ++ * This function is called during startup to allow you to ++ * allocate any resources you need for the data table. ++ * ++ * @param ipv6ScopeZoneIndexTable_reg ++ * Pointer to ipv6ScopeZoneIndexTable_registration ++ * ++ * @retval MFD_SUCCESS : success. ++ * @retval MFD_ERROR : unrecoverable error. ++ */ ++int ++ipv6ScopeZoneIndexTable_init_data(ipv6ScopeZoneIndexTable_registration * ++ ipv6ScopeZoneIndexTable_reg) ++{ ++ DEBUGMSGTL(("verbose:ipv6ScopeZoneIndexTable:ipv6ScopeZoneIndexTable_init_data", "called\n")); ++ return MFD_SUCCESS; ++} /* ipv6ScopeZoneIndexTable_init_data */ ++ ++/** ++ * container overview ++ * ++ */ ++ ++/** ++ * container initialization ++ * ++ * @param container_ptr_ptr A pointer to a container pointer. If you ++ * create a custom container, use this parameter to return it ++ * to the MFD helper. If set to NULL, the MFD helper will ++ * allocate a container for you. ++ * ++ * This function is called at startup to allow you to customize certain ++ * aspects of the access method. For the most part, it is for advanced ++ * users. The default code should suffice for most cases. If no custom ++ * container is allocated, the MFD code will create one for your. ++ * ++ * @remark ++ * This would also be a good place to do any initialization needed ++ * for you data source. For example, opening a connection to another ++ * process that will supply the data, opening a database, etc. ++ */ ++void ++ipv6ScopeZoneIndexTable_container_init(netsnmp_container ** ++ container_ptr_ptr, ++ netsnmp_cache * cache) ++{ ++ DEBUGMSGTL(("verbose:ipv6ScopeZoneIndexTable:ipv6ScopeZoneIndexTable_container_init", "called\n")); ++ ++ if (NULL == container_ptr_ptr) { ++ snmp_log(LOG_ERR, ++ "bad container param to ipv6ScopeZoneIndexTable_container_init\n"); ++ return; ++ } ++ ++ /* ++ * For advanced users, you can use a custom container. If you ++ * do not create one, one will be created for you. ++ */ ++ *container_ptr_ptr = NULL; ++ if (NULL == cache) { ++ snmp_log(LOG_ERR, ++ "bad cache param to ipv6ScopeZoneIndexTable_container_init\n"); ++ return; ++ } ++ ++ /* ++ * TODO:345:A: Set up ipv6ScopeZoneIndexTable cache properties. ++ * ++ * Also for advanced users, you can set parameters for the ++ * cache. Do not change the magic pointer, as it is used ++ * by the MFD helper. To completely disable caching, set ++ * cache->enabled to 0. ++ */ ++ cache->timeout = 60; /* seconds */ ++ ++ ++} /* ipv6ScopeZoneIndexTable_container_init */ ++ ++/** ++ * container shutdown ++ * ++ * @param container_ptr A pointer to the container. ++ * ++ * This function is called at shutdown to allow you to customize certain ++ * aspects of the access method. For the most part, it is for advanced ++ * users. The default code should suffice for most cases. ++ * ++ * This function is called before ipv6ScopeZoneIndexTable_container_free(). ++ * ++ * @remark ++ * This would also be a good place to do any cleanup needed ++ * for you data source. For example, closing a connection to another ++ * process that supplied the data, closing a database, etc. ++ */ ++void ++ipv6ScopeZoneIndexTable_container_shutdown(netsnmp_container *container_ptr) ++{ ++ DEBUGMSGTL(("verbose:ipv6ScopeZoneIndexTable:ipv6ScopeZoneIndexTable_container_shutdown", "called\n")); ++ ++ if (NULL == container_ptr) { ++ snmp_log(LOG_ERR, ++ "bad params to ipv6ScopeZoneIndexTable_container_shutdown\n"); ++ return; ++ } ++ ++} /* ipv6ScopeZoneIndexTable_container_shutdown */ ++ ++/** ++ * check entry for update ++ * ++ */ ++static void ++_snarf_zoneindex_entry(netsnmp_v6scopezone_entry *scopezone_entry, ++ netsnmp_container *container) ++{ ++ ipv6ScopeZoneIndexTable_rowreq_ctx *rowreq_ctx; ++ ++ DEBUGTRACE; ++ netsnmp_assert(NULL != scopezone_entry); ++ netsnmp_assert(NULL != container); ++ rowreq_ctx = ipv6ScopeZoneIndexTable_allocate_rowreq_ctx(scopezone_entry,NULL); ++ if ((NULL != rowreq_ctx) && ++ (MFD_SUCCESS == ipv6ScopeZoneIndexTable_indexes_set ++ (rowreq_ctx, rowreq_ctx->data->index))) { ++ CONTAINER_INSERT(container, rowreq_ctx); ++ } else { ++ if (rowreq_ctx) { ++ snmp_log(LOG_ERR, "error setting index while loading " ++ "ipv6ScopeZoneIndexTable cache.\n"); ++ ipv6ScopeZoneIndexTable_release_rowreq_ctx(rowreq_ctx); ++ } else ++ netsnmp_access_scopezone_entry_free(scopezone_entry); ++ } ++ ++} ++ ++/** ++ * load initial data ++ * ++ * TODO:350:M: Implement ipv6ScopeZoneIndexTable data load ++ * ++ * @param container container to which items should be inserted ++ * ++ * @retval MFD_SUCCESS : success. ++ * @retval MFD_RESOURCE_UNAVAILABLE : Can't access data source ++ * @retval MFD_ERROR : other error. ++ * ++ * This function is called to load the index(es) (and data, optionally) ++ * for the every row in the data set. ++ * ++ * @remark ++ * While loading the data, the only important thing is the indexes. ++ * If access to your data is cheap/fast (e.g. you have a pointer to a ++ * structure in memory), it would make sense to update the data here. ++ * If, however, the accessing the data invovles more work (e.g. parsing ++ * some other existing data, or peforming calculations to derive the data), ++ * then you can limit yourself to setting the indexes and saving any ++ * information you will need later. Then use the saved information in ++ * ipv6ScopeZoneIndexTable_row_prep() for populating data. ++ * ++ * @note ++ * If you need consistency between rows (like you want statistics ++ * for each row to be from the same time frame), you should set all ++ * data here. ++ * ++ */ ++int ++ipv6ScopeZoneIndexTable_container_load(netsnmp_container * container) ++{ ++ ++ /* ++ * temporary storage for index values ++ */ ++ /* ++ * ipv6ScopeZoneIndexIfIndex(1)/InterfaceIndex/ASN_INTEGER/long(long)//l/a/w/e/R/d/H ++ */ ++ netsnmp_container *zoneindex = netsnmp_access_scopezone_container_load(NULL, 0); ++ ++ DEBUGMSGTL(("verbose:ipv6ScopeZoneIndexTable:ipv6ScopeZoneIndexTable_container_load", "called\n")); ++ ++ if (NULL == zoneindex) { ++ DEBUGMSGTL(("ipv6ScopeZoneIndexTable:container_load", ++ "couldn't get scopezone iterator\n")); ++ return MFD_RESOURCE_UNAVAILABLE; ++ } ++ /* ++ * TODO:351:M: |-> Load/update data in the ipv6ScopeZoneIndexTable container. ++ * loop over your ipv6ScopeZoneIndexTable data, allocate a rowreq context, ++ * set the index(es) [and data, optionally] and insert into ++ * the container. ++ */ ++ ++ CONTAINER_FOR_EACH(zoneindex, ++ (netsnmp_container_obj_func *) _snarf_zoneindex_entry, ++ container); ++ /* ++ * free the container. we've either claimed each entry, or released it, ++ * so the access function doesn't need to clear the container. ++ */ ++ netsnmp_access_scopezone_container_free(zoneindex, ++ 0x0001); ++ ++ DEBUGMSGT(("verbose:ipv6ScopeZoneIndexTable:ipv6ScopeZoneIndexTable_container_load", "inserted %d records\n", CONTAINER_SIZE(container))); ++ ++ return MFD_SUCCESS; ++} /* ipv6ScopeZoneIndexTable_container_load */ ++ ++/** ++ * container clean up ++ * ++ * @param container container with all current items ++ * ++ * This optional callback is called prior to all ++ * item's being removed from the container. If you ++ * need to do any processing before that, do it here. ++ * ++ * @note ++ * The MFD helper will take care of releasing all the row contexts. ++ * ++ */ ++void ++ipv6ScopeZoneIndexTable_container_free(netsnmp_container * container) ++{ ++ DEBUGMSGTL(("verbose:ipv6ScopeZoneIndexTable:ipv6ScopeZoneIndexTable_container_free", "called\n")); ++ ++ /* ++ * TODO:380:M: Free ipv6ScopeZoneIndexTable container data. ++ */ ++} /* ipv6ScopeZoneIndexTable_container_free */ ++ ++/** ++ * prepare row for processing. ++ * ++ * When the agent has located the row for a request, this function is ++ * called to prepare the row for processing. If you fully populated ++ * the data context during the index setup phase, you may not need to ++ * do anything. ++ * ++ * @param rowreq_ctx pointer to a context. ++ * ++ * @retval MFD_SUCCESS : success. ++ * @retval MFD_ERROR : other error. ++ */ ++int ++ipv6ScopeZoneIndexTable_row_prep(ipv6ScopeZoneIndexTable_rowreq_ctx * ++ rowreq_ctx) ++{ ++ DEBUGMSGTL(("verbose:ipv6ScopeZoneIndexTable:ipv6ScopeZoneIndexTable_row_prep", "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:390:o: Prepare row for request. ++ * If populating row data was delayed, this is the place to ++ * fill in the row for this request. ++ */ ++ ++ return MFD_SUCCESS; ++} /* ipv6ScopeZoneIndexTable_row_prep */ ++/** @} */ +diff --git a/agent/mibgroup/ip-mib/ipv6ScopeZoneIndexTable/ipv6ScopeZoneIndexTable_data_access.h b/agent/mibgroup/ip-mib/ipv6ScopeZoneIndexTable/ipv6ScopeZoneIndexTable_data_access.h +new file mode 100644 +index 0000000..8f98e91 +--- /dev/null ++++ b/agent/mibgroup/ip-mib/ipv6ScopeZoneIndexTable/ipv6ScopeZoneIndexTable_data_access.h +@@ -0,0 +1,70 @@ ++/* ++ * Note: this file originally auto-generated by mib2c using ++ * version : 14170 $ of $ ++ * ++ * $Id:ipv6ScopeZoneIndexTable_data_access.h 14170 2007-04-29 00:12:32Z varun_c$ ++ */ ++#ifndef IPV6SCOPEZONEINDEXTABLE_DATA_ACCESS_H ++#define IPV6SCOPEZONEINDEXTABLE_DATA_ACCESS_H ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++ ++ /* ++ ********************************************************************* ++ * function declarations ++ */ ++ ++ /* ++ ********************************************************************* ++ * Table declarations ++ */ ++/********************************************************************** ++ ********************************************************************** ++ *** ++ *** Table ipv6ScopeZoneIndexTable ++ *** ++ ********************************************************************** ++ **********************************************************************/ ++ /* ++ * IP-MIB::ipv6ScopeZoneIndexTable is subid 36 of ip. ++ * Its status is Current. ++ * OID: .1.3.6.1.2.1.4.36, length: 8 ++ */ ++ ++ ++ int ++ ipv6ScopeZoneIndexTable_init_data ++ (ipv6ScopeZoneIndexTable_registration * ++ ipv6ScopeZoneIndexTable_reg); ++ ++ ++ void ++ ipv6ScopeZoneIndexTable_container_init(netsnmp_container ** ++ container_ptr_ptr, ++ netsnmp_cache * ++ cache); ++ void ++ ipv6ScopeZoneIndexTable_container_shutdown(netsnmp_container * ++ container_ptr); ++ ++ int ++ ipv6ScopeZoneIndexTable_container_load(netsnmp_container * ++ container); ++ void ++ ipv6ScopeZoneIndexTable_container_free(netsnmp_container * ++ container); ++ ++#define MAX_LINE_SIZE 256 ++ int ++ ipv6ScopeZoneIndexTable_row_prep(ipv6ScopeZoneIndexTable_rowreq_ctx ++ * rowreq_ctx); ++ ++ ++ ++#ifdef __cplusplus ++} ++#endif ++#endif /* IPV6SCOPEZONEINDEXTABLE_DATA_ACCESS_H */ +diff --git a/agent/mibgroup/ip-mib/ipv6ScopeZoneIndexTable/ipv6ScopeZoneIndexTable_enums.h b/agent/mibgroup/ip-mib/ipv6ScopeZoneIndexTable/ipv6ScopeZoneIndexTable_enums.h +new file mode 100644 +index 0000000..a79ec88 +--- /dev/null ++++ b/agent/mibgroup/ip-mib/ipv6ScopeZoneIndexTable/ipv6ScopeZoneIndexTable_enums.h +@@ -0,0 +1,39 @@ ++/* ++ * Note: this file originally auto-generated by mib2c using ++ * : generic-table-enums.m2c 12526 2005-07-15 22:41:16Z rstory $ ++ * ++ * $Id:ipv6ScopeZoneIndexTable_enums.h 14170 2007-04-29 00:12:32Z varun_c$ ++ */ ++#ifndef IPV6SCOPEZONEINDEXTABLE_ENUMS_H ++#define IPV6SCOPEZONEINDEXTABLE_ENUMS_H ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++ /* ++ * NOTES on enums ++ * ============== ++ * ++ * Value Mapping ++ * ------------- ++ * If the values for your data type don't exactly match the ++ * possible values defined by the mib, you should map them ++ * below. For example, a boolean flag (1/0) is usually represented ++ * as a TruthValue in a MIB, which maps to the values (1/2). ++ * ++ */ ++/************************************************************************* ++ ************************************************************************* ++ * ++ * enum definitions for table ipv6ScopeZoneIndexTable ++ * ++ ************************************************************************* ++ *************************************************************************/ ++ ++ ++ ++#ifdef __cplusplus ++} ++#endif ++#endif /* IPV6SCOPEZONEINDEXTABLE_ENUMS_H */ +diff --git a/agent/mibgroup/ip-mib/ipv6ScopeZoneIndexTable/ipv6ScopeZoneIndexTable_interface.c b/agent/mibgroup/ip-mib/ipv6ScopeZoneIndexTable/ipv6ScopeZoneIndexTable_interface.c +new file mode 100644 +index 0000000..40769ad +--- /dev/null ++++ b/agent/mibgroup/ip-mib/ipv6ScopeZoneIndexTable/ipv6ScopeZoneIndexTable_interface.c +@@ -0,0 +1,1124 @@ ++/* ++ * Note: this file originally auto-generated by mib2c using ++ * version : 15899 $ of $ ++ * ++ * $Id:ipv6ScopeZoneIndexTable_interface.c 14170 2007-04-29 00:12:32Z varun_c$ ++ */ ++/* ++ * ********************************************************************* ++ * ********************************************************************* ++ * ********************************************************************* ++ * *** *** ++ * *** NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE *** ++ * *** *** ++ * *** *** ++ * *** THIS FILE DOES NOT CONTAIN ANY USER EDITABLE CODE. *** ++ * *** *** ++ * *** *** ++ * *** THE GENERATED CODE IS INTERNAL IMPLEMENTATION, AND *** ++ * *** *** ++ * *** *** ++ * *** IS SUBJECT TO CHANGE WITHOUT WARNING IN FUTURE RELEASES. *** ++ * *** *** ++ * *** *** ++ * ********************************************************************* ++ * ********************************************************************* ++ * ********************************************************************* ++ */ ++ ++/* ++ * standard Net-SNMP includes ++ */ ++#include ++#include ++#include ++ ++/* ++ * include our parent header ++ */ ++#include "ipv6ScopeZoneIndexTable.h" ++ ++ ++#include ++#include ++ ++#include "ipv6ScopeZoneIndexTable_interface.h" ++ ++#include ++ ++/********************************************************************** ++ ********************************************************************** ++ *** ++ *** Table ipv6ScopeZoneIndexTable ++ *** ++ ********************************************************************** ++ **********************************************************************/ ++/* ++ * IP-MIB::ipv6ScopeZoneIndexTable is subid 36 of ip. ++ * Its status is Current. ++ * OID: .1.3.6.1.2.1.4.36, length: 8 ++ */ ++typedef struct ipv6ScopeZoneIndexTable_interface_ctx_s { ++ ++ netsnmp_container *container; ++ netsnmp_cache *cache; ++ ipv6ScopeZoneIndexTable_registration *user_ctx; ++ ++ netsnmp_table_registration_info tbl_info; ++ ++ netsnmp_baby_steps_access_methods access_multiplexer; ++ ++} ipv6ScopeZoneIndexTable_interface_ctx; ++ ++static ipv6ScopeZoneIndexTable_interface_ctx ++ ipv6ScopeZoneIndexTable_if_ctx; ++ ++static void ++_ipv6ScopeZoneIndexTable_container_init ++(ipv6ScopeZoneIndexTable_interface_ctx * if_ctx); ++static void ++_ipv6ScopeZoneIndexTable_container_shutdown ++(ipv6ScopeZoneIndexTable_interface_ctx * if_ctx); ++static int ++_cache_load(netsnmp_cache * cache, void *vmagic); ++static void ++_cache_free(netsnmp_cache * cache, void *magic); ++ ++ ++netsnmp_container * ++ipv6ScopeZoneIndexTable_container_get(void) ++{ ++ return ipv6ScopeZoneIndexTable_if_ctx.container; ++} ++ ++ipv6ScopeZoneIndexTable_registration * ++ipv6ScopeZoneIndexTable_registration_get(void) ++{ ++ return ipv6ScopeZoneIndexTable_if_ctx.user_ctx; ++} ++ ++ipv6ScopeZoneIndexTable_registration * ++ipv6ScopeZoneIndexTable_registration_set ++ (ipv6ScopeZoneIndexTable_registration * newreg) ++{ ++ ipv6ScopeZoneIndexTable_registration *old = ++ ipv6ScopeZoneIndexTable_if_ctx.user_ctx; ++ ipv6ScopeZoneIndexTable_if_ctx.user_ctx = newreg; ++ return old; ++} ++ ++int ++ipv6ScopeZoneIndexTable_container_size(void) ++{ ++ return CONTAINER_SIZE(ipv6ScopeZoneIndexTable_if_ctx.container); ++} ++ ++/* ++ * mfd multiplexer modes ++ */ ++static Netsnmp_Node_Handler _mfd_ipv6ScopeZoneIndexTable_pre_request; ++static Netsnmp_Node_Handler _mfd_ipv6ScopeZoneIndexTable_post_request; ++static Netsnmp_Node_Handler _mfd_ipv6ScopeZoneIndexTable_object_lookup; ++static Netsnmp_Node_Handler _mfd_ipv6ScopeZoneIndexTable_get_values; ++/** ++ * @internal ++ * Initialize the table ipv6ScopeZoneIndexTable ++ * (Define its contents and how it's structured) ++ */ ++void ++_ipv6ScopeZoneIndexTable_initialize_interface ++ (ipv6ScopeZoneIndexTable_registration * reg_ptr, u_long flags) ++{ ++ netsnmp_baby_steps_access_methods *access_multiplexer = ++ &ipv6ScopeZoneIndexTable_if_ctx.access_multiplexer; ++ netsnmp_table_registration_info *tbl_info = ++ &ipv6ScopeZoneIndexTable_if_ctx.tbl_info; ++ netsnmp_handler_registration *reginfo; ++ netsnmp_mib_handler *handler; ++ int mfd_modes = 0; ++ ++ DEBUGMSGTL(("internal:ipv6ScopeZoneIndexTable:_ipv6ScopeZoneIndexTable_initialize_interface", "called\n")); ++ ++ ++ /************************************************* ++ * ++ * save interface context for ipv6ScopeZoneIndexTable ++ */ ++ /* ++ * Setting up the table's definition ++ */ ++ netsnmp_table_helper_add_indexes(tbl_info, ASN_INTEGER, ++ /** index: ipv6ScopeZoneIndexIfIndex */ ++ 0); ++ ++ /* ++ * Define the minimum and maximum accessible columns. This ++ * optimizes retrival. ++ */ ++ tbl_info->min_column = IPV6SCOPEZONEINDEXTABLE_MIN_COL; ++ tbl_info->max_column = IPV6SCOPEZONEINDEXTABLE_MAX_COL; ++ ++ /* ++ * save users context ++ */ ++ ipv6ScopeZoneIndexTable_if_ctx.user_ctx = reg_ptr; ++ ++ /* ++ * call data access initialization code ++ */ ++ ipv6ScopeZoneIndexTable_init_data(reg_ptr); ++ ++ /* ++ * set up the container ++ */ ++ _ipv6ScopeZoneIndexTable_container_init ++ (&ipv6ScopeZoneIndexTable_if_ctx); ++ if (NULL == ipv6ScopeZoneIndexTable_if_ctx.container) { ++ snmp_log(LOG_ERR, ++ "could not initialize container for ipv6ScopeZoneIndexTable\n"); ++ return; ++ } ++ ++ /* ++ * access_multiplexer: REQUIRED wrapper for get request handling ++ */ ++ access_multiplexer->object_lookup = ++ _mfd_ipv6ScopeZoneIndexTable_object_lookup; ++ access_multiplexer->get_values = ++ _mfd_ipv6ScopeZoneIndexTable_get_values; ++ ++ /* ++ * no wrappers yet ++ */ ++ access_multiplexer->pre_request = ++ _mfd_ipv6ScopeZoneIndexTable_pre_request; ++ access_multiplexer->post_request = ++ _mfd_ipv6ScopeZoneIndexTable_post_request; ++ ++ ++ /************************************************* ++ * ++ * Create a registration, save our reg data, register table. ++ */ ++ DEBUGMSGTL(("ipv6ScopeZoneIndexTable:init_ipv6ScopeZoneIndexTable", ++ "Registering ipv6ScopeZoneIndexTable as a mibs-for-dummies table.\n")); ++ handler = ++ netsnmp_baby_steps_access_multiplexer_get(access_multiplexer); ++ reginfo = ++ netsnmp_handler_registration_create("ipv6ScopeZoneIndexTable", ++ handler, ++ ipv6ScopeZoneIndexTable_oid, ++ ipv6ScopeZoneIndexTable_oid_size, ++ HANDLER_CAN_BABY_STEP | ++ HANDLER_CAN_RONLY); ++ if (NULL == reginfo) { ++ snmp_log(LOG_ERR, ++ "error registering table ipv6ScopeZoneIndexTable\n"); ++ return; ++ } ++ reginfo->my_reg_void = &ipv6ScopeZoneIndexTable_if_ctx; ++ ++ /************************************************* ++ * ++ * set up baby steps handler, create it and inject it ++ */ ++ if (access_multiplexer->object_lookup) ++ mfd_modes |= BABY_STEP_OBJECT_LOOKUP; ++ if (access_multiplexer->set_values) ++ mfd_modes |= BABY_STEP_SET_VALUES; ++ if (access_multiplexer->irreversible_commit) ++ mfd_modes |= BABY_STEP_IRREVERSIBLE_COMMIT; ++ if (access_multiplexer->object_syntax_checks) ++ mfd_modes |= BABY_STEP_CHECK_OBJECT; ++ ++ if (access_multiplexer->pre_request) ++ mfd_modes |= BABY_STEP_PRE_REQUEST; ++ if (access_multiplexer->post_request) ++ mfd_modes |= BABY_STEP_POST_REQUEST; ++ ++ if (access_multiplexer->undo_setup) ++ mfd_modes |= BABY_STEP_UNDO_SETUP; ++ if (access_multiplexer->undo_cleanup) ++ mfd_modes |= BABY_STEP_UNDO_CLEANUP; ++ if (access_multiplexer->undo_sets) ++ mfd_modes |= BABY_STEP_UNDO_SETS; ++ ++ if (access_multiplexer->row_creation) ++ mfd_modes |= BABY_STEP_ROW_CREATE; ++ if (access_multiplexer->consistency_checks) ++ mfd_modes |= BABY_STEP_CHECK_CONSISTENCY; ++ if (access_multiplexer->commit) ++ mfd_modes |= BABY_STEP_COMMIT; ++ if (access_multiplexer->undo_commit) ++ mfd_modes |= BABY_STEP_UNDO_COMMIT; ++ ++ handler = netsnmp_baby_steps_handler_get(mfd_modes); ++ netsnmp_inject_handler(reginfo, handler); ++ ++ /************************************************* ++ * ++ * inject row_merge helper with prefix rootoid_len + 2 (entry.col) ++ */ ++ handler = netsnmp_get_row_merge_handler(reginfo->rootoid_len + 2); ++ netsnmp_inject_handler(reginfo, handler); ++ ++ /************************************************* ++ * ++ * inject container_table helper ++ */ ++ handler = ++ netsnmp_container_table_handler_get(tbl_info, ++ ipv6ScopeZoneIndexTable_if_ctx. ++ container, ++ TABLE_CONTAINER_KEY_NETSNMP_INDEX); ++ netsnmp_inject_handler(reginfo, handler); ++ ++ if (NULL != ipv6ScopeZoneIndexTable_if_ctx.cache) { ++ handler = ++ netsnmp_cache_handler_get(ipv6ScopeZoneIndexTable_if_ctx.cache); ++ netsnmp_inject_handler(reginfo, handler); ++ } ++ ++ /* ++ * register table ++ */ ++ netsnmp_register_table(reginfo, tbl_info); ++ ++} /* _ipv6ScopeZoneIndexTable_initialize_interface */ ++ ++/** ++ * @internal ++ * Shutdown the table ipv6ScopeZoneIndexTable ++ */ ++void ++_ipv6ScopeZoneIndexTable_shutdown_interface ++ (ipv6ScopeZoneIndexTable_registration * reg_ptr) ++{ ++ /* ++ * shutdown the container ++ */ ++ _ipv6ScopeZoneIndexTable_container_shutdown ++ (&ipv6ScopeZoneIndexTable_if_ctx); ++} ++ ++void ++ipv6ScopeZoneIndexTable_valid_columns_set(netsnmp_column_info *vc) ++{ ++ ipv6ScopeZoneIndexTable_if_ctx.tbl_info.valid_columns = vc; ++} /* ipv6ScopeZoneIndexTable_valid_columns_set */ ++ ++/** ++ * @internal ++ * convert the index component stored in the context to an oid ++ */ ++int ++ipv6ScopeZoneIndexTable_index_to_oid(netsnmp_index * oid_idx, ++ ipv6ScopeZoneIndexTable_mib_index * ++ mib_idx) ++{ ++ int err = SNMP_ERR_NOERROR; ++ ++ /* ++ * temp storage for parsing indexes ++ */ ++ /* ++ * ipv6ScopeZoneIndexIfIndex(1)/InterfaceIndex/ASN_INTEGER/long(long)//l/a/w/e/R/d/H ++ */ ++ netsnmp_variable_list var_ipv6ScopeZoneIndexIfIndex; ++ ++ /* ++ * set up varbinds ++ */ ++ memset(&var_ipv6ScopeZoneIndexIfIndex, 0x00, ++ sizeof(var_ipv6ScopeZoneIndexIfIndex)); ++ var_ipv6ScopeZoneIndexIfIndex.type = ASN_INTEGER; ++ ++ /* ++ * chain temp index varbinds together ++ */ ++ var_ipv6ScopeZoneIndexIfIndex.next_variable = NULL; ++ ++ ++ DEBUGMSGTL(("verbose:ipv6ScopeZoneIndexTable:ipv6ScopeZoneIndexTable_index_to_oid", "called\n")); ++ ++ /* ++ * ipv6ScopeZoneIndexIfIndex(1)/InterfaceIndex/ASN_INTEGER/long(long)//l/a/w/e/R/d/H ++ */ ++ snmp_set_var_value(&var_ipv6ScopeZoneIndexIfIndex, ++ (u_char *) & mib_idx->ipv6ScopeZoneIndexIfIndex, ++ sizeof(mib_idx->ipv6ScopeZoneIndexIfIndex)); ++ ++ ++ err = build_oid_noalloc(oid_idx->oids, oid_idx->len, &oid_idx->len, ++ NULL, 0, &var_ipv6ScopeZoneIndexIfIndex); ++ if (err) ++ snmp_log(LOG_ERR, "error %d converting index to oid\n", err); ++ ++ /* ++ * parsing may have allocated memory. free it. ++ */ ++ snmp_reset_var_buffers(&var_ipv6ScopeZoneIndexIfIndex); ++ ++ return err; ++} /* ipv6ScopeZoneIndexTable_index_to_oid */ ++ ++/** ++ * extract ipv6ScopeZoneIndexTable indexes from a netsnmp_index ++ * ++ * @retval SNMP_ERR_NOERROR : no error ++ * @retval SNMP_ERR_GENERR : error ++ */ ++int ++ipv6ScopeZoneIndexTable_index_from_oid(netsnmp_index * oid_idx, ++ ipv6ScopeZoneIndexTable_mib_index * ++ mib_idx) ++{ ++ int err = SNMP_ERR_NOERROR; ++ ++ /* ++ * temp storage for parsing indexes ++ */ ++ /* ++ * ipv6ScopeZoneIndexIfIndex(1)/InterfaceIndex/ASN_INTEGER/long(long)//l/a/w/e/R/d/H ++ */ ++ netsnmp_variable_list var_ipv6ScopeZoneIndexIfIndex; ++ ++ /* ++ * set up varbinds ++ */ ++ memset(&var_ipv6ScopeZoneIndexIfIndex, 0x00, ++ sizeof(var_ipv6ScopeZoneIndexIfIndex)); ++ var_ipv6ScopeZoneIndexIfIndex.type = ASN_INTEGER; ++ ++ /* ++ * chain temp index varbinds together ++ */ ++ var_ipv6ScopeZoneIndexIfIndex.next_variable = NULL; ++ ++ ++ DEBUGMSGTL(("verbose:ipv6ScopeZoneIndexTable:ipv6ScopeZoneIndexTable_index_from_oid", "called\n")); ++ ++ /* ++ * parse the oid into the individual index components ++ */ ++ err = parse_oid_indexes(oid_idx->oids, oid_idx->len, ++ &var_ipv6ScopeZoneIndexIfIndex); ++ if (err == SNMP_ERR_NOERROR) { ++ /* ++ * copy out values ++ */ ++ mib_idx->ipv6ScopeZoneIndexIfIndex = ++ *((long *) var_ipv6ScopeZoneIndexIfIndex.val.string); ++ ++ ++ } ++ ++ /* ++ * parsing may have allocated memory. free it. ++ */ ++ snmp_reset_var_buffers(&var_ipv6ScopeZoneIndexIfIndex); ++ ++ return err; ++} /* ipv6ScopeZoneIndexTable_index_from_oid */ ++ ++ ++/* ++ ********************************************************************* ++ * @internal ++ * allocate resources for a ipv6ScopeZoneIndexTable_rowreq_ctx ++ */ ++ipv6ScopeZoneIndexTable_rowreq_ctx * ++ipv6ScopeZoneIndexTable_allocate_rowreq_ctx(ipv6ScopeZoneIndexTable_data *data, ++ void *user_init_ctx) ++{ ++ ipv6ScopeZoneIndexTable_rowreq_ctx *rowreq_ctx = ++ SNMP_MALLOC_TYPEDEF(ipv6ScopeZoneIndexTable_rowreq_ctx); ++ DEBUGMSGTL(("internal:ipv6ScopeZoneIndexTable:ipv6ScopeZoneIndexTable_allocate_rowreq_ctx", "called\n")); ++ ++ if (NULL == rowreq_ctx) { ++ snmp_log(LOG_ERR, "Couldn't allocate memory for a " ++ "ipv6ScopeZoneIndexTable_rowreq_ctx.\n"); ++ return NULL; ++ } else { ++ if (NULL != data) { ++ /* ++ * track if we got data from user ++ */ ++ rowreq_ctx->rowreq_flags |= MFD_ROW_DATA_FROM_USER; ++ rowreq_ctx->data = data; ++ } else if (NULL == ++ (rowreq_ctx->data = ++ ipv6ScopeZoneIndexTable_allocate_data())) { ++ SNMP_FREE(rowreq_ctx); ++ return NULL; ++ } ++ } ++ ++ ++ rowreq_ctx->oid_idx.oids = rowreq_ctx->oid_tmp; ++ ++ rowreq_ctx->ipv6ScopeZoneIndexTable_data_list = NULL; ++ ++ /* ++ * if we allocated data, call init routine ++ */ ++ if (!(rowreq_ctx->rowreq_flags & MFD_ROW_DATA_FROM_USER)) { ++ if (SNMPERR_SUCCESS != ++ ipv6ScopeZoneIndexTable_rowreq_ctx_init(rowreq_ctx, ++ user_init_ctx)) { ++ ipv6ScopeZoneIndexTable_release_rowreq_ctx(rowreq_ctx); ++ rowreq_ctx = NULL; ++ } ++ } ++ ++ return rowreq_ctx; ++} /* ipv6ScopeZoneIndexTable_allocate_rowreq_ctx */ ++ ++/* ++ * @internal ++ * release resources for a ipv6ScopeZoneIndexTable_rowreq_ctx ++ */ ++void ++ipv6ScopeZoneIndexTable_release_rowreq_ctx ++ (ipv6ScopeZoneIndexTable_rowreq_ctx * rowreq_ctx) ++{ ++ DEBUGMSGTL(("internal:ipv6ScopeZoneIndexTable:ipv6ScopeZoneIndexTable_release_rowreq_ctx", "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ ipv6ScopeZoneIndexTable_rowreq_ctx_cleanup(rowreq_ctx); ++ /* ++ * for non-transient data, don't free data we got from the user ++ */ ++ if ((rowreq_ctx->data) && ++ !(rowreq_ctx->rowreq_flags & MFD_ROW_DATA_FROM_USER)) ++ ipv6ScopeZoneIndexTable_release_data(rowreq_ctx->data); ++ ++ ++ /* ++ * free index oid pointer ++ */ ++ if (rowreq_ctx->oid_idx.oids != rowreq_ctx->oid_tmp) ++ free(rowreq_ctx->oid_idx.oids); ++ ++ SNMP_FREE(rowreq_ctx); ++} /* ipv6ScopeZoneIndexTable_release_rowreq_ctx */ ++ ++/** ++ * @internal ++ * wrapper ++ */ ++static int ++_mfd_ipv6ScopeZoneIndexTable_pre_request(netsnmp_mib_handler *handler, ++ netsnmp_handler_registration ++ *reginfo, ++ netsnmp_agent_request_info ++ *agtreq_info, ++ netsnmp_request_info *requests) ++{ ++ int rc; ++ ++ DEBUGMSGTL(("internal:ipv6ScopeZoneIndexTable:_mfd_ipv6ScopeZoneIndexTable_pre_request", "called\n")); ++ ++ if (1 != netsnmp_row_merge_status_first(reginfo, agtreq_info)) { ++ DEBUGMSGTL(("internal:ipv6ScopeZoneIndexTable", ++ "skipping additional pre_request\n")); ++ return SNMP_ERR_NOERROR; ++ } ++ ++ rc = ipv6ScopeZoneIndexTable_pre_request ++ (ipv6ScopeZoneIndexTable_if_ctx.user_ctx); ++ if (MFD_SUCCESS != rc) { ++ /* ++ * nothing we can do about it but log it ++ */ ++ DEBUGMSGTL(("ipv6ScopeZoneIndexTable", "error %d from " ++ "ipv6ScopeZoneIndexTable_pre_request\n", rc)); ++ netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc)); ++ } ++ ++ return SNMP_ERR_NOERROR; ++} /* _mfd_ipv6ScopeZoneIndexTable_pre_request */ ++ ++/** ++ * @internal ++ * wrapper ++ */ ++static int ++_mfd_ipv6ScopeZoneIndexTable_post_request(netsnmp_mib_handler *handler, ++ netsnmp_handler_registration ++ *reginfo, ++ netsnmp_agent_request_info ++ *agtreq_info, ++ netsnmp_request_info *requests) ++{ ++ ipv6ScopeZoneIndexTable_rowreq_ctx *rowreq_ctx = ++ netsnmp_container_table_row_extract(requests); ++ int rc, packet_rc; ++ ++ DEBUGMSGTL(("internal:ipv6ScopeZoneIndexTable:_mfd_ipv6ScopeZoneIndexTable_post_request", "called\n")); ++ ++ /* ++ * release row context, if deleted ++ */ ++ if (rowreq_ctx && (rowreq_ctx->rowreq_flags & MFD_ROW_DELETED)) ++ ipv6ScopeZoneIndexTable_release_rowreq_ctx(rowreq_ctx); ++ ++ /* ++ * wait for last call before calling user ++ */ ++ if (1 != netsnmp_row_merge_status_last(reginfo, agtreq_info)) { ++ DEBUGMSGTL(("internal:ipv6ScopeZoneIndexTable", ++ "waiting for last post_request\n")); ++ return SNMP_ERR_NOERROR; ++ } ++ ++ packet_rc = netsnmp_check_all_requests_error(agtreq_info->asp, 0); ++ rc = ipv6ScopeZoneIndexTable_post_request ++ (ipv6ScopeZoneIndexTable_if_ctx.user_ctx, packet_rc); ++ if (MFD_SUCCESS != rc) { ++ /* ++ * nothing we can do about it but log it ++ */ ++ DEBUGMSGTL(("ipv6ScopeZoneIndexTable", "error %d from " ++ "ipv6ScopeZoneIndexTable_post_request\n", rc)); ++ } ++ ++ return SNMP_ERR_NOERROR; ++} /* _mfd_ipv6ScopeZoneIndexTable_post_request */ ++ ++/** ++ * @internal ++ * wrapper ++ */ ++static ipv6ScopeZoneIndexTable_rowreq_ctx * ++_mfd_ipv6ScopeZoneIndexTable_rowreq_from_index(netsnmp_index * oid_idx, ++ int *rc_ptr) ++{ ++ ipv6ScopeZoneIndexTable_rowreq_ctx *rowreq_ctx; ++ ipv6ScopeZoneIndexTable_mib_index mib_idx; ++ int rc; ++ ++ DEBUGMSGTL(("internal:ipv6ScopeZoneIndexTable:_mfd_ipv6ScopeZoneIndexTable_rowreq_from_index", "called\n")); ++ ++ if (NULL == rc_ptr) ++ rc_ptr = &rc; ++ *rc_ptr = MFD_SUCCESS; ++ ++ memset(&mib_idx, 0x0, sizeof(mib_idx)); ++ ++ /* ++ * try to parse oid ++ */ ++ *rc_ptr = ipv6ScopeZoneIndexTable_index_from_oid(oid_idx, &mib_idx); ++ if (MFD_SUCCESS != *rc_ptr) { ++ DEBUGMSGT(("ipv6ScopeZoneIndexTable", "error parsing index\n")); ++ return NULL; ++ } ++ ++ /* ++ * allocate new context ++ */ ++ rowreq_ctx = ipv6ScopeZoneIndexTable_allocate_rowreq_ctx(NULL, NULL); ++ if (NULL == rowreq_ctx) { ++ *rc_ptr = MFD_ERROR; ++ return NULL; /* msg already logged */ ++ } ++ ++ memcpy(&rowreq_ctx->tbl_idx, &mib_idx, sizeof(mib_idx)); ++ ++ ++ /* ++ * copy indexes ++ */ ++ rowreq_ctx->oid_idx.len = oid_idx->len; ++ memcpy(rowreq_ctx->oid_idx.oids, oid_idx->oids, ++ oid_idx->len * sizeof(oid)); ++ ++ return rowreq_ctx; ++} /* _mfd_ipv6ScopeZoneIndexTable_rowreq_from_index */ ++ ++/** ++ * @internal ++ * wrapper ++ */ ++static int ++_mfd_ipv6ScopeZoneIndexTable_object_lookup(netsnmp_mib_handler *handler, ++ netsnmp_handler_registration ++ *reginfo, ++ netsnmp_agent_request_info ++ *agtreq_info, ++ netsnmp_request_info *requests) ++{ ++ int rc = SNMP_ERR_NOERROR; ++ ipv6ScopeZoneIndexTable_rowreq_ctx *rowreq_ctx = ++ netsnmp_container_table_row_extract(requests); ++ ++ DEBUGMSGTL(("internal:ipv6ScopeZoneIndexTable:_mfd_ipv6ScopeZoneIndexTable_object_lookup", "called\n")); ++ ++ /* ++ * get our context from mfd ++ * ipv6ScopeZoneIndexTable_interface_ctx *if_ctx = ++ * (ipv6ScopeZoneIndexTable_interface_ctx *)reginfo->my_reg_void; ++ */ ++ ++ if (NULL == rowreq_ctx) { ++ netsnmp_table_request_info *tblreq_info; ++ netsnmp_index oid_idx; ++ ++ tblreq_info = netsnmp_extract_table_info(requests); ++ if (NULL == tblreq_info) { ++ snmp_log(LOG_ERR, "request had no table info\n"); ++ return MFD_ERROR; ++ } ++ ++ /* ++ * try create rowreq ++ */ ++ oid_idx.oids = tblreq_info->index_oid; ++ oid_idx.len = tblreq_info->index_oid_len; ++ ++ rowreq_ctx = ++ _mfd_ipv6ScopeZoneIndexTable_rowreq_from_index(&oid_idx, &rc); ++ if (MFD_SUCCESS == rc) { ++ netsnmp_assert(NULL != rowreq_ctx); ++ rowreq_ctx->rowreq_flags |= MFD_ROW_CREATED; ++ /* ++ * add rowreq_ctx to request data lists ++ */ ++ netsnmp_container_table_row_insert(requests, (netsnmp_index *) ++ rowreq_ctx); ++ } ++ ++ } ++ ++ if (MFD_SUCCESS != rc) ++ netsnmp_request_set_error_all(requests, rc); ++ else ++ ipv6ScopeZoneIndexTable_row_prep(rowreq_ctx); ++ ++ return SNMP_VALIDATE_ERR(rc); ++} /* _mfd_ipv6ScopeZoneIndexTable_object_lookup */ ++ ++/*********************************************************************** ++ * ++ * GET processing ++ * ++ ***********************************************************************/ ++/* ++ * @internal ++ * Retrieve the value for a particular column ++ */ ++NETSNMP_STATIC_INLINE int ++_ipv6ScopeZoneIndexTable_get_column(ipv6ScopeZoneIndexTable_rowreq_ctx * ++ rowreq_ctx, ++ netsnmp_variable_list * var, ++ int column) ++{ ++ int rc = SNMPERR_SUCCESS; ++ ++ DEBUGMSGTL(("internal:ipv6ScopeZoneIndexTable:_mfd_ipv6ScopeZoneIndexTable_get_column", "called for %d\n", column)); ++ ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ switch (column) { ++ ++ /* ++ * ipv6ScopeZoneIndexLinkLocal(2)/InetZoneIndex/ASN_UNSIGNED/u_long(u_long)//l/A/w/e/r/d/H ++ */ ++ case COLUMN_IPV6SCOPEZONEINDEXLINKLOCAL: ++ var->val_len = sizeof(u_long); ++ var->type = ASN_UNSIGNED; ++ rc = ipv6ScopeZoneIndexLinkLocal_get(rowreq_ctx, ++ (u_long *) var->val.string); ++ break; ++ ++ /* ++ * ipv6ScopeZoneIndex3(3)/InetZoneIndex/ASN_UNSIGNED/u_long(u_long)//l/A/w/e/r/d/H ++ */ ++ case COLUMN_IPV6SCOPEZONEINDEX3: ++ var->val_len = sizeof(u_long); ++ var->type = ASN_UNSIGNED; ++ rc = ipv6ScopeZoneIndex3_get(rowreq_ctx, ++ (u_long *) var->val.string); ++ break; ++ ++ /* ++ * ipv6ScopeZoneIndexAdminLocal(4)/InetZoneIndex/ASN_UNSIGNED/u_long(u_long)//l/A/w/e/r/d/H ++ */ ++ case COLUMN_IPV6SCOPEZONEINDEXADMINLOCAL: ++ var->val_len = sizeof(u_long); ++ var->type = ASN_UNSIGNED; ++ rc = ipv6ScopeZoneIndexAdminLocal_get(rowreq_ctx, ++ (u_long *) var->val.string); ++ break; ++ ++ /* ++ * ipv6ScopeZoneIndexSiteLocal(5)/InetZoneIndex/ASN_UNSIGNED/u_long(u_long)//l/A/w/e/r/d/H ++ */ ++ case COLUMN_IPV6SCOPEZONEINDEXSITELOCAL: ++ var->val_len = sizeof(u_long); ++ var->type = ASN_UNSIGNED; ++ rc = ipv6ScopeZoneIndexSiteLocal_get(rowreq_ctx, ++ (u_long *) var->val.string); ++ break; ++ ++ /* ++ * ipv6ScopeZoneIndex6(6)/InetZoneIndex/ASN_UNSIGNED/u_long(u_long)//l/A/w/e/r/d/H ++ */ ++ case COLUMN_IPV6SCOPEZONEINDEX6: ++ var->val_len = sizeof(u_long); ++ var->type = ASN_UNSIGNED; ++ rc = ipv6ScopeZoneIndex6_get(rowreq_ctx, ++ (u_long *) var->val.string); ++ break; ++ ++ /* ++ * ipv6ScopeZoneIndex7(7)/InetZoneIndex/ASN_UNSIGNED/u_long(u_long)//l/A/w/e/r/d/H ++ */ ++ case COLUMN_IPV6SCOPEZONEINDEX7: ++ var->val_len = sizeof(u_long); ++ var->type = ASN_UNSIGNED; ++ rc = ipv6ScopeZoneIndex7_get(rowreq_ctx, ++ (u_long *) var->val.string); ++ break; ++ ++ /* ++ * ipv6ScopeZoneIndexOrganizationLocal(8)/InetZoneIndex/ASN_UNSIGNED/u_long(u_long)//l/A/w/e/r/d/H ++ */ ++ case COLUMN_IPV6SCOPEZONEINDEXORGANIZATIONLOCAL: ++ var->val_len = sizeof(u_long); ++ var->type = ASN_UNSIGNED; ++ rc = ipv6ScopeZoneIndexOrganizationLocal_get(rowreq_ctx, ++ (u_long *) var->val. ++ string); ++ break; ++ ++ /* ++ * ipv6ScopeZoneIndex9(9)/InetZoneIndex/ASN_UNSIGNED/u_long(u_long)//l/A/w/e/r/d/H ++ */ ++ case COLUMN_IPV6SCOPEZONEINDEX9: ++ var->val_len = sizeof(u_long); ++ var->type = ASN_UNSIGNED; ++ rc = ipv6ScopeZoneIndex9_get(rowreq_ctx, ++ (u_long *) var->val.string); ++ break; ++ ++ /* ++ * ipv6ScopeZoneIndexA(10)/InetZoneIndex/ASN_UNSIGNED/u_long(u_long)//l/A/w/e/r/d/H ++ */ ++ case COLUMN_IPV6SCOPEZONEINDEXA: ++ var->val_len = sizeof(u_long); ++ var->type = ASN_UNSIGNED; ++ rc = ipv6ScopeZoneIndexA_get(rowreq_ctx, ++ (u_long *) var->val.string); ++ break; ++ ++ /* ++ * ipv6ScopeZoneIndexB(11)/InetZoneIndex/ASN_UNSIGNED/u_long(u_long)//l/A/w/e/r/d/H ++ */ ++ case COLUMN_IPV6SCOPEZONEINDEXB: ++ var->val_len = sizeof(u_long); ++ var->type = ASN_UNSIGNED; ++ rc = ipv6ScopeZoneIndexB_get(rowreq_ctx, ++ (u_long *) var->val.string); ++ break; ++ ++ /* ++ * ipv6ScopeZoneIndexC(12)/InetZoneIndex/ASN_UNSIGNED/u_long(u_long)//l/A/w/e/r/d/H ++ */ ++ case COLUMN_IPV6SCOPEZONEINDEXC: ++ var->val_len = sizeof(u_long); ++ var->type = ASN_UNSIGNED; ++ rc = ipv6ScopeZoneIndexC_get(rowreq_ctx, ++ (u_long *) var->val.string); ++ break; ++ ++ /* ++ * ipv6ScopeZoneIndexD(13)/InetZoneIndex/ASN_UNSIGNED/u_long(u_long)//l/A/w/e/r/d/H ++ */ ++ case COLUMN_IPV6SCOPEZONEINDEXD: ++ var->val_len = sizeof(u_long); ++ var->type = ASN_UNSIGNED; ++ rc = ipv6ScopeZoneIndexD_get(rowreq_ctx, ++ (u_long *) var->val.string); ++ break; ++ ++ default: ++ if (IPV6SCOPEZONEINDEXTABLE_MIN_COL <= column ++ && column <= IPV6SCOPEZONEINDEXTABLE_MAX_COL) { ++ DEBUGMSGTL(("internal:ipv6ScopeZoneIndexTable:_mfd_ipv6ScopeZoneIndexTable_get_column", "assume column %d is reserved\n", column)); ++ rc = MFD_SKIP; ++ } else { ++ snmp_log(LOG_ERR, ++ "unknown column %d in _ipv6ScopeZoneIndexTable_get_column\n", ++ column); ++ } ++ break; ++ } ++ ++ return rc; ++} /* _ipv6ScopeZoneIndexTable_get_column */ ++ ++int ++_mfd_ipv6ScopeZoneIndexTable_get_values(netsnmp_mib_handler *handler, ++ netsnmp_handler_registration ++ *reginfo, ++ netsnmp_agent_request_info ++ *agtreq_info, ++ netsnmp_request_info *requests) ++{ ++ ipv6ScopeZoneIndexTable_rowreq_ctx *rowreq_ctx = ++ netsnmp_container_table_row_extract(requests); ++ netsnmp_table_request_info *tri; ++ u_char *old_string; ++ void (*dataFreeHook) (void *); ++ int rc; ++ ++ DEBUGMSGTL(("internal:ipv6ScopeZoneIndexTable:_mfd_ipv6ScopeZoneIndexTable_get_values", "called\n")); ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ for (; requests; requests = requests->next) { ++ /* ++ * save old pointer, so we can free it if replaced ++ */ ++ old_string = requests->requestvb->val.string; ++ dataFreeHook = requests->requestvb->dataFreeHook; ++ if (NULL == requests->requestvb->val.string) { ++ requests->requestvb->val.string = requests->requestvb->buf; ++ requests->requestvb->val_len = ++ sizeof(requests->requestvb->buf); ++ } else if (requests->requestvb->buf == ++ requests->requestvb->val.string) { ++ if (requests->requestvb->val_len != ++ sizeof(requests->requestvb->buf)) ++ requests->requestvb->val_len = ++ sizeof(requests->requestvb->buf); ++ } ++ ++ /* ++ * get column data ++ */ ++ tri = netsnmp_extract_table_info(requests); ++ if (NULL == tri) ++ continue; ++ ++ rc = _ipv6ScopeZoneIndexTable_get_column(rowreq_ctx, ++ requests->requestvb, ++ tri->colnum); ++ if (rc) { ++ if (MFD_SKIP == rc) { ++ requests->requestvb->type = SNMP_NOSUCHINSTANCE; ++ rc = SNMP_ERR_NOERROR; ++ } ++ } else if (NULL == requests->requestvb->val.string) { ++ snmp_log(LOG_ERR, "NULL varbind data pointer!\n"); ++ rc = SNMP_ERR_GENERR; ++ } ++ if (rc) ++ netsnmp_request_set_error(requests, SNMP_VALIDATE_ERR(rc)); ++ ++ /* ++ * if the buffer wasn't used previously for the old data (i.e. it ++ * was allcoated memory) and the get routine replaced the pointer, ++ * we need to free the previous pointer. ++ */ ++ if (old_string && (old_string != requests->requestvb->buf) && ++ (requests->requestvb->val.string != old_string)) { ++ if (dataFreeHook) ++ (*dataFreeHook) (old_string); ++ else ++ free(old_string); ++ } ++ } /* for results */ ++ ++ return SNMP_ERR_NOERROR; ++} /* _mfd_ipv6ScopeZoneIndexTable_get_values */ ++ ++ ++/*********************************************************************** ++ * ++ * SET processing ++ * ++ ***********************************************************************/ ++ ++/* ++ * SET PROCESSING NOT APPLICABLE (per MIB or user setting) ++ */ ++/*********************************************************************** ++ * ++ * DATA ACCESS ++ * ++ ***********************************************************************/ ++/** ++ * @internal ++ */ ++static void ++_container_item_free(ipv6ScopeZoneIndexTable_rowreq_ctx * rowreq_ctx, ++ void *context) ++{ ++ DEBUGMSGTL(("internal:ipv6ScopeZoneIndexTable:_container_item_free", ++ "called\n")); ++ ++ if (NULL == rowreq_ctx) ++ return; ++ ++ ipv6ScopeZoneIndexTable_release_rowreq_ctx(rowreq_ctx); ++} /* _container_item_free */ ++ ++/** ++ * @internal ++ */ ++static void ++_container_free(netsnmp_container * container) ++{ ++ DEBUGMSGTL(("internal:ipv6ScopeZoneIndexTable:_container_free", ++ "called\n")); ++ ++ if (NULL == container) { ++ snmp_log(LOG_ERR, ++ "invalid container in ipv6ScopeZoneIndexTable_container_free\n"); ++ return; ++ } ++ ++ /* ++ * call user code ++ */ ++ ipv6ScopeZoneIndexTable_container_free(container); ++ ++ /* ++ * free all items. inefficient, but easy. ++ */ ++ CONTAINER_CLEAR(container, ++ (netsnmp_container_obj_func *) _container_item_free, ++ NULL); ++} /* _container_free */ ++ ++/** ++ * @internal ++ * initialize the container with functions or wrappers ++ */ ++void ++_ipv6ScopeZoneIndexTable_container_init ++ (ipv6ScopeZoneIndexTable_interface_ctx * if_ctx) ++{ ++ DEBUGMSGTL(("internal:ipv6ScopeZoneIndexTable:_ipv6ScopeZoneIndexTable_container_init", "called\n")); ++ ++ /* ++ * container init ++ */ ++ if_ctx->cache = netsnmp_cache_create(30, /* timeout in seconds */ ++ _cache_load, _cache_free, ++ ipv6ScopeZoneIndexTable_oid, ++ ipv6ScopeZoneIndexTable_oid_size); ++ ++ if (NULL == if_ctx->cache) { ++ snmp_log(LOG_ERR, "error creating cache for ipScopeZoneIndexTable\n"); ++ return; ++ } ++ ++ if_ctx->cache->flags = NETSNMP_CACHE_DONT_INVALIDATE_ON_SET; ++ ++ ipv6ScopeZoneIndexTable_container_init(&if_ctx->container, if_ctx->cache); ++ if (NULL == if_ctx->container) ++ if_ctx->container = ++ netsnmp_container_find ++ ("ipv6ScopeZoneIndexTable:table_container"); ++ if (NULL == if_ctx->container) { ++ snmp_log(LOG_ERR, "error creating container in " ++ "ipv6ScopeZoneIndexTable_container_init\n"); ++ return; ++ } ++ if (NULL != if_ctx->cache) ++ if_ctx->cache->magic = (void *) if_ctx->container; ++ ++ ++} /* _ipv6ScopeZoneIndexTable_container_init */ ++ ++/** ++ * @internal ++ * shutdown the container with functions or wrappers ++ */ ++void ++_ipv6ScopeZoneIndexTable_container_shutdown ++ (ipv6ScopeZoneIndexTable_interface_ctx * if_ctx) ++{ ++ DEBUGMSGTL(("internal:ipv6ScopeZoneIndexTable:_ipv6ScopeZoneIndexTable_container_shutdown", "called\n")); ++ ++ ipv6ScopeZoneIndexTable_container_shutdown(if_ctx->container); ++ ++ _container_free(if_ctx->container); ++ ++} /* _ipv6ScopeZoneIndexTable_container_shutdown */ ++ ++ ++ipv6ScopeZoneIndexTable_rowreq_ctx * ++ipv6ScopeZoneIndexTable_row_find_by_mib_index ++ (ipv6ScopeZoneIndexTable_mib_index * mib_idx) ++{ ++ ipv6ScopeZoneIndexTable_rowreq_ctx *rowreq_ctx; ++ oid oid_tmp[MAX_OID_LEN]; ++ netsnmp_index oid_idx; ++ int rc; ++ ++ /* ++ * set up storage for OID ++ */ ++ oid_idx.oids = oid_tmp; ++ oid_idx.len = sizeof(oid_tmp) / sizeof(oid); ++ ++ /* ++ * convert ++ */ ++ rc = ipv6ScopeZoneIndexTable_index_to_oid(&oid_idx, mib_idx); ++ if (MFD_SUCCESS != rc) ++ return NULL; ++ ++ rowreq_ctx = ++ CONTAINER_FIND(ipv6ScopeZoneIndexTable_if_ctx.container, &oid_idx); ++ ++ return rowreq_ctx; ++} ++ ++static int ++_cache_load(netsnmp_cache * cache, void *vmagic) ++{ ++ DEBUGMSGTL(("internal:ipScopeZoneIndexTable:_cache_load", "called\n")); ++ ++ if ((NULL == cache) || (NULL == cache->magic)) { ++ snmp_log(LOG_ERR, ++ "invalid cache for ipScopeZoneIndexTable_cache_load\n"); ++ return -1; ++ } ++ /** should only be called for an invalid or expired cache */ ++ netsnmp_assert((0 == cache->valid) || (1 == cache->expired)); ++ ++ /* ++ * call user code ++ */ ++ return ipv6ScopeZoneIndexTable_container_load((netsnmp_container *) cache-> ++ magic); ++} /* _cache_load */ ++ ++/** ++ * @internal ++ */ ++static void ++_cache_free(netsnmp_cache * cache, void *magic) ++{ ++ netsnmp_container *container; ++ ++ DEBUGMSGTL(("internal:ipScopeZoneIndexTable:_cache_free", "called\n")); ++ ++ if ((NULL == cache) || (NULL == cache->magic)) { ++ snmp_log(LOG_ERR, ++ "invalid cache in ipScopeZoneIndexTable_cache_free\n"); ++ return; ++ } ++ ++ container = (netsnmp_container *) cache->magic; ++ ++ _container_free(container); ++} /* _cache_free */ ++ +diff --git a/agent/mibgroup/ip-mib/ipv6ScopeZoneIndexTable/ipv6ScopeZoneIndexTable_interface.h b/agent/mibgroup/ip-mib/ipv6ScopeZoneIndexTable/ipv6ScopeZoneIndexTable_interface.h +new file mode 100644 +index 0000000..7fc3109 +--- /dev/null ++++ b/agent/mibgroup/ip-mib/ipv6ScopeZoneIndexTable/ipv6ScopeZoneIndexTable_interface.h +@@ -0,0 +1,98 @@ ++/* ++ * Note: this file originally auto-generated by mib2c using ++ * version : 15899 $ of $ ++ * ++ * $Id:ipv6ScopeZoneIndexTable_interface.h 14170 2007-04-29 00:12:32Z varun_c$ ++ */ ++/** @ingroup interface: Routines to interface to Net-SNMP ++ * ++ * \warning This code should not be modified, called directly, ++ * or used to interpret functionality. It is subject to ++ * change at any time. ++ * ++ * @{ ++ */ ++/* ++ * ********************************************************************* ++ * ********************************************************************* ++ * ********************************************************************* ++ * *** *** ++ * *** NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE *** ++ * *** *** ++ * *** *** ++ * *** THIS FILE DOES NOT CONTAIN ANY USER EDITABLE CODE. *** ++ * *** *** ++ * *** *** ++ * *** THE GENERATED CODE IS INTERNAL IMPLEMENTATION, AND *** ++ * *** *** ++ * *** *** ++ * *** IS SUBJECT TO CHANGE WITHOUT WARNING IN FUTURE RELEASES. *** ++ * *** *** ++ * *** *** ++ * ********************************************************************* ++ * ********************************************************************* ++ * ********************************************************************* ++ */ ++#ifndef IPV6SCOPEZONEINDEXTABLE_INTERFACE_H ++#define IPV6SCOPEZONEINDEXTABLE_INTERFACE_H ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++ ++#include "ipv6ScopeZoneIndexTable.h" ++ ++ ++ /* ++ ******************************************************************** ++ * Table declarations ++ */ ++ ++ /* ++ * PUBLIC interface initialization routine ++ */ ++ void ++ _ipv6ScopeZoneIndexTable_initialize_interface ++ (ipv6ScopeZoneIndexTable_registration * user_ctx, u_long flags); ++ void ++ _ipv6ScopeZoneIndexTable_shutdown_interface ++ (ipv6ScopeZoneIndexTable_registration * user_ctx); ++ ++ ipv6ScopeZoneIndexTable_registration ++ *ipv6ScopeZoneIndexTable_registration_get(void); ++ ++ ipv6ScopeZoneIndexTable_registration ++ *ipv6ScopeZoneIndexTable_registration_set ++ (ipv6ScopeZoneIndexTable_registration * newreg); ++ ++ netsnmp_container *ipv6ScopeZoneIndexTable_container_get(void); ++ int ipv6ScopeZoneIndexTable_container_size(void); ++ ++ ipv6ScopeZoneIndexTable_rowreq_ctx ++ *ipv6ScopeZoneIndexTable_allocate_rowreq_ctx(ipv6ScopeZoneIndexTable_data *, void *); ++ void ++ ipv6ScopeZoneIndexTable_release_rowreq_ctx ++ (ipv6ScopeZoneIndexTable_rowreq_ctx * rowreq_ctx); ++ ++ int ipv6ScopeZoneIndexTable_index_to_oid(netsnmp_index * ++ oid_idx, ++ ipv6ScopeZoneIndexTable_mib_index ++ * mib_idx); ++ int ipv6ScopeZoneIndexTable_index_from_oid(netsnmp_index * ++ oid_idx, ++ ipv6ScopeZoneIndexTable_mib_index ++ * mib_idx); ++ ++ /* ++ * access to certain internals. use with caution! ++ */ ++ void ++ ipv6ScopeZoneIndexTable_valid_columns_set(netsnmp_column_info *vc); ++ ++ ++#ifdef __cplusplus ++} ++#endif ++#endif /* IPV6SCOPEZONEINDEXTABLE_INTERFACE_H */ ++/** @} */ +diff --git a/agent/mibgroup/ip-mib/ipv6ScopeZoneIndexTable/ipv6ScopeZoneIndexTable_oids.h b/agent/mibgroup/ip-mib/ipv6ScopeZoneIndexTable/ipv6ScopeZoneIndexTable_oids.h +new file mode 100644 +index 0000000..134daa2 +--- /dev/null ++++ b/agent/mibgroup/ip-mib/ipv6ScopeZoneIndexTable/ipv6ScopeZoneIndexTable_oids.h +@@ -0,0 +1,55 @@ ++/* ++ * Note: this file originally auto-generated by mib2c using ++ * : generic-table-oids.m2c 12855 2005-09-27 15:56:08Z rstory $ ++ * ++ * $Id:ipv6ScopeZoneIndexTable_oids.h 14170 2007-04-29 00:12:32Z varun_c$ ++ */ ++#ifndef IPV6SCOPEZONEINDEXTABLE_OIDS_H ++#define IPV6SCOPEZONEINDEXTABLE_OIDS_H ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++ ++ /* ++ * column number definitions for table ipv6ScopeZoneIndexTable ++ */ ++#define IPV6SCOPEZONEINDEXTABLE_OID 1,3,6,1,2,1,4,36 ++ ++#define COLUMN_IPV6SCOPEZONEINDEXIFINDEX 1 ++ ++#define COLUMN_IPV6SCOPEZONEINDEXLINKLOCAL 2 ++ ++#define COLUMN_IPV6SCOPEZONEINDEX3 3 ++ ++#define COLUMN_IPV6SCOPEZONEINDEXADMINLOCAL 4 ++ ++#define COLUMN_IPV6SCOPEZONEINDEXSITELOCAL 5 ++ ++#define COLUMN_IPV6SCOPEZONEINDEX6 6 ++ ++#define COLUMN_IPV6SCOPEZONEINDEX7 7 ++ ++#define COLUMN_IPV6SCOPEZONEINDEXORGANIZATIONLOCAL 8 ++ ++#define COLUMN_IPV6SCOPEZONEINDEX9 9 ++ ++#define COLUMN_IPV6SCOPEZONEINDEXA 10 ++ ++#define COLUMN_IPV6SCOPEZONEINDEXB 11 ++ ++#define COLUMN_IPV6SCOPEZONEINDEXC 12 ++ ++#define COLUMN_IPV6SCOPEZONEINDEXD 13 ++ ++ ++#define IPV6SCOPEZONEINDEXTABLE_MIN_COL COLUMN_IPV6SCOPEZONEINDEXLINKLOCAL ++#define IPV6SCOPEZONEINDEXTABLE_MAX_COL COLUMN_IPV6SCOPEZONEINDEXD ++ ++ ++ ++#ifdef __cplusplus ++} ++#endif ++#endif /* IPV6SCOPEZONEINDEXTABLE_OIDS_H */ +diff --git a/include/net-snmp/data_access/scopezone.h b/include/net-snmp/data_access/scopezone.h +new file mode 100644 +index 0000000..de5c8bf +--- /dev/null ++++ b/include/net-snmp/data_access/scopezone.h +@@ -0,0 +1,68 @@ ++/* ++ * scopezone data access header ++ * ++ * $Id: scopezone.h 14170 2007-04-29 02:22:12Z varun_c $ ++ */ ++#ifndef NETSNMP_ACCESS_SCOPEZONE_H ++#define NETSNMP_ACCESS_SCOPEZONE_H ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++ ++/**---------------------------------------------------------------------*/ ++/* ++ * structure definitions ++ * ++ * ++ * NOTE: if you add fields, update code dealing with ++ * them in ipv6scopezone_common.c ++ */ ++typedef struct netsnmp_v6scopezone_entry_s { ++ netsnmp_index oid_index; ++ oid ns_scopezone_index; ++ u_int ns_flags; /* net-snmp flags */ ++ oid index; ++ int scopezone_linklocal; ++ ++} netsnmp_v6scopezone_entry; ++ ++/**---------------------------------------------------------------------*/ ++/* ++ * ACCESS function prototypes ++ */ ++ ++/* ++ * scopezone container init ++ */ ++netsnmp_container * netsnmp_access_scopezone_container_init(u_int init_flags); ++ ++/* ++ * scopezone container load and free ++ */ ++netsnmp_container* ++netsnmp_access_scopezone_container_load(netsnmp_container* container, ++ u_int load_flags); ++ ++void netsnmp_access_scopezone_container_free(netsnmp_container *container, ++ u_int free_flags); ++#define NETSNMP_ACCESS_SCOPEZONE_FREE_NOFLAGS 0x0000 ++#define NETSNMP_ACCESS_SCOPEZONE_FREE_DONT_CLEAR 0x0001 ++#define NETSNMP_ACCESS_SCOPEZONE_FREE_KEEP_CONTAINER 0x0002 ++ ++ ++/* ++ * create/free an scopezone entry ++ */ ++netsnmp_v6scopezone_entry * ++netsnmp_access_scopezone_entry_create(void); ++ ++void netsnmp_access_scopezone_entry_free(netsnmp_v6scopezone_entry * entry); ++ ++ ++#ifdef __cplusplus ++} ++#endif ++ ++#endif /* NETSNMP_ACCESS_SCOPEZONE_H */ +-- +1.6.0.2 + diff --git a/Add-IPv6-support-on-Internet-Address-Translation-Tab.patch b/Add-IPv6-support-on-Internet-Address-Translation-Tab.patch new file mode 100644 index 0000000..d38f533 --- /dev/null +++ b/Add-IPv6-support-on-Internet-Address-Translation-Tab.patch @@ -0,0 +1,334 @@ +From ecd91d8a2b532bd1a987369e76d75fef454f2bcf Mon Sep 17 00:00:00 2001 +From: Mitsuru Chinen +Date: Mon, 20 Oct 2008 17:33:11 +0900 +Subject: [PATCH] Add IPv6 support on Internet Address Translation Table + +[ 1708243 ] add linux support for ipDefaultRouterTable OID to net-snmp +http://sourceforge.net/tracker/index.php?func=detail&aid=1708243&group_id=12694&atid=312694 + +[ 1724602 ] [Linux] ipDefaultRouterTable improvement +http://sourceforge.net/tracker/index.php?func=detail&aid=1724602&group_id=12694&atid=312694 + +[ 1728223 ] [Linux] add configure check for netlink socket +http://sourceforge.net/tracker/index.php?func=detail&aid=1728223&group_id=12694&atid=312694 + +Signed-off-by: Mitsuru Chinen +--- + agent/mibgroup/ip-mib/data_access/arp_linux.c | 243 +++++++++++++++++++- + .../inetNetToMediaTable_data_access.c | 2 +- + configure.in | 10 + + 3 files changed, 249 insertions(+), 6 deletions(-) + +diff --git a/agent/mibgroup/ip-mib/data_access/arp_linux.c b/agent/mibgroup/ip-mib/data_access/arp_linux.c +index e1d20c1..a25e4d8 100644 +--- a/agent/mibgroup/ip-mib/data_access/arp_linux.c ++++ b/agent/mibgroup/ip-mib/data_access/arp_linux.c +@@ -14,9 +14,32 @@ + #include + #include + #include ++#include ++#include ++#ifdef NETSNMP_ENABLE_IPV6 ++#ifdef HAVE_LINUX_RTNETLINK_H ++#include ++#define NIP6(addr) \ ++ ntohs((addr).s6_addr16[0]), \ ++ ntohs((addr).s6_addr16[1]), \ ++ ntohs((addr).s6_addr16[2]), \ ++ ntohs((addr).s6_addr16[3]), \ ++ ntohs((addr).s6_addr16[4]), \ ++ ntohs((addr).s6_addr16[5]), \ ++ ntohs((addr).s6_addr16[6]), \ ++ ntohs((addr).s6_addr16[7]) ++#define NIP6_FMT "%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x" ++#endif ++#endif + + int _load_v4(netsnmp_container *container, int idx_offset); +- ++static int _load_v6(netsnmp_container *container, int idx_offset); ++#ifdef HAVE_LINUX_RTNETLINK_H ++int get_translation_table_info (int sd, int *status, ++ char *buff, size_t size); ++int fillup_entry_info(netsnmp_arp_entry *entry, ++ struct nlmsghdr *nlmp); ++#endif + /** + */ + int +@@ -28,11 +51,10 @@ netsnmp_access_arp_container_arch_load(netsnmp_container *container) + if(rc < 0) { + u_int flags = NETSNMP_ACCESS_ARP_FREE_KEEP_CONTAINER; + netsnmp_access_arp_container_free(container, flags); +- return rc; + } + +-#if defined (NETSNMP_ENABLE_IPV6) && 0 /* xx-rks: arp for v6? */ +- idx_offset = rc; ++#if defined (NETSNMP_ENABLE_IPV6) ++ idx_offset = (rc < 0) ? 0 : rc; + + rc = _load_v6(container, idx_offset); + if(rc < 0) { +@@ -64,7 +86,7 @@ _load_v4(netsnmp_container *container, int idx_offset) + + #define PROCFILE "/proc/net/arp" + if (!(in = fopen(PROCFILE, "r"))) { +- snmp_log(LOG_ERR,"could not open " PROCFILE "\n"); ++ snmp_log(LOG_DEBUG,"could not open " PROCFILE "\n"); + return -2; + } + +@@ -192,3 +214,214 @@ _load_v4(netsnmp_container *container, int idx_offset) + + return idx_offset; + } ++ ++#if defined (NETSNMP_ENABLE_IPV6) ++static int ++_load_v6(netsnmp_container *container, int idx_offset) ++{ ++ char buffer[16384]; ++#if defined(HAVE_LINUX_RTNETLINK_H) ++ struct nlmsghdr *nlmp; ++#endif ++ int sd = 0; ++ int status = 0; ++ int rc = 0; ++ int len, req_len; ++ netsnmp_arp_entry *entry; ++ ++ netsnmp_assert(NULL != container); ++#if defined(HAVE_LINUX_RTNETLINK_H) ++ if((sd = socket (PF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE)) < 0) { ++ snmp_log(LOG_ERR,"Unable to create netlink socket\n"); ++ return -2; ++ } ++ ++ if(get_translation_table_info (sd, &status, buffer, sizeof(buffer)) < 0) { ++ snmp_log(LOG_ERR,"Unable to fetch translation table info\n"); ++ close(sd); ++ return -2; ++ } ++ ++ for (nlmp = (struct nlmsghdr *)buffer; status > sizeof(*nlmp); ) { ++ len = nlmp->nlmsg_len; ++ req_len = len - sizeof(*nlmp); ++ if (req_len < 0 || len > status) { ++ snmp_log(LOG_ERR,"invalid length\n"); ++ return -2; ++ } ++ if (!NLMSG_OK (nlmp, status)) { ++ snmp_log(LOG_ERR,"NLMSG not OK\n"); ++ return -2; ++ } ++ entry = netsnmp_access_arp_entry_create(); ++ if(NULL == entry) { ++ rc = -3; ++ break; ++ } ++ entry->ns_arp_index = ++idx_offset; ++ if(fillup_entry_info (entry, nlmp) < 0) { ++ DEBUGMSGTL(("access:arp:load_v6", "filling entry info failed\n")); ++ netsnmp_access_arp_entry_free(entry); ++ status -= NLMSG_ALIGN(len); ++ nlmp = (struct nlmsghdr*)((char*)nlmp + NLMSG_ALIGN(len)); ++ continue; ++ } ++ CONTAINER_INSERT(container, entry); ++ status -= NLMSG_ALIGN(len); ++ nlmp = (struct nlmsghdr*)((char*)nlmp + NLMSG_ALIGN(len)); ++ } ++ ++ close(sd); ++#endif ++ if(rc<0) { ++ return rc; ++ } ++ ++ return idx_offset; ++} ++#if defined(HAVE_LINUX_RTNETLINK_H) ++int ++get_translation_table_info (int sd, int *status, char *buff, size_t size) ++{ ++ struct { ++ struct nlmsghdr n; ++ struct ndmsg r; ++ char buf[1024]; ++ } req; ++ struct rtattr *rta; ++ ++ memset(&req, 0, sizeof(req)); ++ req.n.nlmsg_len = NLMSG_LENGTH (sizeof(struct ndmsg)); ++ req.n.nlmsg_flags = NLM_F_REQUEST | NLM_F_ROOT; ++ req.n.nlmsg_type = RTM_GETNEIGH; ++ ++ req.r.ndm_family = AF_INET6; ++ rta = (struct rtattr *)(((char *)&req) + NLMSG_ALIGN(req.n.nlmsg_len)); ++ rta->rta_len = RTA_LENGTH(16); ++ ++ if(send(sd, &req, req.n.nlmsg_len, 0) < 0) { ++ snmp_log(LOG_ERR,"Sending request failed\n"); ++ return -1; ++ } ++ if((*status = recv(sd, buff, size, 0)) < 0) { ++ snmp_log(LOG_ERR,"Recieving request failed\n"); ++ return -1; ++ } ++ if(*status == 0) { ++ snmp_log(LOG_ERR,"End of file\n"); ++ return -1; ++ } ++ return 0; ++} ++ ++int ++fillup_entry_info(netsnmp_arp_entry *entry, struct nlmsghdr *nlmp) ++{ ++ struct ndmsg *rtmp; ++ struct in6_addr *in6p; ++ struct rtattr *tb[NDA_MAX+1], *rta; ++ size_t in_len, out_len; ++ unsigned int i; ++ int length; ++ char addr[40]; ++ u_char *buf; ++ u_char *hwaddr; ++ ++ rtmp = (struct ndmsg *)NLMSG_DATA(nlmp); ++ if (nlmp->nlmsg_type != RTM_NEWNEIGH && nlmp->nlmsg_type != RTM_DELNEIGH) ++ return -1; ++ ++ if(rtmp->ndm_state != NUD_NOARP) { ++ memset(tb, 0, sizeof(struct rtattr *) * (NDA_MAX + 1)); ++ length = nlmp->nlmsg_len - NLMSG_LENGTH(sizeof(*rtmp)); ++ /* this is what the kernel-removed NDA_RTA define did */ ++ rta = ((struct rtattr*)(((char*)(rtmp)) + ++ NLMSG_ALIGN(sizeof(struct ndmsg)))); ++ while (RTA_OK(rta, length)) { ++ if (rta->rta_type <= NDA_MAX) ++ tb[rta->rta_type] = rta; ++ rta = RTA_NEXT(rta,length); ++ } ++ if(length) ++ return -1; ++ /* Fill up the index ++ */ ++ entry->if_index = rtmp->ndm_ifindex; ++ /* Fill up ip address */ ++ if (tb[NDA_DST]) { ++ memset(&addr, '\0', sizeof(addr)); ++ in6p = (struct in6_addr *)RTA_DATA(tb[NDA_DST]); ++ sprintf(addr, NIP6_FMT, NIP6(*in6p)); ++ in_len = entry->arp_ipaddress_len = sizeof(entry->arp_ipaddress); ++ netsnmp_assert(16 == in_len); ++ out_len = 0; ++ buf = entry->arp_ipaddress; ++ if(1 != netsnmp_hex_to_binary(&buf, &in_len, ++ &out_len, 0, addr, ":")) { ++ snmp_log(LOG_ERR,"error parsing '%s', skipping\n", ++ entry->arp_ipaddress); ++ return -1; ++ } ++ netsnmp_assert(16 == out_len); ++ entry->arp_ipaddress_len = out_len; ++ } ++ if (tb[NDA_LLADDR]) { ++ memset(&addr, '\0', sizeof(addr)); ++ hwaddr = RTA_DATA(tb[NDA_LLADDR]); ++ entry->arp_physaddress_len = RTA_PAYLOAD(tb[NDA_LLADDR]); ++ buf = entry->arp_physaddress; ++ for (i = 0; i < entry->arp_physaddress_len; i++) ++ entry->arp_physaddress[i] = hwaddr[i]; ++ } ++ ++ switch (rtmp->ndm_state) { ++ case NUD_INCOMPLETE: ++ entry->arp_state = INETNETTOMEDIASTATE_INCOMPLETE; ++ break; ++ case NUD_REACHABLE: ++ case NUD_PERMANENT: ++ entry->arp_state = INETNETTOMEDIASTATE_REACHABLE; ++ break; ++ case NUD_STALE: ++ entry->arp_state = INETNETTOMEDIASTATE_STALE; ++ break; ++ case NUD_DELAY: ++ entry->arp_state = INETNETTOMEDIASTATE_DELAY; ++ break; ++ case NUD_PROBE: ++ entry->arp_state = INETNETTOMEDIASTATE_PROBE; ++ break; ++ case NUD_FAILED: ++ entry->arp_state = INETNETTOMEDIASTATE_INVALID; ++ break; ++ case NUD_NONE: ++ entry->arp_state = INETNETTOMEDIASTATE_UNKNOWN; ++ break; ++ } ++ ++ switch (rtmp->ndm_state) { ++ case NUD_INCOMPLETE: ++ case NUD_FAILED : ++ case NUD_NONE : ++ entry->arp_type = INETNETTOMEDIATYPE_INVALID; ++ break; ++ case NUD_REACHABLE: ++ case NUD_STALE : ++ case NUD_DELAY : ++ case NUD_PROBE : ++ entry->arp_type = INETNETTOMEDIATYPE_DYNAMIC; ++ break; ++ case NUD_PERMANENT: ++ entry->arp_type = INETNETTOMEDIATYPE_STATIC; ++ break; ++ default: ++ entry->arp_type = INETNETTOMEDIATYPE_LOCAL; ++ break; ++ } ++ } else { ++ return -1; /* could not create data for this interface */ ++ } ++ return 0; ++} ++#endif ++#endif +diff --git a/agent/mibgroup/ip-mib/inetNetToMediaTable/inetNetToMediaTable_data_access.c b/agent/mibgroup/ip-mib/inetNetToMediaTable/inetNetToMediaTable_data_access.c +index cad942c..dcc7900 100644 +--- a/agent/mibgroup/ip-mib/inetNetToMediaTable/inetNetToMediaTable_data_access.c ++++ b/agent/mibgroup/ip-mib/inetNetToMediaTable/inetNetToMediaTable_data_access.c +@@ -155,7 +155,7 @@ _snarf_arp_entry(netsnmp_arp_entry *arp_entry, + inetAddressType = INETADDRESSTYPE_IPV4; + break; + +- case 6: ++ case 16: + inetAddressType = INETADDRESSTYPE_IPV6; + break; + +diff --git a/configure.in b/configure.in +index c5e05ba..220506a 100644 +--- a/configure.in ++++ b/configure.in +@@ -3365,6 +3365,16 @@ AC_CHECK_HEADERS(linux/rtnetlink.h,,, + #include + #endif + ]]) ++# linux rtnetlink ++AC_CHECK_HEADERS(linux/rtnetlink.h,,, ++[[ ++#if HAVE_ASM_TYPES_H ++#include ++#endif ++#if HAVE_SYS_SOCKET_H ++#include ++#endif ++]]) + # BSDi3 headers + AC_CHECK_HEADERS(sys/stat.h) + # BSDi3/IRIX headers +-- +1.6.0.2 + diff --git a/Fix-for-IPv6-Interface-Table.patch b/Fix-for-IPv6-Interface-Table.patch new file mode 100644 index 0000000..e3c5f1a --- /dev/null +++ b/Fix-for-IPv6-Interface-Table.patch @@ -0,0 +1,69 @@ +From 65f75f485f428b0f22ff82c96ebd7d89e49ce7b2 Mon Sep 17 00:00:00 2001 +From: Mitsuru Chinen +Date: Mon, 20 Oct 2008 14:50:37 +0900 +Subject: [PATCH] Fix for IPv6 Interface Table + +From net-snmp patch tracker: +[ 1669048 ] Support ipv6InterfaceIdentifier on Linux +http://sourceforge.net/tracker/index.php?func=detail&aid=1669048&group_id=12694&atid=312694 + +[ 1783423 ] correct ipv6InterfaceIdentifier of loopback device +http://sourceforge.net/tracker/index.php?func=detail&aid=1783423&group_id=12694&atid=312694 + +Signed-off-by: Mitsuru Chinen +--- + .../mibgroup/if-mib/data_access/interface_linux.c | 31 ++++++++++++++++++++ + 1 files changed, 31 insertions(+), 0 deletions(-) + +diff --git a/agent/mibgroup/if-mib/data_access/interface_linux.c b/agent/mibgroup/if-mib/data_access/interface_linux.c +index 245fa99..474a904 100644 +--- a/agent/mibgroup/if-mib/data_access/interface_linux.c ++++ b/agent/mibgroup/if-mib/data_access/interface_linux.c +@@ -36,6 +36,7 @@ typedef __u8 u8; /* ditto */ + #include + + #include ++#include + + #ifndef IF_NAMESIZE + #define IF_NAMESIZE 16 +@@ -635,6 +636,36 @@ netsnmp_arch_interface_container_load(netsnmp_container* container, + entry->type = IANAIFTYPE_OTHER; + } + ++ /* ++ * interface identifier is specified based on physaddr and type ++ */ ++ switch (entry->type) { ++ case IANAIFTYPE_ETHERNETCSMACD: ++ case IANAIFTYPE_ETHERNET3MBIT: ++ case IANAIFTYPE_FASTETHER: ++ case IANAIFTYPE_FASTETHERFX: ++ case IANAIFTYPE_GIGABITETHERNET: ++ case IANAIFTYPE_FDDI: ++ case IANAIFTYPE_ISO88025TOKENRING: ++ if (NULL != entry->paddr && ETH_ALEN != entry->paddr_len) ++ break; ++ ++ entry->v6_if_id_len = entry->paddr_len + 2; ++ memcpy(entry->v6_if_id, entry->paddr, 3); ++ memcpy(entry->v6_if_id + 5, entry->paddr + 3, 3); ++ entry->v6_if_id[0] ^= 2; ++ entry->v6_if_id[3] = 0xFF; ++ entry->v6_if_id[4] = 0xFE; ++ ++ entry->ns_flags |= NETSNMP_INTERFACE_FLAGS_HAS_V6_IFID; ++ break; ++ ++ case IANAIFTYPE_SOFTWARELOOPBACK: ++ entry->v6_if_id_len = 0; ++ entry->ns_flags |= NETSNMP_INTERFACE_FLAGS_HAS_V6_IFID; ++ break; ++ } ++ + if (IANAIFTYPE_ETHERNETCSMACD == entry->type) + entry->speed = + netsnmp_linux_interface_get_if_speed(fd, entry->name); +-- +1.6.0.2 + diff --git a/Fix-for-Internet-Address-Prefix-Table.patch b/Fix-for-Internet-Address-Prefix-Table.patch new file mode 100644 index 0000000..dc3bfd4 --- /dev/null +++ b/Fix-for-Internet-Address-Prefix-Table.patch @@ -0,0 +1,876 @@ +From 71ffec9f8c1bcd14a7bf6ca7762bc121ba1efaf1 Mon Sep 17 00:00:00 2001 +From: Mitsuru Chinen +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 +--- + .../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 + #include + #include "if-mib/data_access/interface.h" ++#include "mibgroup/util_funcs.h" + #include "interface_ioctl.h" + + #include +@@ -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 ++#include ++#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 + + #include "ip-mib/ipAddressTable/ipAddressTable_constants.h" ++#include "ip-mib/ipAddressPrefixTable/ipAddressPrefixTable_constants.h" ++#include "mibgroup/util_funcs.h" + + #include + #include +@@ -19,15 +21,29 @@ + #if defined (NETSNMP_ENABLE_IPV6) + #include + #include +-#ifdef HAVE_LINUX_RTNETLINK_H ++#if defined(HAVE_PTHREAD_H) && defined(HAVE_LINUX_RTNETLINK_H) + #include ++#include + #include +-#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 + # endif + #endif +- ++#ifdef HAVE_PTHREAD_H ++#include ++#endif + #include + #include + +@@ -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 ++#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 + diff --git a/Fix-for-Internet-Address-Table.patch b/Fix-for-Internet-Address-Table.patch new file mode 100644 index 0000000..6a4f055 --- /dev/null +++ b/Fix-for-Internet-Address-Table.patch @@ -0,0 +1,405 @@ +From 12cb1f471833a7e145bdf7cb4d471d0bd74d73f0 Mon Sep 17 00:00:00 2001 +From: Mitsuru Chinen +Date: Mon, 20 Oct 2008 16:08:06 +0900 +Subject: [PATCH] Fix for Internet Address Table + +From net-snmp patch tracker: +[ 1692817 ] ipAddressTable fixes +http://sourceforge.net/tracker/index.php?func=detail&aid=1692817&group_id=12694&atid=312694 + +[ 1712645 ] meaningful log message on duplicate IP address +http://sourceforge.net/tracker/index.php?func=detail&aid=1712645&group_id=12694&atid=312694 + +[ 1810660 ] Fix broadcast addresses in ipAddressTable on 64 bit +linux +http://sourceforge.net/tracker/index.php?func=detail&aid=1810660&group_id=12694&atid=312694 + +Signed-off-by: Mitsuru Chinen +--- + .../mibgroup/ip-mib/data_access/ipaddress_ioctl.c | 63 +++++++++- + .../mibgroup/ip-mib/data_access/ipaddress_ioctl.h | 13 ++ + .../mibgroup/ip-mib/data_access/ipaddress_linux.c | 121 ++++++++++++++++++-- + .../ip-mib/ipAddressTable/ipAddressTable.c | 5 +- + include/net-snmp/library/container.h | 2 +- + snmplib/container.c | 2 +- + 6 files changed, 189 insertions(+), 17 deletions(-) + +diff --git a/agent/mibgroup/ip-mib/data_access/ipaddress_ioctl.c b/agent/mibgroup/ip-mib/data_access/ipaddress_ioctl.c +index d5e78f0..085653d 100644 +--- a/agent/mibgroup/ip-mib/data_access/ipaddress_ioctl.c ++++ b/agent/mibgroup/ip-mib/data_access/ipaddress_ioctl.c +@@ -135,7 +135,9 @@ _netsnmp_ioctl_ipaddress_container_load_v4(netsnmp_container *container, + struct ifreq *ifrp; + struct sockaddr save_addr; + struct sockaddr_in * si; +- netsnmp_ipaddress_entry *entry; ++ netsnmp_ipaddress_entry *entry, *bcastentry; ++ struct address_flag_info addr_info; ++ in_addr_t ipval; + _ioctl_extras *extras; + + if ((sd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { +@@ -184,6 +186,7 @@ _netsnmp_ioctl_ipaddress_container_load_v4(netsnmp_container *container, + netsnmp_assert(AF_INET == ifrp->ifr_addr.sa_family); + si = (struct sockaddr_in *) &ifrp->ifr_addr; + entry->ia_address_len = sizeof(si->sin_addr.s_addr); ++ ipval = si->sin_addr.s_addr; + memcpy(entry->ia_address, &si->sin_addr.s_addr, + entry->ia_address_len); + +@@ -220,6 +223,26 @@ _netsnmp_ioctl_ipaddress_container_load_v4(netsnmp_container *container, + } + + /* ++ * get broadcast ++ */ ++ memset(&addr_info, 0, sizeof(struct address_flag_info)); ++#if defined (NETSNMP_ENABLE_IPV6) ++ addr_info = netsnmp_access_other_info_get(entry->if_index, AF_INET); ++ if(addr_info.bcastflg) { ++ bcastentry = netsnmp_access_ipaddress_entry_create(); ++ if(NULL == entry) { ++ rc = -3; ++ break; ++ } ++ bcastentry->if_index = entry->if_index; ++ bcastentry->ns_ia_index = ++idx_offset; ++ bcastentry->ia_address_len = sizeof(addr_info.inp->s_addr); ++ memcpy(bcastentry->ia_address, &addr_info.inp->s_addr, ++ bcastentry->ia_address_len); ++ } ++#endif ++ ++ /* + * get netmask + */ + ifrp->ifr_addr = save_addr; +@@ -232,7 +255,10 @@ _netsnmp_ioctl_ipaddress_container_load_v4(netsnmp_container *container, + netsnmp_assert(AF_INET == ifrp->ifr_addr.sa_family); + si = (struct sockaddr_in *) &ifrp->ifr_addr; + entry->ia_prefix_len = +- netsnmp_ipaddress_ipv4_prefix_len(si->sin_addr.s_addr); ++ netsnmp_ipaddress_ipv4_prefix_len(ntohl(si->sin_addr.s_addr)); ++ if(addr_info.bcastflg) ++ bcastentry->ia_prefix_len = entry->ia_prefix_len; ++ + + /* + * get flags +@@ -246,7 +272,12 @@ _netsnmp_ioctl_ipaddress_container_load_v4(netsnmp_container *container, + } + extras->flags = ifrp->ifr_flags; + +- entry->ia_type = IPADDRESSTYPE_UNICAST; /* assume unicast? */ ++ if(addr_info.bcastflg) ++ bcastentry->ia_type = IPADDRESSTYPE_BROADCAST; ++ if(addr_info.anycastflg) ++ entry->ia_type = IPADDRESSTYPE_ANYCAST; ++ else ++ entry->ia_type = IPADDRESSTYPE_UNICAST; + + /** entry->ia_prefix_oid ? */ + +@@ -256,12 +287,23 @@ _netsnmp_ioctl_ipaddress_container_load_v4(netsnmp_container *container, + * always preferred(1). + */ + entry->ia_status = IPADDRESSSTATUSTC_PREFERRED; ++ if(addr_info.bcastflg) ++ bcastentry->ia_status = IPADDRESSSTATUSTC_PREFERRED; + + /* + * can we figure out if an address is from DHCP? + * use manual until then... + */ +- entry->ia_origin = IPADDRESSORIGINTC_MANUAL; ++ if(IS_APIPA(ipval)) { ++ entry->ia_origin = IPADDRESSORIGINTC_RANDOM; ++ if(addr_info.bcastflg) ++ bcastentry->ia_origin = IPADDRESSORIGINTC_RANDOM; ++ } ++ else { ++ entry->ia_origin = IPADDRESSORIGINTC_MANUAL; ++ if(addr_info.bcastflg) ++ bcastentry->ia_origin = IPADDRESSORIGINTC_MANUAL; ++ } + + DEBUGIF("access:ipaddress:container") { + DEBUGMSGT_NC(("access:ipaddress:container", +@@ -279,12 +321,21 @@ _netsnmp_ioctl_ipaddress_container_load_v4(netsnmp_container *container, + /* + * add entry to container + */ +- if (CONTAINER_INSERT(container, entry) < 0) +- { ++ if(addr_info.bcastflg){ ++ if (CONTAINER_INSERT(container, bcastentry) < 0) { ++ DEBUGMSGTL(("access:ipaddress:container","error with ipaddress_entry: insert broadcast entry into container failed.\n")); ++ netsnmp_access_ipaddress_entry_free(bcastentry); ++ netsnmp_access_ipaddress_entry_free(entry); ++ continue; ++ } ++ } ++ ++ if (CONTAINER_INSERT(container, entry) < 0) { + DEBUGMSGTL(("access:ipaddress:container","error with ipaddress_entry: insert into container failed.\n")); + netsnmp_access_ipaddress_entry_free(entry); + continue; + } ++ + } + + /* +diff --git a/agent/mibgroup/ip-mib/data_access/ipaddress_ioctl.h b/agent/mibgroup/ip-mib/data_access/ipaddress_ioctl.h +index a7a0ea2..fc9774f 100644 +--- a/agent/mibgroup/ip-mib/data_access/ipaddress_ioctl.h ++++ b/agent/mibgroup/ip-mib/data_access/ipaddress_ioctl.h +@@ -2,6 +2,17 @@ + extern "C" { + #endif + ++/* ++ * struct for netlink extras ++ */ ++struct address_flag_info { ++ int bcastflg; ++ int anycastflg; ++ struct in_addr *inp; ++}; ++ ++#define IS_APIPA(a) (((in_addr_t)(a << 16)) == 0xFEA90000) ++ + int + _netsnmp_ioctl_ipaddress_container_load_v4(netsnmp_container *container, + int idx_offset); +@@ -13,6 +24,8 @@ _netsnmp_ioctl_ipaddress_remove_v4(netsnmp_ipaddress_entry * entry); + int + netsnmp_access_ipaddress_ioctl_get_interface_count(int sd, struct ifconf * ifc); + ++struct address_flag_info ++netsnmp_access_other_info_get(int index, int family); + + /* + * struct ioctl for arch_data +diff --git a/agent/mibgroup/ip-mib/data_access/ipaddress_linux.c b/agent/mibgroup/ip-mib/data_access/ipaddress_linux.c +index 8cb06a2..ac37578 100644 +--- a/agent/mibgroup/ip-mib/data_access/ipaddress_linux.c ++++ b/agent/mibgroup/ip-mib/data_access/ipaddress_linux.c +@@ -19,6 +19,7 @@ + #if defined (NETSNMP_ENABLE_IPV6) + #include + #include ++#include + #include + #endif + +@@ -188,6 +189,7 @@ _load_v6(netsnmp_container *container, int idx_offset) + netsnmp_ipaddress_entry *entry; + _ioctl_extras *extras; + static int log_open_err = 1; ++ struct address_flag_info addr_info; + + netsnmp_assert(NULL != container); + +@@ -268,6 +270,10 @@ _load_v6(netsnmp_container *container, int idx_offset) + * every time it is called. + */ + entry->if_index = netsnmp_access_interface_index_find(if_name); ++ memset(&addr_info, 0, sizeof(struct address_flag_info)); ++#if defined (NETSNMP_ENABLE_IPV6) ++ addr_info = netsnmp_access_other_info_get(entry->if_index, AF_INET6); ++#endif + + /* + #define IPADDRESSSTATUSTC_PREFERRED 1 +@@ -278,7 +284,7 @@ _load_v6(netsnmp_container *container, int idx_offset) + #define IPADDRESSSTATUSTC_TENTATIVE 6 + #define IPADDRESSSTATUSTC_DUPLICATE 7 + */ +- if(flags & IFA_F_PERMANENT) ++ if((flags & IFA_F_PERMANENT) || (!flags) || (flags & IFA_F_TEMPORARY)) + entry->ia_status = IPADDRESSSTATUSTC_PREFERRED; /* ?? */ + else if(flags & IFA_F_DEPRECATED) + entry->ia_status = IPADDRESSSTATUSTC_DEPRECATED; +@@ -294,7 +300,7 @@ _load_v6(netsnmp_container *container, int idx_offset) + * if it's not multi, it must be uni. + * (an ipv6 address is never broadcast) + */ +- if (IN6_IS_ADDR_MULTICAST(entry->ia_address)) ++ if(addr_info.anycastflg) + entry->ia_type = IPADDRESSTYPE_ANYCAST; + else + entry->ia_type = IPADDRESSTYPE_UNICAST; +@@ -314,18 +320,28 @@ _load_v6(netsnmp_container *container, int idx_offset) + * + * are 'local' address assigned by link layer?? + */ +- if (IN6_IS_ADDR_LINKLOCAL(entry->ia_address) || +- IN6_IS_ADDR_SITELOCAL(entry->ia_address)) +- entry->ia_origin = IPADDRESSORIGINTC_LINKLAYER; +- else +- entry->ia_origin = IPADDRESSORIGINTC_MANUAL; ++ if (!flags) ++ entry->ia_origin = IPADDRESSORIGINTC_LINKLAYER; ++ else if (flags & IFA_F_TEMPORARY) ++ entry->ia_origin = IPADDRESSORIGINTC_RANDOM; ++ else if (IN6_IS_ADDR_LINKLOCAL(entry->ia_address)) ++ entry->ia_origin = IPADDRESSORIGINTC_LINKLAYER; ++ else ++ entry->ia_origin = IPADDRESSORIGINTC_MANUAL; ++ ++ if(entry->ia_origin == IPADDRESSORIGINTC_LINKLAYER) ++ entry->ia_storagetype = STORAGETYPE_PERMANENT; + + /* xxx-rks: what can we do with scope? */ + + /* + * add entry to container + */ +- CONTAINER_INSERT(container, entry); ++ if (CONTAINER_INSERT(container, entry) < 0) { ++ DEBUGMSGTL(("access:ipaddress:container","error with ipaddress_entry: insert into container failed.\n")); ++ netsnmp_access_ipaddress_entry_free(entry); ++ continue; ++ } + } + + fclose(in); +@@ -335,4 +351,93 @@ _load_v6(netsnmp_container *container, int idx_offset) + + return idx_offset; + } ++ ++struct address_flag_info ++netsnmp_access_other_info_get(int index, int family) ++{ ++ struct { ++ struct nlmsghdr n; ++ struct ifaddrmsg r; ++ char buf[1024]; ++ } req; ++ struct address_flag_info addr; ++ struct rtattr *rta; ++ int status; ++ char buf[16384]; ++ struct nlmsghdr *nlmp; ++ struct ifaddrmsg *rtmp; ++ struct rtattr *rtatp; ++ int rtattrlen; ++ int sd; ++ ++ memset(&addr, 0, sizeof(struct address_flag_info)); ++ sd = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE); ++ if(sd < 0) { ++ snmp_log(LOG_ERR, "could not open netlink socket\n"); ++ return addr; ++ } ++ ++ memset(&req, 0, sizeof(req)); ++ req.n.nlmsg_len = NLMSG_LENGTH(sizeof(struct ifaddrmsg)); ++ req.n.nlmsg_flags = NLM_F_REQUEST | NLM_F_ROOT; ++ req.n.nlmsg_type = RTM_GETADDR; ++ req.r.ifa_family = family; ++ rta = (struct rtattr *)(((char *)&req) + NLMSG_ALIGN(req.n.nlmsg_len)); ++ if(family == AF_INET) ++ rta->rta_len = RTA_LENGTH(4); ++ else ++ rta->rta_len = RTA_LENGTH(16); ++ ++ status = send(sd, &req, req.n.nlmsg_len, 0); ++ if (status < 0) { ++ snmp_log(LOG_ERR, "could not send netlink request\n"); ++ return addr; ++ } ++ ++ status = recv(sd, buf, sizeof(buf), 0); ++ if (status < 0) { ++ snmp_log (LOG_ERR, "could not recieve netlink request\n"); ++ return addr; ++ } ++ ++ if(status == 0) { ++ snmp_log (LOG_ERR, "nothing to read\n"); ++ return addr; ++ } ++ ++ for(nlmp = (struct nlmsghdr *)buf; status > sizeof(*nlmp);) { ++ int len = nlmp->nlmsg_len; ++ int req_len = len - sizeof(*nlmp); ++ ++ if (req_len < 0 || len > status) { ++ snmp_log (LOG_ERR, "invalid netlink message\n"); ++ return addr; ++ } ++ ++ if (!NLMSG_OK(nlmp, status)) { ++ snmp_log (LOG_ERR, "invalid NLMSG message\n"); ++ return addr; ++ } ++ rtmp = (struct ifaddrmsg *)NLMSG_DATA(nlmp); ++ rtatp = (struct rtattr *)IFA_RTA(rtmp); ++ rtattrlen = IFA_PAYLOAD(nlmp); ++ if(index == rtmp->ifa_index){ ++ for (; RTA_OK(rtatp, rtattrlen); rtatp = RTA_NEXT(rtatp, rtattrlen)) { ++ if(rtatp->rta_type == IFA_BROADCAST){ ++ addr.inp = (struct in_addr *)RTA_DATA(rtatp); ++ addr.bcastflg = 1; ++ } ++ if(rtatp->rta_type == IFA_ANYCAST){ ++ addr.inp = (struct in_addr *)RTA_DATA(rtatp); ++ addr.anycastflg = 1; ++ } ++ } ++ } ++ status -= NLMSG_ALIGN(len); ++ nlmp = (struct nlmsghdr*)((char*)nlmp + NLMSG_ALIGN(len)); ++ } ++ close(sd); ++ return addr; ++} + #endif ++ +diff --git a/agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable.c b/agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable.c +index e695ab3..8bb3cbc 100644 +--- a/agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable.c ++++ b/agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable.c +@@ -942,7 +942,10 @@ ipAddressRowStatus_get(ipAddressTable_rowreq_ctx * rowreq_ctx, + netsnmp_assert(NULL != ipAddressRowStatus_val_ptr); + + /** WARNING: this code might not work for netsnmp_ipaddress_entry */ +- (*ipAddressRowStatus_val_ptr) = rowreq_ctx->ipAddressRowStatus; ++ if(rowreq_ctx->data->if_index) ++ (*ipAddressRowStatus_val_ptr) = rowreq_ctx->ipAddressRowStatus; ++ else ++ (*ipAddressRowStatus_val_ptr) = ROWSTATUS_NOTREADY; + + return MFD_SUCCESS; + } /* ipAddressRowStatus_get */ +diff --git a/include/net-snmp/library/container.h b/include/net-snmp/library/container.h +index f88fa21..22684aa 100644 +--- a/include/net-snmp/library/container.h ++++ b/include/net-snmp/library/container.h +@@ -358,7 +358,7 @@ extern "C" { + if(x) { + int rc = x->insert(x,k); + if(rc) +- snmp_log(LOG_ERR,"error on subcontainer '%s' insert (%d)\n", ++ snmp_log(LOG_DEBUG,"error on subcontainer '%s' insert (%d)\n", + x->container_name ? x->container_name : "", rc); + else { + rc = CONTAINER_INSERT_HELPER(x->next, k); +diff --git a/snmplib/container.c b/snmplib/container.c +index e34e922..1255f0a 100644 +--- a/snmplib/container.c ++++ b/snmplib/container.c +@@ -275,7 +275,7 @@ int CONTAINER_INSERT_HELPER(netsnmp_container* x, const void* k) + if(x) { + int rc = x->insert(x,k); + if(rc) +- snmp_log(LOG_ERR,"error on subcontainer '%s' insert (%d)\n", ++ snmp_log(LOG_DEBUG,"error on subcontainer '%s' insert (%d)\n", + x->container_name ? x->container_name : "", rc); + else { + rc = CONTAINER_INSERT_HELPER(x->next, k); +-- +1.6.0.2 + diff --git a/Fix-for-tcpConnnectionTable-tcpListenerTable-udpEn.patch b/Fix-for-tcpConnnectionTable-tcpListenerTable-udpEn.patch new file mode 100644 index 0000000..430cffe --- /dev/null +++ b/Fix-for-tcpConnnectionTable-tcpListenerTable-udpEn.patch @@ -0,0 +1,368 @@ +From 757470fe3c79081b3b106f669f39e45f7aaa4baf Mon Sep 17 00:00:00 2001 +From: Mitsuru Chinen +Date: Mon, 20 Oct 2008 14:36:05 +0900 +Subject: [PATCH] Fix for tcpConnnectionTable, tcpListenerTable, udpEndpointTable + +From net-snmp patch tracker: +[ 1670511 ] agent returns 0 for process id in tcp and udp mib +http://sourceforge.net/tracker/index.php?func=detail&aid=1670511&group_id=12694&atid=312694 + +Signed-off-by: Mitsuru Chinen +--- + agent/mibgroup/tcp-mib/data_access/tcpConn_linux.c | 18 ++-- + .../udp-mib/data_access/udp_endpoint_linux.c | 7 +- + .../udp-mib/udpEndpointTable/udpEndpointTable.c | 17 +++- + .../udp-mib/udpEndpointTable/udpEndpointTable.h | 12 ++- + .../udpEndpointTable_data_access.c | 3 +- + agent/mibgroup/util_funcs.c | 100 ++++++++++++++++++++ + agent/mibgroup/util_funcs.h | 4 + + include/net-snmp/data_access/udp_endpoint.h | 1 + + 8 files changed, 146 insertions(+), 16 deletions(-) + +diff --git a/agent/mibgroup/tcp-mib/data_access/tcpConn_linux.c b/agent/mibgroup/tcp-mib/data_access/tcpConn_linux.c +index 7ffebe6..72495a9 100644 +--- a/agent/mibgroup/tcp-mib/data_access/tcpConn_linux.c ++++ b/agent/mibgroup/tcp-mib/data_access/tcpConn_linux.c +@@ -11,7 +11,7 @@ + + #include "tcp-mib/tcpConnectionTable/tcpConnectionTable_constants.h" + #include "tcp-mib/data_access/tcpConn_private.h" +- ++#include "mibgroup/util_funcs.h" + static int + linux_states[12] = { 1, 5, 3, 4, 6, 7, 11, 1, 8, 9, 2, 10 }; + +@@ -135,15 +135,16 @@ _load4(netsnmp_container *container, u_int load_flags) + while (fgets(line, sizeof(line), in)) { + netsnmp_tcpconn_entry *entry; + int state, rc, local_port, remote_port, tmp_state; ++ unsigned long long inode; + size_t buf_len, offset; + u_char local_addr[10], remote_addr[10]; + u_char *tmp_ptr; + +- if (5 != (rc = sscanf(line, "%*d: %8[0-9A-Z]:%x %8[0-9A-Z]:%x %x", ++ if (6 != (rc = sscanf(line, "%*d: %8[0-9A-Z]:%x %8[0-9A-Z]:%x %x %*x:%*x %*x:%*x %*x %*x %*x %llu", + local_addr, &local_port, +- remote_addr, &remote_port, &tmp_state))) { ++ remote_addr, &remote_port, &tmp_state, &inode))) { + DEBUGMSGT(("access:tcpconn:container", +- "error parsing line (%d != 5)\n", rc)); ++ "error parsing line (%d != 6)\n", rc)); + DEBUGMSGT(("access:tcpconn:container"," line '%s'\n", line)); + continue; + } +@@ -180,6 +181,7 @@ _load4(netsnmp_container *container, u_int load_flags) + entry->loc_port = (unsigned short) local_port; + entry->rmt_port = (unsigned short) remote_port; + entry->tcpConnState = state; ++ entry->pid = get_pid_from_inode(inode); + + /** the addr string may need work */ + buf_len = strlen(local_addr); +@@ -286,15 +288,16 @@ _load6(netsnmp_container *container, u_int load_flags) + while (fgets(line, sizeof(line), in)) { + netsnmp_tcpconn_entry *entry; + int state, rc, local_port, remote_port, tmp_state; ++ unsigned long long inode; + size_t buf_len, offset; + u_char local_addr[48], remote_addr[48]; + u_char *tmp_ptr; + +- if (5 != (rc = sscanf(line, "%*d: %47[0-9A-Z]:%x %47[0-9A-Z]:%x %x", ++ if (6 != (rc = sscanf(line, "%*d: %47[0-9A-Z]:%x %47[0-9A-Z]:%x %x %*x:%*x %*x:%*x %*x %*x %*x %llu", + local_addr, &local_port, +- remote_addr, &remote_port, &tmp_state))) { ++ remote_addr, &remote_port, &tmp_state, &inode))) { + DEBUGMSGT(("access:tcpconn:container", +- "error parsing line (%d != 5)\n", rc)); ++ "error parsing line (%d != 6)\n", rc)); + DEBUGMSGT(("access:tcpconn:container"," line '%s'\n", line)); + continue; + } +@@ -331,6 +334,7 @@ _load6(netsnmp_container *container, u_int load_flags) + entry->loc_port = (unsigned short) local_port; + entry->rmt_port = (unsigned short) remote_port; + entry->tcpConnState = state; ++ entry->pid = get_pid_from_inode(inode); + + /** the addr string may need work */ + buf_len = strlen((char*)local_addr); +diff --git a/agent/mibgroup/udp-mib/data_access/udp_endpoint_linux.c b/agent/mibgroup/udp-mib/data_access/udp_endpoint_linux.c +index 4e43e01..70dcace 100644 +--- a/agent/mibgroup/udp-mib/data_access/udp_endpoint_linux.c ++++ b/agent/mibgroup/udp-mib/data_access/udp_endpoint_linux.c +@@ -14,7 +14,7 @@ + #include + + #include "udp-mib/udpEndpointTable/udpEndpointTable_constants.h" +- ++#include "mibgroup/util_funcs.h" + #include "udp_endpoint_private.h" + + #include +@@ -222,6 +222,11 @@ _process_line_udp_ep(netsnmp_line_info *line_info, void *mem, + inode = strtoull(ptr, &ptr, 0); + ep->instance = (u_int)inode; + ++ /* ++ * get the pid also ++ */ ++ ep->pid = get_pid_from_inode(inode); ++ + ep->index = (u_int)(lpi->user_context); + lpi->user_context = (void*)((u_int)(lpi->user_context) + 1); + +diff --git a/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable.c b/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable.c +index 5da022f..b2d8b23 100644 +--- a/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable.c ++++ b/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable.c +@@ -223,7 +223,8 @@ udpEndpointTable_indexes_set_tbl_idx(udpEndpointTable_mib_index * tbl_idx, + size_t + udpEndpointRemoteAddress_val_ptr_len, + u_long udpEndpointRemotePort_val, +- u_long udpEndpointInstance_val) ++ u_long udpEndpointInstance_val, ++ u_long udpEndpointProcess_val) + { + DEBUGMSGTL(("verbose:udpEndpointTable:udpEndpointTable_indexes_set_tbl_idx", "called\n")); + +@@ -292,6 +293,10 @@ udpEndpointTable_indexes_set_tbl_idx(udpEndpointTable_mib_index * tbl_idx, + * udpEndpointInstance(7)/UNSIGNED32/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/h + */ + tbl_idx->udpEndpointInstance = udpEndpointInstance_val; ++ /* ++ * udpEndpointProcess(8)/UNSIGNED32/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/h ++ */ ++ tbl_idx->udpEndpointProcess = udpEndpointProcess_val; + + + return MFD_SUCCESS; +@@ -320,7 +325,8 @@ udpEndpointTable_indexes_set(udpEndpointTable_rowreq_ctx * rowreq_ctx, + char *udpEndpointRemoteAddress_val_ptr, + size_t udpEndpointRemoteAddress_val_ptr_len, + u_long udpEndpointRemotePort_val, +- u_long udpEndpointInstance_val) ++ u_long udpEndpointInstance_val, ++ u_long udpEndpointProcess_val) + { + DEBUGMSGTL(("verbose:udpEndpointTable:udpEndpointTable_indexes_set", + "called\n")); +@@ -335,7 +341,8 @@ udpEndpointTable_indexes_set(udpEndpointTable_rowreq_ctx * rowreq_ctx, + udpEndpointRemoteAddress_val_ptr, + udpEndpointRemoteAddress_val_ptr_len, + udpEndpointRemotePort_val, +- udpEndpointInstance_val)) ++ udpEndpointInstance_val, ++ udpEndpointProcess_val)) + return MFD_ERROR; + + /* +@@ -402,9 +409,9 @@ udpEndpointProcess_get(udpEndpointTable_rowreq_ctx * rowreq_ctx, + + /* + * TODO:231:o: |-> Extract the current value of the udpEndpointProcess data. +- * copy (* udpEndpointProcess_val_ptr ) from rowreq_ctx->data ++ * copy (* udpEndpointProcess_val_ptr ) from rowreq_ctx->tbl_idx.udpEndpointProcess + */ +- (*udpEndpointProcess_val_ptr) = rowreq_ctx->data.udpEndpointProcess; ++ (*udpEndpointProcess_val_ptr) = rowreq_ctx->tbl_idx.udpEndpointProcess; + + return MFD_SUCCESS; + } /* udpEndpointProcess_get */ +diff --git a/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable.h b/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable.h +index f023db8..fce1659 100644 +--- a/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable.h ++++ b/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable.h +@@ -132,6 +132,11 @@ config_require(udp-mib/udpEndpointTable/udpEndpointTable_data_access) + */ + u_long udpEndpointInstance; + ++ /* ++ * udpEndpointProcess(8)/UNSIGNED32/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/h ++ */ ++ u_long udpEndpointProcess; ++ + + } udpEndpointTable_mib_index; + +@@ -257,7 +262,9 @@ config_require(udp-mib/udpEndpointTable/udpEndpointTable_data_access) + u_long + udpEndpointRemotePort_val, + u_long +- udpEndpointInstance_val); ++ udpEndpointInstance_val, ++ u_long ++ udpEndpointProcess_val); + int + udpEndpointTable_indexes_set(udpEndpointTable_rowreq_ctx * + rowreq_ctx, +@@ -273,7 +280,8 @@ config_require(udp-mib/udpEndpointTable/udpEndpointTable_data_access) + size_t + udpEndpointRemoteAddress_val_ptr_len, + u_long udpEndpointRemotePort_val, +- u_long udpEndpointInstance_val); ++ u_long udpEndpointInstance_val, ++ u_long udpEndpointProcess_val); + + + +diff --git a/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable_data_access.c b/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable_data_access.c +index af4762f..1e9ef0f 100644 +--- a/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable_data_access.c ++++ b/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable_data_access.c +@@ -265,7 +265,8 @@ udpEndpointTable_container_load(netsnmp_container *container) + ep->rmt_addr, + ep->rmt_addr_len, + ep->rmt_port, +- ep->instance)) { ++ ep->instance, ++ ep->pid)) { + snmp_log(LOG_ERR, + "error setting index while loading " + "udpEndpointTable data.\n"); +diff --git a/agent/mibgroup/util_funcs.c b/agent/mibgroup/util_funcs.c +index 95ee4bf..26826f7 100644 +--- a/agent/mibgroup/util_funcs.c ++++ b/agent/mibgroup/util_funcs.c +@@ -86,6 +86,20 @@ + #ifdef HAVE_SYS_STAT_H + #include + #endif ++#if HAVE_DIRENT_H ++#include ++#else ++# define dirent direct ++# if HAVE_SYS_NDIR_H ++# include ++# endif ++# if HAVE_SYS_DIR_H ++# include ++# endif ++# if HAVE_NDIR_H ++# include ++# endif ++#endif + + #include + #include +@@ -1192,3 +1206,89 @@ Retrieve_Table_Data(mib_table_t t, int *max_idx) + *max_idx = table->next_index - 1; + return table->data; + } ++ ++#ifdef linux ++# define PROC_PATH "/proc" ++# define FILE_DISP "fd/" ++# define SOCKET_TYPE_1 "socket:[" ++# define SOCKET_TYPE_2 "[0000]:" ++ ++unsigned long long ++extract_inode(char *format) ++{ ++ unsigned long long ret = 0; ++ ++ if (!strncmp(format, SOCKET_TYPE_1, 8)) { ++ ret = strtoull(format + 8, NULL, 0); ++ } else if (!strncmp(format, SOCKET_TYPE_2, 7)) { ++ ret = strtoull(format + 7, NULL, 0); ++ } ++ ++ return ret; ++} ++ ++unsigned int ++get_pid_from_inode(unsigned long long inode) ++{ ++ DIR *procdirs = NULL, *piddirs = NULL; ++ char *name = NULL; ++ char path_name[PATH_MAX + 1]; ++ char socket_lnk[NAME_MAX + 1]; ++ int filelen = 0, readlen = 0, iflag = 0; ++ struct dirent *procinfo, *pidinfo; ++ unsigned int pid; ++ unsigned long long temp_inode; ++ ++ if (!(procdirs = opendir(PROC_PATH))) { ++ snmp_log(LOG_ERR, "snmpd: cannot open /proc\n"); ++ return 0; ++ } ++ ++ while ((procinfo = readdir(procdirs)) != NULL) { ++ name = procinfo->d_name; ++ for (; *name; name++) { ++ if (!isdigit(*name)) ++ break; ++ } ++ if(*name) ++ continue; ++ ++ memset(path_name, '\0', PATH_MAX + 1); ++ filelen = snprintf(path_name, PATH_MAX, ++ PROC_PATH "/%s/" FILE_DISP, procinfo->d_name); ++ if (filelen <= 0 || PATH_MAX < filelen) ++ continue; ++ ++ pid = strtoul(procinfo->d_name, NULL, 0); ++ ++ if (!(piddirs = opendir(path_name))) ++ continue; ++ ++ while ((pidinfo = readdir(piddirs)) != NULL) { ++ if (filelen + strlen(pidinfo->d_name) > PATH_MAX) ++ continue; ++ ++ strcpy(path_name + filelen, pidinfo->d_name); ++ ++ memset(socket_lnk, '\0', NAME_MAX + 1); ++ readlen = readlink(path_name, socket_lnk, NAME_MAX); ++ if (readlen < 0) ++ continue; ++ socket_lnk[readlen] = '\0'; ++ ++ temp_inode = extract_inode(socket_lnk); ++ if (inode == temp_inode) { ++ iflag = 1; ++ break; ++ } ++ } ++ closedir(piddirs); ++ if (iflag == 1) ++ break; ++ } ++ if (procdirs) ++ closedir(procdirs); ++ return pid; ++} ++ ++#endif /* #ifdef linux */ +diff --git a/agent/mibgroup/util_funcs.h b/agent/mibgroup/util_funcs.h +index 1b3fefe..4a0b99e 100644 +--- a/agent/mibgroup/util_funcs.h ++++ b/agent/mibgroup/util_funcs.h +@@ -34,6 +34,10 @@ void string_append_int(char *, int); + void wait_on_exec(struct extensible *); + const char *make_tempfile(void); + ++#ifdef linux ++unsigned int get_pid_from_inode(unsigned long long); ++#endif ++ + #define satosin(x) ((struct sockaddr_in *) &(x)) + #define SOCKADDR(x) (satosin(x)->sin_addr.s_addr) + #ifndef MIB_STATS_CACHE_TIMEOUT +diff --git a/include/net-snmp/data_access/udp_endpoint.h b/include/net-snmp/data_access/udp_endpoint.h +index cc81b02..b9831ec 100644 +--- a/include/net-snmp/data_access/udp_endpoint.h ++++ b/include/net-snmp/data_access/udp_endpoint.h +@@ -41,6 +41,7 @@ extern "C" { + u_short rmt_port; + + u_int instance; ++ u_int pid; + + } netsnmp_udp_endpoint_entry; + +-- +1.6.0.2 + diff --git a/Improve-IP-Statistics-tables.patch b/Improve-IP-Statistics-tables.patch new file mode 100644 index 0000000..75afe35 --- /dev/null +++ b/Improve-IP-Statistics-tables.patch @@ -0,0 +1,7453 @@ +From 32c13f8502b9520a49fb88a6737801d705fcbb9f Mon Sep 17 00:00:00 2001 +From: Mitsuru Chinen +Date: Mon, 20 Oct 2008 17:57:27 +0900 +Subject: [PATCH] Improve IP Statistics tables + +This patch fixes the ipSystemStatsTable and adds ipIfStatsTable for IPv6. + +From net-snmp patch tracker: +[ 1797111 ] Better support for ipIfStatsTable +http://sourceforge.net/tracker/index.php?func=detail&aid=1797111&group_id=12694&atid=312694 + +Signed-off-by: Mitsuru Chinen +--- + README.agent-mibs | 2 +- + .../ip-mib/data_access/systemstats_common.c | 119 +- + .../ip-mib/data_access/systemstats_linux.c | 389 +++- + agent/mibgroup/ip-mib/ipIfStatsTable.h | 8 + + .../ip-mib/ipIfStatsTable/ipIfStatsTable.c | 216 ++ + .../ip-mib/ipIfStatsTable/ipIfStatsTable.h | 200 ++ + .../ipIfStatsTable/ipIfStatsTable_data_access.c | 408 +++ + .../ipIfStatsTable/ipIfStatsTable_data_access.h | 70 + + .../ipIfStatsTable/ipIfStatsTable_data_get.c | 3015 ++++++++++++++++++++ + .../ipIfStatsTable/ipIfStatsTable_data_get.h | 246 ++ + .../ip-mib/ipIfStatsTable/ipIfStatsTable_enums.h | 56 + + .../ipIfStatsTable/ipIfStatsTable_interface.c | 1395 +++++++++ + .../ipIfStatsTable/ipIfStatsTable_interface.h | 99 + + .../ip-mib/ipIfStatsTable/ipIfStatsTable_oids.h | 122 + + .../ip-mib/ipSystemStatsTable/ipSystemStatsTable.c | 154 +- + .../ipSystemStatsTable_data_access.c | 60 +- + include/net-snmp/data_access/ipstats.h | 66 +- + include/net-snmp/data_access/systemstats.h | 14 +- + 18 files changed, 6494 insertions(+), 145 deletions(-) + create mode 100644 agent/mibgroup/ip-mib/ipIfStatsTable.h + create mode 100644 agent/mibgroup/ip-mib/ipIfStatsTable/ipIfStatsTable.c + create mode 100644 agent/mibgroup/ip-mib/ipIfStatsTable/ipIfStatsTable.h + create mode 100644 agent/mibgroup/ip-mib/ipIfStatsTable/ipIfStatsTable_data_access.c + create mode 100644 agent/mibgroup/ip-mib/ipIfStatsTable/ipIfStatsTable_data_access.h + create mode 100644 agent/mibgroup/ip-mib/ipIfStatsTable/ipIfStatsTable_data_get.c + create mode 100644 agent/mibgroup/ip-mib/ipIfStatsTable/ipIfStatsTable_data_get.h + create mode 100644 agent/mibgroup/ip-mib/ipIfStatsTable/ipIfStatsTable_enums.h + create mode 100644 agent/mibgroup/ip-mib/ipIfStatsTable/ipIfStatsTable_interface.c + create mode 100644 agent/mibgroup/ip-mib/ipIfStatsTable/ipIfStatsTable_interface.h + create mode 100644 agent/mibgroup/ip-mib/ipIfStatsTable/ipIfStatsTable_oids.h + +diff --git a/README.agent-mibs b/README.agent-mibs +index 8716f8d..ff5ce6a 100644 +--- a/README.agent-mibs ++++ b/README.agent-mibs +@@ -152,7 +152,7 @@ IP-MIB + + ipSystemStatsTable L 5.2 M ip-mib/=/* + ipIfStatsTableLastChange.0 --- +- ipIfStatsTable --- ++ ipIfStatsTable L-- 5.5 M ip-mib/=/* + + ipAddrTable (D) U $2 4.2 O mibII/ipAddr.c + ipAddressSpinLock.0 --- +diff --git a/agent/mibgroup/ip-mib/data_access/systemstats_common.c b/agent/mibgroup/ip-mib/data_access/systemstats_common.c +index 83e1867..a09cacf 100644 +--- a/agent/mibgroup/ip-mib/data_access/systemstats_common.c ++++ b/agent/mibgroup/ip-mib/data_access/systemstats_common.c +@@ -1,5 +1,5 @@ + /* +- * Systemstats MIB architecture support ++ * ipSystemStatsTable and ipIfStatsTable MIB architecture support + * + * $Id: systemstats_common.c 11913 2005-02-08 21:58:36Z nba $ + */ +@@ -163,7 +163,7 @@ netsnmp_access_systemstats_entry_get_by_index(netsnmp_container *container, oid + /** + */ + netsnmp_systemstats_entry * +-netsnmp_access_systemstats_entry_create(int version) ++netsnmp_access_systemstats_entry_create(int version, int if_index) + { + netsnmp_systemstats_entry *entry = + SNMP_MALLOC_TYPEDEF(netsnmp_systemstats_entry); +@@ -173,10 +173,10 @@ netsnmp_access_systemstats_entry_create(int version) + if(NULL == entry) + return NULL; + +- entry->ns_ip_version = version; +- +- entry->oid_index.len = 1; +- entry->oid_index.oids = (oid *) & entry->ns_ip_version; ++ entry->oid_index.len = 2; ++ entry->oid_index.oids = entry->index; ++ entry->index[0] = version; ++ entry->index[1] = if_index; + + return entry; + } +@@ -217,6 +217,64 @@ _entry_release(netsnmp_systemstats_entry * entry, void *context) + netsnmp_access_systemstats_entry_free(entry); + } + ++/* ++ * Calculates the entries, which are not provided by OS, but can be ++ * computed from the others. ++ */ ++static void ++_calculate_entries(netsnmp_systemstats_entry * entry) ++{ ++ U64 calc_val; ++ ++ /* ++ * HCInForwDatagrams = HCInNoRoutes + HCOutForwDatagrams ++ */ ++ if (!entry->stats.columnAvail[IPSYSTEMSTATSTABLE_HCINFORWDATAGRAMS] ++ && entry->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTFORWDATAGRAMS] ++ && entry->stats.columnAvail[IPSYSTEMSTATSTABLE_HCINNOROUTES]) { ++ ++ entry->stats.HCInForwDatagrams = entry->stats.HCInNoRoutes; ++ u64Incr(&entry->stats.HCInForwDatagrams, &entry->stats.HCOutForwDatagrams); ++ entry->stats.columnAvail[IPSYSTEMSTATSTABLE_HCINFORWDATAGRAMS] = 1; ++ } ++ ++ /* ++ * HCOutFragReqds = HCOutFragOKs + HCOutFragFails ++ */ ++ if (!entry->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTFRAGREQDS] ++ && entry->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTFRAGOKS] ++ && entry->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTFRAGFAILS]) { ++ ++ entry->stats.HCOutFragReqds = entry->stats.HCOutFragOKs; ++ u64Incr(&entry->stats.HCOutFragReqds, &entry->stats.HCOutFragFails); ++ entry->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTFRAGREQDS] = 1; ++ } ++ ++ /* ++ * HCOutTransmits = HCOutRequests + HCOutForwDatagrams + HCOutFragCreates ++ * - HCOutFragReqds - HCOutNoRoutes - HCOutDiscards ++ */ ++ if (!entry->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTTRANSMITS] ++ && entry->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTREQUESTS] ++ && entry->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTFORWDATAGRAMS] ++ && entry->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTFRAGREQDS] ++ && entry->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTNOROUTES] ++ && entry->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTFRAGCREATES] ++ && entry->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTDISCARDS]) { ++ ++ U64 tmp, tmp2, tmp3; ++ tmp = entry->stats.HCOutRequests; ++ u64Incr(&tmp, &entry->stats.HCOutForwDatagrams); ++ u64Incr(&tmp, &entry->stats.HCOutFragCreates); ++ ++ u64Subtract(&tmp, &entry->stats.HCOutFragReqds, &tmp2); ++ u64Subtract(&tmp2, &entry->stats.HCOutNoRoutes, &tmp3); ++ u64Subtract(&tmp3, &entry->stats.HCOutDiscards, &entry->stats.HCOutTransmits); ++ ++ entry->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTTRANSMITS] = 1; ++ } ++} ++ + /** + * update entry stats (checking for counter wrap) + * +@@ -233,7 +291,8 @@ netsnmp_access_systemstats_entry_update_stats(netsnmp_systemstats_entry * prev_v + * sanity checks + */ + if ((NULL == prev_vals) || (NULL == new_vals) || +- (prev_vals->ns_ip_version != new_vals->ns_ip_version)) ++ (prev_vals->index[0] != new_vals->index[0]) ++ || (prev_vals->index[1] != new_vals->index[1])) + return -1; + + /* +@@ -241,6 +300,7 @@ netsnmp_access_systemstats_entry_update_stats(netsnmp_systemstats_entry * prev_v + */ + if (0 == need_wrap_check) { + memcpy(&prev_vals->stats, &new_vals->stats, sizeof(new_vals->stats)); ++ _calculate_entries(prev_vals); + return 0; + } + +@@ -257,8 +317,8 @@ netsnmp_access_systemstats_entry_update_stats(netsnmp_systemstats_entry * prev_v + /* + * update straight 32 bit counters + */ ++ memcpy(&prev_vals->stats.columnAvail[0], &new_vals->stats.columnAvail[0], sizeof(new_vals->stats.columnAvail)); + prev_vals->stats.InHdrErrors = new_vals->stats.InHdrErrors; +- prev_vals->stats.InNoRoutes = new_vals->stats.InNoRoutes; + prev_vals->stats.InAddrErrors = new_vals->stats.InAddrErrors; + prev_vals->stats.InUnknownProtos = new_vals->stats.InUnknownProtos; + prev_vals->stats.InTruncatedPkts = new_vals->stats.InTruncatedPkts; +@@ -266,16 +326,38 @@ netsnmp_access_systemstats_entry_update_stats(netsnmp_systemstats_entry * prev_v + prev_vals->stats.ReasmOKs = new_vals->stats.ReasmOKs; + prev_vals->stats.ReasmFails = new_vals->stats.ReasmFails; + prev_vals->stats.InDiscards = new_vals->stats.InDiscards; +- prev_vals->stats.OutNoRoutes = new_vals->stats.OutNoRoutes; +- prev_vals->stats.OutDiscards = new_vals->stats.OutDiscards; +- prev_vals->stats.OutFragReqds = new_vals->stats.OutFragReqds; +- prev_vals->stats.OutFragOKs = new_vals->stats.OutFragOKs; +- prev_vals->stats.OutFragFails = new_vals->stats.OutFragFails; +- prev_vals->stats.OutFragCreates = new_vals->stats.OutFragCreates; + + /* + * update 64bit counters + */ ++ netsnmp_c64_check32_and_update(&prev_vals->stats.HCInNoRoutes, ++ &new_vals->stats.HCInNoRoutes, ++ &prev_vals->old_stats->HCInNoRoutes, ++ &need_wrap_check); ++ netsnmp_c64_check32_and_update(&prev_vals->stats.HCOutNoRoutes, ++ &new_vals->stats.HCOutNoRoutes, ++ &prev_vals->old_stats->HCOutNoRoutes, ++ &need_wrap_check); ++ netsnmp_c64_check32_and_update(&prev_vals->stats.HCOutDiscards, ++ &new_vals->stats.HCOutDiscards, ++ &prev_vals->old_stats->HCOutDiscards, ++ &need_wrap_check); ++ netsnmp_c64_check32_and_update(&prev_vals->stats.HCOutFragReqds, ++ &new_vals->stats.HCOutFragReqds, ++ &prev_vals->old_stats->HCOutFragReqds, ++ &need_wrap_check); ++ netsnmp_c64_check32_and_update(&prev_vals->stats.HCOutFragOKs, ++ &new_vals->stats.HCOutFragOKs, ++ &prev_vals->old_stats->HCOutFragOKs, ++ &need_wrap_check); ++ netsnmp_c64_check32_and_update(&prev_vals->stats.HCOutFragFails, ++ &new_vals->stats.HCOutFragFails, ++ &prev_vals->old_stats->HCOutFragFails, ++ &need_wrap_check); ++ netsnmp_c64_check32_and_update(&prev_vals->stats.HCOutFragCreates, ++ &new_vals->stats.HCOutFragCreates, ++ &prev_vals->old_stats->HCOutFragCreates, ++ &need_wrap_check); + netsnmp_c64_check32_and_update(&prev_vals->stats.HCInReceives, + &new_vals->stats.HCInReceives, + &prev_vals->old_stats->HCInReceives, +@@ -333,7 +415,7 @@ netsnmp_access_systemstats_entry_update_stats(netsnmp_systemstats_entry * prev_v + &prev_vals->old_stats->HCOutBcastPkts, + &need_wrap_check); + } +- ++ + /* + * if we've decided we no longer need to check wraps, free old stats + */ +@@ -346,7 +428,9 @@ netsnmp_access_systemstats_entry_update_stats(netsnmp_systemstats_entry * prev_v + * careful - old_stats is a pointer to stats... + */ + memcpy(prev_vals->old_stats, &new_vals->stats, sizeof(new_vals->stats)); +- ++ ++ _calculate_entries(prev_vals); ++ + return 0; + } + +@@ -367,7 +451,8 @@ netsnmp_access_systemstats_entry_update(netsnmp_systemstats_entry * lhs, + DEBUGMSGTL(("access:systemstats", "copy\n")); + + if ((NULL == lhs) || (NULL == rhs) || +- (lhs->ns_ip_version != rhs->ns_ip_version)) ++ (lhs->index[0] != rhs->index[0]) ++ || (lhs->index[1] != rhs->index[1])) + return -1; + + /* +diff --git a/agent/mibgroup/ip-mib/data_access/systemstats_linux.c b/agent/mibgroup/ip-mib/data_access/systemstats_linux.c +index 947afe8..552a745 100644 +--- a/agent/mibgroup/ip-mib/data_access/systemstats_linux.c ++++ b/agent/mibgroup/ip-mib/data_access/systemstats_linux.c +@@ -1,5 +1,5 @@ + /* +- * Interface MIB architecture support ++ * ipSystemStatsTable and ipIfStatsTable interface MIB architecture support + * + * $Id: systemstats_linux.c 15220 2006-09-15 00:48:50Z tanders $ + */ +@@ -10,11 +10,22 @@ + #include + #include + ++#include "../ipSystemStatsTable/ipSystemStatsTable.h" ++ ++#include ++#include ++#include ++ + static int _systemstats_v4(netsnmp_container* container, u_int load_flags); ++static int _additional_systemstats_v4(netsnmp_systemstats_entry* entry, ++ u_int load_flags); ++ + #if defined (NETSNMP_ENABLE_IPV6) + static int _systemstats_v6(netsnmp_container* container, u_int load_flags); + #endif + ++static netsnmp_column_info valid_columns; ++static unsigned int my_columns[IPSYSTEMSTATSTABLE_MAX_COL]; + + void + netsnmp_access_systemstats_arch_init(void) +@@ -62,7 +73,7 @@ netsnmp_access_systemstats_container_arch_load(netsnmp_container* container, + snmp_log(LOG_ERR, "no container specified/found for access_systemstats_\n"); + return -1; + } +- ++ + /* + * load v4 and v6 stats. Even if one fails, try the other. + * If they have the same rc, return it. if the differ, return +@@ -81,6 +92,9 @@ netsnmp_access_systemstats_container_arch_load(netsnmp_container* container, + #endif + } + ++/* ++ * Based on load_flags, load ipSystemStatsTable or ipIfStatsTable for ipv4 entries. ++ */ + static int + _systemstats_v4(netsnmp_container* container, u_int load_flags) + { +@@ -97,6 +111,11 @@ _systemstats_v4(netsnmp_container* container, u_int load_flags) + + netsnmp_assert(container != NULL); /* load function shoulda checked this */ + ++ if (load_flags & NETSNMP_ACCESS_SYSTEMSTATS_LOAD_IFTABLE) { ++ /* we do not support ipIfStatsTable for ipv4 */ ++ return 0; ++ } ++ + if (!(devin = fopen("/proc/net/snmp", "r"))) { + DEBUGMSGTL(("access:systemstats", + "Failed to load Systemstats Table (linux1)\n")); +@@ -144,7 +163,7 @@ _systemstats_v4(netsnmp_container* container, u_int load_flags) + while (*stats == ' ') /* skip spaces before stats */ + stats++; + +- entry = netsnmp_access_systemstats_entry_create(1); ++ entry = netsnmp_access_systemstats_entry_create(1, 0); + if(NULL == entry) { + netsnmp_access_systemstats_container_free(container, + NETSNMP_ACCESS_SYSTEMSTATS_FREE_NOFLAGS); +@@ -185,23 +204,54 @@ _systemstats_v4(netsnmp_container* container, u_int load_flags) + entry->stats.HCInReceives.high = scan_vals[2] >> 32; + entry->stats.InHdrErrors = scan_vals[3]; + entry->stats.InAddrErrors = scan_vals[4]; +- entry->stats.HCInForwDatagrams.low = scan_vals[5] & 0xffffffff; +- entry->stats.HCInForwDatagrams.high = scan_vals[5] >> 32; ++ entry->stats.HCOutForwDatagrams.low = scan_vals[5] & 0xffffffff; ++ entry->stats.HCOutForwDatagrams.high = scan_vals[5] >> 32; + entry->stats.InUnknownProtos = scan_vals[6]; + entry->stats.InDiscards = scan_vals[7]; + entry->stats.HCInDelivers.low = scan_vals[8] & 0xffffffff; + entry->stats.HCInDelivers.high = scan_vals[8] >> 32; + entry->stats.HCOutRequests.low = scan_vals[9] & 0xffffffff; + entry->stats.HCOutRequests.high = scan_vals[9] >> 32; +- entry->stats.OutDiscards = scan_vals[10]; +- entry->stats.OutNoRoutes = scan_vals[11]; ++ entry->stats.HCOutDiscards.low = scan_vals[10] & 0xffffffff;; ++ entry->stats.HCOutDiscards.high = scan_vals[10] >> 32; ++ entry->stats.HCOutNoRoutes.low = scan_vals[11] & 0xffffffff;; ++ entry->stats.HCOutNoRoutes.high = scan_vals[11] >> 32; + /* entry->stats. = scan_vals[12]; / * ReasmTimeout */ + entry->stats.ReasmReqds = scan_vals[13]; + entry->stats.ReasmOKs = scan_vals[14]; + entry->stats.ReasmFails = scan_vals[15]; +- entry->stats.OutFragOKs = scan_vals[16]; +- entry->stats.OutFragFails = scan_vals[17]; +- entry->stats.OutFragCreates = scan_vals[18]; ++ entry->stats.HCOutFragOKs.low = scan_vals[16] & 0xffffffff;; ++ entry->stats.HCOutFragOKs.high = scan_vals[16] >> 32; ++ entry->stats.HCOutFragFails.low = scan_vals[17] & 0xffffffff;; ++ entry->stats.HCOutFragFails.high = scan_vals[17] >> 32; ++ entry->stats.HCOutFragCreates.low = scan_vals[18] & 0xffffffff;; ++ entry->stats.HCOutFragCreates.high = scan_vals[18] >> 32; ++ ++ entry->stats.columnAvail[IPSYSTEMSTATSTABLE_HCINRECEIVES] = 1; ++ entry->stats.columnAvail[IPSYSTEMSTATSTABLE_INHDRERRORS] = 1; ++ entry->stats.columnAvail[IPSYSTEMSTATSTABLE_INADDRERRORS] = 1; ++ entry->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTFORWDATAGRAMS] = 1; ++ entry->stats.columnAvail[IPSYSTEMSTATSTABLE_INUNKNOWNPROTOS] = 1; ++ entry->stats.columnAvail[IPSYSTEMSTATSTABLE_INDISCARDS] = 1; ++ entry->stats.columnAvail[IPSYSTEMSTATSTABLE_HCINDELIVERS] = 1; ++ entry->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTREQUESTS] = 1; ++ entry->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTDISCARDS] = 1; ++ entry->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTNOROUTES] = 1; ++ entry->stats.columnAvail[IPSYSTEMSTATSTABLE_REASMREQDS] = 1; ++ entry->stats.columnAvail[IPSYSTEMSTATSTABLE_REASMOKS] = 1; ++ entry->stats.columnAvail[IPSYSTEMSTATSTABLE_REASMFAILS] = 1; ++ entry->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTFRAGOKS] = 1; ++ entry->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTFRAGFAILS] = 1; ++ entry->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTFRAGCREATES] = 1; ++ entry->stats.columnAvail[IPSYSTEMSTATSTABLE_DISCONTINUITYTIME] = 1; ++ entry->stats.columnAvail[IPSYSTEMSTATSTABLE_REFRESHRATE] = 1; ++ ++ /* ++ * load addtional statistics defined by RFC 4293 ++ * As these are supported linux 2.6.22 or later, it is no problem ++ * if loading them are failed. ++ */ ++ _additional_systemstats_v4(entry, load_flags); + + /* + * add to container +@@ -211,49 +261,106 @@ _systemstats_v4(netsnmp_container* container, u_int load_flags) + return 0; + } + +-#if defined (NETSNMP_ENABLE_IPV6) ++#define IP_EXT_HEAD "IpExt:" + static int +-_systemstats_v6(netsnmp_container* container, u_int load_flags) ++_additional_systemstats_v4(netsnmp_systemstats_entry* entry, ++ u_int load_flags) + { + FILE *devin; + char line[1024]; +- netsnmp_systemstats_entry *entry = NULL; +- int scan_count = 0; +- char *stats, *start = line; +- int len, rc; +- uintmax_t scan_val; +- const char *filename = "/proc/net/snmp6"; +- static int warned_open = 0; ++ int scan_count; ++ uintmax_t scan_vals[6]; ++ int retval = 0; + +- DEBUGMSGTL(("access:systemstats:container:arch", "load v6 (flags %p)\n", +- load_flags)); ++ DEBUGMSGTL(("access:systemstats:container:arch", ++ "load addtional v4 (flags %p)\n", load_flags)); + +- netsnmp_assert(container != NULL); /* load function shoulda checked this */ ++ if (!(devin = fopen("/proc/net/netstat", "r"))) { ++ DEBUGMSGTL(("access:systemstats", ++ "cannot open /proc/net/netstat\n")); ++ return -2; ++ } + +- entry = netsnmp_access_systemstats_entry_create(2); +- if(NULL == entry) +- return -3; +- + /* +- * try to open file. If we can't, that's ok - maybe the module hasn't +- * been loaded yet. ++ * Get header and stat lines + */ +- if (!(devin = fopen(filename, "r"))) { +- DEBUGMSGTL(("access:systemstats", +- "Failed to load Systemstats Table (linux1)\n")); +- if(!warned_open) { +- ++warned_open; +- snmp_log(LOG_ERR, "cannot open %s ...\n", filename); +- } +- free(entry); +- return 0; ++ while (fgets(line, sizeof(line), devin)) { ++ if (strncmp(IP_EXT_HEAD, line, sizeof(IP_EXT_HEAD) - 1) == 0) { ++ /* next line should includes IPv4 addtional statistics */ ++ if ((fgets(line, sizeof(line), devin)) == NULL) { ++ retval = -4; ++ break; ++ } ++ if (strncmp(IP_EXT_HEAD, line, sizeof(IP_EXT_HEAD) - 1) != 0) { ++ retval = -4; ++ break; ++ } ++ ++ memset(scan_vals, 0x0, sizeof(scan_vals)); ++ scan_count = sscanf(line, ++ "%*s" /* ignore `IpExt:' */ ++ "%llu %llu %llu %llu %llu %llu", ++ &scan_vals[0], &scan_vals[1], &scan_vals[2], ++ &scan_vals[3], &scan_vals[4], &scan_vals[5]); ++ if (scan_count < 6) { ++ snmp_log(LOG_ERR, ++ "error scanning addtional systemstats data" ++ "(minimum expected %d, got %d)\n", ++ 6, scan_count); ++ retval = -4; ++ break; ++ } ++ ++ entry->stats.HCInNoRoutes.low = scan_vals[0] & 0xffffffff; ++ entry->stats.HCInNoRoutes.high = scan_vals[0] >> 32; ++ entry->stats.InTruncatedPkts = scan_vals[1]; ++ entry->stats.HCInMcastPkts.low = scan_vals[2] & 0xffffffff; ++ entry->stats.HCInMcastPkts.high = scan_vals[2] >> 32; ++ entry->stats.HCOutMcastPkts.low = scan_vals[3] & 0xffffffff; ++ entry->stats.HCOutMcastPkts.high = scan_vals[3] >> 32; ++ entry->stats.HCInBcastPkts.low = scan_vals[4] & 0xffffffff; ++ entry->stats.HCInBcastPkts.high = scan_vals[4] >> 32; ++ entry->stats.HCOutBcastPkts.low = scan_vals[5] & 0xffffffff; ++ entry->stats.HCOutBcastPkts.high = scan_vals[5] >> 32; ++ ++ entry->stats.columnAvail[IPSYSTEMSTATSTABLE_HCINNOROUTES] = 1; ++ entry->stats.columnAvail[IPSYSTEMSTATSTABLE_INTRUNCATEDPKTS] = 1; ++ entry->stats.columnAvail[IPSYSTEMSTATSTABLE_HCINMCASTPKTS] = 1; ++ entry->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTMCASTPKTS] = 1; ++ entry->stats.columnAvail[IPSYSTEMSTATSTABLE_HCINBCASTPKTS] = 1; ++ entry->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTBCASTPKTS] = 1; ++ } + } + ++ fclose(devin); ++ ++ if (retval < 0) ++ DEBUGMSGTL(("access:systemstats", ++ "/proc/net/netstat does not include addtional stats\n")); ++ ++ return retval; ++} ++ ++#if defined (NETSNMP_ENABLE_IPV6) ++ ++/* ++ * Load one /proc/net/snmp6 - like file (e.g. /proc/net/dev_snmp6/*) ++ */ ++ static int ++_systemstats_v6_load_file(netsnmp_systemstats_entry *entry, FILE *devin) ++{ ++ char line[1024]; ++ char *stats, *start = line; ++ int len, rc; ++ int scan_count; ++ uintmax_t scan_val; ++ + /* + * This file provides the statistics for each systemstats. + * Read in each line in turn, isolate the systemstats name + * and retrieve (or create) the corresponding data structure. + */ ++ rc = 0; + while (1) { + start = fgets(line, sizeof(line), devin); + if (NULL == start) +@@ -283,77 +390,101 @@ _systemstats_v6(netsnmp_container* container, u_int load_flags) + * data structure accordingly. + */ + scan_val = atoll(stats); +- if (0 == scan_val) +- continue; + + rc = 0; + if ('I' == line[3]) { /* In */ + if ('A' == line[5]) { + entry->stats.InAddrErrors = scan_val; ++ entry->stats.columnAvail[IPSYSTEMSTATSTABLE_INADDRERRORS] = 1; + } else if ('D' == line[5]) { + if ('e' == line[6]) { + entry->stats.HCInDelivers.low = scan_val & 0xffffffff; + entry->stats.HCInDelivers.high = scan_val >> 32; +- } else if ('i' == line[6]) ++ entry->stats.columnAvail[IPSYSTEMSTATSTABLE_HCINDELIVERS] = 1; ++ } else if ('i' == line[6]) { + entry->stats.InDiscards = scan_val; +- else ++ entry->stats.columnAvail[IPSYSTEMSTATSTABLE_INDISCARDS] = 1; ++ } else + rc = 1; + } else if ('H' == line[5]) { + entry->stats.InHdrErrors = scan_val; ++ entry->stats.columnAvail[IPSYSTEMSTATSTABLE_INHDRERRORS] = 1; + } else if ('M' == line[5]) { + entry->stats.HCInMcastPkts.low = scan_val & 0xffffffff; + entry->stats.HCInMcastPkts.high = scan_val >> 32; ++ entry->stats.columnAvail[IPSYSTEMSTATSTABLE_HCINMCASTPKTS] = 1; + } else if ('N' == line[5]) { +- entry->stats.InNoRoutes = scan_val; ++ entry->stats.HCInNoRoutes.low = scan_val & 0xffffffff; ++ entry->stats.HCInNoRoutes.high = scan_val >> 32; ++ entry->stats.columnAvail[IPSYSTEMSTATSTABLE_HCINNOROUTES] = 1; + } else if ('R' == line[5]) { + entry->stats.HCInReceives.low = scan_val & 0xffffffff; + entry->stats.HCInReceives.high = scan_val >> 32; ++ entry->stats.columnAvail[IPSYSTEMSTATSTABLE_HCINRECEIVES] = 1; + } else if ('T' == line[5]) { + if ('r' == line[6]) { + entry->stats.InTruncatedPkts = scan_val & 0xffffffff; ++ entry->stats.columnAvail[IPSYSTEMSTATSTABLE_INTRUNCATEDPKTS] = 1; + } else if ('o' == line[6]) + ; /* TooBig isn't in the MIB, so ignore it */ + else + rc = 1; + } else if ('U' == line[5]) { + entry->stats.InUnknownProtos = scan_val; ++ entry->stats.columnAvail[IPSYSTEMSTATSTABLE_INUNKNOWNPROTOS] = 1; + } else + rc = 1; + } else if ('O' == line[3]) { /* Out */ + if ('D' == line[6]) { +- entry->stats.OutDiscards = scan_val; ++ entry->stats.HCOutDiscards.low = scan_val & 0xffffffff; ++ entry->stats.HCOutDiscards.high = scan_val >> 32; ++ entry->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTDISCARDS] = 1; + } else if ('F' == line[6]) { + entry->stats.HCOutForwDatagrams.low = scan_val & 0xffffffff; + entry->stats.HCOutForwDatagrams.high = scan_val >> 32; ++ entry->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTFORWDATAGRAMS] = 1; + } else if ('M' == line[6]) { + entry->stats.HCOutMcastPkts.low = scan_val & 0xffffffff; + entry->stats.HCOutMcastPkts.high = scan_val >> 32; ++ entry->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTMCASTPKTS] = 1; + } else if ('N' == line[6]) { +- entry->stats.OutNoRoutes = scan_val; ++ entry->stats.HCOutNoRoutes.low = scan_val & 0xffffffff; ++ entry->stats.HCOutNoRoutes.high = scan_val >> 32; ++ entry->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTNOROUTES] = 1; + } else if ('R' == line[6]) { + entry->stats.HCOutRequests.low = scan_val & 0xffffffff; + entry->stats.HCOutRequests.high = scan_val >> 32; ++ entry->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTREQUESTS] = 1; + } else + rc = 1; + } else if ('R' == line[3]) { /* Reasm */ + if ('F' == line[8]) { + entry->stats.ReasmFails = scan_val; ++ entry->stats.columnAvail[IPSYSTEMSTATSTABLE_REASMFAILS] = 1; + } else if ('O' == line[8]) { + entry->stats.ReasmOKs = scan_val; ++ entry->stats.columnAvail[IPSYSTEMSTATSTABLE_REASMOKS] = 1; + } else if ('R' == line[8]) { + entry->stats.ReasmReqds = scan_val; ++ entry->stats.columnAvail[IPSYSTEMSTATSTABLE_REASMREQDS] = 1; + } else if ('T' == line[8]) { + ; /* no mib entry for reasm timeout */ + } else + rc = 1; + } else if ('F' == line[3]) { /* Frag */ +- if ('C' == line[7]) +- entry->stats.OutFragCreates = scan_val; +- else if ('O' == line[7]) +- entry->stats.OutFragOKs = scan_val; +- else if ('F' == line[7]) +- entry->stats.OutFragFails = scan_val; +- else ++ if ('C' == line[7]) { ++ entry->stats.HCOutFragCreates.low = scan_val & 0xffffffff; ++ entry->stats.HCOutFragCreates.high = scan_val >> 32; ++ entry->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTFRAGCREATES] = 1; ++ } else if ('O' == line[7]) { ++ entry->stats.HCOutFragOKs.low = scan_val & 0xffffffff; ++ entry->stats.HCOutFragOKs.high = scan_val >> 32; ++ entry->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTFRAGOKS] = 1; ++ } else if ('F' == line[7]) { ++ entry->stats.HCOutFragFails.low = scan_val & 0xffffffff; ++ entry->stats.HCOutFragFails.high = scan_val >> 32; ++ entry->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTFRAGFAILS] = 1; ++ } else + rc = 1; + } else + rc = 1; +@@ -363,6 +494,47 @@ _systemstats_v6(netsnmp_container* container, u_int load_flags) + else + ++scan_count; + } ++ /* ++ * Let DiscontinuityTime and RefreshRate active ++ */ ++ entry->stats.columnAvail[IPSYSTEMSTATSTABLE_DISCONTINUITYTIME] = 1; ++ entry->stats.columnAvail[IPSYSTEMSTATSTABLE_REFRESHRATE] = 1; ++ ++ return rc; ++} ++ ++/* ++ * load ipSystemStatsTable for ipv6 entries ++ */ ++static int ++_systemstats_v6_load_systemstats(netsnmp_container* container, u_int load_flags) ++{ ++ FILE *devin; ++ netsnmp_systemstats_entry *entry = NULL; ++ const char *filename = "/proc/net/snmp6"; ++ static int warned_open = 0; ++ int rc = 0; ++ ++ entry = netsnmp_access_systemstats_entry_create(2, 0); ++ if(NULL == entry) ++ return -3; ++ ++ /* ++ * try to open file. If we can't, that's ok - maybe the module hasn't ++ * been loaded yet. ++ */ ++ if (!(devin = fopen(filename, "r"))) { ++ DEBUGMSGTL(("access:systemstats", ++ "Failed to load Systemstats Table (linux1)\n")); ++ if(!warned_open) { ++ ++warned_open; ++ snmp_log(LOG_ERR, "cannot open %s ...\n", filename); ++ } ++ free(entry); ++ return 0; ++ } ++ ++ rc = _systemstats_v6_load_file(entry, devin); + + fclose(devin); + +@@ -373,4 +545,119 @@ _systemstats_v6(netsnmp_container* container, u_int load_flags) + + return rc; + } ++ ++#define DEV_SNMP6_DIRNAME "/proc/net/dev_snmp6" ++#define IFINDEX_LINE "ifIndex" ++#define DEV_FILENAME_LEN 64 ++ ++/* ++ * load ipIfStatsTable for ipv6 entries ++ */ ++static int ++_systemstats_v6_load_ifstats(netsnmp_container* container, u_int load_flags) ++{ ++ DIR *dev_snmp6_dir; ++ struct dirent *dev_snmp6_entry; ++ char dev_filename[DEV_FILENAME_LEN]; ++ FILE *devin; ++ char line[1024]; ++ char *stats, *start = line; ++ int rc; ++ char *scan_str; ++ uintmax_t scan_val; ++ netsnmp_systemstats_entry *entry = NULL; ++ ++ /* ++ * try to open /proc/net/dev_snmp6 directory. If we can't, that' ok - ++ * maybe it is not supported by the current running kernel. ++ */ ++ if ((dev_snmp6_dir = opendir(DEV_SNMP6_DIRNAME)) == NULL) { ++ DEBUGMSGTL(("access:ifstats", ++ "Failed to load IPv6 IfStats Table (linux)\n")); ++ return 0; ++ } ++ ++ /* ++ * Read each per interface statistics proc file ++ */ ++ rc = 0; ++ while ((dev_snmp6_entry = readdir(dev_snmp6_dir)) != NULL) { ++ if (dev_snmp6_entry->d_name[0] == '.') ++ continue; ++ ++ if (snprintf(dev_filename, DEV_FILENAME_LEN, "%s/%s", DEV_SNMP6_DIRNAME, ++ dev_snmp6_entry->d_name) > DEV_FILENAME_LEN) { ++ snmp_log(LOG_ERR, "Interface name %s is too long\n", ++ dev_snmp6_entry->d_name); ++ continue; ++ } ++ if (NULL == (devin = fopen(dev_filename, "r"))) { ++ snmp_log(LOG_ERR, "Failed to open %s\n", dev_filename); ++ continue; ++ } ++ ++ /* ++ * If a stat file name is made of digits, the name is interface index. ++ * If it is an interface name, the file includes a line labeled ifIndex. ++ */ ++ if (isdigit(dev_snmp6_entry->d_name[0])) { ++ scan_val = strtoull(dev_snmp6_entry->d_name, NULL, 0); ++ } else { ++ if (NULL == (start = fgets(line, sizeof(line), devin))) { ++ snmp_log(LOG_ERR, "%s doesn't include any lines\n", ++ dev_filename); ++ fclose(devin); ++ continue; ++ } ++ ++ if (0 != strncmp(start, IFINDEX_LINE, 7)) { ++ snmp_log(LOG_ERR, "%s doesn't include ifIndex line", ++ dev_filename); ++ fclose(devin); ++ continue; ++ } ++ ++ scan_str = strrchr(line, ' '); ++ if (NULL == scan_str) { ++ snmp_log(LOG_ERR, "%s is wrong format", dev_filename); ++ fclose(devin); ++ continue; ++ } ++ scan_val = strtoull(scan_str, NULL, 0); ++ } ++ ++ entry = netsnmp_access_systemstats_entry_create(2, scan_val); ++ if(NULL == entry) { ++ fclose(devin); ++ closedir(dev_snmp6_dir); ++ return -3; ++ } ++ ++ _systemstats_v6_load_file(entry, devin); ++ CONTAINER_INSERT(container, entry); ++ fclose(devin); ++ } ++ closedir(dev_snmp6_dir); ++ return 0; ++} ++ ++/* ++ * Based on load_flags, load ipSystemStatsTable or ipIfStatsTable for ipv6 entries. ++ */ ++static int ++_systemstats_v6(netsnmp_container* container, u_int load_flags) ++{ ++ DEBUGMSGTL(("access:systemstats:container:arch", "load v6 (flags %p)\n", ++ load_flags)); ++ ++ netsnmp_assert(container != NULL); /* load function shoulda checked this */ ++ ++ if (load_flags & NETSNMP_ACCESS_SYSTEMSTATS_LOAD_IFTABLE) { ++ /* load ipIfStatsTable */ ++ return _systemstats_v6_load_ifstats(container, load_flags); ++ } else { ++ /* load ipSystemStatsTable */ ++ return _systemstats_v6_load_systemstats(container, load_flags); ++ } ++} + #endif /* NETSNMP_ENABLE_IPV6 */ +diff --git a/agent/mibgroup/ip-mib/ipIfStatsTable.h b/agent/mibgroup/ip-mib/ipIfStatsTable.h +new file mode 100644 +index 0000000..da1d85c +--- /dev/null ++++ b/agent/mibgroup/ip-mib/ipIfStatsTable.h +@@ -0,0 +1,8 @@ ++/* ++ * module to include the modules ++ */ ++ ++config_require(ip-mib/data_access/systemstats) ++config_require(ip-mib/ipIfStatsTable/ipIfStatsTable) ++config_require(ip-mib/ipIfStatsTable/ipIfStatsTable_interface) ++config_require(ip-mib/ipIfStatsTable/ipIfStatsTable_data_access) +diff --git a/agent/mibgroup/ip-mib/ipIfStatsTable/ipIfStatsTable.c b/agent/mibgroup/ip-mib/ipIfStatsTable/ipIfStatsTable.c +new file mode 100644 +index 0000000..6af3529 +--- /dev/null ++++ b/agent/mibgroup/ip-mib/ipIfStatsTable/ipIfStatsTable.c +@@ -0,0 +1,216 @@ ++/* ++ * Note: this file originally auto-generated by mib2c using ++ * version : 14170 $ of $ ++ * ++ * $Id:$ ++ */ ++/** \page MFD helper for ipIfStatsTable ++ * ++ * \section intro Introduction ++ * Introductory text. ++ * ++ */ ++/* ++ * standard Net-SNMP includes ++ */ ++#include ++#include ++#include ++ ++/* ++ * include our parent header ++ */ ++#include "ipIfStatsTable.h" ++ ++#include ++ ++#include "ipIfStatsTable_interface.h" ++ ++oid ipIfStatsTable_oid[] = { IPIFSTATSTABLE_OID }; ++int ipIfStatsTable_oid_size = OID_LENGTH(ipIfStatsTable_oid); ++ ++ipIfStatsTable_registration ipIfStatsTable_user_context; ++ ++void initialize_table_ipIfStatsTable(void); ++void shutdown_table_ipIfStatsTable(void); ++ ++ ++/** ++ * Initializes the ipIfStatsTable module ++ */ ++void ++init_ipIfStatsTable(void) ++{ ++ DEBUGMSGTL(("verbose:ipIfStatsTable:init_ipIfStatsTable", "called\n")); ++ ++ /* ++ * TODO:300:o: Perform ipIfStatsTable one-time module initialization. ++ */ ++ ++ /* ++ * here we initialize all the tables we're planning on supporting ++ */ ++ if (should_init("ipIfStatsTable")) ++ initialize_table_ipIfStatsTable(); ++ ++ /* ++ * last changed should be 0 at startup ++ */ ++ ipIfStatsTable_lastChange_set(0); ++} /* init_ipIfStatsTable */ ++ ++/** ++ * Shut-down the ipIfStatsTable module (agent is exiting) ++ */ ++void ++shutdown_ipIfStatsTable(void) ++{ ++ if (should_init("ipIfStatsTable")) ++ shutdown_table_ipIfStatsTable(); ++ ++} ++ ++/** ++ * Initialize the table ipIfStatsTable ++ * (Define its contents and how it's structured) ++ */ ++void ++initialize_table_ipIfStatsTable(void) ++{ ++ ipIfStatsTable_registration *user_context; ++ u_long flags; ++ ++ DEBUGMSGTL(("verbose:ipIfStatsTable:initialize_table_ipIfStatsTable", ++ "called\n")); ++ ++ /* ++ * TODO:301:o: Perform ipIfStatsTable one-time table initialization. ++ */ ++ ++ /* ++ * TODO:302:o: |->Initialize ipIfStatsTable user context ++ * if you'd like to pass in a pointer to some data for this ++ * table, allocate or set it up here. ++ */ ++ /* ++ * a netsnmp_data_list is a simple way to store void pointers. A simple ++ * string token is used to add, find or remove pointers. ++ */ ++ user_context = netsnmp_create_data_list("ipIfStatsTable", NULL, NULL); ++ ++ /* ++ * No support for any flags yet, but in the future you would ++ * set any flags here. ++ */ ++ flags = 0; ++ ++ /* ++ * call interface initialization code ++ */ ++ _ipIfStatsTable_initialize_interface(user_context, flags); ++} /* initialize_table_ipIfStatsTable */ ++ ++/** ++ * Shutdown the table ipIfStatsTable ++ */ ++void ++shutdown_table_ipIfStatsTable(void) ++{ ++ /* ++ * call interface shutdown code ++ */ ++ _ipIfStatsTable_shutdown_interface(&ipIfStatsTable_user_context); ++} ++ ++/** ++ * extra context initialization (eg default values) ++ * ++ * @param rowreq_ctx : row request context ++ * @param user_init_ctx : void pointer for user (parameter to rowreq_ctx_allocate) ++ * ++ * @retval MFD_SUCCESS : no errors ++ * @retval MFD_ERROR : error (context allocate will fail) ++ */ ++int ++ipIfStatsTable_rowreq_ctx_init(ipIfStatsTable_rowreq_ctx * rowreq_ctx, ++ void *user_init_ctx) ++{ ++ DEBUGMSGTL(("verbose:ipIfStatsTable:ipIfStatsTable_rowreq_ctx_init", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:210:o: |-> Perform extra ipIfStatsTable rowreq initialization. (eg DEFVALS) ++ */ ++ ++ return MFD_SUCCESS; ++} /* ipIfStatsTable_rowreq_ctx_init */ ++ ++/** ++ * extra context cleanup ++ * ++ */ ++void ++ipIfStatsTable_rowreq_ctx_cleanup(ipIfStatsTable_rowreq_ctx * rowreq_ctx) ++{ ++ DEBUGMSGTL(("verbose:ipIfStatsTable:ipIfStatsTable_rowreq_ctx_cleanup", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:211:o: |-> Perform extra ipIfStatsTable rowreq cleanup. ++ */ ++} /* ipIfStatsTable_rowreq_ctx_cleanup */ ++ ++/** ++ * pre-request callback ++ * ++ * ++ * @retval MFD_SUCCESS : success. ++ * @retval MFD_ERROR : other error ++ */ ++int ++ipIfStatsTable_pre_request(ipIfStatsTable_registration * user_context) ++{ ++ DEBUGMSGTL(("verbose:ipIfStatsTable:ipIfStatsTable_pre_request", ++ "called\n")); ++ ++ /* ++ * TODO:510:o: Perform ipIfStatsTable pre-request actions. ++ */ ++ ++ return MFD_SUCCESS; ++} /* ipIfStatsTable_pre_request */ ++ ++/** ++ * post-request callback ++ * ++ * Note: ++ * New rows have been inserted into the container, and ++ * deleted rows have been removed from the container and ++ * released. ++ * ++ * @param user_context ++ * @param rc : MFD_SUCCESS if all requests succeeded ++ * ++ * @retval MFD_SUCCESS : success. ++ * @retval MFD_ERROR : other error (ignored) ++ */ ++int ++ipIfStatsTable_post_request(ipIfStatsTable_registration * user_context, ++ int rc) ++{ ++ DEBUGMSGTL(("verbose:ipIfStatsTable:ipIfStatsTable_post_request", ++ "called\n")); ++ ++ /* ++ * TODO:511:o: Perform ipIfStatsTable post-request actions. ++ */ ++ ++ return MFD_SUCCESS; ++} /* ipIfStatsTable_post_request */ ++ ++ ++/** @{ */ +diff --git a/agent/mibgroup/ip-mib/ipIfStatsTable/ipIfStatsTable.h b/agent/mibgroup/ip-mib/ipIfStatsTable/ipIfStatsTable.h +new file mode 100644 +index 0000000..8bf0a7a +--- /dev/null ++++ b/agent/mibgroup/ip-mib/ipIfStatsTable/ipIfStatsTable.h +@@ -0,0 +1,200 @@ ++/* ++ * Note: this file originally auto-generated by mib2c using ++ * version : 14170 $ of $ ++ * ++ * $Id:$ ++ */ ++#ifndef IPIFSTATSTABLE_H ++#define IPIFSTATSTABLE_H ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++ ++/** @addtogroup misc misc: Miscellaneous routines ++ * ++ * @{ ++ */ ++#include ++#include ++#include ++ ++ /* ++ * other required module components ++ */ ++ /* *INDENT-OFF* */ ++config_require(ip-mib/ipIfStatsTable/ipIfStatsTable_interface) ++config_require(ip-mib/ipIfStatsTable/ipIfStatsTable_data_access) ++config_require(ip-mib/ipIfStatsTable/ipIfStatsTable_data_get) ++ /* *INDENT-ON* */ ++ ++ /* ++ * OID and column number definitions for ipIfStatsTable ++ */ ++#include "ipIfStatsTable_oids.h" ++ ++ /* ++ * enum definions ++ */ ++#include "ipIfStatsTable_enums.h" ++ ++ /* ++ ********************************************************************* ++ * function declarations ++ */ ++ void init_ipIfStatsTable(void); ++ void shutdown_ipIfStatsTable(void); ++ ++ /* ++ ********************************************************************* ++ * Table declarations ++ */ ++/********************************************************************** ++ ********************************************************************** ++ *** ++ *** Table ipIfStatsTable ++ *** ++ ********************************************************************** ++ **********************************************************************/ ++ /* ++ * IP-MIB::ipIfStatsTable is subid 3 of ipTrafficStats. ++ * Its status is Current. ++ * OID: .1.3.6.1.2.1.4.31.3, length: 9 ++ */ ++ /* ++ ********************************************************************* ++ * When you register your mib, you get to provide a generic ++ * pointer that will be passed back to you for most of the ++ * functions calls. ++ * ++ * TODO:100:r: Review all context structures ++ */ ++ /* ++ * TODO:101:o: |-> Review ipIfStatsTable registration context. ++ */ ++ typedef netsnmp_data_list ipIfStatsTable_registration; ++ ++/**********************************************************************/ ++ /* ++ * TODO:110:r: |-> Review ipIfStatsTable data context structure. ++ * This structure is used to represent the data for ipIfStatsTable. ++ */ ++ typedef netsnmp_systemstats_entry ipIfStatsTable_data; ++ ++ ++ /* ++ * TODO:120:r: |-> Review ipIfStatsTable mib index. ++ * This structure is used to represent the index for ipIfStatsTable. ++ */ ++ typedef struct ipIfStatsTable_mib_index_s { ++ ++ /* ++ * ipIfStatsIPVersion(1)/InetVersion/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h ++ */ ++ u_long ipIfStatsIPVersion; ++ ++ /* ++ * ipIfStatsIfIndex(2)/InterfaceIndex/ASN_INTEGER/long(long)//l/a/w/e/R/d/H ++ */ ++ long ipIfStatsIfIndex; ++ ++ ++ } ipIfStatsTable_mib_index; ++ ++ /* ++ * TODO:121:r: | |-> Review ipIfStatsTable max index length. ++ * If you KNOW that your indexes will never exceed a certain ++ * length, update this macro to that length. ++ */ ++#define MAX_ipIfStatsTable_IDX_LEN 2 ++ ++ ++ /* ++ ********************************************************************* ++ * TODO:130:o: |-> Review ipIfStatsTable Row request (rowreq) context. ++ * When your functions are called, you will be passed a ++ * ipIfStatsTable_rowreq_ctx pointer. ++ */ ++ typedef struct ipIfStatsTable_rowreq_ctx_s { ++ ++ /** this must be first for container compare to work */ ++ netsnmp_index oid_idx; ++ oid oid_tmp[MAX_ipIfStatsTable_IDX_LEN]; ++ ++ ipIfStatsTable_mib_index tbl_idx; ++ ++ ipIfStatsTable_data *data; ++ ++ /* ++ * flags per row. Currently, the first (lower) 8 bits are reserved ++ * for the user. See mfd.h for other flags. ++ */ ++ u_int rowreq_flags; ++ ++ /* ++ * TODO:131:o: | |-> Add useful data to ipIfStatsTable rowreq context. ++ */ ++ char known_missing; ++ uint32_t ipIfStatsDiscontinuityTime; ++ uint32_t ipIfStatsRefreshRate; ++ ++ /* ++ * storage for future expansion ++ */ ++ netsnmp_data_list *ipIfStatsTable_data_list; ++ ++ } ipIfStatsTable_rowreq_ctx; ++ ++ typedef struct ipIfStatsTable_ref_rowreq_ctx_s { ++ ipIfStatsTable_rowreq_ctx *rowreq_ctx; ++ } ipIfStatsTable_ref_rowreq_ctx; ++ ++ /* ++ ********************************************************************* ++ * function prototypes ++ */ ++ int ipIfStatsTable_pre_request(ipIfStatsTable_registration ++ * user_context); ++ int ipIfStatsTable_post_request(ipIfStatsTable_registration ++ * user_context, int rc); ++ ++ int ++ ipIfStatsTable_rowreq_ctx_init(ipIfStatsTable_rowreq_ctx * ++ rowreq_ctx, void *user_init_ctx); ++ void ++ ipIfStatsTable_rowreq_ctx_cleanup(ipIfStatsTable_rowreq_ctx * ++ rowreq_ctx); ++ ++ ipIfStatsTable_data *ipIfStatsTable_allocate_data(void); ++ void ipIfStatsTable_release_data(ipIfStatsTable_data * ++ data); ++ ++ ++ ipIfStatsTable_rowreq_ctx ++ *ipIfStatsTable_row_find_by_mib_index(ipIfStatsTable_mib_index * ++ mib_idx); ++ ++ extern oid ipIfStatsTable_oid[]; ++ extern int ipIfStatsTable_oid_size; ++ ++ ++#include "ipIfStatsTable_interface.h" ++#include "ipIfStatsTable_data_access.h" ++#include "ipIfStatsTable_data_get.h" ++ ++ /* ++ * DUMMY markers, ignore ++ * ++ * TODO:099:x: ************************************************************* ++ * TODO:199:x: ************************************************************* ++ * TODO:299:x: ************************************************************* ++ * TODO:399:x: ************************************************************* ++ * TODO:499:x: ************************************************************* ++ */ ++ ++#ifdef __cplusplus ++} ++#endif ++#endif /* IPIFSTATSTABLE_H */ ++/** @} */ +diff --git a/agent/mibgroup/ip-mib/ipIfStatsTable/ipIfStatsTable_data_access.c b/agent/mibgroup/ip-mib/ipIfStatsTable/ipIfStatsTable_data_access.c +new file mode 100644 +index 0000000..f2ec1a1 +--- /dev/null ++++ b/agent/mibgroup/ip-mib/ipIfStatsTable/ipIfStatsTable_data_access.c +@@ -0,0 +1,408 @@ ++/* ++ * Note: this file originally auto-generated by mib2c using ++ * version : 14170 $ of $ ++ * ++ * $Id:$ ++ */ ++/* ++ * standard Net-SNMP includes ++ */ ++#include ++#include ++#include ++ ++/* ++ * include our parent header ++ */ ++#include "ipIfStatsTable.h" ++ ++ ++#include "ipIfStatsTable_data_access.h" ++ ++static int ipis_cache_refresh = IPIFSTATSTABLE_CACHE_TIMEOUT; ++ ++/** @ingroup interface ++ * @addtogroup data_access data_access: Routines to access data ++ * ++ * These routines are used to locate the data used to satisfy ++ * requests. ++ * ++ * @{ ++ */ ++/********************************************************************** ++ ********************************************************************** ++ *** ++ *** Table ipIfStatsTable ++ *** ++ ********************************************************************** ++ **********************************************************************/ ++/* ++ * IP-MIB::ipIfStatsTable is subid 3 of ipTrafficStats. ++ * Its status is Current. ++ * OID: .1.3.6.1.2.1.4.31.3, length: 9 ++ */ ++ ++/** ++ * initialization for ipIfStatsTable data access ++ * ++ * This function is called during startup to allow you to ++ * allocate any resources you need for the data table. ++ * ++ * @param ipIfStatsTable_reg ++ * Pointer to ipIfStatsTable_registration ++ * ++ * @retval MFD_SUCCESS : success. ++ * @retval MFD_ERROR : unrecoverable error. ++ */ ++int ++ipIfStatsTable_init_data(ipIfStatsTable_registration * ipIfStatsTable_reg) ++{ ++ DEBUGMSGTL(("verbose:ipIfStatsTable:ipIfStatsTable_init_data", ++ "called\n")); ++ ++ /* ++ * TODO:303:o: Initialize ipIfStatsTable data. ++ */ ++ netsnmp_access_systemstats_init(); ++ ++ return MFD_SUCCESS; ++} /* ipIfStatsTable_init_data */ ++ ++/** ++ * container overview ++ * ++ */ ++ ++/** ++ * container initialization ++ * ++ * @param container_ptr_ptr A pointer to a container pointer. If you ++ * create a custom container, use this parameter to return it ++ * to the MFD helper. If set to NULL, the MFD helper will ++ * allocate a container for you. ++ * @param cache A pointer to a cache structure. You can set the timeout ++ * and other cache flags using this pointer. ++ * ++ * This function is called at startup to allow you to customize certain ++ * aspects of the access method. For the most part, it is for advanced ++ * users. The default code should suffice for most cases. If no custom ++ * container is allocated, the MFD code will create one for your. ++ * ++ * This is also the place to set up cache behavior. The default, to ++ * simply set the cache timeout, will work well with the default ++ * container. If you are using a custom container, you may want to ++ * look at the cache helper documentation to see if there are any ++ * flags you want to set. ++ * ++ * @remark ++ * This would also be a good place to do any initialization needed ++ * for you data source. For example, opening a connection to another ++ * process that will supply the data, opening a database, etc. ++ */ ++void ++ipIfStatsTable_container_init(netsnmp_container ** container_ptr_ptr, ++ netsnmp_cache * cache) ++{ ++ DEBUGMSGTL(("verbose:ipIfStatsTable:ipIfStatsTable_container_init", ++ "called\n")); ++ ++ if (NULL == container_ptr_ptr) { ++ snmp_log(LOG_ERR, ++ "bad container param to ipIfStatsTable_container_init\n"); ++ return; ++ } ++ ++ /* ++ * For advanced users, you can use a custom container. If you ++ * do not create one, one will be created for you. ++ */ ++ /* ++ * We create a custom container here so we can pre-load it, which ++ * will result in all new entries with last changed values. we need ++ * to clear those... We also need to make sure ifIndexes have been ++ * assigned... ++ */ ++ *container_ptr_ptr = ++ netsnmp_container_find("ipIfStatsTable:table_container"); ++ if (NULL != *container_ptr_ptr) ++ ipIfStatsTable_container_load(*container_ptr_ptr); ++ if (NULL == cache) { ++ snmp_log(LOG_ERR, ++ "bad cache param to ipIfStatsTable_container_init\n"); ++ return; ++ } ++ ++ /* ++ * TODO:345:A: Set up ipIfStatsTable cache properties. ++ * ++ * Also for advanced users, you can set parameters for the ++ * cache. Do not change the magic pointer, as it is used ++ * by the MFD helper. To completely disable caching, set ++ * cache->enabled to 0. ++ */ ++ cache->timeout = IPIFSTATSTABLE_CACHE_TIMEOUT; /* seconds */ ++ ++ cache->flags |= ++ (NETSNMP_CACHE_DONT_AUTO_RELEASE | NETSNMP_CACHE_DONT_FREE_EXPIRED ++ | NETSNMP_CACHE_DONT_FREE_BEFORE_LOAD | ++ NETSNMP_CACHE_AUTO_RELOAD); ++} /* ipIfStatsTable_container_init */ ++ ++/** ++ * check entry for update ++ */ ++static void ++_check_for_updates(ipIfStatsTable_rowreq_ctx * rowreq_ctx, ++ netsnmp_container *stats) ++{ ++ netsnmp_systemstats_entry *ifstats_entry; ++ ++ /* ++ * check for matching entry. works because indexes are the same. ++ */ ++ ifstats_entry = CONTAINER_FIND(stats, rowreq_ctx->data); ++ if (NULL == ifstats_entry) { ++ DEBUGMSGTL(("ipIfStatsTable:access", ++ "updating missing entry\n")); ++ ++ /* ++ * mark row as missing, so we can set discontinuity ++ * when it comes back. ++ * ++ * what else should we do? set refresh to 0? that's not quite right... ++ */ ++ rowreq_ctx->known_missing = 1; ++ } else { ++ DEBUGMSGTL(("ipIfStatsTable:access", ++ "updating existing entry\n")); ++ ++ /* ++ * Check for changes & update ++ */ ++ netsnmp_access_systemstats_entry_update(rowreq_ctx->data, ++ ifstats_entry); ++ ++ /* ++ * set discontinuity if previously missing. ++ */ ++ if (1 == rowreq_ctx->known_missing) { ++ rowreq_ctx->known_missing = 0; ++ rowreq_ctx->ipIfStatsDiscontinuityTime = ++ netsnmp_get_agent_uptime(); ++ ipIfStatsTable_lastChange_set(netsnmp_get_agent_uptime()); ++ } ++ ++ /* ++ * remove entry from container ++ */ ++ CONTAINER_REMOVE(stats, ifstats_entry); ++ netsnmp_access_systemstats_entry_free(ifstats_entry); ++ } ++} ++ ++/** ++ * add new entry ++ */ ++static void ++_add_new(netsnmp_systemstats_entry *ifstats_entry, ++ netsnmp_container *container) ++{ ++ ipIfStatsTable_rowreq_ctx *rowreq_ctx; ++ ++ DEBUGMSGTL(("ipIfStatsTable:access", "creating new entry\n")); ++ ++ netsnmp_assert(NULL != ifstats_entry); ++ netsnmp_assert(NULL != container); ++ ++ /* ++ * allocate an row context and set the index(es) ++ */ ++ rowreq_ctx = ++ ipIfStatsTable_allocate_rowreq_ctx(ifstats_entry, NULL); ++ if ((NULL != rowreq_ctx) ++ && (MFD_SUCCESS == ++ ipIfStatsTable_indexes_set(rowreq_ctx, ++ ifstats_entry->index[0], ++ ifstats_entry->index[1]))) { ++ rowreq_ctx->ipIfStatsRefreshRate = ipis_cache_refresh * 1000; /* milli-seconds */ ++ CONTAINER_INSERT(container, rowreq_ctx); ++ ipIfStatsTable_lastChange_set(netsnmp_get_agent_uptime()); ++ } else { ++ if (NULL != rowreq_ctx) { ++ snmp_log(LOG_ERR, "error setting index while loading " ++ "ipIfStatsTable cache.\n"); ++ ipIfStatsTable_release_rowreq_ctx(rowreq_ctx); ++ } else { ++ snmp_log(LOG_ERR, "memory allocation failed while loading " ++ "ipIfStatsTable cache.\n"); ++ netsnmp_access_systemstats_entry_free(ifstats_entry); ++ } ++ } ++} ++ ++/** ++ * container shutdown ++ * ++ * @param container_ptr A pointer to the container. ++ * ++ * This function is called at shutdown to allow you to customize certain ++ * aspects of the access method. For the most part, it is for advanced ++ * users. The default code should suffice for most cases. ++ * ++ * This function is called before ipIfStatsTable_container_free(). ++ * ++ * @remark ++ * This would also be a good place to do any cleanup needed ++ * for you data source. For example, closing a connection to another ++ * process that supplied the data, closing a database, etc. ++ */ ++void ++ipIfStatsTable_container_shutdown(netsnmp_container * container_ptr) ++{ ++ DEBUGMSGTL(("verbose:ipIfStatsTable:ipIfStatsTable_container_shutdown", ++ "called\n")); ++ ++ if (NULL == container_ptr) { ++ snmp_log(LOG_ERR, ++ "bad params to ipIfStatsTable_container_shutdown\n"); ++ return; ++ } ++ ++} /* ipIfStatsTable_container_shutdown */ ++ ++/** ++ * load initial data ++ * ++ * TODO:350:M: Implement ipIfStatsTable data load ++ * This function will also be called by the cache helper to load ++ * the container again (after the container free function has been ++ * called to free the previous contents). ++ * ++ * @param container container to which items should be inserted ++ * ++ * @retval MFD_SUCCESS : success. ++ * @retval MFD_RESOURCE_UNAVAILABLE : Can't access data source ++ * @retval MFD_ERROR : other error. ++ * ++ * This function is called to load the index(es) (and data, optionally) ++ * for the every row in the data set. ++ * ++ * @remark ++ * While loading the data, the only important thing is the indexes. ++ * If access to your data is cheap/fast (e.g. you have a pointer to a ++ * structure in memory), it would make sense to update the data here. ++ * If, however, the accessing the data invovles more work (e.g. parsing ++ * some other existing data, or peforming calculations to derive the data), ++ * then you can limit yourself to setting the indexes and saving any ++ * information you will need later. Then use the saved information in ++ * ipIfStatsTable_row_prep() for populating data. ++ * ++ * @note ++ * If you need consistency between rows (like you want statistics ++ * for each row to be from the same time frame), you should set all ++ * data here. ++ * ++ */ ++int ++ipIfStatsTable_container_load(netsnmp_container * container) ++{ ++ netsnmp_container *stats; ++ ++ DEBUGMSGTL(("verbose:ipIfStatsTable:ipIfStatsTable_container_load", ++ "called\n")); ++ ++ netsnmp_assert(NULL != container); ++ ++ stats = netsnmp_access_systemstats_container_load(NULL, NETSNMP_ACCESS_SYSTEMSTATS_LOAD_IFTABLE); ++ if (NULL == stats) ++ return MFD_RESOURCE_UNAVAILABLE; /* msg already logged */ ++ ++ /* ++ * TODO:351:M: |-> Load/update data in the ipIfStatsTable container. ++ * loop over your ipIfStatsTable data, allocate a rowreq context, ++ * set the index(es) [and data, optionally] and insert into ++ * the container. ++ */ ++ ++ /* ++ * we just got a fresh copy of data. compare it to ++ * what we've already got, and make any adjustements... ++ */ ++ CONTAINER_FOR_EACH(container, (netsnmp_container_obj_func *) ++ _check_for_updates, stats); ++ ++ /* ++ * now add any new entries ++ */ ++ CONTAINER_FOR_EACH(stats, (netsnmp_container_obj_func *) ++ _add_new, container); ++ ++ ++ /* ++ * free the container. we've either claimed each ifentry, or released it, ++ * so the dal function doesn't need to clear the container. ++ */ ++ netsnmp_access_systemstats_container_free(stats, ++ NETSNMP_ACCESS_SYSTEMSTATS_FREE_DONT_CLEAR); ++ ++ DEBUGMSGT(("verbose:ipIfStatsTable:ipIfStatsTable_container_load", ++ "%d records\n", CONTAINER_SIZE(container))); ++ ++ return MFD_SUCCESS; ++} /* ipIfStatsTable_container_load */ ++ ++/** ++ * container clean up ++ * ++ * @param container container with all current items ++ * ++ * This optional callback is called prior to all ++ * item's being removed from the container. If you ++ * need to do any processing before that, do it here. ++ * ++ * @note ++ * The MFD helper will take care of releasing all the row contexts. ++ * ++ */ ++void ++ipIfStatsTable_container_free(netsnmp_container * container) ++{ ++ DEBUGMSGTL(("verbose:ipIfStatsTable:ipIfStatsTable_container_free", ++ "called\n")); ++ ++ /* ++ * TODO:380:M: Free ipIfStatsTable container data. ++ */ ++} /* ipIfStatsTable_container_free */ ++ ++/** ++ * prepare row for processing. ++ * ++ * When the agent has located the row for a request, this function is ++ * called to prepare the row for processing. If you fully populated ++ * the data context during the index setup phase, you may not need to ++ * do anything. ++ * ++ * @param rowreq_ctx pointer to a context. ++ * ++ * @retval MFD_SUCCESS : success. ++ * @retval MFD_ERROR : other error. ++ */ ++int ++ipIfStatsTable_row_prep(ipIfStatsTable_rowreq_ctx * rowreq_ctx) ++{ ++ DEBUGMSGTL(("verbose:ipIfStatsTable:ipIfStatsTable_row_prep", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:390:o: Prepare row for request. ++ * If populating row data was delayed, this is the place to ++ * fill in the row for this request. ++ */ ++ ++ return MFD_SUCCESS; ++} /* ipIfStatsTable_row_prep */ ++ ++/** @} */ +diff --git a/agent/mibgroup/ip-mib/ipIfStatsTable/ipIfStatsTable_data_access.h b/agent/mibgroup/ip-mib/ipIfStatsTable/ipIfStatsTable_data_access.h +new file mode 100644 +index 0000000..5ef7682 +--- /dev/null ++++ b/agent/mibgroup/ip-mib/ipIfStatsTable/ipIfStatsTable_data_access.h +@@ -0,0 +1,70 @@ ++/* ++ * Note: this file originally auto-generated by mib2c using ++ * version : 14170 $ of $ ++ * ++ * $Id:$ ++ */ ++#ifndef IPIFSTATSTABLE_DATA_ACCESS_H ++#define IPIFSTATSTABLE_DATA_ACCESS_H ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++ ++ /* ++ ********************************************************************* ++ * function declarations ++ */ ++ ++ /* ++ ********************************************************************* ++ * Table declarations ++ */ ++/********************************************************************** ++ ********************************************************************** ++ *** ++ *** Table ipIfStatsTable ++ *** ++ ********************************************************************** ++ **********************************************************************/ ++ /* ++ * IP-MIB::ipIfStatsTable is subid 3 of ipTrafficStats. ++ * Its status is Current. ++ * OID: .1.3.6.1.2.1.4.31.3, length: 9 ++ */ ++ ++ ++ int ipIfStatsTable_init_data(ipIfStatsTable_registration * ++ ipIfStatsTable_reg); ++ ++ ++ /* ++ * TODO:180:o: Review ipIfStatsTable cache timeout. ++ * The number of seconds before the cache times out ++ */ ++#define IPIFSTATSTABLE_CACHE_TIMEOUT 60 ++ ++ void ipIfStatsTable_container_init(netsnmp_container ** ++ container_ptr_ptr, ++ netsnmp_cache * cache); ++ void ipIfStatsTable_container_shutdown(netsnmp_container * ++ container_ptr); ++ ++ int ipIfStatsTable_container_load(netsnmp_container * ++ container); ++ void ipIfStatsTable_container_free(netsnmp_container * ++ container); ++ ++ int ipIfStatsTable_cache_load(netsnmp_container * ++ container); ++ void ipIfStatsTable_cache_free(netsnmp_container * ++ container); ++ ++ int ipIfStatsTable_row_prep(ipIfStatsTable_rowreq_ctx * ++ rowreq_ctx); ++ ++#ifdef __cplusplus ++} ++#endif ++#endif /* IPIFSTATSTABLE_DATA_ACCESS_H */ +diff --git a/agent/mibgroup/ip-mib/ipIfStatsTable/ipIfStatsTable_data_get.c b/agent/mibgroup/ip-mib/ipIfStatsTable/ipIfStatsTable_data_get.c +new file mode 100644 +index 0000000..db673dc +--- /dev/null ++++ b/agent/mibgroup/ip-mib/ipIfStatsTable/ipIfStatsTable_data_get.c +@@ -0,0 +1,3015 @@ ++/* ++ * Note: this file originally auto-generated by mib2c using ++ * version : 12088 $ of $ ++ * ++ * $Id:$ ++ */ ++/* ++ * standard Net-SNMP includes ++ */ ++#include ++#include ++#include ++ ++/* ++ * include our parent header ++ */ ++#include "ipIfStatsTable.h" ++ ++ ++/** @defgroup data_get data_get: Routines to get data ++ * ++ * TODO:230:M: Implement ipIfStatsTable get routines. ++ * TODO:240:M: Implement ipIfStatsTable mapping routines (if any). ++ * ++ * These routine are used to get the value for individual objects. The ++ * row context is passed, along with a pointer to the memory where the ++ * value should be copied. ++ * ++ * @{ ++ */ ++/********************************************************************** ++ ********************************************************************** ++ *** ++ *** Table ipIfStatsTable ++ *** ++ ********************************************************************** ++ **********************************************************************/ ++/* ++ * IP-MIB::ipIfStatsTable is subid 3 of ipTrafficStats. ++ * Its status is Current. ++ * OID: .1.3.6.1.2.1.4.31.3, length: 9 ++ */ ++ ++/* ++ * --------------------------------------------------------------------- ++ * * TODO:200:r: Implement ipIfStatsTable data context functions. ++ */ ++/* ++ * ipIfStatsTable_allocate_data ++ * ++ * Purpose: create new ipIfStatsTable_data. ++ */ ++ipIfStatsTable_data * ++ipIfStatsTable_allocate_data(void) ++{ ++ /* ++ * TODO:201:r: |-> allocate memory for the ipIfStatsTable data context. ++ */ ++ ipIfStatsTable_data *rtn = SNMP_MALLOC_TYPEDEF(ipIfStatsTable_data); ++ ++ DEBUGMSGTL(("verbose:ipIfStatsTable:ipIfStatsTable_allocate_data", ++ "called\n")); ++ ++ if (NULL == rtn) { ++ snmp_log(LOG_ERR, "unable to malloc memory for new " ++ "ipIfStatsTable_data.\n"); ++ } ++ ++ return rtn; ++} /* ipIfStatsTable_allocate_data */ ++ ++/* ++ * ipIfStatsTable_release_data ++ * ++ * Purpose: release ipIfStatsTable data. ++ */ ++void ++ipIfStatsTable_release_data(ipIfStatsTable_data * data) ++{ ++ DEBUGMSGTL(("verbose:ipIfStatsTable:ipIfStatsTable_release_data", ++ "called\n")); ++ ++ /* ++ * TODO:202:r: |-> release memory for the ipIfStatsTable data context. ++ */ ++ free(data); ++} /* ipIfStatsTable_release_data */ ++ ++ ++ ++/** ++ * set mib index(es) ++ * ++ * @param tbl_idx mib index structure ++ * @param ipIfStatsIPVersion_val ++ * @param ipIfStatsIfIndex_val ++ * ++ * @retval MFD_SUCCESS : success. ++ * @retval MFD_ERROR : other error. ++ * ++ * @remark ++ * This convenience function is useful for setting all the MIB index ++ * components with a single function call. It is assume that the C values ++ * have already been mapped from their native/rawformat to the MIB format. ++ */ ++int ++ipIfStatsTable_indexes_set_tbl_idx(ipIfStatsTable_mib_index * tbl_idx, ++ u_long ipIfStatsIPVersion_val, ++ long ipIfStatsIfIndex_val) ++{ ++ DEBUGMSGTL(("verbose:ipIfStatsTable:ipIfStatsTable_indexes_set_tbl_idx", "called\n")); ++ ++ /* ++ * ipIfStatsIPVersion(1)/InetVersion/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h ++ */ ++ /** WARNING: this code might not work for netsnmp_ifstats_entry */ ++ tbl_idx->ipIfStatsIPVersion = ipIfStatsIPVersion_val; ++ ++ /* ++ * ipIfStatsIfIndex(2)/InterfaceIndex/ASN_INTEGER/long(long)//l/a/w/e/R/d/H ++ */ ++ /** WARNING: this code might not work for netsnmp_ifstats_entry */ ++ tbl_idx->ipIfStatsIfIndex = ipIfStatsIfIndex_val; ++ ++ ++ return MFD_SUCCESS; ++} /* ipIfStatsTable_indexes_set_tbl_idx */ ++ ++/** ++ * @internal ++ * set row context indexes ++ * ++ * @param reqreq_ctx the row context that needs updated indexes ++ * ++ * @retval MFD_SUCCESS : success. ++ * @retval MFD_ERROR : other error. ++ * ++ * @remark ++ * This function sets the mib indexs, then updates the oid indexs ++ * from the mib index. ++ */ ++int ++ipIfStatsTable_indexes_set(ipIfStatsTable_rowreq_ctx * rowreq_ctx, ++ u_long ipIfStatsIPVersion_val, ++ long ipIfStatsIfIndex_val) ++{ ++ DEBUGMSGTL(("verbose:ipIfStatsTable:ipIfStatsTable_indexes_set", ++ "called\n")); ++ ++ if (MFD_SUCCESS != ++ ipIfStatsTable_indexes_set_tbl_idx(&rowreq_ctx->tbl_idx, ++ ipIfStatsIPVersion_val, ++ ipIfStatsIfIndex_val)) ++ return MFD_ERROR; ++ ++ /* ++ * convert mib index to oid index ++ */ ++ rowreq_ctx->oid_idx.len = sizeof(rowreq_ctx->oid_tmp) / sizeof(oid); ++ if (0 != ipIfStatsTable_index_to_oid(&rowreq_ctx->oid_idx, ++ &rowreq_ctx->tbl_idx)) { ++ return MFD_ERROR; ++ } ++ ++ return MFD_SUCCESS; ++} /* ipIfStatsTable_indexes_set */ ++ ++ ++/*--------------------------------------------------------------------- ++ * IP-MIB::ipIfStatsEntry.ipIfStatsInReceives ++ * ipIfStatsInReceives is subid 3 of ipIfStatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.4.31.3.1.3 ++ * Description: ++The total number of input IP datagrams received, including ++ those received in error. ++ ++ Discontinuities in the value of this counter can occur at ++ re-initialization of the management system, and at other ++ times as indicated by the value of ++ ipIfStatsDiscontinuityTime. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER (based on perltype COUNTER) ++ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the ipIfStatsInReceives data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param ipIfStatsInReceives_val_ptr ++ * Pointer to storage for a u_long variable ++ * ++ * @retval MFD_SUCCESS : success ++ * @retval MFD_SKIP : skip this node (no value for now) ++ * @retval MFD_ERROR : Any other error ++ */ ++int ++ipIfStatsInReceives_get(ipIfStatsTable_rowreq_ctx * rowreq_ctx, ++ u_long * ipIfStatsInReceives_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != ipIfStatsInReceives_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:ipIfStatsTable:ipIfStatsInReceives_get", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the ipIfStatsInReceives data. ++ * copy (* ipIfStatsInReceives_val_ptr ) from rowreq_ctx->data ++ */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_HCINRECEIVES]) ++ return MFD_SKIP; ++ ++ (*ipIfStatsInReceives_val_ptr) = ++ rowreq_ctx->data->stats.HCInReceives.low; ++ ++ return MFD_SUCCESS; ++} /* ipIfStatsInReceives_get */ ++ ++/*--------------------------------------------------------------------- ++ * IP-MIB::ipIfStatsEntry.ipIfStatsHCInReceives ++ * ipIfStatsHCInReceives is subid 4 of ipIfStatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.4.31.3.1.4 ++ * Description: ++The total number of input IP datagrams received, including ++ those received in error. This object counts the same ++ datagrams as ipIfStatsInReceives, but allows for larger ++ values. ++ ++ Discontinuities in the value of this counter can occur at ++ re-initialization of the management system, and at other ++ times as indicated by the value of ++ ipIfStatsDiscontinuityTime. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER64 (based on perltype COUNTER64) ++ * The net-snmp type is ASN_COUNTER64. The C type decl is U64 (U64) ++ */ ++/** ++ * Extract the current value of the ipIfStatsHCInReceives data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param ipIfStatsHCInReceives_val_ptr ++ * Pointer to storage for a U64 variable ++ * ++ * @retval MFD_SUCCESS : success ++ * @retval MFD_SKIP : skip this node (no value for now) ++ * @retval MFD_ERROR : Any other error ++ */ ++int ++ipIfStatsHCInReceives_get(ipIfStatsTable_rowreq_ctx * rowreq_ctx, ++ U64 * ipIfStatsHCInReceives_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != ipIfStatsHCInReceives_val_ptr); ++ ++ /* ++ * TODO:231:o: |-> copy ipIfStatsHCInReceives data. ++ * get (* ipIfStatsHCInReceives_val_ptr ).low and (* ipIfStatsHCInReceives_val_ptr ).high from rowreq_ctx->data ++ */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_HCINRECEIVES]) ++ return MFD_SKIP; ++ ++ (*ipIfStatsHCInReceives_val_ptr).low = ++ rowreq_ctx->data->stats.HCInReceives.low; ++ (*ipIfStatsHCInReceives_val_ptr).high = ++ rowreq_ctx->data->stats.HCInReceives.high; ++ ++ return MFD_SUCCESS; ++} /* ipIfStatsHCInReceives_get */ ++ ++/*--------------------------------------------------------------------- ++ * IP-MIB::ipIfStatsEntry.ipIfStatsInOctets ++ * ipIfStatsInOctets is subid 5 of ipIfStatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.4.31.3.1.5 ++ * Description: ++The total number of octets received in input IP datagrams, ++ including those received in error. Octets from datagrams ++ counted in ipIfStatsInReceives MUST be counted here. ++ ++ Discontinuities in the value of this counter can occur at ++ re-initialization of the management system, and at other ++ times as indicated by the value of ++ ipIfStatsDiscontinuityTime. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER (based on perltype COUNTER) ++ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the ipIfStatsInOctets data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param ipIfStatsInOctets_val_ptr ++ * Pointer to storage for a u_long variable ++ * ++ * @retval MFD_SUCCESS : success ++ * @retval MFD_SKIP : skip this node (no value for now) ++ * @retval MFD_ERROR : Any other error ++ */ ++int ++ipIfStatsInOctets_get(ipIfStatsTable_rowreq_ctx * rowreq_ctx, ++ u_long * ipIfStatsInOctets_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != ipIfStatsInOctets_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:ipIfStatsTable:ipIfStatsInOctets_get", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the ipIfStatsInOctets data. ++ * copy (* ipIfStatsInOctets_val_ptr ) from rowreq_ctx->data ++ */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_HCINOCTETS]) ++ return MFD_SKIP; ++ ++ (*ipIfStatsInOctets_val_ptr) = ++ rowreq_ctx->data->stats.HCInOctets.low; ++ ++ return MFD_SUCCESS; ++} /* ipIfStatsInOctets_get */ ++ ++/*--------------------------------------------------------------------- ++ * IP-MIB::ipIfStatsEntry.ipIfStatsHCInOctets ++ * ipIfStatsHCInOctets is subid 6 of ipIfStatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.4.31.3.1.6 ++ * Description: ++The total number of octets received in input IP datagrams, ++ including those received in error. This object counts the ++ same octets as ipIfStatsInOctets, but allows for larger ++ values. ++ ++ Discontinuities in the value of this counter can occur at ++ re-initialization of the management system, and at other ++ times as indicated by the value of ++ ipIfStatsDiscontinuityTime. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER64 (based on perltype COUNTER64) ++ * The net-snmp type is ASN_COUNTER64. The C type decl is U64 (U64) ++ */ ++/** ++ * Extract the current value of the ipIfStatsHCInOctets data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param ipIfStatsHCInOctets_val_ptr ++ * Pointer to storage for a U64 variable ++ * ++ * @retval MFD_SUCCESS : success ++ * @retval MFD_SKIP : skip this node (no value for now) ++ * @retval MFD_ERROR : Any other error ++ */ ++int ++ipIfStatsHCInOctets_get(ipIfStatsTable_rowreq_ctx * rowreq_ctx, ++ U64 * ipIfStatsHCInOctets_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != ipIfStatsHCInOctets_val_ptr); ++ ++ /* ++ * TODO:231:o: |-> copy ipIfStatsHCInOctets data. ++ * get (* ipIfStatsHCInOctets_val_ptr ).low and (* ipIfStatsHCInOctets_val_ptr ).high from rowreq_ctx->data ++ */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_HCINOCTETS]) ++ return MFD_SKIP; ++ ++ (*ipIfStatsHCInOctets_val_ptr).low = ++ rowreq_ctx->data->stats.HCInOctets.low; ++ (*ipIfStatsHCInOctets_val_ptr).high = ++ rowreq_ctx->data->stats.HCInOctets.high; ++ ++ return MFD_SUCCESS; ++} /* ipIfStatsHCInOctets_get */ ++ ++/*--------------------------------------------------------------------- ++ * IP-MIB::ipIfStatsEntry.ipIfStatsInHdrErrors ++ * ipIfStatsInHdrErrors is subid 7 of ipIfStatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.4.31.3.1.7 ++ * Description: ++The number of input IP datagrams discarded due to errors in ++ their IP headers, including version number mismatch, other ++ format errors, hop count exceeded, errors discovered in ++ processing their IP options, etc. ++ ++ Discontinuities in the value of this counter can occur at ++ re-initialization of the management system, and at other ++ times as indicated by the value of ++ ipIfStatsDiscontinuityTime. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER (based on perltype COUNTER) ++ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the ipIfStatsInHdrErrors data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param ipIfStatsInHdrErrors_val_ptr ++ * Pointer to storage for a u_long variable ++ * ++ * @retval MFD_SUCCESS : success ++ * @retval MFD_SKIP : skip this node (no value for now) ++ * @retval MFD_ERROR : Any other error ++ */ ++int ++ipIfStatsInHdrErrors_get(ipIfStatsTable_rowreq_ctx * rowreq_ctx, ++ u_long * ipIfStatsInHdrErrors_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != ipIfStatsInHdrErrors_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:ipIfStatsTable:ipIfStatsInHdrErrors_get", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the ipIfStatsInHdrErrors data. ++ * copy (* ipIfStatsInHdrErrors_val_ptr ) from rowreq_ctx->data ++ */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_INHDRERRORS]) ++ return MFD_SKIP; ++ ++ (*ipIfStatsInHdrErrors_val_ptr) = ++ rowreq_ctx->data->stats.InHdrErrors; ++ ++ return MFD_SUCCESS; ++} /* ipIfStatsInHdrErrors_get */ ++ ++/*--------------------------------------------------------------------- ++ * IP-MIB::ipIfStatsEntry.ipIfStatsInNoRoutes ++ * ipIfStatsInNoRoutes is subid 8 of ipIfStatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.4.31.3.1.8 ++ * Description: ++The number of input IP datagrams discarded because no route ++ could be found to transmit them to their destination. ++ ++ Discontinuities in the value of this counter can occur at ++ re-initialization of the management system, and at other ++ times as indicated by the value of ++ ipIfStatsDiscontinuityTime. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER (based on perltype COUNTER) ++ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the ipIfStatsInNoRoutes data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param ipIfStatsInNoRoutes_val_ptr ++ * Pointer to storage for a u_long variable ++ * ++ * @retval MFD_SUCCESS : success ++ * @retval MFD_SKIP : skip this node (no value for now) ++ * @retval MFD_ERROR : Any other error ++ */ ++int ++ipIfStatsInNoRoutes_get(ipIfStatsTable_rowreq_ctx * rowreq_ctx, ++ u_long * ipIfStatsInNoRoutes_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != ipIfStatsInNoRoutes_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:ipIfStatsTable:ipIfStatsInNoRoutes_get", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the ipIfStatsInNoRoutes data. ++ * copy (* ipIfStatsInNoRoutes_val_ptr ) from rowreq_ctx->data ++ */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_HCINNOROUTES]) ++ return MFD_SKIP; ++ ++ (*ipIfStatsInNoRoutes_val_ptr) = ++ rowreq_ctx->data->stats.HCInNoRoutes.low; ++ ++ return MFD_SUCCESS; ++} /* ipIfStatsInNoRoutes_get */ ++ ++/*--------------------------------------------------------------------- ++ * IP-MIB::ipIfStatsEntry.ipIfStatsInAddrErrors ++ * ipIfStatsInAddrErrors is subid 9 of ipIfStatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.4.31.3.1.9 ++ * Description: ++The number of input IP datagrams discarded because the IP ++ address in their IP header's destination field was not a ++ valid address to be received at this entity. This count ++ includes invalid addresses (e.g., ::0). For entities that ++ are not IP routers and therefore do not forward datagrams, ++ this counter includes datagrams discarded because the ++ destination address was not a local address. ++ ++ Discontinuities in the value of this counter can occur at ++ re-initialization of the management system, and at other ++ times as indicated by the value of ++ ipIfStatsDiscontinuityTime. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER (based on perltype COUNTER) ++ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the ipIfStatsInAddrErrors data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param ipIfStatsInAddrErrors_val_ptr ++ * Pointer to storage for a u_long variable ++ * ++ * @retval MFD_SUCCESS : success ++ * @retval MFD_SKIP : skip this node (no value for now) ++ * @retval MFD_ERROR : Any other error ++ */ ++int ++ipIfStatsInAddrErrors_get(ipIfStatsTable_rowreq_ctx * rowreq_ctx, ++ u_long * ipIfStatsInAddrErrors_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != ipIfStatsInAddrErrors_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:ipIfStatsTable:ipIfStatsInAddrErrors_get", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the ipIfStatsInAddrErrors data. ++ * copy (* ipIfStatsInAddrErrors_val_ptr ) from rowreq_ctx->data ++ */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_INADDRERRORS]) ++ return MFD_SKIP; ++ ++ (*ipIfStatsInAddrErrors_val_ptr) = ++ rowreq_ctx->data->stats.InAddrErrors; ++ ++ return MFD_SUCCESS; ++} /* ipIfStatsInAddrErrors_get */ ++ ++/*--------------------------------------------------------------------- ++ * IP-MIB::ipIfStatsEntry.ipIfStatsInUnknownProtos ++ * ipIfStatsInUnknownProtos is subid 10 of ipIfStatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.4.31.3.1.10 ++ * Description: ++The number of locally-addressed IP datagrams received ++ successfully but discarded because of an unknown or ++ unsupported protocol. ++ ++ When tracking interface statistics, the counter of the ++ interface to which these datagrams were addressed is ++ incremented. This interface might not be the same as the ++ input interface for some of the datagrams. ++ ++ Discontinuities in the value of this counter can occur at ++ re-initialization of the management system, and at other ++ times as indicated by the value of ++ ++ ++ ++ ipIfStatsDiscontinuityTime. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER (based on perltype COUNTER) ++ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the ipIfStatsInUnknownProtos data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param ipIfStatsInUnknownProtos_val_ptr ++ * Pointer to storage for a u_long variable ++ * ++ * @retval MFD_SUCCESS : success ++ * @retval MFD_SKIP : skip this node (no value for now) ++ * @retval MFD_ERROR : Any other error ++ */ ++int ++ipIfStatsInUnknownProtos_get(ipIfStatsTable_rowreq_ctx * rowreq_ctx, ++ u_long * ipIfStatsInUnknownProtos_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != ipIfStatsInUnknownProtos_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:ipIfStatsTable:ipIfStatsInUnknownProtos_get", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the ipIfStatsInUnknownProtos data. ++ * copy (* ipIfStatsInUnknownProtos_val_ptr ) from rowreq_ctx->data ++ */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_INUNKNOWNPROTOS]) ++ return MFD_SKIP; ++ ++ (*ipIfStatsInUnknownProtos_val_ptr) = ++ rowreq_ctx->data->stats.InUnknownProtos; ++ ++ return MFD_SUCCESS; ++} /* ipIfStatsInUnknownProtos_get */ ++ ++/*--------------------------------------------------------------------- ++ * IP-MIB::ipIfStatsEntry.ipIfStatsInTruncatedPkts ++ * ipIfStatsInTruncatedPkts is subid 11 of ipIfStatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.4.31.3.1.11 ++ * Description: ++The number of input IP datagrams discarded because the ++ datagram frame didn't carry enough data. ++ ++ Discontinuities in the value of this counter can occur at ++ re-initialization of the management system, and at other ++ times as indicated by the value of ++ ipIfStatsDiscontinuityTime. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER (based on perltype COUNTER) ++ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the ipIfStatsInTruncatedPkts data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param ipIfStatsInTruncatedPkts_val_ptr ++ * Pointer to storage for a u_long variable ++ * ++ * @retval MFD_SUCCESS : success ++ * @retval MFD_SKIP : skip this node (no value for now) ++ * @retval MFD_ERROR : Any other error ++ */ ++int ++ipIfStatsInTruncatedPkts_get(ipIfStatsTable_rowreq_ctx * rowreq_ctx, ++ u_long * ipIfStatsInTruncatedPkts_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != ipIfStatsInTruncatedPkts_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:ipIfStatsTable:ipIfStatsInTruncatedPkts_get", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the ipIfStatsInTruncatedPkts data. ++ * copy (* ipIfStatsInTruncatedPkts_val_ptr ) from rowreq_ctx->data ++ */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_INTRUNCATEDPKTS]) ++ return MFD_SKIP; ++ ++ (*ipIfStatsInTruncatedPkts_val_ptr) = ++ rowreq_ctx->data->stats.InTruncatedPkts; ++ ++ return MFD_SUCCESS; ++} /* ipIfStatsInTruncatedPkts_get */ ++ ++/*--------------------------------------------------------------------- ++ * IP-MIB::ipIfStatsEntry.ipIfStatsInForwDatagrams ++ * ipIfStatsInForwDatagrams is subid 12 of ipIfStatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.4.31.3.1.12 ++ * Description: ++The number of input datagrams for which this entity was not ++ their final IP destination and for which this entity ++ attempted to find a route to forward them to that final ++ destination. In entities that do not act as IP routers, ++ this counter will include only those datagrams that were ++ Source-Routed via this entity, and the Source-Route ++ processing was successful. ++ ++ When tracking interface statistics, the counter of the ++ incoming interface is incremented for each datagram. ++ ++ Discontinuities in the value of this counter can occur at ++ re-initialization of the management system, and at other ++ times as indicated by the value of ++ ipIfStatsDiscontinuityTime. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER (based on perltype COUNTER) ++ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the ipIfStatsInForwDatagrams data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param ipIfStatsInForwDatagrams_val_ptr ++ * Pointer to storage for a u_long variable ++ * ++ * @retval MFD_SUCCESS : success ++ * @retval MFD_SKIP : skip this node (no value for now) ++ * @retval MFD_ERROR : Any other error ++ */ ++int ++ipIfStatsInForwDatagrams_get(ipIfStatsTable_rowreq_ctx * rowreq_ctx, ++ u_long * ipIfStatsInForwDatagrams_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != ipIfStatsInForwDatagrams_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:ipIfStatsTable:ipIfStatsInForwDatagrams_get", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the ipIfStatsInForwDatagrams data. ++ * copy (* ipIfStatsInForwDatagrams_val_ptr ) from rowreq_ctx->data ++ */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_HCINFORWDATAGRAMS]) ++ return MFD_SKIP; ++ ++ (*ipIfStatsInForwDatagrams_val_ptr) = ++ rowreq_ctx->data->stats.HCInForwDatagrams.low; ++ ++ return MFD_SUCCESS; ++} /* ipIfStatsInForwDatagrams_get */ ++ ++/*--------------------------------------------------------------------- ++ * IP-MIB::ipIfStatsEntry.ipIfStatsHCInForwDatagrams ++ * ipIfStatsHCInForwDatagrams is subid 13 of ipIfStatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.4.31.3.1.13 ++ * Description: ++The number of input datagrams for which this entity was not ++ their final IP destination and for which this entity ++ attempted to find a route to forward them to that final ++ destination. This object counts the same packets as ++ ++ ++ ++ ipIfStatsInForwDatagrams, but allows for larger values. ++ ++ Discontinuities in the value of this counter can occur at ++ re-initialization of the management system, and at other ++ times as indicated by the value of ++ ipIfStatsDiscontinuityTime. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER64 (based on perltype COUNTER64) ++ * The net-snmp type is ASN_COUNTER64. The C type decl is U64 (U64) ++ */ ++/** ++ * Extract the current value of the ipIfStatsHCInForwDatagrams data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param ipIfStatsHCInForwDatagrams_val_ptr ++ * Pointer to storage for a U64 variable ++ * ++ * @retval MFD_SUCCESS : success ++ * @retval MFD_SKIP : skip this node (no value for now) ++ * @retval MFD_ERROR : Any other error ++ */ ++int ++ipIfStatsHCInForwDatagrams_get(ipIfStatsTable_rowreq_ctx * rowreq_ctx, ++ U64 * ipIfStatsHCInForwDatagrams_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != ipIfStatsHCInForwDatagrams_val_ptr); ++ ++ /* ++ * TODO:231:o: |-> copy ipIfStatsHCInForwDatagrams data. ++ * get (* ipIfStatsHCInForwDatagrams_val_ptr ).low and (* ipIfStatsHCInForwDatagrams_val_ptr ).high from rowreq_ctx->data ++ */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_HCINFORWDATAGRAMS]) ++ return MFD_SKIP; ++ ++ (*ipIfStatsHCInForwDatagrams_val_ptr).low = ++ rowreq_ctx->data->stats.HCInForwDatagrams.low; ++ (*ipIfStatsHCInForwDatagrams_val_ptr).high = ++ rowreq_ctx->data->stats.HCInForwDatagrams.high; ++ ++ return MFD_SUCCESS; ++} /* ipIfStatsHCInForwDatagrams_get */ ++ ++/*--------------------------------------------------------------------- ++ * IP-MIB::ipIfStatsEntry.ipIfStatsReasmReqds ++ * ipIfStatsReasmReqds is subid 14 of ipIfStatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.4.31.3.1.14 ++ * Description: ++The number of IP fragments received that needed to be ++ reassembled at this interface. ++ ++ When tracking interface statistics, the counter of the ++ interface to which these fragments were addressed is ++ incremented. This interface might not be the same as the ++ input interface for some of the fragments. ++ ++ Discontinuities in the value of this counter can occur at ++ re-initialization of the management system, and at other ++ times as indicated by the value of ++ ipIfStatsDiscontinuityTime. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER (based on perltype COUNTER) ++ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the ipIfStatsReasmReqds data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param ipIfStatsReasmReqds_val_ptr ++ * Pointer to storage for a u_long variable ++ * ++ * @retval MFD_SUCCESS : success ++ * @retval MFD_SKIP : skip this node (no value for now) ++ * @retval MFD_ERROR : Any other error ++ */ ++int ++ipIfStatsReasmReqds_get(ipIfStatsTable_rowreq_ctx * rowreq_ctx, ++ u_long * ipIfStatsReasmReqds_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != ipIfStatsReasmReqds_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:ipIfStatsTable:ipIfStatsReasmReqds_get", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the ipIfStatsReasmReqds data. ++ * copy (* ipIfStatsReasmReqds_val_ptr ) from rowreq_ctx->data ++ */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_REASMREQDS]) ++ return MFD_SKIP; ++ ++ (*ipIfStatsReasmReqds_val_ptr) = ++ rowreq_ctx->data->stats.ReasmReqds; ++ ++ return MFD_SUCCESS; ++} /* ipIfStatsReasmReqds_get */ ++ ++/*--------------------------------------------------------------------- ++ * IP-MIB::ipIfStatsEntry.ipIfStatsReasmOKs ++ * ipIfStatsReasmOKs is subid 15 of ipIfStatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.4.31.3.1.15 ++ * Description: ++The number of IP datagrams successfully reassembled. ++ ++ When tracking interface statistics, the counter of the ++ interface to which these datagrams were addressed is ++ incremented. This interface might not be the same as the ++ input interface for some of the datagrams. ++ ++ Discontinuities in the value of this counter can occur at ++ re-initialization of the management system, and at other ++ times as indicated by the value of ++ ipIfStatsDiscontinuityTime. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER (based on perltype COUNTER) ++ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the ipIfStatsReasmOKs data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param ipIfStatsReasmOKs_val_ptr ++ * Pointer to storage for a u_long variable ++ * ++ * @retval MFD_SUCCESS : success ++ * @retval MFD_SKIP : skip this node (no value for now) ++ * @retval MFD_ERROR : Any other error ++ */ ++int ++ipIfStatsReasmOKs_get(ipIfStatsTable_rowreq_ctx * rowreq_ctx, ++ u_long * ipIfStatsReasmOKs_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != ipIfStatsReasmOKs_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:ipIfStatsTable:ipIfStatsReasmOKs_get", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the ipIfStatsReasmOKs data. ++ * copy (* ipIfStatsReasmOKs_val_ptr ) from rowreq_ctx->data ++ */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_REASMOKS]) ++ return MFD_SKIP; ++ ++ (*ipIfStatsReasmOKs_val_ptr) = ++ rowreq_ctx->data->stats.ReasmOKs; ++ ++ return MFD_SUCCESS; ++} /* ipIfStatsReasmOKs_get */ ++ ++/*--------------------------------------------------------------------- ++ * IP-MIB::ipIfStatsEntry.ipIfStatsReasmFails ++ * ipIfStatsReasmFails is subid 16 of ipIfStatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.4.31.3.1.16 ++ * Description: ++The number of failures detected by the IP re-assembly ++ algorithm (for whatever reason: timed out, errors, etc.). ++ Note that this is not necessarily a count of discarded IP ++ fragments since some algorithms (notably the algorithm in ++ RFC 815) can lose track of the number of fragments by ++ combining them as they are received. ++ ++ When tracking interface statistics, the counter of the ++ interface to which these fragments were addressed is ++ incremented. This interface might not be the same as the ++ input interface for some of the fragments. ++ ++ Discontinuities in the value of this counter can occur at ++ re-initialization of the management system, and at other ++ times as indicated by the value of ++ ipIfStatsDiscontinuityTime. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER (based on perltype COUNTER) ++ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the ipIfStatsReasmFails data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param ipIfStatsReasmFails_val_ptr ++ * Pointer to storage for a u_long variable ++ * ++ * @retval MFD_SUCCESS : success ++ * @retval MFD_SKIP : skip this node (no value for now) ++ * @retval MFD_ERROR : Any other error ++ */ ++int ++ipIfStatsReasmFails_get(ipIfStatsTable_rowreq_ctx * rowreq_ctx, ++ u_long * ipIfStatsReasmFails_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != ipIfStatsReasmFails_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:ipIfStatsTable:ipIfStatsReasmFails_get", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the ipIfStatsReasmFails data. ++ * copy (* ipIfStatsReasmFails_val_ptr ) from rowreq_ctx->data ++ */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_REASMFAILS]) ++ return MFD_SKIP; ++ ++ (*ipIfStatsReasmFails_val_ptr) = ++ rowreq_ctx->data->stats.ReasmFails; ++ ++ return MFD_SUCCESS; ++} /* ipIfStatsReasmFails_get */ ++ ++/*--------------------------------------------------------------------- ++ * IP-MIB::ipIfStatsEntry.ipIfStatsInDiscards ++ * ipIfStatsInDiscards is subid 17 of ipIfStatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.4.31.3.1.17 ++ * Description: ++The number of input IP datagrams for which no problems were ++ encountered to prevent their continued processing, but ++ were discarded (e.g., for lack of buffer space). Note that ++ this counter does not include any datagrams discarded while ++ awaiting re-assembly. ++ ++ Discontinuities in the value of this counter can occur at ++ re-initialization of the management system, and at other ++ times as indicated by the value of ++ ipIfStatsDiscontinuityTime. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER (based on perltype COUNTER) ++ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the ipIfStatsInDiscards data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param ipIfStatsInDiscards_val_ptr ++ * Pointer to storage for a u_long variable ++ * ++ * @retval MFD_SUCCESS : success ++ * @retval MFD_SKIP : skip this node (no value for now) ++ * @retval MFD_ERROR : Any other error ++ */ ++int ++ipIfStatsInDiscards_get(ipIfStatsTable_rowreq_ctx * rowreq_ctx, ++ u_long * ipIfStatsInDiscards_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != ipIfStatsInDiscards_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:ipIfStatsTable:ipIfStatsInDiscards_get", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the ipIfStatsInDiscards data. ++ * copy (* ipIfStatsInDiscards_val_ptr ) from rowreq_ctx->data ++ */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_INDISCARDS]) ++ return MFD_SKIP; ++ ++ (*ipIfStatsInDiscards_val_ptr) = ++ rowreq_ctx->data->stats.InDiscards; ++ ++ return MFD_SUCCESS; ++} /* ipIfStatsInDiscards_get */ ++ ++/*--------------------------------------------------------------------- ++ * IP-MIB::ipIfStatsEntry.ipIfStatsInDelivers ++ * ipIfStatsInDelivers is subid 18 of ipIfStatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.4.31.3.1.18 ++ * Description: ++The total number of datagrams successfully delivered to IP ++ user-protocols (including ICMP). ++ ++ When tracking interface statistics, the counter of the ++ interface to which these datagrams were addressed is ++ incremented. This interface might not be the same as the ++ ++ ++ ++ input interface for some of the datagrams. ++ ++ Discontinuities in the value of this counter can occur at ++ re-initialization of the management system, and at other ++ times as indicated by the value of ++ ipIfStatsDiscontinuityTime. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER (based on perltype COUNTER) ++ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the ipIfStatsInDelivers data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param ipIfStatsInDelivers_val_ptr ++ * Pointer to storage for a u_long variable ++ * ++ * @retval MFD_SUCCESS : success ++ * @retval MFD_SKIP : skip this node (no value for now) ++ * @retval MFD_ERROR : Any other error ++ */ ++int ++ipIfStatsInDelivers_get(ipIfStatsTable_rowreq_ctx * rowreq_ctx, ++ u_long * ipIfStatsInDelivers_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != ipIfStatsInDelivers_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:ipIfStatsTable:ipIfStatsInDelivers_get", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the ipIfStatsInDelivers data. ++ * copy (* ipIfStatsInDelivers_val_ptr ) from rowreq_ctx->data ++ */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_HCINDELIVERS]) ++ return MFD_SKIP; ++ ++ (*ipIfStatsInDelivers_val_ptr) = ++ rowreq_ctx->data->stats.HCInDelivers.low; ++ ++ return MFD_SUCCESS; ++} /* ipIfStatsInDelivers_get */ ++ ++/*--------------------------------------------------------------------- ++ * IP-MIB::ipIfStatsEntry.ipIfStatsHCInDelivers ++ * ipIfStatsHCInDelivers is subid 19 of ipIfStatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.4.31.3.1.19 ++ * Description: ++The total number of datagrams successfully delivered to IP ++ user-protocols (including ICMP). This object counts the ++ same packets as ipIfStatsInDelivers, but allows for larger ++ values. ++ ++ Discontinuities in the value of this counter can occur at ++ re-initialization of the management system, and at other ++ times as indicated by the value of ++ ipIfStatsDiscontinuityTime. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER64 (based on perltype COUNTER64) ++ * The net-snmp type is ASN_COUNTER64. The C type decl is U64 (U64) ++ */ ++/** ++ * Extract the current value of the ipIfStatsHCInDelivers data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param ipIfStatsHCInDelivers_val_ptr ++ * Pointer to storage for a U64 variable ++ * ++ * @retval MFD_SUCCESS : success ++ * @retval MFD_SKIP : skip this node (no value for now) ++ * @retval MFD_ERROR : Any other error ++ */ ++int ++ipIfStatsHCInDelivers_get(ipIfStatsTable_rowreq_ctx * rowreq_ctx, ++ U64 * ipIfStatsHCInDelivers_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != ipIfStatsHCInDelivers_val_ptr); ++ ++ /* ++ * TODO:231:o: |-> copy ipIfStatsHCInDelivers data. ++ * get (* ipIfStatsHCInDelivers_val_ptr ).low and (* ipIfStatsHCInDelivers_val_ptr ).high from rowreq_ctx->data ++ */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_HCINDELIVERS]) ++ return MFD_SKIP; ++ ++ (*ipIfStatsHCInDelivers_val_ptr).low = ++ rowreq_ctx->data->stats.HCInDelivers.low; ++ (*ipIfStatsHCInDelivers_val_ptr).high = ++ rowreq_ctx->data->stats.HCInDelivers.high; ++ ++ return MFD_SUCCESS; ++} /* ipIfStatsHCInDelivers_get */ ++ ++/*--------------------------------------------------------------------- ++ * IP-MIB::ipIfStatsEntry.ipIfStatsOutRequests ++ * ipIfStatsOutRequests is subid 20 of ipIfStatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.4.31.3.1.20 ++ * Description: ++The total number of IP datagrams that local IP user- ++ protocols (including ICMP) supplied to IP in requests for ++ transmission. Note that this counter does not include any ++ datagrams counted in ipIfStatsOutForwDatagrams. ++ ++ Discontinuities in the value of this counter can occur at ++ re-initialization of the management system, and at other ++ times as indicated by the value of ++ ipIfStatsDiscontinuityTime. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER (based on perltype COUNTER) ++ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the ipIfStatsOutRequests data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param ipIfStatsOutRequests_val_ptr ++ * Pointer to storage for a u_long variable ++ * ++ * @retval MFD_SUCCESS : success ++ * @retval MFD_SKIP : skip this node (no value for now) ++ * @retval MFD_ERROR : Any other error ++ */ ++int ++ipIfStatsOutRequests_get(ipIfStatsTable_rowreq_ctx * rowreq_ctx, ++ u_long * ipIfStatsOutRequests_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != ipIfStatsOutRequests_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:ipIfStatsTable:ipIfStatsOutRequests_get", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the ipIfStatsOutRequests data. ++ * copy (* ipIfStatsOutRequests_val_ptr ) from rowreq_ctx->data ++ */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTREQUESTS]) ++ return MFD_SKIP; ++ ++ (*ipIfStatsOutRequests_val_ptr) = ++ rowreq_ctx->data->stats.HCOutRequests.low; ++ ++ return MFD_SUCCESS; ++} /* ipIfStatsOutRequests_get */ ++ ++/*--------------------------------------------------------------------- ++ * IP-MIB::ipIfStatsEntry.ipIfStatsHCOutRequests ++ * ipIfStatsHCOutRequests is subid 21 of ipIfStatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.4.31.3.1.21 ++ * Description: ++The total number of IP datagrams that local IP user- ++ protocols (including ICMP) supplied to IP in requests for ++ transmission. This object counts the same packets as ++ ++ ++ ++ ipIfStatsOutRequests, but allows for larger values. ++ ++ Discontinuities in the value of this counter can occur at ++ re-initialization of the management system, and at other ++ times as indicated by the value of ++ ipIfStatsDiscontinuityTime. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER64 (based on perltype COUNTER64) ++ * The net-snmp type is ASN_COUNTER64. The C type decl is U64 (U64) ++ */ ++/** ++ * Extract the current value of the ipIfStatsHCOutRequests data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param ipIfStatsHCOutRequests_val_ptr ++ * Pointer to storage for a U64 variable ++ * ++ * @retval MFD_SUCCESS : success ++ * @retval MFD_SKIP : skip this node (no value for now) ++ * @retval MFD_ERROR : Any other error ++ */ ++int ++ipIfStatsHCOutRequests_get(ipIfStatsTable_rowreq_ctx * rowreq_ctx, ++ U64 * ipIfStatsHCOutRequests_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != ipIfStatsHCOutRequests_val_ptr); ++ ++ /* ++ * TODO:231:o: |-> copy ipIfStatsHCOutRequests data. ++ * get (* ipIfStatsHCOutRequests_val_ptr ).low and (* ipIfStatsHCOutRequests_val_ptr ).high from rowreq_ctx->data ++ */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTREQUESTS]) ++ return MFD_SKIP; ++ ++ (*ipIfStatsHCOutRequests_val_ptr).low = ++ rowreq_ctx->data->stats.HCOutRequests.low; ++ (*ipIfStatsHCOutRequests_val_ptr).high = ++ rowreq_ctx->data->stats.HCOutRequests.high; ++ ++ return MFD_SUCCESS; ++} /* ipIfStatsHCOutRequests_get */ ++ ++/*--------------------------------------------------------------------- ++ * IP-MIB::ipIfStatsEntry.ipIfStatsOutForwDatagrams ++ * ipIfStatsOutForwDatagrams is subid 23 of ipIfStatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.4.31.3.1.23 ++ * Description: ++The number of datagrams for which this entity was not their ++ final IP destination and for which it was successful in ++ finding a path to their final destination. In entities ++ that do not act as IP routers, this counter will include ++ only those datagrams that were Source-Routed via this ++ entity, and the Source-Route processing was successful. ++ ++ When tracking interface statistics, the counter of the ++ outgoing interface is incremented for a successfully ++ forwarded datagram. ++ ++ Discontinuities in the value of this counter can occur at ++ re-initialization of the management system, and at other ++ times as indicated by the value of ++ ipIfStatsDiscontinuityTime. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER (based on perltype COUNTER) ++ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the ipIfStatsOutForwDatagrams data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param ipIfStatsOutForwDatagrams_val_ptr ++ * Pointer to storage for a u_long variable ++ * ++ * @retval MFD_SUCCESS : success ++ * @retval MFD_SKIP : skip this node (no value for now) ++ * @retval MFD_ERROR : Any other error ++ */ ++int ++ipIfStatsOutForwDatagrams_get(ipIfStatsTable_rowreq_ctx * rowreq_ctx, ++ u_long * ipIfStatsOutForwDatagrams_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != ipIfStatsOutForwDatagrams_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:ipIfStatsTable:ipIfStatsOutForwDatagrams_get", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the ipIfStatsOutForwDatagrams data. ++ * copy (* ipIfStatsOutForwDatagrams_val_ptr ) from rowreq_ctx->data ++ */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTFORWDATAGRAMS]) ++ return MFD_SKIP; ++ ++ (*ipIfStatsOutForwDatagrams_val_ptr) = ++ rowreq_ctx->data->stats.HCOutForwDatagrams.low; ++ ++ return MFD_SUCCESS; ++} /* ipIfStatsOutForwDatagrams_get */ ++ ++/*--------------------------------------------------------------------- ++ * IP-MIB::ipIfStatsEntry.ipIfStatsHCOutForwDatagrams ++ * ipIfStatsHCOutForwDatagrams is subid 24 of ipIfStatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.4.31.3.1.24 ++ * Description: ++The number of datagrams for which this entity was not their ++ final IP destination and for which it was successful in ++ finding a path to their final destination. This object ++ counts the same packets as ipIfStatsOutForwDatagrams, but ++ allows for larger values. ++ ++ Discontinuities in the value of this counter can occur at ++ re-initialization of the management system, and at other ++ times as indicated by the value of ++ ++ ++ ++ ipIfStatsDiscontinuityTime. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER64 (based on perltype COUNTER64) ++ * The net-snmp type is ASN_COUNTER64. The C type decl is U64 (U64) ++ */ ++/** ++ * Extract the current value of the ipIfStatsHCOutForwDatagrams data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param ipIfStatsHCOutForwDatagrams_val_ptr ++ * Pointer to storage for a U64 variable ++ * ++ * @retval MFD_SUCCESS : success ++ * @retval MFD_SKIP : skip this node (no value for now) ++ * @retval MFD_ERROR : Any other error ++ */ ++int ++ipIfStatsHCOutForwDatagrams_get(ipIfStatsTable_rowreq_ctx * rowreq_ctx, ++ U64 * ipIfStatsHCOutForwDatagrams_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != ipIfStatsHCOutForwDatagrams_val_ptr); ++ ++ /* ++ * TODO:231:o: |-> copy ipIfStatsHCOutForwDatagrams data. ++ * get (* ipIfStatsHCOutForwDatagrams_val_ptr ).low and (* ipIfStatsHCOutForwDatagrams_val_ptr ).high from rowreq_ctx->data ++ */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTFORWDATAGRAMS]) ++ return MFD_SKIP; ++ ++ (*ipIfStatsHCOutForwDatagrams_val_ptr).low = ++ rowreq_ctx->data->stats.HCOutForwDatagrams.low; ++ (*ipIfStatsHCOutForwDatagrams_val_ptr).high = ++ rowreq_ctx->data->stats.HCOutForwDatagrams.high; ++ ++ return MFD_SUCCESS; ++} /* ipIfStatsHCOutForwDatagrams_get */ ++ ++/*--------------------------------------------------------------------- ++ * IP-MIB::ipIfStatsEntry.ipIfStatsOutDiscards ++ * ipIfStatsOutDiscards is subid 25 of ipIfStatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.4.31.3.1.25 ++ * Description: ++The number of output IP datagrams for which no problem was ++ encountered to prevent their transmission to their ++ destination, but were discarded (e.g., for lack of ++ buffer space). Note that this counter would include ++ datagrams counted in ipIfStatsOutForwDatagrams if any such ++ datagrams met this (discretionary) discard criterion. ++ ++ Discontinuities in the value of this counter can occur at ++ re-initialization of the management system, and at other ++ times as indicated by the value of ++ ipIfStatsDiscontinuityTime. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER (based on perltype COUNTER) ++ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the ipIfStatsOutDiscards data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param ipIfStatsOutDiscards_val_ptr ++ * Pointer to storage for a u_long variable ++ * ++ * @retval MFD_SUCCESS : success ++ * @retval MFD_SKIP : skip this node (no value for now) ++ * @retval MFD_ERROR : Any other error ++ */ ++int ++ipIfStatsOutDiscards_get(ipIfStatsTable_rowreq_ctx * rowreq_ctx, ++ u_long * ipIfStatsOutDiscards_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != ipIfStatsOutDiscards_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:ipIfStatsTable:ipIfStatsOutDiscards_get", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the ipIfStatsOutDiscards data. ++ * copy (* ipIfStatsOutDiscards_val_ptr ) from rowreq_ctx->data ++ */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTDISCARDS]) ++ return MFD_SKIP; ++ ++ (*ipIfStatsOutDiscards_val_ptr) = ++ rowreq_ctx->data->stats.HCOutDiscards.low; ++ ++ return MFD_SUCCESS; ++} /* ipIfStatsOutDiscards_get */ ++ ++/*--------------------------------------------------------------------- ++ * IP-MIB::ipIfStatsEntry.ipIfStatsOutFragReqds ++ * ipIfStatsOutFragReqds is subid 26 of ipIfStatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.4.31.3.1.26 ++ * Description: ++The number of IP datagrams that would require fragmentation ++ in order to be transmitted. ++ ++ When tracking interface statistics, the counter of the ++ outgoing interface is incremented for a successfully ++ fragmented datagram. ++ ++ Discontinuities in the value of this counter can occur at ++ re-initialization of the management system, and at other ++ times as indicated by the value of ++ ipIfStatsDiscontinuityTime. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER (based on perltype COUNTER) ++ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the ipIfStatsOutFragReqds data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param ipIfStatsOutFragReqds_val_ptr ++ * Pointer to storage for a u_long variable ++ * ++ * @retval MFD_SUCCESS : success ++ * @retval MFD_SKIP : skip this node (no value for now) ++ * @retval MFD_ERROR : Any other error ++ */ ++int ++ipIfStatsOutFragReqds_get(ipIfStatsTable_rowreq_ctx * rowreq_ctx, ++ u_long * ipIfStatsOutFragReqds_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != ipIfStatsOutFragReqds_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:ipIfStatsTable:ipIfStatsOutFragReqds_get", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the ipIfStatsOutFragReqds data. ++ * copy (* ipIfStatsOutFragReqds_val_ptr ) from rowreq_ctx->data ++ */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTFRAGREQDS]) ++ return MFD_SKIP; ++ ++ (*ipIfStatsOutFragReqds_val_ptr) = ++ rowreq_ctx->data->stats.HCOutFragReqds.low; ++ ++ return MFD_SUCCESS; ++} /* ipIfStatsOutFragReqds_get */ ++ ++/*--------------------------------------------------------------------- ++ * IP-MIB::ipIfStatsEntry.ipIfStatsOutFragOKs ++ * ipIfStatsOutFragOKs is subid 27 of ipIfStatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.4.31.3.1.27 ++ * Description: ++The number of IP datagrams that have been successfully ++ fragmented. ++ ++ When tracking interface statistics, the counter of the ++ ++ ++ ++ outgoing interface is incremented for a successfully ++ fragmented datagram. ++ ++ Discontinuities in the value of this counter can occur at ++ re-initialization of the management system, and at other ++ times as indicated by the value of ++ ipIfStatsDiscontinuityTime. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER (based on perltype COUNTER) ++ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the ipIfStatsOutFragOKs data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param ipIfStatsOutFragOKs_val_ptr ++ * Pointer to storage for a u_long variable ++ * ++ * @retval MFD_SUCCESS : success ++ * @retval MFD_SKIP : skip this node (no value for now) ++ * @retval MFD_ERROR : Any other error ++ */ ++int ++ipIfStatsOutFragOKs_get(ipIfStatsTable_rowreq_ctx * rowreq_ctx, ++ u_long * ipIfStatsOutFragOKs_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != ipIfStatsOutFragOKs_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:ipIfStatsTable:ipIfStatsOutFragOKs_get", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the ipIfStatsOutFragOKs data. ++ * copy (* ipIfStatsOutFragOKs_val_ptr ) from rowreq_ctx->data ++ */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTFRAGOKS]) ++ return MFD_SKIP; ++ ++ (*ipIfStatsOutFragOKs_val_ptr) = ++ rowreq_ctx->data->stats.HCOutFragOKs.low; ++ ++ return MFD_SUCCESS; ++} /* ipIfStatsOutFragOKs_get */ ++ ++/*--------------------------------------------------------------------- ++ * IP-MIB::ipIfStatsEntry.ipIfStatsOutFragFails ++ * ipIfStatsOutFragFails is subid 28 of ipIfStatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.4.31.3.1.28 ++ * Description: ++The number of IP datagrams that have been discarded because ++ they needed to be fragmented but could not be. This ++ includes IPv4 packets that have the DF bit set and IPv6 ++ packets that are being forwarded and exceed the outgoing ++ link MTU. ++ ++ When tracking interface statistics, the counter of the ++ outgoing interface is incremented for an unsuccessfully ++ fragmented datagram. ++ ++ Discontinuities in the value of this counter can occur at ++ re-initialization of the management system, and at other ++ times as indicated by the value of ++ ipIfStatsDiscontinuityTime. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER (based on perltype COUNTER) ++ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the ipIfStatsOutFragFails data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param ipIfStatsOutFragFails_val_ptr ++ * Pointer to storage for a u_long variable ++ * ++ * @retval MFD_SUCCESS : success ++ * @retval MFD_SKIP : skip this node (no value for now) ++ * @retval MFD_ERROR : Any other error ++ */ ++int ++ipIfStatsOutFragFails_get(ipIfStatsTable_rowreq_ctx * rowreq_ctx, ++ u_long * ipIfStatsOutFragFails_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != ipIfStatsOutFragFails_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:ipIfStatsTable:ipIfStatsOutFragFails_get", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the ipIfStatsOutFragFails data. ++ * copy (* ipIfStatsOutFragFails_val_ptr ) from rowreq_ctx->data ++ */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTFRAGFAILS]) ++ return MFD_SKIP; ++ ++ (*ipIfStatsOutFragFails_val_ptr) = ++ rowreq_ctx->data->stats.HCOutFragFails.low; ++ ++ return MFD_SUCCESS; ++} /* ipIfStatsOutFragFails_get */ ++ ++/*--------------------------------------------------------------------- ++ * IP-MIB::ipIfStatsEntry.ipIfStatsOutFragCreates ++ * ipIfStatsOutFragCreates is subid 29 of ipIfStatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.4.31.3.1.29 ++ * Description: ++The number of output datagram fragments that have been ++ generated as a result of IP fragmentation. ++ ++ When tracking interface statistics, the counter of the ++ outgoing interface is incremented for a successfully ++ fragmented datagram. ++ ++ Discontinuities in the value of this counter can occur at ++ re-initialization of the management system, and at other ++ times as indicated by the value of ++ ipIfStatsDiscontinuityTime. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER (based on perltype COUNTER) ++ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the ipIfStatsOutFragCreates data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param ipIfStatsOutFragCreates_val_ptr ++ * Pointer to storage for a u_long variable ++ * ++ * @retval MFD_SUCCESS : success ++ * @retval MFD_SKIP : skip this node (no value for now) ++ * @retval MFD_ERROR : Any other error ++ */ ++int ++ipIfStatsOutFragCreates_get(ipIfStatsTable_rowreq_ctx * rowreq_ctx, ++ u_long * ipIfStatsOutFragCreates_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != ipIfStatsOutFragCreates_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:ipIfStatsTable:ipIfStatsOutFragCreates_get", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the ipIfStatsOutFragCreates data. ++ * copy (* ipIfStatsOutFragCreates_val_ptr ) from rowreq_ctx->data ++ */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTFRAGCREATES]) ++ return MFD_SKIP; ++ ++ (*ipIfStatsOutFragCreates_val_ptr) = ++ rowreq_ctx->data->stats.HCOutFragCreates.low; ++ ++ return MFD_SUCCESS; ++} /* ipIfStatsOutFragCreates_get */ ++ ++/*--------------------------------------------------------------------- ++ * IP-MIB::ipIfStatsEntry.ipIfStatsOutTransmits ++ * ipIfStatsOutTransmits is subid 30 of ipIfStatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.4.31.3.1.30 ++ * Description: ++The total number of IP datagrams that this entity supplied ++ to the lower layers for transmission. This includes ++ datagrams generated locally and those forwarded by this ++ entity. ++ ++ Discontinuities in the value of this counter can occur at ++ re-initialization of the management system, and at other ++ times as indicated by the value of ++ ipIfStatsDiscontinuityTime. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER (based on perltype COUNTER) ++ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the ipIfStatsOutTransmits data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param ipIfStatsOutTransmits_val_ptr ++ * Pointer to storage for a u_long variable ++ * ++ * @retval MFD_SUCCESS : success ++ * @retval MFD_SKIP : skip this node (no value for now) ++ * @retval MFD_ERROR : Any other error ++ */ ++int ++ipIfStatsOutTransmits_get(ipIfStatsTable_rowreq_ctx * rowreq_ctx, ++ u_long * ipIfStatsOutTransmits_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != ipIfStatsOutTransmits_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:ipIfStatsTable:ipIfStatsOutTransmits_get", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the ipIfStatsOutTransmits data. ++ * copy (* ipIfStatsOutTransmits_val_ptr ) from rowreq_ctx->data ++ */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTTRANSMITS]) ++ return MFD_SKIP; ++ ++ (*ipIfStatsOutTransmits_val_ptr) = ++ rowreq_ctx->data->stats.HCOutTransmits.low; ++ ++ return MFD_SUCCESS; ++} /* ipIfStatsOutTransmits_get */ ++ ++/*--------------------------------------------------------------------- ++ * IP-MIB::ipIfStatsEntry.ipIfStatsHCOutTransmits ++ * ipIfStatsHCOutTransmits is subid 31 of ipIfStatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.4.31.3.1.31 ++ * Description: ++The total number of IP datagrams that this entity supplied ++ to the lower layers for transmission. This object counts ++ the same datagrams as ipIfStatsOutTransmits, but allows for ++ larger values. ++ ++ Discontinuities in the value of this counter can occur at ++ re-initialization of the management system, and at other ++ times as indicated by the value of ++ ipIfStatsDiscontinuityTime. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER64 (based on perltype COUNTER64) ++ * The net-snmp type is ASN_COUNTER64. The C type decl is U64 (U64) ++ */ ++/** ++ * Extract the current value of the ipIfStatsHCOutTransmits data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param ipIfStatsHCOutTransmits_val_ptr ++ * Pointer to storage for a U64 variable ++ * ++ * @retval MFD_SUCCESS : success ++ * @retval MFD_SKIP : skip this node (no value for now) ++ * @retval MFD_ERROR : Any other error ++ */ ++int ++ipIfStatsHCOutTransmits_get(ipIfStatsTable_rowreq_ctx * rowreq_ctx, ++ U64 * ipIfStatsHCOutTransmits_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != ipIfStatsHCOutTransmits_val_ptr); ++ ++ /* ++ * TODO:231:o: |-> copy ipIfStatsHCOutTransmits data. ++ * get (* ipIfStatsHCOutTransmits_val_ptr ).low and (* ipIfStatsHCOutTransmits_val_ptr ).high from rowreq_ctx->data ++ */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTTRANSMITS]) ++ return MFD_SKIP; ++ ++ (*ipIfStatsHCOutTransmits_val_ptr).low = ++ rowreq_ctx->data->stats.HCOutTransmits.low; ++ (*ipIfStatsHCOutTransmits_val_ptr).high = ++ rowreq_ctx->data->stats.HCOutTransmits.high; ++ ++ return MFD_SUCCESS; ++} /* ipIfStatsHCOutTransmits_get */ ++ ++/*--------------------------------------------------------------------- ++ * IP-MIB::ipIfStatsEntry.ipIfStatsOutOctets ++ * ipIfStatsOutOctets is subid 32 of ipIfStatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.4.31.3.1.32 ++ * Description: ++The total number of octets in IP datagrams delivered to the ++ lower layers for transmission. Octets from datagrams ++ counted in ipIfStatsOutTransmits MUST be counted here. ++ ++ Discontinuities in the value of this counter can occur at ++ re-initialization of the management system, and at other ++ times as indicated by the value of ++ ipIfStatsDiscontinuityTime. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER (based on perltype COUNTER) ++ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the ipIfStatsOutOctets data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param ipIfStatsOutOctets_val_ptr ++ * Pointer to storage for a u_long variable ++ * ++ * @retval MFD_SUCCESS : success ++ * @retval MFD_SKIP : skip this node (no value for now) ++ * @retval MFD_ERROR : Any other error ++ */ ++int ++ipIfStatsOutOctets_get(ipIfStatsTable_rowreq_ctx * rowreq_ctx, ++ u_long * ipIfStatsOutOctets_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != ipIfStatsOutOctets_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:ipIfStatsTable:ipIfStatsOutOctets_get", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the ipIfStatsOutOctets data. ++ * copy (* ipIfStatsOutOctets_val_ptr ) from rowreq_ctx->data ++ */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTOCTETS]) ++ return MFD_SKIP; ++ ++ (*ipIfStatsOutOctets_val_ptr) = ++ rowreq_ctx->data->stats.HCOutOctets.low; ++ ++ return MFD_SUCCESS; ++} /* ipIfStatsOutOctets_get */ ++ ++/*--------------------------------------------------------------------- ++ * IP-MIB::ipIfStatsEntry.ipIfStatsHCOutOctets ++ * ipIfStatsHCOutOctets is subid 33 of ipIfStatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.4.31.3.1.33 ++ * Description: ++The total number of octets in IP datagrams delivered to the ++ lower layers for transmission. This objects counts the same ++ octets as ipIfStatsOutOctets, but allows for larger values. ++ ++ Discontinuities in the value of this counter can occur at ++ re-initialization of the management system, and at other ++ times as indicated by the value of ++ ipIfStatsDiscontinuityTime. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER64 (based on perltype COUNTER64) ++ * The net-snmp type is ASN_COUNTER64. The C type decl is U64 (U64) ++ */ ++/** ++ * Extract the current value of the ipIfStatsHCOutOctets data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param ipIfStatsHCOutOctets_val_ptr ++ * Pointer to storage for a U64 variable ++ * ++ * @retval MFD_SUCCESS : success ++ * @retval MFD_SKIP : skip this node (no value for now) ++ * @retval MFD_ERROR : Any other error ++ */ ++int ++ipIfStatsHCOutOctets_get(ipIfStatsTable_rowreq_ctx * rowreq_ctx, ++ U64 * ipIfStatsHCOutOctets_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != ipIfStatsHCOutOctets_val_ptr); ++ ++ /* ++ * TODO:231:o: |-> copy ipIfStatsHCOutOctets data. ++ * get (* ipIfStatsHCOutOctets_val_ptr ).low and (* ipIfStatsHCOutOctets_val_ptr ).high from rowreq_ctx->data ++ */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTOCTETS]) ++ return MFD_SKIP; ++ ++ (*ipIfStatsHCOutOctets_val_ptr).low = ++ rowreq_ctx->data->stats.HCOutOctets.low; ++ (*ipIfStatsHCOutOctets_val_ptr).high = ++ rowreq_ctx->data->stats.HCOutOctets.high; ++ ++ return MFD_SUCCESS; ++} /* ipIfStatsHCOutOctets_get */ ++ ++/*--------------------------------------------------------------------- ++ * IP-MIB::ipIfStatsEntry.ipIfStatsInMcastPkts ++ * ipIfStatsInMcastPkts is subid 34 of ipIfStatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.4.31.3.1.34 ++ * Description: ++The number of IP multicast datagrams received. ++ ++ Discontinuities in the value of this counter can occur at ++ re-initialization of the management system, and at other ++ times as indicated by the value of ++ ipIfStatsDiscontinuityTime. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER (based on perltype COUNTER) ++ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the ipIfStatsInMcastPkts data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param ipIfStatsInMcastPkts_val_ptr ++ * Pointer to storage for a u_long variable ++ * ++ * @retval MFD_SUCCESS : success ++ * @retval MFD_SKIP : skip this node (no value for now) ++ * @retval MFD_ERROR : Any other error ++ */ ++int ++ipIfStatsInMcastPkts_get(ipIfStatsTable_rowreq_ctx * rowreq_ctx, ++ u_long * ipIfStatsInMcastPkts_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != ipIfStatsInMcastPkts_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:ipIfStatsTable:ipIfStatsInMcastPkts_get", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the ipIfStatsInMcastPkts data. ++ * copy (* ipIfStatsInMcastPkts_val_ptr ) from rowreq_ctx->data ++ */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_HCINMCASTPKTS]) ++ return MFD_SKIP; ++ ++ (*ipIfStatsInMcastPkts_val_ptr) = ++ rowreq_ctx->data->stats.HCInMcastPkts.low; ++ ++ return MFD_SUCCESS; ++} /* ipIfStatsInMcastPkts_get */ ++ ++/*--------------------------------------------------------------------- ++ * IP-MIB::ipIfStatsEntry.ipIfStatsHCInMcastPkts ++ * ipIfStatsHCInMcastPkts is subid 35 of ipIfStatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.4.31.3.1.35 ++ * Description: ++The number of IP multicast datagrams received. This object ++ counts the same datagrams as ipIfStatsInMcastPkts, but ++ allows for larger values. ++ ++ Discontinuities in the value of this counter can occur at ++ re-initialization of the management system, and at other ++ times as indicated by the value of ++ ipIfStatsDiscontinuityTime. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER64 (based on perltype COUNTER64) ++ * The net-snmp type is ASN_COUNTER64. The C type decl is U64 (U64) ++ */ ++/** ++ * Extract the current value of the ipIfStatsHCInMcastPkts data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param ipIfStatsHCInMcastPkts_val_ptr ++ * Pointer to storage for a U64 variable ++ * ++ * @retval MFD_SUCCESS : success ++ * @retval MFD_SKIP : skip this node (no value for now) ++ * @retval MFD_ERROR : Any other error ++ */ ++int ++ipIfStatsHCInMcastPkts_get(ipIfStatsTable_rowreq_ctx * rowreq_ctx, ++ U64 * ipIfStatsHCInMcastPkts_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != ipIfStatsHCInMcastPkts_val_ptr); ++ ++ /* ++ * TODO:231:o: |-> copy ipIfStatsHCInMcastPkts data. ++ * get (* ipIfStatsHCInMcastPkts_val_ptr ).low and (* ipIfStatsHCInMcastPkts_val_ptr ).high from rowreq_ctx->data ++ */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_HCINMCASTPKTS]) ++ return MFD_SKIP; ++ ++ (*ipIfStatsHCInMcastPkts_val_ptr).low = ++ rowreq_ctx->data->stats.HCInMcastPkts.low; ++ (*ipIfStatsHCInMcastPkts_val_ptr).high = ++ rowreq_ctx->data->stats.HCInMcastPkts.high; ++ ++ return MFD_SUCCESS; ++} /* ipIfStatsHCInMcastPkts_get */ ++ ++/*--------------------------------------------------------------------- ++ * IP-MIB::ipIfStatsEntry.ipIfStatsInMcastOctets ++ * ipIfStatsInMcastOctets is subid 36 of ipIfStatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.4.31.3.1.36 ++ * Description: ++The total number of octets received in IP multicast ++ ++ ++ ++ datagrams. Octets from datagrams counted in ++ ipIfStatsInMcastPkts MUST be counted here. ++ ++ Discontinuities in the value of this counter can occur at ++ re-initialization of the management system, and at other ++ times as indicated by the value of ++ ipIfStatsDiscontinuityTime. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER (based on perltype COUNTER) ++ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the ipIfStatsInMcastOctets data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param ipIfStatsInMcastOctets_val_ptr ++ * Pointer to storage for a u_long variable ++ * ++ * @retval MFD_SUCCESS : success ++ * @retval MFD_SKIP : skip this node (no value for now) ++ * @retval MFD_ERROR : Any other error ++ */ ++int ++ipIfStatsInMcastOctets_get(ipIfStatsTable_rowreq_ctx * rowreq_ctx, ++ u_long * ipIfStatsInMcastOctets_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != ipIfStatsInMcastOctets_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:ipIfStatsTable:ipIfStatsInMcastOctets_get", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the ipIfStatsInMcastOctets data. ++ * copy (* ipIfStatsInMcastOctets_val_ptr ) from rowreq_ctx->data ++ */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_HCINMCASTOCTETS]) ++ return MFD_SKIP; ++ ++ (*ipIfStatsInMcastOctets_val_ptr) = ++ rowreq_ctx->data->stats.HCInMcastOctets.low; ++ ++ return MFD_SUCCESS; ++} /* ipIfStatsInMcastOctets_get */ ++ ++/*--------------------------------------------------------------------- ++ * IP-MIB::ipIfStatsEntry.ipIfStatsHCInMcastOctets ++ * ipIfStatsHCInMcastOctets is subid 37 of ipIfStatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.4.31.3.1.37 ++ * Description: ++The total number of octets received in IP multicast ++ datagrams. This object counts the same octets as ++ ipIfStatsInMcastOctets, but allows for larger values. ++ ++ Discontinuities in the value of this counter can occur at ++ re-initialization of the management system, and at other ++ times as indicated by the value of ++ ipIfStatsDiscontinuityTime. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER64 (based on perltype COUNTER64) ++ * The net-snmp type is ASN_COUNTER64. The C type decl is U64 (U64) ++ */ ++/** ++ * Extract the current value of the ipIfStatsHCInMcastOctets data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param ipIfStatsHCInMcastOctets_val_ptr ++ * Pointer to storage for a U64 variable ++ * ++ * @retval MFD_SUCCESS : success ++ * @retval MFD_SKIP : skip this node (no value for now) ++ * @retval MFD_ERROR : Any other error ++ */ ++int ++ipIfStatsHCInMcastOctets_get(ipIfStatsTable_rowreq_ctx * rowreq_ctx, ++ U64 * ipIfStatsHCInMcastOctets_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != ipIfStatsHCInMcastOctets_val_ptr); ++ ++ /* ++ * TODO:231:o: |-> copy ipIfStatsHCInMcastOctets data. ++ * get (* ipIfStatsHCInMcastOctets_val_ptr ).low and (* ipIfStatsHCInMcastOctets_val_ptr ).high from rowreq_ctx->data ++ */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_HCINMCASTOCTETS]) ++ return MFD_SKIP; ++ ++ (*ipIfStatsHCInMcastOctets_val_ptr).low = ++ rowreq_ctx->data->stats.HCInMcastOctets.low; ++ (*ipIfStatsHCInMcastOctets_val_ptr).high = ++ rowreq_ctx->data->stats.HCInMcastOctets.high; ++ ++ return MFD_SUCCESS; ++} /* ipIfStatsHCInMcastOctets_get */ ++ ++/*--------------------------------------------------------------------- ++ * IP-MIB::ipIfStatsEntry.ipIfStatsOutMcastPkts ++ * ipIfStatsOutMcastPkts is subid 38 of ipIfStatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.4.31.3.1.38 ++ * Description: ++The number of IP multicast datagrams transmitted. ++ ++ Discontinuities in the value of this counter can occur at ++ re-initialization of the management system, and at other ++ times as indicated by the value of ++ ipIfStatsDiscontinuityTime. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER (based on perltype COUNTER) ++ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the ipIfStatsOutMcastPkts data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param ipIfStatsOutMcastPkts_val_ptr ++ * Pointer to storage for a u_long variable ++ * ++ * @retval MFD_SUCCESS : success ++ * @retval MFD_SKIP : skip this node (no value for now) ++ * @retval MFD_ERROR : Any other error ++ */ ++int ++ipIfStatsOutMcastPkts_get(ipIfStatsTable_rowreq_ctx * rowreq_ctx, ++ u_long * ipIfStatsOutMcastPkts_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != ipIfStatsOutMcastPkts_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:ipIfStatsTable:ipIfStatsOutMcastPkts_get", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the ipIfStatsOutMcastPkts data. ++ * copy (* ipIfStatsOutMcastPkts_val_ptr ) from rowreq_ctx->data ++ */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTMCASTPKTS]) ++ return MFD_SKIP; ++ ++ (*ipIfStatsOutMcastPkts_val_ptr) = ++ rowreq_ctx->data->stats.HCOutMcastPkts.low; ++ ++ return MFD_SUCCESS; ++} /* ipIfStatsOutMcastPkts_get */ ++ ++/*--------------------------------------------------------------------- ++ * IP-MIB::ipIfStatsEntry.ipIfStatsHCOutMcastPkts ++ * ipIfStatsHCOutMcastPkts is subid 39 of ipIfStatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.4.31.3.1.39 ++ * Description: ++The number of IP multicast datagrams transmitted. This ++ object counts the same datagrams as ipIfStatsOutMcastPkts, ++ but allows for larger values. ++ ++ Discontinuities in the value of this counter can occur at ++ re-initialization of the management system, and at other ++ ++ ++ ++ times as indicated by the value of ++ ipIfStatsDiscontinuityTime. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER64 (based on perltype COUNTER64) ++ * The net-snmp type is ASN_COUNTER64. The C type decl is U64 (U64) ++ */ ++/** ++ * Extract the current value of the ipIfStatsHCOutMcastPkts data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param ipIfStatsHCOutMcastPkts_val_ptr ++ * Pointer to storage for a U64 variable ++ * ++ * @retval MFD_SUCCESS : success ++ * @retval MFD_SKIP : skip this node (no value for now) ++ * @retval MFD_ERROR : Any other error ++ */ ++int ++ipIfStatsHCOutMcastPkts_get(ipIfStatsTable_rowreq_ctx * rowreq_ctx, ++ U64 * ipIfStatsHCOutMcastPkts_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != ipIfStatsHCOutMcastPkts_val_ptr); ++ ++ /* ++ * TODO:231:o: |-> copy ipIfStatsHCOutMcastPkts data. ++ * get (* ipIfStatsHCOutMcastPkts_val_ptr ).low and (* ipIfStatsHCOutMcastPkts_val_ptr ).high from rowreq_ctx->data ++ */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTMCASTPKTS]) ++ return MFD_SKIP; ++ ++ (*ipIfStatsHCOutMcastPkts_val_ptr).low = ++ rowreq_ctx->data->stats.HCOutMcastPkts.low; ++ (*ipIfStatsHCOutMcastPkts_val_ptr).high = ++ rowreq_ctx->data->stats.HCOutMcastPkts.high; ++ ++ return MFD_SUCCESS; ++} /* ipIfStatsHCOutMcastPkts_get */ ++ ++/*--------------------------------------------------------------------- ++ * IP-MIB::ipIfStatsEntry.ipIfStatsOutMcastOctets ++ * ipIfStatsOutMcastOctets is subid 40 of ipIfStatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.4.31.3.1.40 ++ * Description: ++The total number of octets transmitted in IP multicast ++ datagrams. Octets from datagrams counted in ++ ipIfStatsOutMcastPkts MUST be counted here. ++ ++ Discontinuities in the value of this counter can occur at ++ re-initialization of the management system, and at other ++ times as indicated by the value of ++ ipIfStatsDiscontinuityTime. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER (based on perltype COUNTER) ++ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the ipIfStatsOutMcastOctets data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param ipIfStatsOutMcastOctets_val_ptr ++ * Pointer to storage for a u_long variable ++ * ++ * @retval MFD_SUCCESS : success ++ * @retval MFD_SKIP : skip this node (no value for now) ++ * @retval MFD_ERROR : Any other error ++ */ ++int ++ipIfStatsOutMcastOctets_get(ipIfStatsTable_rowreq_ctx * rowreq_ctx, ++ u_long * ipIfStatsOutMcastOctets_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != ipIfStatsOutMcastOctets_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:ipIfStatsTable:ipIfStatsOutMcastOctets_get", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the ipIfStatsOutMcastOctets data. ++ * copy (* ipIfStatsOutMcastOctets_val_ptr ) from rowreq_ctx->data ++ */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTMCASTOCTETS]) ++ return MFD_SKIP; ++ ++ (*ipIfStatsOutMcastOctets_val_ptr) = ++ rowreq_ctx->data->stats.HCOutMcastOctets.low; ++ ++ return MFD_SUCCESS; ++} /* ipIfStatsOutMcastOctets_get */ ++ ++/*--------------------------------------------------------------------- ++ * IP-MIB::ipIfStatsEntry.ipIfStatsHCOutMcastOctets ++ * ipIfStatsHCOutMcastOctets is subid 41 of ipIfStatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.4.31.3.1.41 ++ * Description: ++The total number of octets transmitted in IP multicast ++ datagrams. This object counts the same octets as ++ ipIfStatsOutMcastOctets, but allows for larger values. ++ ++ Discontinuities in the value of this counter can occur at ++ re-initialization of the management system, and at other ++ times as indicated by the value of ++ ipIfStatsDiscontinuityTime. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER64 (based on perltype COUNTER64) ++ * The net-snmp type is ASN_COUNTER64. The C type decl is U64 (U64) ++ */ ++/** ++ * Extract the current value of the ipIfStatsHCOutMcastOctets data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param ipIfStatsHCOutMcastOctets_val_ptr ++ * Pointer to storage for a U64 variable ++ * ++ * @retval MFD_SUCCESS : success ++ * @retval MFD_SKIP : skip this node (no value for now) ++ * @retval MFD_ERROR : Any other error ++ */ ++int ++ipIfStatsHCOutMcastOctets_get(ipIfStatsTable_rowreq_ctx * rowreq_ctx, ++ U64 * ipIfStatsHCOutMcastOctets_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != ipIfStatsHCOutMcastOctets_val_ptr); ++ ++ /* ++ * TODO:231:o: |-> copy ipIfStatsHCOutMcastOctets data. ++ * get (* ipIfStatsHCOutMcastOctets_val_ptr ).low and (* ipIfStatsHCOutMcastOctets_val_ptr ).high from rowreq_ctx->data ++ */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTMCASTOCTETS]) ++ return MFD_SKIP; ++ ++ (*ipIfStatsHCOutMcastOctets_val_ptr).low = ++ rowreq_ctx->data->stats.HCOutMcastOctets.low; ++ (*ipIfStatsHCOutMcastOctets_val_ptr).high = ++ rowreq_ctx->data->stats.HCOutMcastOctets.high; ++ ++ return MFD_SUCCESS; ++} /* ipIfStatsHCOutMcastOctets_get */ ++ ++/*--------------------------------------------------------------------- ++ * IP-MIB::ipIfStatsEntry.ipIfStatsInBcastPkts ++ * ipIfStatsInBcastPkts is subid 42 of ipIfStatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.4.31.3.1.42 ++ * Description: ++The number of IP broadcast datagrams received. ++ ++ Discontinuities in the value of this counter can occur at ++ re-initialization of the management system, and at other ++ times as indicated by the value of ++ ipIfStatsDiscontinuityTime. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER (based on perltype COUNTER) ++ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the ipIfStatsInBcastPkts data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param ipIfStatsInBcastPkts_val_ptr ++ * Pointer to storage for a u_long variable ++ * ++ * @retval MFD_SUCCESS : success ++ * @retval MFD_SKIP : skip this node (no value for now) ++ * @retval MFD_ERROR : Any other error ++ */ ++int ++ipIfStatsInBcastPkts_get(ipIfStatsTable_rowreq_ctx * rowreq_ctx, ++ u_long * ipIfStatsInBcastPkts_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != ipIfStatsInBcastPkts_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:ipIfStatsTable:ipIfStatsInBcastPkts_get", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the ipIfStatsInBcastPkts data. ++ * copy (* ipIfStatsInBcastPkts_val_ptr ) from rowreq_ctx->data ++ */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_HCINBCASTPKTS]) ++ return MFD_SKIP; ++ ++ (*ipIfStatsInBcastPkts_val_ptr) = ++ rowreq_ctx->data->stats.HCInBcastPkts.low; ++ ++ return MFD_SUCCESS; ++} /* ipIfStatsInBcastPkts_get */ ++ ++/*--------------------------------------------------------------------- ++ * IP-MIB::ipIfStatsEntry.ipIfStatsHCInBcastPkts ++ * ipIfStatsHCInBcastPkts is subid 43 of ipIfStatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.4.31.3.1.43 ++ * Description: ++The number of IP broadcast datagrams received. This object ++ counts the same datagrams as ipIfStatsInBcastPkts, but ++ allows for larger values. ++ ++ Discontinuities in the value of this counter can occur at ++ re-initialization of the management system, and at other ++ times as indicated by the value of ++ ipIfStatsDiscontinuityTime. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER64 (based on perltype COUNTER64) ++ * The net-snmp type is ASN_COUNTER64. The C type decl is U64 (U64) ++ */ ++/** ++ * Extract the current value of the ipIfStatsHCInBcastPkts data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param ipIfStatsHCInBcastPkts_val_ptr ++ * Pointer to storage for a U64 variable ++ * ++ * @retval MFD_SUCCESS : success ++ * @retval MFD_SKIP : skip this node (no value for now) ++ * @retval MFD_ERROR : Any other error ++ */ ++int ++ipIfStatsHCInBcastPkts_get(ipIfStatsTable_rowreq_ctx * rowreq_ctx, ++ U64 * ipIfStatsHCInBcastPkts_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != ipIfStatsHCInBcastPkts_val_ptr); ++ ++ /* ++ * TODO:231:o: |-> copy ipIfStatsHCInBcastPkts data. ++ * get (* ipIfStatsHCInBcastPkts_val_ptr ).low and (* ipIfStatsHCInBcastPkts_val_ptr ).high from rowreq_ctx->data ++ */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_HCINBCASTPKTS]) ++ return MFD_SKIP; ++ ++ (*ipIfStatsHCInBcastPkts_val_ptr).low = ++ rowreq_ctx->data->stats.HCInBcastPkts.low; ++ (*ipIfStatsHCInBcastPkts_val_ptr).high = ++ rowreq_ctx->data->stats.HCInBcastPkts.high; ++ ++ return MFD_SUCCESS; ++} /* ipIfStatsHCInBcastPkts_get */ ++ ++/*--------------------------------------------------------------------- ++ * IP-MIB::ipIfStatsEntry.ipIfStatsOutBcastPkts ++ * ipIfStatsOutBcastPkts is subid 44 of ipIfStatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.4.31.3.1.44 ++ * Description: ++The number of IP broadcast datagrams transmitted. ++ ++ Discontinuities in the value of this counter can occur at ++ re-initialization of the management system, and at other ++ times as indicated by the value of ++ ipIfStatsDiscontinuityTime. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER (based on perltype COUNTER) ++ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the ipIfStatsOutBcastPkts data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param ipIfStatsOutBcastPkts_val_ptr ++ * Pointer to storage for a u_long variable ++ * ++ * @retval MFD_SUCCESS : success ++ * @retval MFD_SKIP : skip this node (no value for now) ++ * @retval MFD_ERROR : Any other error ++ */ ++int ++ipIfStatsOutBcastPkts_get(ipIfStatsTable_rowreq_ctx * rowreq_ctx, ++ u_long * ipIfStatsOutBcastPkts_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != ipIfStatsOutBcastPkts_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:ipIfStatsTable:ipIfStatsOutBcastPkts_get", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the ipIfStatsOutBcastPkts data. ++ * copy (* ipIfStatsOutBcastPkts_val_ptr ) from rowreq_ctx->data ++ */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTBCASTPKTS]) ++ return MFD_SKIP; ++ ++ (*ipIfStatsOutBcastPkts_val_ptr) = ++ rowreq_ctx->data->stats.HCOutBcastPkts.low; ++ ++ return MFD_SUCCESS; ++} /* ipIfStatsOutBcastPkts_get */ ++ ++/*--------------------------------------------------------------------- ++ * IP-MIB::ipIfStatsEntry.ipIfStatsHCOutBcastPkts ++ * ipIfStatsHCOutBcastPkts is subid 45 of ipIfStatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.4.31.3.1.45 ++ * Description: ++The number of IP broadcast datagrams transmitted. This ++ object counts the same datagrams as ipIfStatsOutBcastPkts, ++ but allows for larger values. ++ ++ Discontinuities in the value of this counter can occur at ++ re-initialization of the management system, and at other ++ times as indicated by the value of ++ ipIfStatsDiscontinuityTime. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER64 (based on perltype COUNTER64) ++ * The net-snmp type is ASN_COUNTER64. The C type decl is U64 (U64) ++ */ ++/** ++ * Extract the current value of the ipIfStatsHCOutBcastPkts data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param ipIfStatsHCOutBcastPkts_val_ptr ++ * Pointer to storage for a U64 variable ++ * ++ * @retval MFD_SUCCESS : success ++ * @retval MFD_SKIP : skip this node (no value for now) ++ * @retval MFD_ERROR : Any other error ++ */ ++int ++ipIfStatsHCOutBcastPkts_get(ipIfStatsTable_rowreq_ctx * rowreq_ctx, ++ U64 * ipIfStatsHCOutBcastPkts_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != ipIfStatsHCOutBcastPkts_val_ptr); ++ ++ /* ++ * TODO:231:o: |-> copy ipIfStatsHCOutBcastPkts data. ++ * get (* ipIfStatsHCOutBcastPkts_val_ptr ).low and (* ipIfStatsHCOutBcastPkts_val_ptr ).high from rowreq_ctx->data ++ */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTBCASTPKTS]) ++ return MFD_SKIP; ++ ++ (*ipIfStatsHCOutBcastPkts_val_ptr).low = ++ rowreq_ctx->data->stats.HCOutBcastPkts.low; ++ (*ipIfStatsHCOutBcastPkts_val_ptr).high = ++ rowreq_ctx->data->stats.HCOutBcastPkts.high; ++ ++ return MFD_SUCCESS; ++} /* ipIfStatsHCOutBcastPkts_get */ ++ ++/*--------------------------------------------------------------------- ++ * IP-MIB::ipIfStatsEntry.ipIfStatsDiscontinuityTime ++ * ipIfStatsDiscontinuityTime is subid 46 of ipIfStatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.4.31.3.1.46 ++ * Description: ++The value of sysUpTime on the most recent occasion at which ++ ++ ++ ++ any one or more of this entry's counters suffered a ++ discontinuity. ++ ++ If no such discontinuities have occurred since the last re- ++ initialization of the local management subsystem, then this ++ object contains a zero value. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is TimeStamp (based on perltype TICKS) ++ * The net-snmp type is ASN_TIMETICKS. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the ipIfStatsDiscontinuityTime data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param ipIfStatsDiscontinuityTime_val_ptr ++ * Pointer to storage for a u_long variable ++ * ++ * @retval MFD_SUCCESS : success ++ * @retval MFD_SKIP : skip this node (no value for now) ++ * @retval MFD_ERROR : Any other error ++ */ ++int ++ipIfStatsDiscontinuityTime_get(ipIfStatsTable_rowreq_ctx * rowreq_ctx, ++ u_long * ipIfStatsDiscontinuityTime_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != ipIfStatsDiscontinuityTime_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:ipIfStatsTable:ipIfStatsDiscontinuityTime_get", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the ipIfStatsDiscontinuityTime data. ++ * copy (* ipIfStatsDiscontinuityTime_val_ptr ) from rowreq_ctx->data ++ */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_DISCONTINUITYTIME]) ++ return MFD_SKIP; ++ ++ (*ipIfStatsDiscontinuityTime_val_ptr) = ++ rowreq_ctx->ipIfStatsDiscontinuityTime; ++ ++ return MFD_SUCCESS; ++} /* ipIfStatsDiscontinuityTime_get */ ++ ++/*--------------------------------------------------------------------- ++ * IP-MIB::ipIfStatsEntry.ipIfStatsRefreshRate ++ * ipIfStatsRefreshRate is subid 47 of ipIfStatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.4.31.3.1.47 ++ * Description: ++The minimum reasonable polling interval for this entry. ++ This object provides an indication of the minimum amount of ++ time required to update the counters in this entry. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is UNSIGNED32 (based on perltype UNSIGNED32) ++ * The net-snmp type is ASN_UNSIGNED. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the ipIfStatsRefreshRate data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param ipIfStatsRefreshRate_val_ptr ++ * Pointer to storage for a u_long variable ++ * ++ * @retval MFD_SUCCESS : success ++ * @retval MFD_SKIP : skip this node (no value for now) ++ * @retval MFD_ERROR : Any other error ++ */ ++int ++ipIfStatsRefreshRate_get(ipIfStatsTable_rowreq_ctx * rowreq_ctx, ++ u_long * ipIfStatsRefreshRate_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != ipIfStatsRefreshRate_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:ipIfStatsTable:ipIfStatsRefreshRate_get", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the ipIfStatsRefreshRate data. ++ * copy (* ipIfStatsRefreshRate_val_ptr ) from rowreq_ctx->data ++ */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_REFRESHRATE]) ++ return MFD_SKIP; ++ ++ (*ipIfStatsRefreshRate_val_ptr) = ++ rowreq_ctx->ipIfStatsRefreshRate; ++ ++ return MFD_SUCCESS; ++} /* ipIfStatsRefreshRate_get */ ++ ++ ++ ++/** @} */ +diff --git a/agent/mibgroup/ip-mib/ipIfStatsTable/ipIfStatsTable_data_get.h b/agent/mibgroup/ip-mib/ipIfStatsTable/ipIfStatsTable_data_get.h +new file mode 100644 +index 0000000..0cc7e47 +--- /dev/null ++++ b/agent/mibgroup/ip-mib/ipIfStatsTable/ipIfStatsTable_data_get.h +@@ -0,0 +1,246 @@ ++/* ++ * Note: this file originally auto-generated by mib2c using ++ * version : 12088 $ of $ ++ * ++ * $Id:$ ++ * ++ * @file ipIfStatsTable_data_get.h ++ * ++ * @addtogroup get ++ * ++ * Prototypes for get functions ++ * ++ * @{ ++ */ ++#ifndef IPIFSTATSTABLE_DATA_GET_H ++#define IPIFSTATSTABLE_DATA_GET_H ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++ /* ++ ********************************************************************* ++ * GET function declarations ++ */ ++ ++ /* ++ ********************************************************************* ++ * GET Table declarations ++ */ ++/********************************************************************** ++ ********************************************************************** ++ *** ++ *** Table ipIfStatsTable ++ *** ++ ********************************************************************** ++ **********************************************************************/ ++ /* ++ * IP-MIB::ipIfStatsTable is subid 3 of ipTrafficStats. ++ * Its status is Current. ++ * OID: .1.3.6.1.2.1.4.31.3, length: 9 ++ */ ++ /* ++ * indexes ++ */ ++ ++ int ipIfStatsInReceives_get(ipIfStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long * ++ ipIfStatsInReceives_val_ptr); ++ int ipIfStatsHCInReceives_get(ipIfStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ U64 * ++ ipIfStatsHCInReceives_val_ptr); ++ int ipIfStatsInOctets_get(ipIfStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long * ++ ipIfStatsInOctets_val_ptr); ++ int ipIfStatsHCInOctets_get(ipIfStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ U64 * ++ ipIfStatsHCInOctets_val_ptr); ++ int ipIfStatsInHdrErrors_get(ipIfStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long * ++ ipIfStatsInHdrErrors_val_ptr); ++ int ipIfStatsInNoRoutes_get(ipIfStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long * ++ ipIfStatsInNoRoutes_val_ptr); ++ int ipIfStatsInAddrErrors_get(ipIfStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long * ++ ipIfStatsInAddrErrors_val_ptr); ++ int ipIfStatsInUnknownProtos_get(ipIfStatsTable_rowreq_ctx ++ * rowreq_ctx, ++ u_long * ++ ipIfStatsInUnknownProtos_val_ptr); ++ int ipIfStatsInTruncatedPkts_get(ipIfStatsTable_rowreq_ctx ++ * rowreq_ctx, ++ u_long * ++ ipIfStatsInTruncatedPkts_val_ptr); ++ int ipIfStatsInForwDatagrams_get(ipIfStatsTable_rowreq_ctx ++ * rowreq_ctx, ++ u_long * ++ ipIfStatsInForwDatagrams_val_ptr); ++ int ++ ipIfStatsHCInForwDatagrams_get(ipIfStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ U64 * ++ ipIfStatsHCInForwDatagrams_val_ptr); ++ int ipIfStatsReasmReqds_get(ipIfStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long * ++ ipIfStatsReasmReqds_val_ptr); ++ int ipIfStatsReasmOKs_get(ipIfStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long * ++ ipIfStatsReasmOKs_val_ptr); ++ int ipIfStatsReasmFails_get(ipIfStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long * ++ ipIfStatsReasmFails_val_ptr); ++ int ipIfStatsInDiscards_get(ipIfStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long * ++ ipIfStatsInDiscards_val_ptr); ++ int ipIfStatsInDelivers_get(ipIfStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long * ++ ipIfStatsInDelivers_val_ptr); ++ int ipIfStatsHCInDelivers_get(ipIfStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ U64 * ++ ipIfStatsHCInDelivers_val_ptr); ++ int ipIfStatsOutRequests_get(ipIfStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long * ++ ipIfStatsOutRequests_val_ptr); ++ int ipIfStatsHCOutRequests_get(ipIfStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ U64 * ++ ipIfStatsHCOutRequests_val_ptr); ++ int ipIfStatsOutForwDatagrams_get(ipIfStatsTable_rowreq_ctx ++ * rowreq_ctx, ++ u_long * ++ ipIfStatsOutForwDatagrams_val_ptr); ++ int ++ ipIfStatsHCOutForwDatagrams_get(ipIfStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ U64 * ++ ipIfStatsHCOutForwDatagrams_val_ptr); ++ int ipIfStatsOutDiscards_get(ipIfStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long * ++ ipIfStatsOutDiscards_val_ptr); ++ int ipIfStatsOutFragReqds_get(ipIfStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long * ++ ipIfStatsOutFragReqds_val_ptr); ++ int ipIfStatsOutFragOKs_get(ipIfStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long * ++ ipIfStatsOutFragOKs_val_ptr); ++ int ipIfStatsOutFragFails_get(ipIfStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long * ++ ipIfStatsOutFragFails_val_ptr); ++ int ipIfStatsOutFragCreates_get(ipIfStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long * ++ ipIfStatsOutFragCreates_val_ptr); ++ int ipIfStatsOutTransmits_get(ipIfStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long * ++ ipIfStatsOutTransmits_val_ptr); ++ int ipIfStatsHCOutTransmits_get(ipIfStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ U64 * ++ ipIfStatsHCOutTransmits_val_ptr); ++ int ipIfStatsOutOctets_get(ipIfStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long * ++ ipIfStatsOutOctets_val_ptr); ++ int ipIfStatsHCOutOctets_get(ipIfStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ U64 * ++ ipIfStatsHCOutOctets_val_ptr); ++ int ipIfStatsInMcastPkts_get(ipIfStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long * ++ ipIfStatsInMcastPkts_val_ptr); ++ int ipIfStatsHCInMcastPkts_get(ipIfStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ U64 * ++ ipIfStatsHCInMcastPkts_val_ptr); ++ int ipIfStatsInMcastOctets_get(ipIfStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long * ++ ipIfStatsInMcastOctets_val_ptr); ++ int ipIfStatsHCInMcastOctets_get(ipIfStatsTable_rowreq_ctx ++ * rowreq_ctx, ++ U64 * ++ ipIfStatsHCInMcastOctets_val_ptr); ++ int ipIfStatsOutMcastPkts_get(ipIfStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long * ++ ipIfStatsOutMcastPkts_val_ptr); ++ int ipIfStatsHCOutMcastPkts_get(ipIfStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ U64 * ++ ipIfStatsHCOutMcastPkts_val_ptr); ++ int ipIfStatsOutMcastOctets_get(ipIfStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long * ++ ipIfStatsOutMcastOctets_val_ptr); ++ int ipIfStatsHCOutMcastOctets_get(ipIfStatsTable_rowreq_ctx ++ * rowreq_ctx, ++ U64 * ++ ipIfStatsHCOutMcastOctets_val_ptr); ++ int ipIfStatsInBcastPkts_get(ipIfStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long * ++ ipIfStatsInBcastPkts_val_ptr); ++ int ipIfStatsHCInBcastPkts_get(ipIfStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ U64 * ++ ipIfStatsHCInBcastPkts_val_ptr); ++ int ipIfStatsOutBcastPkts_get(ipIfStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long * ++ ipIfStatsOutBcastPkts_val_ptr); ++ int ipIfStatsHCOutBcastPkts_get(ipIfStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ U64 * ++ ipIfStatsHCOutBcastPkts_val_ptr); ++ int ++ ipIfStatsDiscontinuityTime_get(ipIfStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long * ++ ipIfStatsDiscontinuityTime_val_ptr); ++ int ipIfStatsRefreshRate_get(ipIfStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long * ++ ipIfStatsRefreshRate_val_ptr); ++ ++ ++ int ++ ipIfStatsTable_indexes_set_tbl_idx(ipIfStatsTable_mib_index * ++ tbl_idx, ++ u_long ipIfStatsIPVersion_val, ++ long ipIfStatsIfIndex_val); ++ int ipIfStatsTable_indexes_set(ipIfStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long ++ ipIfStatsIPVersion_val, ++ long ipIfStatsIfIndex_val); ++ ++ ++ ++ ++#ifdef __cplusplus ++} ++#endif ++#endif /* IPIFSTATSTABLE_DATA_GET_H */ ++/** @} */ +diff --git a/agent/mibgroup/ip-mib/ipIfStatsTable/ipIfStatsTable_enums.h b/agent/mibgroup/ip-mib/ipIfStatsTable/ipIfStatsTable_enums.h +new file mode 100644 +index 0000000..c3657d5 +--- /dev/null ++++ b/agent/mibgroup/ip-mib/ipIfStatsTable/ipIfStatsTable_enums.h +@@ -0,0 +1,56 @@ ++/* ++ * Note: this file originally auto-generated by mib2c using ++ * : generic-table-enums.m2c 12526 2005-07-15 22:41:16Z rstory $ ++ * ++ * $Id:$ ++ */ ++#ifndef IPIFSTATSTABLE_ENUMS_H ++#define IPIFSTATSTABLE_ENUMS_H ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++ /* ++ * NOTES on enums ++ * ============== ++ * ++ * Value Mapping ++ * ------------- ++ * If the values for your data type don't exactly match the ++ * possible values defined by the mib, you should map them ++ * below. For example, a boolean flag (1/0) is usually represented ++ * as a TruthValue in a MIB, which maps to the values (1/2). ++ * ++ */ ++/************************************************************************* ++ ************************************************************************* ++ * ++ * enum definitions for table ipIfStatsTable ++ * ++ ************************************************************************* ++ *************************************************************************/ ++ ++/************************************************************* ++ * constants for enums for the MIB node ++ * ipIfStatsIPVersion (InetVersion / ASN_INTEGER) ++ * ++ * since a Textual Convention may be referenced more than once in a ++ * MIB, protect againt redefinitions of the enum values. ++ */ ++#ifndef INETVERSION_ENUMS ++#define INETVERSION_ENUMS ++ ++#define INETVERSION_UNKNOWN 0 ++#define INETVERSION_IPV4 1 ++#define INETVERSION_IPV6 2 ++ ++#endif /* INETVERSION_ENUMS */ ++ ++ ++ ++ ++#ifdef __cplusplus ++} ++#endif ++#endif /* IPIFSTATSTABLE_ENUMS_H */ +diff --git a/agent/mibgroup/ip-mib/ipIfStatsTable/ipIfStatsTable_interface.c b/agent/mibgroup/ip-mib/ipIfStatsTable/ipIfStatsTable_interface.c +new file mode 100644 +index 0000000..d415a83 +--- /dev/null ++++ b/agent/mibgroup/ip-mib/ipIfStatsTable/ipIfStatsTable_interface.c +@@ -0,0 +1,1395 @@ ++/* ++ * Note: this file originally auto-generated by mib2c using ++ * version : 15899 $ of $ ++ * ++ * $Id:$ ++ */ ++/* ++ * ********************************************************************* ++ * ********************************************************************* ++ * ********************************************************************* ++ * *** *** ++ * *** NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE *** ++ * *** *** ++ * *** *** ++ * *** THIS FILE DOES NOT CONTAIN ANY USER EDITABLE CODE. *** ++ * *** *** ++ * *** *** ++ * *** THE GENERATED CODE IS INTERNAL IMPLEMENTATION, AND *** ++ * *** *** ++ * *** *** ++ * *** IS SUBJECT TO CHANGE WITHOUT WARNING IN FUTURE RELEASES. *** ++ * *** *** ++ * *** *** ++ * ********************************************************************* ++ * ********************************************************************* ++ * ********************************************************************* ++ */ ++ ++/* ++ * standard Net-SNMP includes ++ */ ++#include ++#include ++#include ++ ++/* ++ * include our parent header ++ */ ++#include "ipIfStatsTable.h" ++ ++ ++#include ++#include ++ ++#include "ipIfStatsTable_interface.h" ++ ++#include ++ ++/********************************************************************** ++ ********************************************************************** ++ *** ++ *** Table ipIfStatsTable ++ *** ++ ********************************************************************** ++ **********************************************************************/ ++/* ++ * IP-MIB::ipIfStatsTable is subid 3 of ipTrafficStats. ++ * Its status is Current. ++ * OID: .1.3.6.1.2.1.4.31.3, length: 9 ++ */ ++typedef struct ipIfStatsTable_interface_ctx_s { ++ ++ netsnmp_container *container; ++ netsnmp_cache *cache; ++ ++ ipIfStatsTable_registration *user_ctx; ++ ++ netsnmp_table_registration_info tbl_info; ++ ++ netsnmp_baby_steps_access_methods access_multiplexer; ++ ++ u_long last_changed; ++ ++} ipIfStatsTable_interface_ctx; ++ ++static ipIfStatsTable_interface_ctx ipIfStatsTable_if_ctx; ++ ++static void _ipIfStatsTable_container_init(ipIfStatsTable_interface_ctx ++ * if_ctx); ++static void ++_ipIfStatsTable_container_shutdown(ipIfStatsTable_interface_ctx * if_ctx); ++ ++ ++netsnmp_container * ++ipIfStatsTable_container_get(void) ++{ ++ return ipIfStatsTable_if_ctx.container; ++} ++ ++ipIfStatsTable_registration * ++ipIfStatsTable_registration_get(void) ++{ ++ return ipIfStatsTable_if_ctx.user_ctx; ++} ++ ++ipIfStatsTable_registration * ++ipIfStatsTable_registration_set(ipIfStatsTable_registration * newreg) ++{ ++ ipIfStatsTable_registration *old = ipIfStatsTable_if_ctx.user_ctx; ++ ipIfStatsTable_if_ctx.user_ctx = newreg; ++ return old; ++} ++ ++int ++ipIfStatsTable_container_size(void) ++{ ++ return CONTAINER_SIZE(ipIfStatsTable_if_ctx.container); ++} ++ ++/* ++ * ipIfStatsTableLastChanged, which is the last time that a row in ++ * the table was changed or the last time a row was added/deleted from the ++ * table. ++ */ ++void ++ipIfStatsTable_lastChange_set(u_long table_changed) ++{ ++ DEBUGMSGTL(("ipIfStatsTable:lastChanged_set", ++ "called. was %ld, now %ld\n", ++ ipIfStatsTable_if_ctx.last_changed, table_changed)); ++ ipIfStatsTable_if_ctx.last_changed = table_changed; ++} ++ ++/* ++ * mfd multiplexer modes ++ */ ++static Netsnmp_Node_Handler _mfd_ipIfStatsTable_pre_request; ++static Netsnmp_Node_Handler _mfd_ipIfStatsTable_post_request; ++static Netsnmp_Node_Handler _mfd_ipIfStatsTable_object_lookup; ++static Netsnmp_Node_Handler _mfd_ipIfStatsTable_get_values; ++/** ++ * @internal ++ * Initialize the table ipIfStatsTable ++ * (Define its contents and how it's structured) ++ */ ++void ++_ipIfStatsTable_initialize_interface(ipIfStatsTable_registration * reg_ptr, ++ u_long flags) ++{ ++ netsnmp_baby_steps_access_methods *access_multiplexer = ++ &ipIfStatsTable_if_ctx.access_multiplexer; ++ netsnmp_table_registration_info *tbl_info = ++ &ipIfStatsTable_if_ctx.tbl_info; ++ netsnmp_handler_registration *reginfo; ++ netsnmp_mib_handler *handler; ++ int mfd_modes = 0; ++ ++ DEBUGMSGTL(("internal:ipIfStatsTable:_ipIfStatsTable_initialize_interface", "called\n")); ++ ++ ++ /************************************************* ++ * ++ * save interface context for ipIfStatsTable ++ */ ++ /* ++ * Setting up the table's definition ++ */ ++ netsnmp_table_helper_add_indexes(tbl_info, ASN_INTEGER, ++ /** index: ipIfStatsIPVersion */ ++ ASN_INTEGER, ++ /** index: ipIfStatsIfIndex */ ++ 0); ++ ++ /* ++ * Define the minimum and maximum accessible columns. This ++ * optimizes retrival. ++ */ ++ tbl_info->min_column = IPIFSTATSTABLE_MIN_COL; ++ tbl_info->max_column = IPIFSTATSTABLE_MAX_COL; ++ ++ /* ++ * save users context ++ */ ++ ipIfStatsTable_if_ctx.user_ctx = reg_ptr; ++ ++ /* ++ * call data access initialization code ++ */ ++ ipIfStatsTable_init_data(reg_ptr); ++ ++ /* ++ * set up the container ++ */ ++ _ipIfStatsTable_container_init(&ipIfStatsTable_if_ctx); ++ if (NULL == ipIfStatsTable_if_ctx.container) { ++ snmp_log(LOG_ERR, ++ "could not initialize container for ipIfStatsTable\n"); ++ return; ++ } ++ ++ /* ++ * access_multiplexer: REQUIRED wrapper for get request handling ++ */ ++ access_multiplexer->object_lookup = _mfd_ipIfStatsTable_object_lookup; ++ access_multiplexer->get_values = _mfd_ipIfStatsTable_get_values; ++ ++ /* ++ * no wrappers yet ++ */ ++ access_multiplexer->pre_request = _mfd_ipIfStatsTable_pre_request; ++ access_multiplexer->post_request = _mfd_ipIfStatsTable_post_request; ++ ++ ++ /************************************************* ++ * ++ * Create a registration, save our reg data, register table. ++ */ ++ DEBUGMSGTL(("ipIfStatsTable:init_ipIfStatsTable", ++ "Registering ipIfStatsTable as a mibs-for-dummies table.\n")); ++ handler = ++ netsnmp_baby_steps_access_multiplexer_get(access_multiplexer); ++ reginfo = ++ netsnmp_handler_registration_create("ipIfStatsTable", handler, ++ ipIfStatsTable_oid, ++ ipIfStatsTable_oid_size, ++ HANDLER_CAN_BABY_STEP | ++ HANDLER_CAN_RONLY); ++ if (NULL == reginfo) { ++ snmp_log(LOG_ERR, "error registering table ipIfStatsTable\n"); ++ return; ++ } ++ reginfo->my_reg_void = &ipIfStatsTable_if_ctx; ++ ++ /************************************************* ++ * ++ * set up baby steps handler, create it and inject it ++ */ ++ if (access_multiplexer->object_lookup) ++ mfd_modes |= BABY_STEP_OBJECT_LOOKUP; ++ if (access_multiplexer->set_values) ++ mfd_modes |= BABY_STEP_SET_VALUES; ++ if (access_multiplexer->irreversible_commit) ++ mfd_modes |= BABY_STEP_IRREVERSIBLE_COMMIT; ++ if (access_multiplexer->object_syntax_checks) ++ mfd_modes |= BABY_STEP_CHECK_OBJECT; ++ ++ if (access_multiplexer->pre_request) ++ mfd_modes |= BABY_STEP_PRE_REQUEST; ++ if (access_multiplexer->post_request) ++ mfd_modes |= BABY_STEP_POST_REQUEST; ++ ++ if (access_multiplexer->undo_setup) ++ mfd_modes |= BABY_STEP_UNDO_SETUP; ++ if (access_multiplexer->undo_cleanup) ++ mfd_modes |= BABY_STEP_UNDO_CLEANUP; ++ if (access_multiplexer->undo_sets) ++ mfd_modes |= BABY_STEP_UNDO_SETS; ++ ++ if (access_multiplexer->row_creation) ++ mfd_modes |= BABY_STEP_ROW_CREATE; ++ if (access_multiplexer->consistency_checks) ++ mfd_modes |= BABY_STEP_CHECK_CONSISTENCY; ++ if (access_multiplexer->commit) ++ mfd_modes |= BABY_STEP_COMMIT; ++ if (access_multiplexer->undo_commit) ++ mfd_modes |= BABY_STEP_UNDO_COMMIT; ++ ++ handler = netsnmp_baby_steps_handler_get(mfd_modes); ++ netsnmp_inject_handler(reginfo, handler); ++ ++ /************************************************* ++ * ++ * inject row_merge helper with prefix rootoid_len + 2 (entry.col) ++ */ ++ handler = netsnmp_get_row_merge_handler(reginfo->rootoid_len + 2); ++ netsnmp_inject_handler(reginfo, handler); ++ ++ /************************************************* ++ * ++ * inject container_table helper ++ */ ++ handler = ++ netsnmp_container_table_handler_get(tbl_info, ++ ipIfStatsTable_if_ctx. ++ container, ++ TABLE_CONTAINER_KEY_NETSNMP_INDEX); ++ netsnmp_inject_handler(reginfo, handler); ++ ++ /************************************************* ++ * ++ * inject cache helper ++ */ ++ if (NULL != ipIfStatsTable_if_ctx.cache) { ++ handler = netsnmp_cache_handler_get(ipIfStatsTable_if_ctx.cache); ++ netsnmp_inject_handler(reginfo, handler); ++ } ++ ++ /* ++ * register table ++ */ ++ netsnmp_register_table(reginfo, tbl_info); ++ ++ /* ++ * register LastChanged ++ */ ++ { ++ oid lc_oid[] = { IPIFSTATSTABLELASTCHANGE_OID }; ++ netsnmp_register_watched_scalar(netsnmp_create_handler_registration ++ ("ipIfStatsTableLastChanged", NULL, ++ lc_oid, OID_LENGTH(lc_oid), ++ HANDLER_CAN_RONLY), ++ netsnmp_create_watcher_info((void ++ *) ++ &ipIfStatsTable_if_ctx. ++ last_changed, ++ sizeof ++ (u_long), ++ ASN_TIMETICKS, ++ WATCHER_FIXED_SIZE)); ++ } ++} /* _ipIfStatsTable_initialize_interface */ ++ ++/** ++ * @internal ++ * Shutdown the table ipIfStatsTable ++ */ ++void ++_ipIfStatsTable_shutdown_interface(ipIfStatsTable_registration * reg_ptr) ++{ ++ /* ++ * shutdown the container ++ */ ++ _ipIfStatsTable_container_shutdown(&ipIfStatsTable_if_ctx); ++} ++ ++void ++ipIfStatsTable_valid_columns_set(netsnmp_column_info *vc) ++{ ++ ipIfStatsTable_if_ctx.tbl_info.valid_columns = vc; ++} /* ipIfStatsTable_valid_columns_set */ ++ ++/** ++ * @internal ++ * convert the index component stored in the context to an oid ++ */ ++int ++ipIfStatsTable_index_to_oid(netsnmp_index * oid_idx, ++ ipIfStatsTable_mib_index * mib_idx) ++{ ++ int err = SNMP_ERR_NOERROR; ++ ++ /* ++ * temp storage for parsing indexes ++ */ ++ /* ++ * ipIfStatsIPVersion(1)/InetVersion/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h ++ */ ++ netsnmp_variable_list var_ipIfStatsIPVersion; ++ /* ++ * ipIfStatsIfIndex(2)/InterfaceIndex/ASN_INTEGER/long(long)//l/a/w/e/R/d/H ++ */ ++ netsnmp_variable_list var_ipIfStatsIfIndex; ++ ++ /* ++ * set up varbinds ++ */ ++ memset(&var_ipIfStatsIPVersion, 0x00, sizeof(var_ipIfStatsIPVersion)); ++ var_ipIfStatsIPVersion.type = ASN_INTEGER; ++ memset(&var_ipIfStatsIfIndex, 0x00, sizeof(var_ipIfStatsIfIndex)); ++ var_ipIfStatsIfIndex.type = ASN_INTEGER; ++ ++ /* ++ * chain temp index varbinds together ++ */ ++ var_ipIfStatsIPVersion.next_variable = &var_ipIfStatsIfIndex; ++ var_ipIfStatsIfIndex.next_variable = NULL; ++ ++ ++ DEBUGMSGTL(("verbose:ipIfStatsTable:ipIfStatsTable_index_to_oid", ++ "called\n")); ++ ++ /* ++ * ipIfStatsIPVersion(1)/InetVersion/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h ++ */ ++ snmp_set_var_value(&var_ipIfStatsIPVersion, ++ (u_char *) & mib_idx->ipIfStatsIPVersion, ++ sizeof(mib_idx->ipIfStatsIPVersion)); ++ ++ /* ++ * ipIfStatsIfIndex(2)/InterfaceIndex/ASN_INTEGER/long(long)//l/a/w/e/R/d/H ++ */ ++ snmp_set_var_value(&var_ipIfStatsIfIndex, ++ (u_char *) & mib_idx->ipIfStatsIfIndex, ++ sizeof(mib_idx->ipIfStatsIfIndex)); ++ ++ ++ err = build_oid_noalloc(oid_idx->oids, oid_idx->len, &oid_idx->len, ++ NULL, 0, &var_ipIfStatsIPVersion); ++ if (err) ++ snmp_log(LOG_ERR, "error %d converting index to oid\n", err); ++ ++ /* ++ * parsing may have allocated memory. free it. ++ */ ++ snmp_reset_var_buffers(&var_ipIfStatsIPVersion); ++ ++ return err; ++} /* ipIfStatsTable_index_to_oid */ ++ ++/** ++ * extract ipIfStatsTable indexes from a netsnmp_index ++ * ++ * @retval SNMP_ERR_NOERROR : no error ++ * @retval SNMP_ERR_GENERR : error ++ */ ++int ++ipIfStatsTable_index_from_oid(netsnmp_index * oid_idx, ++ ipIfStatsTable_mib_index * mib_idx) ++{ ++ int err = SNMP_ERR_NOERROR; ++ ++ /* ++ * temp storage for parsing indexes ++ */ ++ /* ++ * ipIfStatsIPVersion(1)/InetVersion/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h ++ */ ++ netsnmp_variable_list var_ipIfStatsIPVersion; ++ /* ++ * ipIfStatsIfIndex(2)/InterfaceIndex/ASN_INTEGER/long(long)//l/a/w/e/R/d/H ++ */ ++ netsnmp_variable_list var_ipIfStatsIfIndex; ++ ++ /* ++ * set up varbinds ++ */ ++ memset(&var_ipIfStatsIPVersion, 0x00, sizeof(var_ipIfStatsIPVersion)); ++ var_ipIfStatsIPVersion.type = ASN_INTEGER; ++ memset(&var_ipIfStatsIfIndex, 0x00, sizeof(var_ipIfStatsIfIndex)); ++ var_ipIfStatsIfIndex.type = ASN_INTEGER; ++ ++ /* ++ * chain temp index varbinds together ++ */ ++ var_ipIfStatsIPVersion.next_variable = &var_ipIfStatsIfIndex; ++ var_ipIfStatsIfIndex.next_variable = NULL; ++ ++ ++ DEBUGMSGTL(("verbose:ipIfStatsTable:ipIfStatsTable_index_from_oid", ++ "called\n")); ++ ++ /* ++ * parse the oid into the individual index components ++ */ ++ err = parse_oid_indexes(oid_idx->oids, oid_idx->len, ++ &var_ipIfStatsIPVersion); ++ if (err == SNMP_ERR_NOERROR) { ++ /* ++ * copy out values ++ */ ++ mib_idx->ipIfStatsIPVersion = ++ *((u_long *) var_ipIfStatsIPVersion.val.string); ++ mib_idx->ipIfStatsIfIndex = ++ *((long *) var_ipIfStatsIfIndex.val.string); ++ ++ ++ } ++ ++ /* ++ * parsing may have allocated memory. free it. ++ */ ++ snmp_reset_var_buffers(&var_ipIfStatsIPVersion); ++ ++ return err; ++} /* ipIfStatsTable_index_from_oid */ ++ ++ ++/* ++ ********************************************************************* ++ * @internal ++ * allocate resources for a ipIfStatsTable_rowreq_ctx ++ */ ++ipIfStatsTable_rowreq_ctx * ++ipIfStatsTable_allocate_rowreq_ctx(ipIfStatsTable_data * data, ++ void *user_init_ctx) ++{ ++ ipIfStatsTable_rowreq_ctx *rowreq_ctx = ++ SNMP_MALLOC_TYPEDEF(ipIfStatsTable_rowreq_ctx); ++ ++ DEBUGMSGTL(("internal:ipIfStatsTable:ipIfStatsTable_allocate_rowreq_ctx", "called\n")); ++ ++ if (NULL == rowreq_ctx) { ++ snmp_log(LOG_ERR, "Couldn't allocate memory for a " ++ "ipIfStatsTable_rowreq_ctx.\n"); ++ return NULL; ++ } else { ++ if (NULL != data) { ++ /* ++ * track if we got data from user ++ */ ++ rowreq_ctx->rowreq_flags |= MFD_ROW_DATA_FROM_USER; ++ rowreq_ctx->data = data; ++ } else if (NULL == ++ (rowreq_ctx->data = ipIfStatsTable_allocate_data())) { ++ SNMP_FREE(rowreq_ctx); ++ return NULL; ++ } ++ } ++ ++ /* ++ * undo context will be allocated when needed (in *_undo_setup) ++ */ ++ ++ rowreq_ctx->oid_idx.oids = rowreq_ctx->oid_tmp; ++ ++ rowreq_ctx->ipIfStatsTable_data_list = NULL; ++ ++ /* ++ * if we allocated data, call init routine ++ */ ++ if (!(rowreq_ctx->rowreq_flags & MFD_ROW_DATA_FROM_USER)) { ++ if (SNMPERR_SUCCESS != ++ ipIfStatsTable_rowreq_ctx_init(rowreq_ctx, user_init_ctx)) { ++ ipIfStatsTable_release_rowreq_ctx(rowreq_ctx); ++ rowreq_ctx = NULL; ++ } ++ } ++ ++ return rowreq_ctx; ++} /* ipIfStatsTable_allocate_rowreq_ctx */ ++ ++/* ++ * @internal ++ * release resources for a ipIfStatsTable_rowreq_ctx ++ */ ++void ++ipIfStatsTable_release_rowreq_ctx(ipIfStatsTable_rowreq_ctx * rowreq_ctx) ++{ ++ DEBUGMSGTL(("internal:ipIfStatsTable:ipIfStatsTable_release_rowreq_ctx", "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ ipIfStatsTable_rowreq_ctx_cleanup(rowreq_ctx); ++ ++ /* ++ * for non-transient data, don't free data we got from the user ++ */ ++ if ((rowreq_ctx->data) && ++ !(rowreq_ctx->rowreq_flags & MFD_ROW_DATA_FROM_USER)) ++ ipIfStatsTable_release_data(rowreq_ctx->data); ++ ++ /* ++ * free index oid pointer ++ */ ++ if (rowreq_ctx->oid_idx.oids != rowreq_ctx->oid_tmp) ++ free(rowreq_ctx->oid_idx.oids); ++ ++ SNMP_FREE(rowreq_ctx); ++} /* ipIfStatsTable_release_rowreq_ctx */ ++ ++/** ++ * @internal ++ * wrapper ++ */ ++static int ++_mfd_ipIfStatsTable_pre_request(netsnmp_mib_handler *handler, ++ netsnmp_handler_registration *reginfo, ++ netsnmp_agent_request_info *agtreq_info, ++ netsnmp_request_info *requests) ++{ ++ int rc; ++ ++ DEBUGMSGTL(("internal:ipIfStatsTable:_mfd_ipIfStatsTable_pre_request", ++ "called\n")); ++ ++ if (1 != netsnmp_row_merge_status_first(reginfo, agtreq_info)) { ++ DEBUGMSGTL(("internal:ipIfStatsTable", ++ "skipping additional pre_request\n")); ++ return SNMP_ERR_NOERROR; ++ } ++ ++ rc = ipIfStatsTable_pre_request(ipIfStatsTable_if_ctx.user_ctx); ++ if (MFD_SUCCESS != rc) { ++ /* ++ * nothing we can do about it but log it ++ */ ++ DEBUGMSGTL(("ipIfStatsTable", "error %d from " ++ "ipIfStatsTable_pre_request\n", rc)); ++ netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc)); ++ } ++ ++ return SNMP_ERR_NOERROR; ++} /* _mfd_ipIfStatsTable_pre_request */ ++ ++/** ++ * @internal ++ * wrapper ++ */ ++static int ++_mfd_ipIfStatsTable_post_request(netsnmp_mib_handler *handler, ++ netsnmp_handler_registration *reginfo, ++ netsnmp_agent_request_info *agtreq_info, ++ netsnmp_request_info *requests) ++{ ++ ipIfStatsTable_rowreq_ctx *rowreq_ctx = ++ netsnmp_container_table_row_extract(requests); ++ int rc, packet_rc; ++ ++ DEBUGMSGTL(("internal:ipIfStatsTable:_mfd_ipIfStatsTable_post_request", ++ "called\n")); ++ ++ /* ++ * release row context, if deleted ++ */ ++ if (rowreq_ctx && (rowreq_ctx->rowreq_flags & MFD_ROW_DELETED)) ++ ipIfStatsTable_release_rowreq_ctx(rowreq_ctx); ++ ++ /* ++ * wait for last call before calling user ++ */ ++ if (1 != netsnmp_row_merge_status_last(reginfo, agtreq_info)) { ++ DEBUGMSGTL(("internal:ipIfStatsTable", ++ "waiting for last post_request\n")); ++ return SNMP_ERR_NOERROR; ++ } ++ ++ packet_rc = netsnmp_check_all_requests_error(agtreq_info->asp, 0); ++ rc = ipIfStatsTable_post_request(ipIfStatsTable_if_ctx.user_ctx, ++ packet_rc); ++ if (MFD_SUCCESS != rc) { ++ /* ++ * nothing we can do about it but log it ++ */ ++ DEBUGMSGTL(("ipIfStatsTable", "error %d from " ++ "ipIfStatsTable_post_request\n", rc)); ++ } ++ ++ return SNMP_ERR_NOERROR; ++} /* _mfd_ipIfStatsTable_post_request */ ++ ++/** ++ * @internal ++ * wrapper ++ */ ++static int ++_mfd_ipIfStatsTable_object_lookup(netsnmp_mib_handler *handler, ++ netsnmp_handler_registration *reginfo, ++ netsnmp_agent_request_info *agtreq_info, ++ netsnmp_request_info *requests) ++{ ++ int rc = SNMP_ERR_NOERROR; ++ ipIfStatsTable_rowreq_ctx *rowreq_ctx = ++ netsnmp_container_table_row_extract(requests); ++ ++ DEBUGMSGTL(("internal:ipIfStatsTable:_mfd_ipIfStatsTable_object_lookup", "called\n")); ++ ++ /* ++ * get our context from mfd ++ * ipIfStatsTable_interface_ctx *if_ctx = ++ * (ipIfStatsTable_interface_ctx *)reginfo->my_reg_void; ++ */ ++ ++ if (NULL == rowreq_ctx) { ++ rc = SNMP_ERR_NOCREATION; ++ } ++ ++ if (MFD_SUCCESS != rc) ++ netsnmp_request_set_error_all(requests, rc); ++ else ++ ipIfStatsTable_row_prep(rowreq_ctx); ++ ++ return SNMP_VALIDATE_ERR(rc); ++} /* _mfd_ipIfStatsTable_object_lookup */ ++ ++/*********************************************************************** ++ * ++ * GET processing ++ * ++ ***********************************************************************/ ++/* ++ * @internal ++ * Retrieve the value for a particular column ++ */ ++NETSNMP_STATIC_INLINE int ++_ipIfStatsTable_get_column(ipIfStatsTable_rowreq_ctx * rowreq_ctx, ++ netsnmp_variable_list * var, int column) ++{ ++ int rc = SNMPERR_SUCCESS; ++ ++ DEBUGMSGTL(("internal:ipIfStatsTable:_mfd_ipIfStatsTable_get_column", ++ "called for %d\n", column)); ++ ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ switch (column) { ++ ++ /* ++ * ipIfStatsInReceives(3)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_IPIFSTATSINRECEIVES: ++ var->val_len = sizeof(u_long); ++ var->type = ASN_COUNTER; ++ rc = ipIfStatsInReceives_get(rowreq_ctx, ++ (u_long *) var->val.string); ++ break; ++ ++ /* ++ * ipIfStatsHCInReceives(4)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_IPIFSTATSHCINRECEIVES: ++ var->val_len = sizeof(U64); ++ var->type = ASN_COUNTER64; ++ rc = ipIfStatsHCInReceives_get(rowreq_ctx, ++ (U64 *) var->val.string); ++ break; ++ ++ /* ++ * ipIfStatsInOctets(5)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_IPIFSTATSINOCTETS: ++ var->val_len = sizeof(u_long); ++ var->type = ASN_COUNTER; ++ rc = ipIfStatsInOctets_get(rowreq_ctx, (u_long *) var->val.string); ++ break; ++ ++ /* ++ * ipIfStatsHCInOctets(6)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_IPIFSTATSHCINOCTETS: ++ var->val_len = sizeof(U64); ++ var->type = ASN_COUNTER64; ++ rc = ipIfStatsHCInOctets_get(rowreq_ctx, (U64 *) var->val.string); ++ break; ++ ++ /* ++ * ipIfStatsInHdrErrors(7)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_IPIFSTATSINHDRERRORS: ++ var->val_len = sizeof(u_long); ++ var->type = ASN_COUNTER; ++ rc = ipIfStatsInHdrErrors_get(rowreq_ctx, ++ (u_long *) var->val.string); ++ break; ++ ++ /* ++ * ipIfStatsInNoRoutes(8)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_IPIFSTATSINNOROUTES: ++ var->val_len = sizeof(u_long); ++ var->type = ASN_COUNTER; ++ rc = ipIfStatsInNoRoutes_get(rowreq_ctx, ++ (u_long *) var->val.string); ++ break; ++ ++ /* ++ * ipIfStatsInAddrErrors(9)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_IPIFSTATSINADDRERRORS: ++ var->val_len = sizeof(u_long); ++ var->type = ASN_COUNTER; ++ rc = ipIfStatsInAddrErrors_get(rowreq_ctx, ++ (u_long *) var->val.string); ++ break; ++ ++ /* ++ * ipIfStatsInUnknownProtos(10)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_IPIFSTATSINUNKNOWNPROTOS: ++ var->val_len = sizeof(u_long); ++ var->type = ASN_COUNTER; ++ rc = ipIfStatsInUnknownProtos_get(rowreq_ctx, ++ (u_long *) var->val.string); ++ break; ++ ++ /* ++ * ipIfStatsInTruncatedPkts(11)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_IPIFSTATSINTRUNCATEDPKTS: ++ var->val_len = sizeof(u_long); ++ var->type = ASN_COUNTER; ++ rc = ipIfStatsInTruncatedPkts_get(rowreq_ctx, ++ (u_long *) var->val.string); ++ break; ++ ++ /* ++ * ipIfStatsInForwDatagrams(12)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_IPIFSTATSINFORWDATAGRAMS: ++ var->val_len = sizeof(u_long); ++ var->type = ASN_COUNTER; ++ rc = ipIfStatsInForwDatagrams_get(rowreq_ctx, ++ (u_long *) var->val.string); ++ break; ++ ++ /* ++ * ipIfStatsHCInForwDatagrams(13)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_IPIFSTATSHCINFORWDATAGRAMS: ++ var->val_len = sizeof(U64); ++ var->type = ASN_COUNTER64; ++ rc = ipIfStatsHCInForwDatagrams_get(rowreq_ctx, ++ (U64 *) var->val.string); ++ break; ++ ++ /* ++ * ipIfStatsReasmReqds(14)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_IPIFSTATSREASMREQDS: ++ var->val_len = sizeof(u_long); ++ var->type = ASN_COUNTER; ++ rc = ipIfStatsReasmReqds_get(rowreq_ctx, ++ (u_long *) var->val.string); ++ break; ++ ++ /* ++ * ipIfStatsReasmOKs(15)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_IPIFSTATSREASMOKS: ++ var->val_len = sizeof(u_long); ++ var->type = ASN_COUNTER; ++ rc = ipIfStatsReasmOKs_get(rowreq_ctx, (u_long *) var->val.string); ++ break; ++ ++ /* ++ * ipIfStatsReasmFails(16)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_IPIFSTATSREASMFAILS: ++ var->val_len = sizeof(u_long); ++ var->type = ASN_COUNTER; ++ rc = ipIfStatsReasmFails_get(rowreq_ctx, ++ (u_long *) var->val.string); ++ break; ++ ++ /* ++ * ipIfStatsInDiscards(17)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_IPIFSTATSINDISCARDS: ++ var->val_len = sizeof(u_long); ++ var->type = ASN_COUNTER; ++ rc = ipIfStatsInDiscards_get(rowreq_ctx, ++ (u_long *) var->val.string); ++ break; ++ ++ /* ++ * ipIfStatsInDelivers(18)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_IPIFSTATSINDELIVERS: ++ var->val_len = sizeof(u_long); ++ var->type = ASN_COUNTER; ++ rc = ipIfStatsInDelivers_get(rowreq_ctx, ++ (u_long *) var->val.string); ++ break; ++ ++ /* ++ * ipIfStatsHCInDelivers(19)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_IPIFSTATSHCINDELIVERS: ++ var->val_len = sizeof(U64); ++ var->type = ASN_COUNTER64; ++ rc = ipIfStatsHCInDelivers_get(rowreq_ctx, ++ (U64 *) var->val.string); ++ break; ++ ++ /* ++ * ipIfStatsOutRequests(20)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_IPIFSTATSOUTREQUESTS: ++ var->val_len = sizeof(u_long); ++ var->type = ASN_COUNTER; ++ rc = ipIfStatsOutRequests_get(rowreq_ctx, ++ (u_long *) var->val.string); ++ break; ++ ++ /* ++ * ipIfStatsHCOutRequests(21)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_IPIFSTATSHCOUTREQUESTS: ++ var->val_len = sizeof(U64); ++ var->type = ASN_COUNTER64; ++ rc = ipIfStatsHCOutRequests_get(rowreq_ctx, ++ (U64 *) var->val.string); ++ break; ++ ++ /* ++ * ipIfStatsOutForwDatagrams(23)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_IPIFSTATSOUTFORWDATAGRAMS: ++ var->val_len = sizeof(u_long); ++ var->type = ASN_COUNTER; ++ rc = ipIfStatsOutForwDatagrams_get(rowreq_ctx, ++ (u_long *) var->val.string); ++ break; ++ ++ /* ++ * ipIfStatsHCOutForwDatagrams(24)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_IPIFSTATSHCOUTFORWDATAGRAMS: ++ var->val_len = sizeof(U64); ++ var->type = ASN_COUNTER64; ++ rc = ipIfStatsHCOutForwDatagrams_get(rowreq_ctx, ++ (U64 *) var->val.string); ++ break; ++ ++ /* ++ * ipIfStatsOutDiscards(25)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_IPIFSTATSOUTDISCARDS: ++ var->val_len = sizeof(u_long); ++ var->type = ASN_COUNTER; ++ rc = ipIfStatsOutDiscards_get(rowreq_ctx, ++ (u_long *) var->val.string); ++ break; ++ ++ /* ++ * ipIfStatsOutFragReqds(26)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_IPIFSTATSOUTFRAGREQDS: ++ var->val_len = sizeof(u_long); ++ var->type = ASN_COUNTER; ++ rc = ipIfStatsOutFragReqds_get(rowreq_ctx, ++ (u_long *) var->val.string); ++ break; ++ ++ /* ++ * ipIfStatsOutFragOKs(27)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_IPIFSTATSOUTFRAGOKS: ++ var->val_len = sizeof(u_long); ++ var->type = ASN_COUNTER; ++ rc = ipIfStatsOutFragOKs_get(rowreq_ctx, ++ (u_long *) var->val.string); ++ break; ++ ++ /* ++ * ipIfStatsOutFragFails(28)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_IPIFSTATSOUTFRAGFAILS: ++ var->val_len = sizeof(u_long); ++ var->type = ASN_COUNTER; ++ rc = ipIfStatsOutFragFails_get(rowreq_ctx, ++ (u_long *) var->val.string); ++ break; ++ ++ /* ++ * ipIfStatsOutFragCreates(29)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_IPIFSTATSOUTFRAGCREATES: ++ var->val_len = sizeof(u_long); ++ var->type = ASN_COUNTER; ++ rc = ipIfStatsOutFragCreates_get(rowreq_ctx, ++ (u_long *) var->val.string); ++ break; ++ ++ /* ++ * ipIfStatsOutTransmits(30)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_IPIFSTATSOUTTRANSMITS: ++ var->val_len = sizeof(u_long); ++ var->type = ASN_COUNTER; ++ rc = ipIfStatsOutTransmits_get(rowreq_ctx, ++ (u_long *) var->val.string); ++ break; ++ ++ /* ++ * ipIfStatsHCOutTransmits(31)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_IPIFSTATSHCOUTTRANSMITS: ++ var->val_len = sizeof(U64); ++ var->type = ASN_COUNTER64; ++ rc = ipIfStatsHCOutTransmits_get(rowreq_ctx, ++ (U64 *) var->val.string); ++ break; ++ ++ /* ++ * ipIfStatsOutOctets(32)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_IPIFSTATSOUTOCTETS: ++ var->val_len = sizeof(u_long); ++ var->type = ASN_COUNTER; ++ rc = ipIfStatsOutOctets_get(rowreq_ctx, ++ (u_long *) var->val.string); ++ break; ++ ++ /* ++ * ipIfStatsHCOutOctets(33)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_IPIFSTATSHCOUTOCTETS: ++ var->val_len = sizeof(U64); ++ var->type = ASN_COUNTER64; ++ rc = ipIfStatsHCOutOctets_get(rowreq_ctx, (U64 *) var->val.string); ++ break; ++ ++ /* ++ * ipIfStatsInMcastPkts(34)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_IPIFSTATSINMCASTPKTS: ++ var->val_len = sizeof(u_long); ++ var->type = ASN_COUNTER; ++ rc = ipIfStatsInMcastPkts_get(rowreq_ctx, ++ (u_long *) var->val.string); ++ break; ++ ++ /* ++ * ipIfStatsHCInMcastPkts(35)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_IPIFSTATSHCINMCASTPKTS: ++ var->val_len = sizeof(U64); ++ var->type = ASN_COUNTER64; ++ rc = ipIfStatsHCInMcastPkts_get(rowreq_ctx, ++ (U64 *) var->val.string); ++ break; ++ ++ /* ++ * ipIfStatsInMcastOctets(36)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_IPIFSTATSINMCASTOCTETS: ++ var->val_len = sizeof(u_long); ++ var->type = ASN_COUNTER; ++ rc = ipIfStatsInMcastOctets_get(rowreq_ctx, ++ (u_long *) var->val.string); ++ break; ++ ++ /* ++ * ipIfStatsHCInMcastOctets(37)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_IPIFSTATSHCINMCASTOCTETS: ++ var->val_len = sizeof(U64); ++ var->type = ASN_COUNTER64; ++ rc = ipIfStatsHCInMcastOctets_get(rowreq_ctx, ++ (U64 *) var->val.string); ++ break; ++ ++ /* ++ * ipIfStatsOutMcastPkts(38)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_IPIFSTATSOUTMCASTPKTS: ++ var->val_len = sizeof(u_long); ++ var->type = ASN_COUNTER; ++ rc = ipIfStatsOutMcastPkts_get(rowreq_ctx, ++ (u_long *) var->val.string); ++ break; ++ ++ /* ++ * ipIfStatsHCOutMcastPkts(39)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_IPIFSTATSHCOUTMCASTPKTS: ++ var->val_len = sizeof(U64); ++ var->type = ASN_COUNTER64; ++ rc = ipIfStatsHCOutMcastPkts_get(rowreq_ctx, ++ (U64 *) var->val.string); ++ break; ++ ++ /* ++ * ipIfStatsOutMcastOctets(40)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_IPIFSTATSOUTMCASTOCTETS: ++ var->val_len = sizeof(u_long); ++ var->type = ASN_COUNTER; ++ rc = ipIfStatsOutMcastOctets_get(rowreq_ctx, ++ (u_long *) var->val.string); ++ break; ++ ++ /* ++ * ipIfStatsHCOutMcastOctets(41)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_IPIFSTATSHCOUTMCASTOCTETS: ++ var->val_len = sizeof(U64); ++ var->type = ASN_COUNTER64; ++ rc = ipIfStatsHCOutMcastOctets_get(rowreq_ctx, ++ (U64 *) var->val.string); ++ break; ++ ++ /* ++ * ipIfStatsInBcastPkts(42)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_IPIFSTATSINBCASTPKTS: ++ var->val_len = sizeof(u_long); ++ var->type = ASN_COUNTER; ++ rc = ipIfStatsInBcastPkts_get(rowreq_ctx, ++ (u_long *) var->val.string); ++ break; ++ ++ /* ++ * ipIfStatsHCInBcastPkts(43)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_IPIFSTATSHCINBCASTPKTS: ++ var->val_len = sizeof(U64); ++ var->type = ASN_COUNTER64; ++ rc = ipIfStatsHCInBcastPkts_get(rowreq_ctx, ++ (U64 *) var->val.string); ++ break; ++ ++ /* ++ * ipIfStatsOutBcastPkts(44)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_IPIFSTATSOUTBCASTPKTS: ++ var->val_len = sizeof(u_long); ++ var->type = ASN_COUNTER; ++ rc = ipIfStatsOutBcastPkts_get(rowreq_ctx, ++ (u_long *) var->val.string); ++ break; ++ ++ /* ++ * ipIfStatsHCOutBcastPkts(45)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_IPIFSTATSHCOUTBCASTPKTS: ++ var->val_len = sizeof(U64); ++ var->type = ASN_COUNTER64; ++ rc = ipIfStatsHCOutBcastPkts_get(rowreq_ctx, ++ (U64 *) var->val.string); ++ break; ++ ++ /* ++ * ipIfStatsDiscontinuityTime(46)/TimeStamp/ASN_TIMETICKS/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_IPIFSTATSDISCONTINUITYTIME: ++ var->val_len = sizeof(u_long); ++ var->type = ASN_TIMETICKS; ++ rc = ipIfStatsDiscontinuityTime_get(rowreq_ctx, ++ (u_long *) var->val.string); ++ break; ++ ++ /* ++ * ipIfStatsRefreshRate(47)/UNSIGNED32/ASN_UNSIGNED/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_IPIFSTATSREFRESHRATE: ++ var->val_len = sizeof(u_long); ++ var->type = ASN_UNSIGNED; ++ rc = ipIfStatsRefreshRate_get(rowreq_ctx, ++ (u_long *) var->val.string); ++ break; ++ ++ default: ++ if (IPIFSTATSTABLE_MIN_COL <= column ++ && column <= IPIFSTATSTABLE_MAX_COL) { ++ DEBUGMSGTL(("internal:ipIfStatsTable:_mfd_ipIfStatsTable_get_column", "assume column %d is reserved\n", column)); ++ rc = MFD_SKIP; ++ } else { ++ snmp_log(LOG_ERR, ++ "unknown column %d in _ipIfStatsTable_get_column\n", ++ column); ++ } ++ break; ++ } ++ ++ return rc; ++} /* _ipIfStatsTable_get_column */ ++ ++int ++_mfd_ipIfStatsTable_get_values(netsnmp_mib_handler *handler, ++ netsnmp_handler_registration *reginfo, ++ netsnmp_agent_request_info *agtreq_info, ++ netsnmp_request_info *requests) ++{ ++ ipIfStatsTable_rowreq_ctx *rowreq_ctx = ++ netsnmp_container_table_row_extract(requests); ++ netsnmp_table_request_info *tri; ++ u_char *old_string; ++ void (*dataFreeHook) (void *); ++ int rc; ++ ++ DEBUGMSGTL(("internal:ipIfStatsTable:_mfd_ipIfStatsTable_get_values", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ for (; requests; requests = requests->next) { ++ /* ++ * save old pointer, so we can free it if replaced ++ */ ++ old_string = requests->requestvb->val.string; ++ dataFreeHook = requests->requestvb->dataFreeHook; ++ if (NULL == requests->requestvb->val.string) { ++ requests->requestvb->val.string = requests->requestvb->buf; ++ requests->requestvb->val_len = ++ sizeof(requests->requestvb->buf); ++ } else if (requests->requestvb->buf == ++ requests->requestvb->val.string) { ++ if (requests->requestvb->val_len != ++ sizeof(requests->requestvb->buf)) ++ requests->requestvb->val_len = ++ sizeof(requests->requestvb->buf); ++ } ++ ++ /* ++ * get column data ++ */ ++ tri = netsnmp_extract_table_info(requests); ++ if (NULL == tri) ++ continue; ++ ++ rc = _ipIfStatsTable_get_column(rowreq_ctx, requests->requestvb, ++ tri->colnum); ++ if (rc) { ++ if (MFD_SKIP == rc) { ++ requests->requestvb->type = SNMP_NOSUCHINSTANCE; ++ rc = SNMP_ERR_NOERROR; ++ } ++ } else if (NULL == requests->requestvb->val.string) { ++ snmp_log(LOG_ERR, "NULL varbind data pointer!\n"); ++ rc = SNMP_ERR_GENERR; ++ } ++ if (rc) ++ netsnmp_request_set_error(requests, SNMP_VALIDATE_ERR(rc)); ++ ++ /* ++ * if the buffer wasn't used previously for the old data (i.e. it ++ * was allcoated memory) and the get routine replaced the pointer, ++ * we need to free the previous pointer. ++ */ ++ if (old_string && (old_string != requests->requestvb->buf) && ++ (requests->requestvb->val.string != old_string)) { ++ if (dataFreeHook) ++ (*dataFreeHook) (old_string); ++ else ++ free(old_string); ++ } ++ } /* for results */ ++ ++ return SNMP_ERR_NOERROR; ++} /* _mfd_ipIfStatsTable_get_values */ ++ ++ ++/*********************************************************************** ++ * ++ * SET processing ++ * ++ ***********************************************************************/ ++ ++/* ++ * SET PROCESSING NOT APPLICABLE (per MIB or user setting) ++ */ ++/*********************************************************************** ++ * ++ * DATA ACCESS ++ * ++ ***********************************************************************/ ++static void _container_free(netsnmp_container * container); ++ ++/** ++ * @internal ++ */ ++static int ++_cache_load(netsnmp_cache * cache, void *vmagic) ++{ ++ DEBUGMSGTL(("internal:ipIfStatsTable:_cache_load", "called\n")); ++ ++ if ((NULL == cache) || (NULL == cache->magic)) { ++ snmp_log(LOG_ERR, "invalid cache for ipIfStatsTable_cache_load\n"); ++ return -1; ++ } ++ ++ /** should only be called for an invalid or expired cache */ ++ netsnmp_assert((0 == cache->valid) || (1 == cache->expired)); ++ ++ /* ++ * call user code ++ */ ++ return ipIfStatsTable_container_load((netsnmp_container *) cache-> ++ magic); ++} /* _cache_load */ ++ ++/** ++ * @internal ++ */ ++static void ++_cache_free(netsnmp_cache * cache, void *magic) ++{ ++ netsnmp_container *container; ++ ++ DEBUGMSGTL(("internal:ipIfStatsTable:_cache_free", "called\n")); ++ ++ if ((NULL == cache) || (NULL == cache->magic)) { ++ snmp_log(LOG_ERR, "invalid cache in ipIfStatsTable_cache_free\n"); ++ return; ++ } ++ ++ container = (netsnmp_container *) cache->magic; ++ ++ _container_free(container); ++} /* _cache_free */ ++ ++/** ++ * @internal ++ */ ++static void ++_container_item_free(ipIfStatsTable_rowreq_ctx * rowreq_ctx, void *context) ++{ ++ DEBUGMSGTL(("internal:ipIfStatsTable:_container_item_free", ++ "called\n")); ++ ++ if (NULL == rowreq_ctx) ++ return; ++ ++ ipIfStatsTable_release_rowreq_ctx(rowreq_ctx); ++} /* _container_item_free */ ++ ++/** ++ * @internal ++ */ ++static void ++_container_free(netsnmp_container * container) ++{ ++ DEBUGMSGTL(("internal:ipIfStatsTable:_container_free", "called\n")); ++ ++ if (NULL == container) { ++ snmp_log(LOG_ERR, ++ "invalid container in ipIfStatsTable_container_free\n"); ++ return; ++ } ++ ++ /* ++ * call user code ++ */ ++ ipIfStatsTable_container_free(container); ++ ++ /* ++ * free all items. inefficient, but easy. ++ */ ++ CONTAINER_CLEAR(container, ++ (netsnmp_container_obj_func *) _container_item_free, ++ NULL); ++} /* _container_free */ ++ ++/** ++ * @internal ++ * initialize the container with functions or wrappers ++ */ ++void ++_ipIfStatsTable_container_init(ipIfStatsTable_interface_ctx * if_ctx) ++{ ++ DEBUGMSGTL(("internal:ipIfStatsTable:_ipIfStatsTable_container_init", ++ "called\n")); ++ ++ /* ++ * cache init ++ */ ++ if_ctx->cache = netsnmp_cache_create(30, /* timeout in seconds */ ++ _cache_load, _cache_free, ++ ipIfStatsTable_oid, ++ ipIfStatsTable_oid_size); ++ ++ if (NULL == if_ctx->cache) { ++ snmp_log(LOG_ERR, "error creating cache for ipIfStatsTable\n"); ++ return; ++ } ++ ++ if_ctx->cache->flags = NETSNMP_CACHE_DONT_INVALIDATE_ON_SET; ++ ++ ipIfStatsTable_container_init(&if_ctx->container, if_ctx->cache); ++ if (NULL == if_ctx->container) ++ if_ctx->container = ++ netsnmp_container_find("ipIfStatsTable:table_container"); ++ if (NULL == if_ctx->container) { ++ snmp_log(LOG_ERR, "error creating container in " ++ "ipIfStatsTable_container_init\n"); ++ return; ++ } ++ ++ if (NULL != if_ctx->cache) ++ if_ctx->cache->magic = (void *) if_ctx->container; ++} /* _ipIfStatsTable_container_init */ ++ ++/** ++ * @internal ++ * shutdown the container with functions or wrappers ++ */ ++void ++_ipIfStatsTable_container_shutdown(ipIfStatsTable_interface_ctx * if_ctx) ++{ ++ DEBUGMSGTL(("internal:ipIfStatsTable:_ipIfStatsTable_container_shutdown", "called\n")); ++ ++ ipIfStatsTable_container_shutdown(if_ctx->container); ++ ++ _container_free(if_ctx->container); ++ ++} /* _ipIfStatsTable_container_shutdown */ ++ ++ ++ipIfStatsTable_rowreq_ctx * ++ipIfStatsTable_row_find_by_mib_index(ipIfStatsTable_mib_index * mib_idx) ++{ ++ ipIfStatsTable_rowreq_ctx *rowreq_ctx; ++ oid oid_tmp[MAX_OID_LEN]; ++ netsnmp_index oid_idx; ++ int rc; ++ ++ /* ++ * set up storage for OID ++ */ ++ oid_idx.oids = oid_tmp; ++ oid_idx.len = sizeof(oid_tmp) / sizeof(oid); ++ ++ /* ++ * convert ++ */ ++ rc = ipIfStatsTable_index_to_oid(&oid_idx, mib_idx); ++ if (MFD_SUCCESS != rc) ++ return NULL; ++ ++ rowreq_ctx = CONTAINER_FIND(ipIfStatsTable_if_ctx.container, &oid_idx); ++ ++ return rowreq_ctx; ++} +diff --git a/agent/mibgroup/ip-mib/ipIfStatsTable/ipIfStatsTable_interface.h b/agent/mibgroup/ip-mib/ipIfStatsTable/ipIfStatsTable_interface.h +new file mode 100644 +index 0000000..c43de84 +--- /dev/null ++++ b/agent/mibgroup/ip-mib/ipIfStatsTable/ipIfStatsTable_interface.h +@@ -0,0 +1,99 @@ ++/* ++ * Note: this file originally auto-generated by mib2c using ++ * version : 15899 $ of $ ++ * ++ * $Id:$ ++ */ ++/** @ingroup interface: Routines to interface to Net-SNMP ++ * ++ * \warning This code should not be modified, called directly, ++ * or used to interpret functionality. It is subject to ++ * change at any time. ++ * ++ * @{ ++ */ ++/* ++ * ********************************************************************* ++ * ********************************************************************* ++ * ********************************************************************* ++ * *** *** ++ * *** NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE *** ++ * *** *** ++ * *** *** ++ * *** THIS FILE DOES NOT CONTAIN ANY USER EDITABLE CODE. *** ++ * *** *** ++ * *** *** ++ * *** THE GENERATED CODE IS INTERNAL IMPLEMENTATION, AND *** ++ * *** *** ++ * *** *** ++ * *** IS SUBJECT TO CHANGE WITHOUT WARNING IN FUTURE RELEASES. *** ++ * *** *** ++ * *** *** ++ * ********************************************************************* ++ * ********************************************************************* ++ * ********************************************************************* ++ */ ++#ifndef IPIFSTATSTABLE_INTERFACE_H ++#define IPIFSTATSTABLE_INTERFACE_H ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++ ++#include "ipIfStatsTable.h" ++ ++ ++ /* ++ ******************************************************************** ++ * Table declarations ++ */ ++ ++ /* ++ * PUBLIC interface initialization routine ++ */ ++ void ++ _ipIfStatsTable_initialize_interface(ipIfStatsTable_registration * ++ user_ctx, u_long flags); ++ void ++ _ipIfStatsTable_shutdown_interface(ipIfStatsTable_registration * ++ user_ctx); ++ ++ ipIfStatsTable_registration *ipIfStatsTable_registration_get(void); ++ ++ ipIfStatsTable_registration ++ *ipIfStatsTable_registration_set(ipIfStatsTable_registration * ++ newreg); ++ ++ netsnmp_container *ipIfStatsTable_container_get(void); ++ int ipIfStatsTable_container_size(void); ++ ++ ipIfStatsTable_rowreq_ctx ++ *ipIfStatsTable_allocate_rowreq_ctx(ipIfStatsTable_data *, void *); ++ void ++ ipIfStatsTable_release_rowreq_ctx(ipIfStatsTable_rowreq_ctx * ++ rowreq_ctx); ++ ++ int ipIfStatsTable_index_to_oid(netsnmp_index * oid_idx, ++ ipIfStatsTable_mib_index * ++ mib_idx); ++ int ipIfStatsTable_index_from_oid(netsnmp_index * oid_idx, ++ ipIfStatsTable_mib_index ++ * mib_idx); ++ ++ /* ++ * access to certain internals. use with caution! ++ */ ++ void ipIfStatsTable_valid_columns_set(netsnmp_column_info ++ *vc); ++ ++ /* ++ */ ++ void ipIfStatsTable_lastChange_set(u_long uptime); ++ ++ ++#ifdef __cplusplus ++} ++#endif ++#endif /* IPIFSTATSTABLE_INTERFACE_H */ ++/** @} */ +diff --git a/agent/mibgroup/ip-mib/ipIfStatsTable/ipIfStatsTable_oids.h b/agent/mibgroup/ip-mib/ipIfStatsTable/ipIfStatsTable_oids.h +new file mode 100644 +index 0000000..76607a9 +--- /dev/null ++++ b/agent/mibgroup/ip-mib/ipIfStatsTable/ipIfStatsTable_oids.h +@@ -0,0 +1,122 @@ ++/* ++ * Note: this file originally auto-generated by mib2c using ++ * : generic-table-oids.m2c 12855 2005-09-27 15:56:08Z rstory $ ++ * ++ * $Id:$ ++ */ ++#ifndef IPIFSTATSTABLE_OIDS_H ++#define IPIFSTATSTABLE_OIDS_H ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++ ++ /* ++ * column number definitions for table ipIfStatsTable ++ */ ++#define IPIFSTATSTABLE_OID 1,3,6,1,2,1,4,31,3 ++#define IPIFSTATSTABLELASTCHANGE_OID 1,3,6,1,2,1,4,31,2 ++ ++#define COLUMN_IPIFSTATSIPVERSION 1 ++ ++#define COLUMN_IPIFSTATSIFINDEX 2 ++ ++#define COLUMN_IPIFSTATSINRECEIVES 3 ++ ++#define COLUMN_IPIFSTATSHCINRECEIVES 4 ++ ++#define COLUMN_IPIFSTATSINOCTETS 5 ++ ++#define COLUMN_IPIFSTATSHCINOCTETS 6 ++ ++#define COLUMN_IPIFSTATSINHDRERRORS 7 ++ ++#define COLUMN_IPIFSTATSINNOROUTES 8 ++ ++#define COLUMN_IPIFSTATSINADDRERRORS 9 ++ ++#define COLUMN_IPIFSTATSINUNKNOWNPROTOS 10 ++ ++#define COLUMN_IPIFSTATSINTRUNCATEDPKTS 11 ++ ++#define COLUMN_IPIFSTATSINFORWDATAGRAMS 12 ++ ++#define COLUMN_IPIFSTATSHCINFORWDATAGRAMS 13 ++ ++#define COLUMN_IPIFSTATSREASMREQDS 14 ++ ++#define COLUMN_IPIFSTATSREASMOKS 15 ++ ++#define COLUMN_IPIFSTATSREASMFAILS 16 ++ ++#define COLUMN_IPIFSTATSINDISCARDS 17 ++ ++#define COLUMN_IPIFSTATSINDELIVERS 18 ++ ++#define COLUMN_IPIFSTATSHCINDELIVERS 19 ++ ++#define COLUMN_IPIFSTATSOUTREQUESTS 20 ++ ++#define COLUMN_IPIFSTATSHCOUTREQUESTS 21 ++ ++#define COLUMN_IPIFSTATSOUTFORWDATAGRAMS 23 ++ ++#define COLUMN_IPIFSTATSHCOUTFORWDATAGRAMS 24 ++ ++#define COLUMN_IPIFSTATSOUTDISCARDS 25 ++ ++#define COLUMN_IPIFSTATSOUTFRAGREQDS 26 ++ ++#define COLUMN_IPIFSTATSOUTFRAGOKS 27 ++ ++#define COLUMN_IPIFSTATSOUTFRAGFAILS 28 ++ ++#define COLUMN_IPIFSTATSOUTFRAGCREATES 29 ++ ++#define COLUMN_IPIFSTATSOUTTRANSMITS 30 ++ ++#define COLUMN_IPIFSTATSHCOUTTRANSMITS 31 ++ ++#define COLUMN_IPIFSTATSOUTOCTETS 32 ++ ++#define COLUMN_IPIFSTATSHCOUTOCTETS 33 ++ ++#define COLUMN_IPIFSTATSINMCASTPKTS 34 ++ ++#define COLUMN_IPIFSTATSHCINMCASTPKTS 35 ++ ++#define COLUMN_IPIFSTATSINMCASTOCTETS 36 ++ ++#define COLUMN_IPIFSTATSHCINMCASTOCTETS 37 ++ ++#define COLUMN_IPIFSTATSOUTMCASTPKTS 38 ++ ++#define COLUMN_IPIFSTATSHCOUTMCASTPKTS 39 ++ ++#define COLUMN_IPIFSTATSOUTMCASTOCTETS 40 ++ ++#define COLUMN_IPIFSTATSHCOUTMCASTOCTETS 41 ++ ++#define COLUMN_IPIFSTATSINBCASTPKTS 42 ++ ++#define COLUMN_IPIFSTATSHCINBCASTPKTS 43 ++ ++#define COLUMN_IPIFSTATSOUTBCASTPKTS 44 ++ ++#define COLUMN_IPIFSTATSHCOUTBCASTPKTS 45 ++ ++#define COLUMN_IPIFSTATSDISCONTINUITYTIME 46 ++ ++#define COLUMN_IPIFSTATSREFRESHRATE 47 ++ ++ ++#define IPIFSTATSTABLE_MIN_COL COLUMN_IPIFSTATSINRECEIVES ++#define IPIFSTATSTABLE_MAX_COL COLUMN_IPIFSTATSREFRESHRATE ++ ++ ++ ++#ifdef __cplusplus ++} ++#endif ++#endif /* IPIFSTATSTABLE_OIDS_H */ +diff --git a/agent/mibgroup/ip-mib/ipSystemStatsTable/ipSystemStatsTable.c b/agent/mibgroup/ip-mib/ipSystemStatsTable/ipSystemStatsTable.c +index 4b1acb1..28e8538 100644 +--- a/agent/mibgroup/ip-mib/ipSystemStatsTable/ipSystemStatsTable.c ++++ b/agent/mibgroup/ip-mib/ipSystemStatsTable/ipSystemStatsTable.c +@@ -387,11 +387,14 @@ ipSystemStatsInReceives_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx, + "called\n")); + + netsnmp_assert(NULL != rowreq_ctx); +- ++ + /* + * TODO:231:o: |-> Extract the current value of the ipSystemStatsInReceives data. + * copy (* ipSystemStatsInReceives_val_ptr ) from rowreq_ctx->data + */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_HCINRECEIVES]) ++ return MFD_SKIP; ++ + (*ipSystemStatsInReceives_val_ptr) = + rowreq_ctx->data->stats.HCInReceives.low; + +@@ -453,6 +456,9 @@ ipSystemStatsHCInReceives_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx, + * TODO:231:o: |-> copy ipSystemStatsHCInReceives data. + * get (* ipSystemStatsHCInReceives_val_ptr ).low and (* ipSystemStatsHCInReceives_val_ptr ).high from rowreq_ctx->data + */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_HCINRECEIVES]) ++ return MFD_SKIP; ++ + (*ipSystemStatsHCInReceives_val_ptr).low = + rowreq_ctx->data->stats.HCInReceives.low; + (*ipSystemStatsHCInReceives_val_ptr).high = +@@ -517,6 +523,9 @@ ipSystemStatsInOctets_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx, + * TODO:231:o: |-> Extract the current value of the ipSystemStatsInOctets data. + * copy (* ipSystemStatsInOctets_val_ptr ) from rowreq_ctx->data + */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_HCINOCTETS]) ++ return MFD_SKIP; ++ + (*ipSystemStatsInOctets_val_ptr) = + rowreq_ctx->data->stats.HCInOctets.low; + +@@ -574,6 +583,9 @@ ipSystemStatsHCInOctets_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx, + * TODO:231:o: |-> copy ipSystemStatsHCInOctets data. + * get (* ipSystemStatsHCInOctets_val_ptr ).low and (* ipSystemStatsHCInOctets_val_ptr ).high from rowreq_ctx->data + */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_HCINOCTETS]) ++ return MFD_SKIP; ++ + (*ipSystemStatsHCInOctets_val_ptr).low = + rowreq_ctx->data->stats.HCInOctets.low; + (*ipSystemStatsHCInOctets_val_ptr).high = +@@ -641,6 +653,9 @@ ipSystemStatsInHdrErrors_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx, + * TODO:231:o: |-> Extract the current value of the ipSystemStatsInHdrErrors data. + * copy (* ipSystemStatsInHdrErrors_val_ptr ) from rowreq_ctx->data + */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_INHDRERRORS]) ++ return MFD_SKIP; ++ + (*ipSystemStatsInHdrErrors_val_ptr) = + rowreq_ctx->data->stats.InHdrErrors; + +@@ -702,8 +717,11 @@ ipSystemStatsInNoRoutes_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx, + * TODO:231:o: |-> Extract the current value of the ipSystemStatsInNoRoutes data. + * copy (* ipSystemStatsInNoRoutes_val_ptr ) from rowreq_ctx->data + */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_HCINNOROUTES]) ++ return MFD_SKIP; ++ + (*ipSystemStatsInNoRoutes_val_ptr) = +- rowreq_ctx->data->stats.InNoRoutes; ++ rowreq_ctx->data->stats.HCInNoRoutes.low; + + return MFD_SUCCESS; + } /* ipSystemStatsInNoRoutes_get */ +@@ -769,6 +787,9 @@ ipSystemStatsInAddrErrors_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx, + * TODO:231:o: |-> Extract the current value of the ipSystemStatsInAddrErrors data. + * copy (* ipSystemStatsInAddrErrors_val_ptr ) from rowreq_ctx->data + */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_INADDRERRORS]) ++ return MFD_SKIP; ++ + (*ipSystemStatsInAddrErrors_val_ptr) = + rowreq_ctx->data->stats.InAddrErrors; + +@@ -840,6 +861,9 @@ ipSystemStatsInUnknownProtos_get(ipSystemStatsTable_rowreq_ctx * + * TODO:231:o: |-> Extract the current value of the ipSystemStatsInUnknownProtos data. + * copy (* ipSystemStatsInUnknownProtos_val_ptr ) from rowreq_ctx->data + */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_INUNKNOWNPROTOS]) ++ return MFD_SKIP; ++ + (*ipSystemStatsInUnknownProtos_val_ptr) = + rowreq_ctx->data->stats.InUnknownProtos; + +@@ -902,6 +926,9 @@ ipSystemStatsInTruncatedPkts_get(ipSystemStatsTable_rowreq_ctx * + * TODO:231:o: |-> Extract the current value of the ipSystemStatsInTruncatedPkts data. + * copy (* ipSystemStatsInTruncatedPkts_val_ptr ) from rowreq_ctx->data + */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_INTRUNCATEDPKTS]) ++ return MFD_SKIP; ++ + (*ipSystemStatsInTruncatedPkts_val_ptr) = + rowreq_ctx->data->stats.InTruncatedPkts; + +@@ -973,6 +1000,9 @@ ipSystemStatsInForwDatagrams_get(ipSystemStatsTable_rowreq_ctx * + * TODO:231:o: |-> Extract the current value of the ipSystemStatsInForwDatagrams data. + * copy (* ipSystemStatsInForwDatagrams_val_ptr ) from rowreq_ctx->data + */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_HCINFORWDATAGRAMS]) ++ return MFD_SKIP; ++ + (*ipSystemStatsInForwDatagrams_val_ptr) = + rowreq_ctx->data->stats.HCInForwDatagrams.low; + +@@ -1033,6 +1063,9 @@ ipSystemStatsHCInForwDatagrams_get(ipSystemStatsTable_rowreq_ctx * + * TODO:231:o: |-> copy ipSystemStatsHCInForwDatagrams data. + * get (* ipSystemStatsHCInForwDatagrams_val_ptr ).low and (* ipSystemStatsHCInForwDatagrams_val_ptr ).high from rowreq_ctx->data + */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_HCINFORWDATAGRAMS]) ++ return MFD_SKIP; ++ + (*ipSystemStatsHCInForwDatagrams_val_ptr).low = + rowreq_ctx->data->stats.HCInForwDatagrams.low; + (*ipSystemStatsHCInForwDatagrams_val_ptr).high = +@@ -1102,6 +1135,9 @@ ipSystemStatsReasmReqds_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx, + * TODO:231:o: |-> Extract the current value of the ipSystemStatsReasmReqds data. + * copy (* ipSystemStatsReasmReqds_val_ptr ) from rowreq_ctx->data + */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_REASMREQDS]) ++ return MFD_SKIP; ++ + (*ipSystemStatsReasmReqds_val_ptr) = + rowreq_ctx->data->stats.ReasmReqds; + +@@ -1172,6 +1208,9 @@ ipSystemStatsReasmOKs_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx, + * TODO:231:o: |-> Extract the current value of the ipSystemStatsReasmOKs data. + * copy (* ipSystemStatsReasmOKs_val_ptr ) from rowreq_ctx->data + */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_REASMOKS]) ++ return MFD_SKIP; ++ + (*ipSystemStatsReasmOKs_val_ptr) = rowreq_ctx->data->stats.ReasmOKs; + + return MFD_SUCCESS; +@@ -1242,6 +1281,9 @@ ipSystemStatsReasmFails_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx, + * TODO:231:o: |-> Extract the current value of the ipSystemStatsReasmFails data. + * copy (* ipSystemStatsReasmFails_val_ptr ) from rowreq_ctx->data + */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_REASMFAILS]) ++ return MFD_SKIP; ++ + (*ipSystemStatsReasmFails_val_ptr) = + rowreq_ctx->data->stats.ReasmFails; + +@@ -1306,6 +1348,9 @@ ipSystemStatsInDiscards_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx, + * TODO:231:o: |-> Extract the current value of the ipSystemStatsInDiscards data. + * copy (* ipSystemStatsInDiscards_val_ptr ) from rowreq_ctx->data + */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_INDISCARDS]) ++ return MFD_SKIP; ++ + (*ipSystemStatsInDiscards_val_ptr) = + rowreq_ctx->data->stats.InDiscards; + +@@ -1373,6 +1418,9 @@ ipSystemStatsInDelivers_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx, + * TODO:231:o: |-> Extract the current value of the ipSystemStatsInDelivers data. + * copy (* ipSystemStatsInDelivers_val_ptr ) from rowreq_ctx->data + */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_HCINDELIVERS]) ++ return MFD_SKIP; ++ + (*ipSystemStatsInDelivers_val_ptr) = + rowreq_ctx->data->stats.HCInDelivers.low; + +@@ -1430,6 +1478,9 @@ ipSystemStatsHCInDelivers_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx, + * TODO:231:o: |-> copy ipSystemStatsHCInDelivers data. + * get (* ipSystemStatsHCInDelivers_val_ptr ).low and (* ipSystemStatsHCInDelivers_val_ptr ).high from rowreq_ctx->data + */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_HCINDELIVERS]) ++ return MFD_SKIP; ++ + (*ipSystemStatsHCInDelivers_val_ptr).low = + rowreq_ctx->data->stats.HCInDelivers.low; + (*ipSystemStatsHCInDelivers_val_ptr).high = +@@ -1495,6 +1546,9 @@ ipSystemStatsOutRequests_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx, + * TODO:231:o: |-> Extract the current value of the ipSystemStatsOutRequests data. + * copy (* ipSystemStatsOutRequests_val_ptr ) from rowreq_ctx->data + */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTREQUESTS]) ++ return MFD_SKIP; ++ + (*ipSystemStatsOutRequests_val_ptr) = + rowreq_ctx->data->stats.HCOutRequests.low; + +@@ -1552,6 +1606,9 @@ ipSystemStatsHCOutRequests_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx, + * TODO:231:o: |-> copy ipSystemStatsHCOutRequests data. + * get (* ipSystemStatsHCOutRequests_val_ptr ).low and (* ipSystemStatsHCOutRequests_val_ptr ).high from rowreq_ctx->data + */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTREQUESTS]) ++ return MFD_SKIP; ++ + (*ipSystemStatsHCOutRequests_val_ptr).low = + rowreq_ctx->data->stats.HCOutRequests.low; + (*ipSystemStatsHCOutRequests_val_ptr).high = +@@ -1616,8 +1673,11 @@ ipSystemStatsOutNoRoutes_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx, + * TODO:231:o: |-> Extract the current value of the ipSystemStatsOutNoRoutes data. + * copy (* ipSystemStatsOutNoRoutes_val_ptr ) from rowreq_ctx->data + */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTNOROUTES]) ++ return MFD_SKIP; ++ + (*ipSystemStatsOutNoRoutes_val_ptr) = +- rowreq_ctx->data->stats.OutNoRoutes; ++ rowreq_ctx->data->stats.HCOutNoRoutes.low; + + return MFD_SUCCESS; + } /* ipSystemStatsOutNoRoutes_get */ +@@ -1691,6 +1751,9 @@ ipSystemStatsOutForwDatagrams_get(ipSystemStatsTable_rowreq_ctx * + * TODO:231:o: |-> Extract the current value of the ipSystemStatsOutForwDatagrams data. + * copy (* ipSystemStatsOutForwDatagrams_val_ptr ) from rowreq_ctx->data + */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTFORWDATAGRAMS]) ++ return MFD_SKIP; ++ + (*ipSystemStatsOutForwDatagrams_val_ptr) = + rowreq_ctx->data->stats.HCOutForwDatagrams.low; + +@@ -1751,6 +1814,9 @@ ipSystemStatsHCOutForwDatagrams_get(ipSystemStatsTable_rowreq_ctx * + * TODO:231:o: |-> copy ipSystemStatsHCOutForwDatagrams data. + * get (* ipSystemStatsHCOutForwDatagrams_val_ptr ).low and (* ipSystemStatsHCOutForwDatagrams_val_ptr ).high from rowreq_ctx->data + */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTFORWDATAGRAMS]) ++ return MFD_SKIP; ++ + (*ipSystemStatsHCOutForwDatagrams_val_ptr).low = + rowreq_ctx->data->stats.HCOutForwDatagrams.low; + (*ipSystemStatsHCOutForwDatagrams_val_ptr).high = +@@ -1818,8 +1884,11 @@ ipSystemStatsOutDiscards_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx, + * TODO:231:o: |-> Extract the current value of the ipSystemStatsOutDiscards data. + * copy (* ipSystemStatsOutDiscards_val_ptr ) from rowreq_ctx->data + */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTDISCARDS]) ++ return MFD_SKIP; ++ + (*ipSystemStatsOutDiscards_val_ptr) = +- rowreq_ctx->data->stats.OutDiscards; ++ rowreq_ctx->data->stats.HCOutDiscards.low; + + return MFD_SUCCESS; + } /* ipSystemStatsOutDiscards_get */ +@@ -1887,8 +1956,11 @@ ipSystemStatsOutFragReqds_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx, + * TODO:231:o: |-> Extract the current value of the ipSystemStatsOutFragReqds data. + * copy (* ipSystemStatsOutFragReqds_val_ptr ) from rowreq_ctx->data + */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTFRAGREQDS]) ++ return MFD_SKIP; ++ + (*ipSystemStatsOutFragReqds_val_ptr) = +- rowreq_ctx->data->stats.OutFragReqds; ++ rowreq_ctx->data->stats.HCOutFragReqds.low; + + return MFD_SUCCESS; + } /* ipSystemStatsOutFragReqds_get */ +@@ -1953,9 +2025,11 @@ ipSystemStatsOutFragOKs_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx, + * TODO:231:o: |-> Extract the current value of the ipSystemStatsOutFragOKs data. + * copy (* ipSystemStatsOutFragOKs_val_ptr ) from rowreq_ctx->data + */ +- snmp_log(LOG_ERR, +- "ipSystemStatsTable node ipSystemStatsOutFragOKs not implemented: skipping\n"); +- return MFD_SKIP; ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTFRAGOKS]) ++ return MFD_SKIP; ++ ++ (*ipSystemStatsOutFragOKs_val_ptr) = ++ rowreq_ctx->data->stats.HCOutFragOKs.low; + + return MFD_SUCCESS; + } /* ipSystemStatsOutFragOKs_get */ +@@ -2023,8 +2097,11 @@ ipSystemStatsOutFragFails_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx, + * TODO:231:o: |-> Extract the current value of the ipSystemStatsOutFragFails data. + * copy (* ipSystemStatsOutFragFails_val_ptr ) from rowreq_ctx->data + */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTFRAGFAILS]) ++ return MFD_SKIP; ++ + (*ipSystemStatsOutFragFails_val_ptr) = +- rowreq_ctx->data->stats.OutFragFails; ++ rowreq_ctx->data->stats.HCOutFragFails.low; + + return MFD_SUCCESS; + } /* ipSystemStatsOutFragFails_get */ +@@ -2089,8 +2166,11 @@ ipSystemStatsOutFragCreates_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx, + * TODO:231:o: |-> Extract the current value of the ipSystemStatsOutFragCreates data. + * copy (* ipSystemStatsOutFragCreates_val_ptr ) from rowreq_ctx->data + */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTFRAGCREATES]) ++ return MFD_SKIP; ++ + (*ipSystemStatsOutFragCreates_val_ptr) = +- rowreq_ctx->data->stats.OutFragCreates; ++ rowreq_ctx->data->stats.HCOutFragCreates.low; + + return MFD_SUCCESS; + } /* ipSystemStatsOutFragCreates_get */ +@@ -2152,6 +2232,9 @@ ipSystemStatsOutTransmits_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx, + * TODO:231:o: |-> Extract the current value of the ipSystemStatsOutTransmits data. + * copy (* ipSystemStatsOutTransmits_val_ptr ) from rowreq_ctx->data + */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTTRANSMITS]) ++ return MFD_SKIP; ++ + (*ipSystemStatsOutTransmits_val_ptr) = + rowreq_ctx->data->stats.HCOutTransmits.low; + +@@ -2209,6 +2292,9 @@ ipSystemStatsHCOutTransmits_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx, + * TODO:231:o: |-> copy ipSystemStatsHCOutTransmits data. + * get (* ipSystemStatsHCOutTransmits_val_ptr ).low and (* ipSystemStatsHCOutTransmits_val_ptr ).high from rowreq_ctx->data + */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTTRANSMITS]) ++ return MFD_SKIP; ++ + (*ipSystemStatsHCOutTransmits_val_ptr).low = + rowreq_ctx->data->stats.HCOutTransmits.low; + (*ipSystemStatsHCOutTransmits_val_ptr).high = +@@ -2273,6 +2359,9 @@ ipSystemStatsOutOctets_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx, + * TODO:231:o: |-> Extract the current value of the ipSystemStatsOutOctets data. + * copy (* ipSystemStatsOutOctets_val_ptr ) from rowreq_ctx->data + */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTOCTETS]) ++ return MFD_SKIP; ++ + (*ipSystemStatsOutOctets_val_ptr) = + rowreq_ctx->data->stats.HCOutOctets.low; + +@@ -2330,6 +2419,9 @@ ipSystemStatsHCOutOctets_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx, + * TODO:231:o: |-> copy ipSystemStatsHCOutOctets data. + * get (* ipSystemStatsHCOutOctets_val_ptr ).low and (* ipSystemStatsHCOutOctets_val_ptr ).high from rowreq_ctx->data + */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTOCTETS]) ++ return MFD_SKIP; ++ + (*ipSystemStatsHCOutOctets_val_ptr).low = + rowreq_ctx->data->stats.HCOutOctets.low; + (*ipSystemStatsHCOutOctets_val_ptr).high = +@@ -2392,6 +2484,9 @@ ipSystemStatsInMcastPkts_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx, + * TODO:231:o: |-> Extract the current value of the ipSystemStatsInMcastPkts data. + * copy (* ipSystemStatsInMcastPkts_val_ptr ) from rowreq_ctx->data + */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_HCINMCASTPKTS]) ++ return MFD_SKIP; ++ + (*ipSystemStatsInMcastPkts_val_ptr) = + rowreq_ctx->data->stats.HCInMcastPkts.low; + +@@ -2448,6 +2543,9 @@ ipSystemStatsHCInMcastPkts_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx, + * TODO:231:o: |-> copy ipSystemStatsHCInMcastPkts data. + * get (* ipSystemStatsHCInMcastPkts_val_ptr ).low and (* ipSystemStatsHCInMcastPkts_val_ptr ).high from rowreq_ctx->data + */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_HCINMCASTPKTS]) ++ return MFD_SKIP; ++ + (*ipSystemStatsHCInMcastPkts_val_ptr).low = + rowreq_ctx->data->stats.HCInMcastPkts.low; + (*ipSystemStatsHCInMcastPkts_val_ptr).high = +@@ -2511,6 +2609,9 @@ ipSystemStatsInMcastOctets_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx, + * TODO:231:o: |-> Extract the current value of the ipSystemStatsInMcastOctets data. + * copy (* ipSystemStatsInMcastOctets_val_ptr ) from rowreq_ctx->data + */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_HCINMCASTOCTETS]) ++ return MFD_SKIP; ++ + (*ipSystemStatsInMcastOctets_val_ptr) = + rowreq_ctx->data->stats.HCInMcastOctets.low; + +@@ -2569,6 +2670,9 @@ ipSystemStatsHCInMcastOctets_get(ipSystemStatsTable_rowreq_ctx * + * TODO:231:o: |-> copy ipSystemStatsHCInMcastOctets data. + * get (* ipSystemStatsHCInMcastOctets_val_ptr ).low and (* ipSystemStatsHCInMcastOctets_val_ptr ).high from rowreq_ctx->data + */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_HCINMCASTOCTETS]) ++ return MFD_SKIP; ++ + (*ipSystemStatsHCInMcastOctets_val_ptr).low = + rowreq_ctx->data->stats.HCInMcastOctets.low; + (*ipSystemStatsHCInMcastOctets_val_ptr).high = +@@ -2631,6 +2735,9 @@ ipSystemStatsOutMcastPkts_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx, + * TODO:231:o: |-> Extract the current value of the ipSystemStatsOutMcastPkts data. + * copy (* ipSystemStatsOutMcastPkts_val_ptr ) from rowreq_ctx->data + */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTMCASTPKTS]) ++ return MFD_SKIP; ++ + (*ipSystemStatsOutMcastPkts_val_ptr) = + rowreq_ctx->data->stats.HCOutMcastPkts.low; + +@@ -2687,6 +2794,9 @@ ipSystemStatsHCOutMcastPkts_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx, + * TODO:231:o: |-> copy ipSystemStatsHCOutMcastPkts data. + * get (* ipSystemStatsHCOutMcastPkts_val_ptr ).low and (* ipSystemStatsHCOutMcastPkts_val_ptr ).high from rowreq_ctx->data + */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTMCASTPKTS]) ++ return MFD_SKIP; ++ + (*ipSystemStatsHCOutMcastPkts_val_ptr).low = + rowreq_ctx->data->stats.HCOutMcastPkts.low; + (*ipSystemStatsHCOutMcastPkts_val_ptr).high = +@@ -2751,6 +2861,9 @@ ipSystemStatsOutMcastOctets_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx, + * TODO:231:o: |-> Extract the current value of the ipSystemStatsOutMcastOctets data. + * copy (* ipSystemStatsOutMcastOctets_val_ptr ) from rowreq_ctx->data + */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTMCASTOCTETS]) ++ return MFD_SKIP; ++ + (*ipSystemStatsOutMcastOctets_val_ptr) = + rowreq_ctx->data->stats.HCOutMcastOctets.low; + +@@ -2813,6 +2926,9 @@ ipSystemStatsHCOutMcastOctets_get(ipSystemStatsTable_rowreq_ctx * + * TODO:231:o: |-> copy ipSystemStatsHCOutMcastOctets data. + * get (* ipSystemStatsHCOutMcastOctets_val_ptr ).low and (* ipSystemStatsHCOutMcastOctets_val_ptr ).high from rowreq_ctx->data + */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTMCASTOCTETS]) ++ return MFD_SKIP; ++ + (*ipSystemStatsHCOutMcastOctets_val_ptr).low = + rowreq_ctx->data->stats.HCOutMcastOctets.low; + (*ipSystemStatsHCOutMcastOctets_val_ptr).high = +@@ -2875,6 +2991,9 @@ ipSystemStatsInBcastPkts_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx, + * TODO:231:o: |-> Extract the current value of the ipSystemStatsInBcastPkts data. + * copy (* ipSystemStatsInBcastPkts_val_ptr ) from rowreq_ctx->data + */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_HCINBCASTPKTS]) ++ return MFD_SKIP; ++ + (*ipSystemStatsInBcastPkts_val_ptr) = + rowreq_ctx->data->stats.HCInBcastPkts.low; + +@@ -2931,6 +3050,9 @@ ipSystemStatsHCInBcastPkts_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx, + * TODO:231:o: |-> copy ipSystemStatsHCInBcastPkts data. + * get (* ipSystemStatsHCInBcastPkts_val_ptr ).low and (* ipSystemStatsHCInBcastPkts_val_ptr ).high from rowreq_ctx->data + */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_HCINBCASTPKTS]) ++ return MFD_SKIP; ++ + (*ipSystemStatsHCInBcastPkts_val_ptr).low = + rowreq_ctx->data->stats.HCInBcastPkts.low; + (*ipSystemStatsHCInBcastPkts_val_ptr).high = +@@ -2993,6 +3115,9 @@ ipSystemStatsOutBcastPkts_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx, + * TODO:231:o: |-> Extract the current value of the ipSystemStatsOutBcastPkts data. + * copy (* ipSystemStatsOutBcastPkts_val_ptr ) from rowreq_ctx->data + */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTBCASTPKTS]) ++ return MFD_SKIP; ++ + (*ipSystemStatsOutBcastPkts_val_ptr) = + rowreq_ctx->data->stats.HCOutBcastPkts.low; + +@@ -3049,6 +3174,9 @@ ipSystemStatsHCOutBcastPkts_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx, + * TODO:231:o: |-> copy ipSystemStatsHCOutBcastPkts data. + * get (* ipSystemStatsHCOutBcastPkts_val_ptr ).low and (* ipSystemStatsHCOutBcastPkts_val_ptr ).high from rowreq_ctx->data + */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTBCASTPKTS]) ++ return MFD_SKIP; ++ + (*ipSystemStatsHCOutBcastPkts_val_ptr).low = + rowreq_ctx->data->stats.HCOutBcastPkts.low; + (*ipSystemStatsHCOutBcastPkts_val_ptr).high = +@@ -3113,6 +3241,9 @@ ipSystemStatsDiscontinuityTime_get(ipSystemStatsTable_rowreq_ctx * + * TODO:231:o: |-> Extract the current value of the ipSystemStatsDiscontinuityTime data. + * copy (* ipSystemStatsDiscontinuityTime_val_ptr ) from rowreq_ctx->data + */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_DISCONTINUITYTIME]) ++ return MFD_SKIP; ++ + (*ipSystemStatsDiscontinuityTime_val_ptr) = + rowreq_ctx->ipSystemStatsDiscontinuityTime; + +@@ -3169,6 +3300,9 @@ ipSystemStatsRefreshRate_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx, + * TODO:231:o: |-> Extract the current value of the ipSystemStatsRefreshRate data. + * copy (* ipSystemStatsRefreshRate_val_ptr ) from rowreq_ctx->data + */ ++ if (!rowreq_ctx->data->stats.columnAvail[IPSYSTEMSTATSTABLE_REFRESHRATE]) ++ return MFD_SKIP; ++ + (*ipSystemStatsRefreshRate_val_ptr) = + rowreq_ctx->ipSystemStatsRefreshRate; + +diff --git a/agent/mibgroup/ip-mib/ipSystemStatsTable/ipSystemStatsTable_data_access.c b/agent/mibgroup/ip-mib/ipSystemStatsTable/ipSystemStatsTable_data_access.c +index c1d257d..56d163d 100644 +--- a/agent/mibgroup/ip-mib/ipSystemStatsTable/ipSystemStatsTable_data_access.c ++++ b/agent/mibgroup/ip-mib/ipSystemStatsTable/ipSystemStatsTable_data_access.c +@@ -19,7 +19,7 @@ + + #include "ipSystemStatsTable_data_access.h" + +-static int ipss_cache_refresh = 30; ++static int ipss_cache_refresh = IPSYSTEMSTATSTABLE_CACHE_TIMEOUT; + + /** @ingroup interface + * @addtogroup data_access data_access: Routines to access data +@@ -58,61 +58,10 @@ int + ipSystemStatsTable_init_data(ipSystemStatsTable_registration * + ipSystemStatsTable_reg) + { +- static unsigned int my_columns[] = { +- COLUMN_IPSYSTEMSTATSINRECEIVES, COLUMN_IPSYSTEMSTATSHCINRECEIVES, +- /** COLUMN_IPSYSTEMSTATSINOCTETS, */ +- COLUMN_IPSYSTEMSTATSHCINOCTETS, +- COLUMN_IPSYSTEMSTATSINHDRERRORS, +- /** COLUMN_IPSYSTEMSTATSINNOROUTES, */ +- COLUMN_IPSYSTEMSTATSINADDRERRORS, +- COLUMN_IPSYSTEMSTATSINUNKNOWNPROTOS, +- /** COLUMN_IPSYSTEMSTATSINTRUNCATEDPKTS, */ +- COLUMN_IPSYSTEMSTATSINFORWDATAGRAMS, +- COLUMN_IPSYSTEMSTATSHCINFORWDATAGRAMS, +- COLUMN_IPSYSTEMSTATSREASMREQDS, +- COLUMN_IPSYSTEMSTATSREASMOKS, COLUMN_IPSYSTEMSTATSREASMFAILS, +- COLUMN_IPSYSTEMSTATSINDISCARDS, COLUMN_IPSYSTEMSTATSINDELIVERS, +- COLUMN_IPSYSTEMSTATSHCINDELIVERS, COLUMN_IPSYSTEMSTATSOUTREQUESTS, +- COLUMN_IPSYSTEMSTATSHCOUTREQUESTS, COLUMN_IPSYSTEMSTATSOUTNOROUTES, +- /** COLUMN_IPSYSTEMSTATSOUTFORWDATAGRAMS, */ +- COLUMN_IPSYSTEMSTATSHCOUTFORWDATAGRAMS, +- COLUMN_IPSYSTEMSTATSOUTDISCARDS, +- /** COLUMN_IPSYSTEMSTATSOUTFRAGREQDS, */ +- COLUMN_IPSYSTEMSTATSOUTFRAGOKS, COLUMN_IPSYSTEMSTATSOUTFRAGFAILS, +- COLUMN_IPSYSTEMSTATSOUTFRAGCREATES, +- /** COLUMN_IPSYSTEMSTATSOUTTRANSMITS, */ +- /** COLUMN_IPSYSTEMSTATSHCOUTTRANSMITS, */ +- /** COLUMN_IPSYSTEMSTATSOUTOCTETS, */ +- /** COLUMN_IPSYSTEMSTATSHCOUTOCTETS, */ +- /** COLUMN_IPSYSTEMSTATSINMCASTPKTS, */ +- /** COLUMN_IPSYSTEMSTATSHCINMCASTPKTS, */ +- /** COLUMN_IPSYSTEMSTATSINMCASTOCTETS, */ +- /** COLUMN_IPSYSTEMSTATSHCINMCASTOCTETS, */ +- /** COLUMN_IPSYSTEMSTATSOUTMCASTPKTS, */ +- /** COLUMN_IPSYSTEMSTATSHCOUTMCASTPKTS, */ +- /** COLUMN_IPSYSTEMSTATSOUTMCASTOCTETS, */ +- /** COLUMN_IPSYSTEMSTATSHCOUTMCASTOCTETS, */ +- /** COLUMN_IPSYSTEMSTATSINBCASTPKTS, */ +- /** COLUMN_IPSYSTEMSTATSHCINBCASTPKTS, */ +- /** COLUMN_IPSYSTEMSTATSOUTBCASTPKTS, */ +- /** COLUMN_IPSYSTEMSTATSHCOUTBCASTPKTS, */ +- COLUMN_IPSYSTEMSTATSDISCONTINUITYTIME, +- COLUMN_IPSYSTEMSTATSREFRESHRATE +- }; +- static netsnmp_column_info valid_columns; +- + DEBUGMSGTL(("verbose:ipSystemStatsTable:ipSystemStatsTable_init_data", + "called\n")); + + /* +- * we only want to process certain columns, and ignore +- * anything else. +- */ +- valid_columns.isRange = 0; +- valid_columns.details.list = my_columns; +- valid_columns.list_count = sizeof(my_columns) / sizeof(unsigned int); +- ipSystemStatsTable_valid_columns_set(&valid_columns); +- /* + * TODO:303:o: Initialize ipSystemStatsTable data. + */ + +@@ -166,7 +115,9 @@ ipSystemStatsTable_container_init(netsnmp_container **container_ptr_ptr, + * For advanced users, you can use a custom container. If you + * do not create one, one will be created for you. + */ +- *container_ptr_ptr = NULL; ++ ++ ++ *container_ptr_ptr = netsnmp_container_find("ipSystemStatsTable:table_container"); + + if (NULL == cache) { + snmp_log(LOG_ERR, +@@ -191,6 +142,7 @@ ipSystemStatsTable_container_init(netsnmp_container **container_ptr_ptr, + (NETSNMP_CACHE_DONT_AUTO_RELEASE | NETSNMP_CACHE_DONT_FREE_EXPIRED + | NETSNMP_CACHE_DONT_FREE_BEFORE_LOAD | + NETSNMP_CACHE_AUTO_RELOAD); ++ ipSystemStatsTable_container_load(*container_ptr_ptr); + } /* ipSystemStatsTable_container_init */ + + /** +@@ -266,7 +218,7 @@ _add_new(netsnmp_systemstats_entry *systemstats_entry, + && (MFD_SUCCESS == + ipSystemStatsTable_indexes_set(rowreq_ctx, + systemstats_entry-> +- ns_ip_version))) { ++ index[0]))) { + rowreq_ctx->ipSystemStatsRefreshRate = ipss_cache_refresh * 1000; /* milli-seconds */ + CONTAINER_INSERT(container, rowreq_ctx); + } else { +diff --git a/include/net-snmp/data_access/ipstats.h b/include/net-snmp/data_access/ipstats.h +index 0e7aa1e..0e1bc21 100644 +--- a/include/net-snmp/data_access/ipstats.h ++++ b/include/net-snmp/data_access/ipstats.h +@@ -10,6 +10,40 @@ + extern "C" { + #endif + ++#define IPSYSTEMSTATSTABLE_HCINRECEIVES 1 ++#define IPSYSTEMSTATSTABLE_HCINOCTETS 2 ++#define IPSYSTEMSTATSTABLE_INHDRERRORS 3 ++#define IPSYSTEMSTATSTABLE_HCINNOROUTES 4 ++#define IPSYSTEMSTATSTABLE_INADDRERRORS 5 ++#define IPSYSTEMSTATSTABLE_INUNKNOWNPROTOS 6 ++#define IPSYSTEMSTATSTABLE_INTRUNCATEDPKTS 7 ++#define IPSYSTEMSTATSTABLE_HCINFORWDATAGRAMS 8 ++#define IPSYSTEMSTATSTABLE_REASMREQDS 9 ++#define IPSYSTEMSTATSTABLE_REASMOKS 10 ++#define IPSYSTEMSTATSTABLE_REASMFAILS 11 ++#define IPSYSTEMSTATSTABLE_INDISCARDS 12 ++#define IPSYSTEMSTATSTABLE_HCINDELIVERS 13 ++#define IPSYSTEMSTATSTABLE_HCOUTREQUESTS 14 ++#define IPSYSTEMSTATSTABLE_HCOUTNOROUTES 15 ++#define IPSYSTEMSTATSTABLE_HCOUTFORWDATAGRAMS 16 ++#define IPSYSTEMSTATSTABLE_HCOUTDISCARDS 17 ++#define IPSYSTEMSTATSTABLE_HCOUTFRAGREQDS 18 ++#define IPSYSTEMSTATSTABLE_HCOUTFRAGOKS 19 ++#define IPSYSTEMSTATSTABLE_HCOUTFRAGFAILS 20 ++#define IPSYSTEMSTATSTABLE_HCOUTFRAGCREATES 21 ++#define IPSYSTEMSTATSTABLE_HCOUTTRANSMITS 22 ++#define IPSYSTEMSTATSTABLE_HCOUTOCTETS 23 ++#define IPSYSTEMSTATSTABLE_HCINMCASTPKTS 24 ++#define IPSYSTEMSTATSTABLE_HCINMCASTOCTETS 25 ++#define IPSYSTEMSTATSTABLE_HCOUTMCASTPKTS 26 ++#define IPSYSTEMSTATSTABLE_HCOUTMCASTOCTETS 27 ++#define IPSYSTEMSTATSTABLE_HCINBCASTPKTS 28 ++#define IPSYSTEMSTATSTABLE_HCOUTBCASTPKTS 29 ++#define IPSYSTEMSTATSTABLE_DISCONTINUITYTIME 30 ++#define IPSYSTEMSTATSTABLE_REFRESHRATE 31 ++ ++#define IPSYSTEMSTATSTABLE_LAST IPSYSTEMSTATSTABLE_REFRESHRATE ++ + /**---------------------------------------------------------------------*/ + /* + * structure definitions +@@ -20,28 +54,42 @@ extern "C" { + */ + typedef struct netsnmp_ipstats_s { + ++ /* Columns of ipStatsTable. Some of them are HC for computation of the ++ * other columns, when underlying OS does not provide them. ++ * Always fill at least 32 bits, the table is periodically polled -> 32 bit ++ * overflow shall be detected and 64 bit value should be computed automatically. */ + U64 HCInReceives; + U64 HCInOctets; + u_long InHdrErrors; +- u_long InNoRoutes; ++ U64 HCInNoRoutes; + u_long InAddrErrors; + u_long InUnknownProtos; + u_long InTruncatedPkts; +- U64 HCInForwDatagrams; ++ ++ /* optional, can be computed from HCInNoRoutes and HCOutForwDatagrams */ ++ U64 HCInForwDatagrams; ++ + u_long ReasmReqds; + u_long ReasmOKs; + u_long ReasmFails; + u_long InDiscards; + U64 HCInDelivers; + U64 HCOutRequests; +- u_long OutNoRoutes; ++ U64 HCOutNoRoutes; + U64 HCOutForwDatagrams; +- u_long OutDiscards; +- u_long OutFragReqds; +- u_long OutFragOKs; +- u_long OutFragFails; +- u_long OutFragCreates; ++ U64 HCOutDiscards; ++ ++ /* optional, can be computed from HCOutFragOKs + HCOutFragFails*/ ++ U64 HCOutFragReqds; ++ U64 HCOutFragOKs; ++ U64 HCOutFragFails; ++ U64 HCOutFragCreates; ++ ++ /* optional, can be computed from ++ * HCOutRequests +HCOutForwDatagrams + HCOutFragCreates ++ * - HCOutFragReqds - HCOutNoRoutes - HCOutDiscards */ + U64 HCOutTransmits; ++ + U64 HCOutOctets; + U64 HCInMcastPkts; + U64 HCInMcastOctets; +@@ -50,6 +98,8 @@ typedef struct netsnmp_ipstats_s { + U64 HCInBcastPkts; + U64 HCOutBcastPkts; + ++ /* Array of available columns.*/ ++ int columnAvail[IPSYSTEMSTATSTABLE_LAST+1]; + } netsnmp_ipstats; + + +diff --git a/include/net-snmp/data_access/systemstats.h b/include/net-snmp/data_access/systemstats.h +index 53dfd51..47e1076 100644 +--- a/include/net-snmp/data_access/systemstats.h ++++ b/include/net-snmp/data_access/systemstats.h +@@ -22,7 +22,11 @@ extern "C" { + typedef struct netsnmp_systemstats_s { + + netsnmp_index oid_index; /* MUST BE FIRST!! for container use */ +- oid ns_ip_version; ++ /* ++ * Index of the table ++ * First entry = ip version ++ * Second entry = interface index (0 for ipSystemStatsTable */ ++ oid index[2]; + + int flags; /* for net-snmp use */ + +@@ -49,13 +53,15 @@ netsnmp_container * netsnmp_access_systemstats_container_init(u_int init_flags); + #define NETSNMP_ACCESS_SYSTEMSTATS_INIT_NOFLAGS 0x0000 + #define NETSNMP_ACCESS_SYSTEMSTATS_INIT_ADDL_IDX_BY_ADDR 0x0001 + +-/* +- * load and free ++/** ++ * Load container. If the NETSNMP_ACCESS_SYSTEMSTATS_LOAD_IFTABLE is set ++ * the ipIfSystemStats table is loaded, else ipSystemStatsTable is loaded. + */ + netsnmp_container* + netsnmp_access_systemstats_container_load(netsnmp_container* container, + u_int load_flags); + #define NETSNMP_ACCESS_SYSTEMSTATS_LOAD_NOFLAGS 0x0000 ++#define NETSNMP_ACCESS_SYSTEMSTATS_LOAD_IFTABLE 0x0001 + + void netsnmp_access_systemstats_container_free(netsnmp_container *container, + u_int free_flags); +@@ -68,7 +74,7 @@ void netsnmp_access_systemstats_container_free(netsnmp_container *container, + * create/free an entry + */ + netsnmp_systemstats_entry * +-netsnmp_access_systemstats_entry_create(int version); ++netsnmp_access_systemstats_entry_create(int version, int if_index); + + void netsnmp_access_systemstats_entry_free(netsnmp_systemstats_entry * entry); + +-- +1.6.0.2 + diff --git a/net-snmp-5.1.2-snmpconf-selinux.patch b/net-snmp-5.1.2-snmpconf-selinux.patch deleted file mode 100644 index 4c7f513..0000000 --- a/net-snmp-5.1.2-snmpconf-selinux.patch +++ /dev/null @@ -1,12 +0,0 @@ -https://bugzilla.redhat.com/show_bug.cgi?id=248329 - ---- net-snmp-5.1.2/local/snmpconf -+++ net-snmp-5.1.2/local/snmpconf -@@ -585,6 +585,7 @@ - } - } - close(O); -+ system("restorecon $outputf"); - } - } - diff --git a/net-snmp-5.4.1.2-etherlike-mib-revised_1.patch b/net-snmp-5.4.1.2-etherlike-mib-revised_1.patch index 7465b0e..d2826fc 100644 --- a/net-snmp-5.4.1.2-etherlike-mib-revised_1.patch +++ b/net-snmp-5.4.1.2-etherlike-mib-revised_1.patch @@ -4604,4 +4604,4 @@ Index: agent/mibgroup/etherlike-mib.h +config_require(etherlike-mib/dot3StatsTable_data_get) +config_require(etherlike-mib/dot3StatsTable_data_set) +config_require(etherlike-mib/dot3StatsTable_data_access) -+config_add_mib(ETHERLIKE-MIB) ++config_add_mib(EtherLike-MIB) diff --git a/net-snmp-5.3.0.1-audit.diff b/net-snmp-5.4.2_audit.patch similarity index 77% rename from net-snmp-5.3.0.1-audit.diff rename to net-snmp-5.4.2_audit.patch index c77388a..31e408a 100644 --- a/net-snmp-5.3.0.1-audit.diff +++ b/net-snmp-5.4.2_audit.patch @@ -1,7 +1,7 @@ Index: agent/mibgroup/examples/ucdDemoPublic.c =================================================================== ---- agent/mibgroup/examples/ucdDemoPublic.c.orig -+++ agent/mibgroup/examples/ucdDemoPublic.c +--- agent/mibgroup/examples/ucdDemoPublic.c.orig 2002-12-19 16:07:36.000000000 +0100 ++++ agent/mibgroup/examples/ucdDemoPublic.c 2008-10-24 15:30:26.538387687 +0200 @@ -219,7 +219,11 @@ write_ucdDemoPublicString(int action, } if (action == COMMIT) { @@ -17,8 +17,8 @@ Index: agent/mibgroup/examples/ucdDemoPublic.c publicString[0] = '\0'; Index: agent/mibgroup/mibII/system_mib.c =================================================================== ---- agent/mibgroup/mibII/system_mib.c.orig -+++ 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]; @@ -48,9 +48,9 @@ Index: agent/mibgroup/mibII/system_mib.c config_perror(tmpbuf); Index: agent/mibgroup/mibII/var_route.c =================================================================== ---- agent/mibgroup/mibII/var_route.c.orig -+++ agent/mibgroup/mibII/var_route.c -@@ -1378,7 +1378,7 @@ Route_Scan_Reload(void) +--- 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! */ @@ -61,9 +61,9 @@ Index: agent/mibgroup/mibII/var_route.c #endif Index: agent/mibgroup/util_funcs.c =================================================================== ---- agent/mibgroup/util_funcs.c.orig -+++ agent/mibgroup/util_funcs.c -@@ -139,6 +139,10 @@ make_tempfile(void) +--- agent/mibgroup/util_funcs.c.orig 2007-08-16 16:12:47.000000000 +0200 ++++ agent/mibgroup/util_funcs.c 2008-10-24 15:30:26.598384777 +0200 +@@ -140,6 +140,10 @@ make_tempfile(void) } #endif if (fd >= 0) { @@ -76,18 +76,18 @@ Index: agent/mibgroup/util_funcs.c return name; Index: agent/auto_nlist.c =================================================================== ---- agent/auto_nlist.c.orig -+++ agent/auto_nlist.c +--- agent/auto_nlist.c.orig 2008-06-05 23:11:53.000000000 +0200 ++++ agent/auto_nlist.c 2008-10-24 15:30:26.630385059 +0200 @@ -64,6 +64,7 @@ auto_nlist_value(const char *string) it->nl[0].n_name = (char *) malloc(strlen(string) + 2); - #if defined(aix4) || defined(aix5) + #if defined(aix4) || defined(aix5) || defined(aix6) strcpy(it->nl[0].n_name, string); + it->nl[0].n_name[strlen(string)+1] = '\0'; #else sprintf(it->nl[0].n_name, "_%s", string); #endif @@ -72,6 +73,7 @@ auto_nlist_value(const char *string) - #if !(defined(aix4) || defined(aix5)) + #if !(defined(aix4) || defined(aix5) || defined(aix6)) if (it->nl[0].n_type == 0) { strcpy(it->nl[0].n_name, string); + it->nl[0].n_name[strlen(string)+1] = '\0'; @@ -96,8 +96,8 @@ Index: agent/auto_nlist.c #endif Index: apps/snmptest.c =================================================================== ---- apps/snmptest.c.orig -+++ apps/snmptest.c +--- apps/snmptest.c.orig 2008-05-29 11:59:06.000000000 +0200 ++++ apps/snmptest.c 2008-10-24 15:30:26.650386319 +0200 @@ -456,6 +456,7 @@ input_variable(netsnmp_variable_list * v goto getValue; } @@ -108,8 +108,8 @@ Index: apps/snmptest.c size_t buf_len = 256; Index: apps/snmptrapd_handlers.c =================================================================== ---- apps/snmptrapd_handlers.c.orig -+++ apps/snmptrapd_handlers.c +--- apps/snmptrapd_handlers.c.orig 2007-06-08 12:44:37.000000000 +0200 ++++ apps/snmptrapd_handlers.c 2008-10-24 15:30:26.682736940 +0200 @@ -24,6 +24,9 @@ #include #endif @@ -120,7 +120,7 @@ Index: apps/snmptrapd_handlers.c #include #include #include -@@ -840,10 +843,11 @@ do_external(char *cmd, struct hostent *h +@@ -863,10 +866,11 @@ do_external(char *cmd, struct hostent *h #else char command_buf[128]; char file_buf[L_tmpnam]; @@ -136,9 +136,9 @@ Index: apps/snmptrapd_handlers.c send_handler_data(file, host, pdu, transport); Index: snmplib/parse.c =================================================================== ---- snmplib/parse.c.orig -+++ snmplib/parse.c -@@ -4187,7 +4187,7 @@ static struct node * +--- snmplib/parse.c.orig 2008-04-07 16:00:44.000000000 +0200 ++++ snmplib/parse.c 2008-10-24 15:30:26.706385615 +0200 +@@ -4191,7 +4191,7 @@ static struct node * parse(FILE * fp, struct node *root) { char token[MAXTOKEN]; @@ -147,7 +147,7 @@ Index: snmplib/parse.c int type = LABEL; int lasttype = LABEL; -@@ -4279,7 +4279,8 @@ parse(FILE * fp, struct node *root) +@@ -4283,7 +4283,8 @@ parse(FILE * fp, struct node *root) case ENDOFFILE: continue; default: @@ -157,7 +157,7 @@ Index: snmplib/parse.c type = get_token(fp, token, MAXTOKEN); nnp = NULL; if (type == MACRO) { -@@ -4296,7 +4297,8 @@ parse(FILE * fp, struct node *root) +@@ -4300,7 +4301,8 @@ parse(FILE * fp, struct node *root) print_error(name, "is a reserved word", lasttype); continue; /* see if we can parse the rest of the file */ } @@ -169,9 +169,9 @@ Index: snmplib/parse.c Index: snmplib/tools.c =================================================================== ---- snmplib/tools.c.orig -+++ snmplib/tools.c -@@ -695,7 +695,7 @@ dump_snmpEngineID(const u_char * estring +--- snmplib/tools.c.orig 2007-02-21 14:58:27.000000000 +0100 ++++ snmplib/tools.c 2008-10-24 15:30:26.750385578 +0200 +@@ -696,7 +696,7 @@ dump_snmpEngineID(const u_char * estring /* * s += snprintf(s, remaining_len+3, "\"%s\"", esp); */ @@ -182,8 +182,8 @@ Index: snmplib/tools.c /*NOTREACHED*/ case 5: /* Octets. */ Index: testing/TESTCONF.sh =================================================================== ---- testing/TESTCONF.sh.orig -+++ testing/TESTCONF.sh +--- testing/TESTCONF.sh.orig 2006-08-07 17:34:16.000000000 +0200 ++++ testing/TESTCONF.sh 2008-10-24 15:30:26.774385440 +0200 @@ -77,8 +77,8 @@ if [ "x$SNMP_TMPDIR" = "x" -a "x$SNMP_HE fi SNMP_TMP_PERSISTENTDIR=$SNMP_TMPDIR/persist @@ -197,8 +197,8 @@ Index: testing/TESTCONF.sh if [ "x$SNMP_SAVE_TMPDIR" = "x" ]; then Index: testing/eval_suite.sh =================================================================== ---- testing/eval_suite.sh.orig -+++ testing/eval_suite.sh +--- testing/eval_suite.sh.orig 2002-04-20 09:30:29.000000000 +0200 ++++ testing/eval_suite.sh 2008-10-24 15:30:26.798384612 +0200 @@ -79,7 +79,11 @@ exit 0 PROGRAM= ARGUMENTS="$*" diff --git a/net-snmp-5.4.1-autoconf.diff b/net-snmp-5.4.2_autoconf.patch similarity index 82% rename from net-snmp-5.4.1-autoconf.diff rename to net-snmp-5.4.2_autoconf.patch index d4aadb9..b2f393d 100644 --- a/net-snmp-5.4.1-autoconf.diff +++ b/net-snmp-5.4.2_autoconf.patch @@ -1,8 +1,8 @@ Index: configure.in =================================================================== ---- configure.in.orig 2007-08-02 00:45:15.851154004 +0200 -+++ configure.in 2007-08-02 00:45:23.287603014 +0200 -@@ -1009,7 +1009,7 @@ AC_SUBST(LINKCC) +--- 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 @@ -11,7 +11,7 @@ Index: configure.in changequote(, ) PARTIALTARGETOS=`echo $target_os | sed 's/[-._].*//'` changequote([, ]) -@@ -2737,8 +2737,6 @@ AC_ARG_WITH(libwrap, +@@ -2756,8 +2756,6 @@ AC_ARG_WITH(libwrap, [ AC_MSG_RESULT([no]) # Linux RedHat 6.1 won't link libwrap without libnsl @@ -20,7 +20,7 @@ Index: configure.in AC_MSG_CHECKING([for TCP wrappers library -lwrap linked with -lnsl]) AC_TRY_LINK([#include #include -@@ -4521,7 +4519,7 @@ fi +@@ -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. # @@ -29,7 +29,7 @@ Index: configure.in [AC_EGREP_CPP(hz, [#include TCPTV_SRTTDFLT -@@ -4575,7 +4573,7 @@ fi +@@ -4609,7 +4607,7 @@ fi ME=`$WHOAMI` if test -f /etc/resolv.conf; then diff --git a/net-snmp-5.4_net-snmp-config_headercheck.patch b/net-snmp-5.4.2_net-snmp-config_headercheck.patch similarity index 90% rename from net-snmp-5.4_net-snmp-config_headercheck.patch rename to net-snmp-5.4.2_net-snmp-config_headercheck.patch index bb723ff..0e4de91 100644 --- a/net-snmp-5.4_net-snmp-config_headercheck.patch +++ b/net-snmp-5.4.2_net-snmp-config_headercheck.patch @@ -1,7 +1,7 @@ Index: net-snmp-config.in =================================================================== ---- net-snmp-config.in.orig -+++ net-snmp-config.in +--- net-snmp-config.in.orig 2008-07-30 19:28:08.000000000 +0200 ++++ net-snmp-config.in 2008-10-24 15:30:56.926874746 +0200 @@ -27,6 +27,14 @@ check_build_dir() fi } @@ -17,7 +17,7 @@ Index: net-snmp-config.in prefix=@prefix@ exec_prefix=@exec_prefix@ includedir=@includedir@ -@@ -104,9 +112,11 @@ else +@@ -105,9 +113,11 @@ else ;; #################################################### compile --base-cflags) @@ -29,7 +29,7 @@ Index: net-snmp-config.in echo @CFLAGS@ @DEVFLAGS@ @CPPFLAGS@ -I. -I${NSC_INCLUDEDIR} ;; --srcdir) -@@ -117,6 +127,7 @@ else +@@ -118,6 +128,7 @@ else echo $NSC_LIBDIR ;; --ldflags|--ld*) @@ -37,7 +37,7 @@ Index: net-snmp-config.in echo $NSC_LDFLAGS ;; --build-lib-dirs) -@@ -150,30 +161,38 @@ else +@@ -151,30 +162,38 @@ else ;; #################################################### client lib --libs) @@ -76,11 +76,11 @@ Index: net-snmp-config.in echo $NSC_LDFLAGS $NSC_AGENTLIBS ;; #################################################### -@@ -314,6 +333,7 @@ else +@@ -316,6 +335,7 @@ else #################################################### --compile-subagent) + check_devel_files shift + shifted=1 while test "x$done" = "x" -a "x$1" != "x" ; do - case $1 in diff --git a/net-snmp-5.2.1-overflow.diff b/net-snmp-5.4.2_overflow.patch similarity index 63% rename from net-snmp-5.2.1-overflow.diff rename to net-snmp-5.4.2_overflow.patch index 3ab323f..01b5a16 100644 --- a/net-snmp-5.2.1-overflow.diff +++ b/net-snmp-5.4.2_overflow.patch @@ -1,6 +1,8 @@ ---- snmplib/mib.c.xx 2005-02-02 21:14:34.167265497 +0100 -+++ snmplib/mib.c 2005-02-02 21:15:40.937887906 +0100 -@@ -1521,7 +1521,7 @@ +Index: snmplib/mib.c +=================================================================== +--- snmplib/mib.c.orig 2008-07-30 09:57:19.000000000 +0200 ++++ snmplib/mib.c 2008-10-24 15:30:42.854387100 +0200 +@@ -1489,7 +1489,7 @@ sprint_realloc_gauge(u_char ** buf, size return 0; } } else { @@ -9,7 +11,7 @@ if (!snmp_strcat (buf, buf_len, out_len, allow_realloc, (const u_char *) tmp)) { return 0; -@@ -1585,7 +1585,7 @@ +@@ -1553,7 +1553,7 @@ sprint_realloc_counter(u_char ** buf, si return 0; } } diff --git a/net-snmp-5.4.1_perl_tk_warning.patch b/net-snmp-5.4.2_perl_tk_warning.patch similarity index 89% rename from net-snmp-5.4.1_perl_tk_warning.patch rename to net-snmp-5.4.2_perl_tk_warning.patch index 4a80654..e63120c 100644 --- a/net-snmp-5.4.1_perl_tk_warning.patch +++ b/net-snmp-5.4.2_perl_tk_warning.patch @@ -1,7 +1,7 @@ Index: local/tkmib =================================================================== --- local/tkmib.orig 2006-07-27 21:48:25.000000000 +0200 -+++ local/tkmib 2008-06-21 01:23:34.985622311 +0200 ++++ local/tkmib 2008-10-24 15:31:02.574384593 +0200 @@ -27,10 +27,9 @@ instructions. if (!$havetk) { diff --git a/net-snmp-5.4.2_snmpconf-selinux.patch b/net-snmp-5.4.2_snmpconf-selinux.patch new file mode 100644 index 0000000..8a6e3e1 --- /dev/null +++ b/net-snmp-5.4.2_snmpconf-selinux.patch @@ -0,0 +1,14 @@ +https://bugzilla.redhat.com/show_bug.cgi?id=248329 + +Index: local/snmpconf +=================================================================== +--- local/snmpconf.orig 2005-08-16 17:59:16.000000000 +0200 ++++ local/snmpconf 2008-10-24 15:31:06.798387241 +0200 +@@ -682,6 +682,7 @@ sub output_files { + } + } + close(O); ++ system("restorecon $outputf"); + } + } + diff --git a/net-snmp-5.2.1.testing.empty_arptable.patch b/net-snmp-5.4.2_testing.empty_arptable.patch similarity index 77% rename from net-snmp-5.2.1.testing.empty_arptable.patch rename to net-snmp-5.4.2_testing.empty_arptable.patch index 0a44400..87bf37c 100644 --- a/net-snmp-5.2.1.testing.empty_arptable.patch +++ b/net-snmp-5.4.2_testing.empty_arptable.patch @@ -1,11 +1,13 @@ ---- testing/rfc1213/snmpfun.sh -+++ testing/rfc1213/snmpfun.sh +Index: testing/rfc1213/snmpfun.sh +=================================================================== +--- testing/rfc1213/snmpfun.sh.orig 2004-12-10 16:15:52.000000000 +0100 ++++ testing/rfc1213/snmpfun.sh 2008-10-24 15:30:46.066386937 +0200 @@ -1,4 +1,3 @@ - # functions used by RFC-1213 MIB test modules myport=$SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT -@@ -11,6 +10,23 @@ +@@ -11,6 +10,23 @@ else TEST_AUTHPRIV_PARMS="-l authNoPriv -a MD5 -A testpass" fi @@ -29,7 +31,7 @@ config() { rm -f $SNMP_CONFIG_FILE -@@ -54,25 +70,35 @@ +@@ -54,25 +70,35 @@ get_snmpv3_variable() get_snmp_table() { test_start "Access table $2 by SNMPv$1..." @@ -76,9 +78,11 @@ } + ---- testing/rfc1213/test_fun -+++ testing/rfc1213/test_fun -@@ -51,6 +51,9 @@ +Index: testing/rfc1213/test_fun +=================================================================== +--- testing/rfc1213/test_fun.orig 2004-10-16 22:44:35.000000000 +0200 ++++ testing/rfc1213/test_fun 2008-10-24 15:30:46.066386937 +0200 +@@ -51,6 +51,9 @@ test_finish() if [ x$1 == x"PASS" ];then pass_num=`expr $pass_num + 1` pass_info "PASS\n" @@ -88,7 +92,7 @@ else fail_num=`expr $fail_num + 1` fail_info "FAIL\n" -@@ -66,3 +69,4 @@ +@@ -66,3 +69,4 @@ summary() fi } diff --git a/net-snmp-5.4.2_velocity-mib.patch b/net-snmp-5.4.2_velocity-mib.patch new file mode 100644 index 0000000..7476845 --- /dev/null +++ b/net-snmp-5.4.2_velocity-mib.patch @@ -0,0 +1,3373 @@ +Index: LICENSE.VELOCITY +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ LICENSE.VELOCITY 2008-10-24 15:34:16.302888835 +0200 +@@ -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 ++ * that may apply: ++ */ ++/* ++ * Portions of these files are copyrighted by: ++ * Copyright © 2003 Sun Microsystems, Inc. All rights reserved. ++ * Use is subject to license terms specified in the COPYING file ++ * distributed with the Net-SNMP package. ++ */ ++/* ++ * Copyright © 2002-2008, Velocity Software, Inc. ++ * All rights reserved. ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions are met: ++ * ++ ** Redistributions of source code must retain the above copyright notice, ++ * this list of conditions and the following disclaimer. ++ * ++ ** Redistributions in binary form must reproduce the above copyright ++ * notice, this list of conditions and the following disclaimer in the ++ * documentation and/or other materials provided with the distribution. ++ * ++ ** Neither the name of the Velocity Software, Inc. nor the ++ * names of its contributors may be used to endorse or promote ++ * products derived from this software without specific prior written ++ * permission. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS ++ * IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, ++ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR ++ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ++ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ++ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, ++ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; ++ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ++ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR ++ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ++ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ */ +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 +@@ -0,0 +1,28 @@ ++/* ++ * Velocity 'wrapper' interface which is an extension of the host resources ++ * calls the per-group interfaces from 'hr_*.h' and 'velocity_*.h' ++ */ ++ ++ config_require(host/hr_system) ++ config_require(velocity/velocity_system) ++ config_require(host/hr_storage) ++ config_require(host/hr_device) ++ config_require(host/hr_other) ++ config_require(host/hr_proc) ++ config_require(host/hr_network) ++ config_require(host/hr_print) ++ config_require(host/hr_disk) ++ config_require(host/hr_partition) ++ config_require(host/hr_filesys) ++ config_require(velocity/velocity_swrun) ++ config_require(host/hr_swrun) ++ config_require(host/hr_swinst) ++ config_require(velocity/velocity_app) ++/* config_require(ucd-snmp/proc) */ ++ ++/* add the host resources mib to the default mibs to load */ ++config_add_mib(HOST-RESOURCES-MIB) ++config_add_mib(HOST-RESOURCES-TYPES) ++config_add_mib(UCD-SNMP-MIB) ++config_add_mib(VELOCITY-MIB) ++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 +@@ -0,0 +1,499 @@ ++#include ++ ++#ifdef solaris2 ++#define _KMEMUSER /* Needed by */ ++#include /* helps define struct rlimit */ ++#endif ++ ++#if HAVE_IO_H /* win32 */ ++#include ++#endif ++#if HAVE_STDLIB_H ++#include ++#endif ++#if HAVE_UNISTD_H ++#include ++#endif ++#if HAVE_STRING_H ++#include ++#else ++#include ++#endif ++#if HAVE_MALLOC_H ++#include ++#endif ++#include ++#include ++#include ++#if HAVE_NETINET_IN_H ++#include ++#endif ++#if TIME_WITH_SYS_TIME ++# ifdef WIN32 ++# include ++# else ++# include ++# endif ++# include ++#else ++# if HAVE_SYS_TIME_H ++# include ++# else ++# include ++# endif ++#endif ++#if HAVE_KVM_H ++#include ++#endif ++#if HAVE_WINSOCK_H ++#include ++#endif ++ ++#if HAVE_DMALLOC_H ++#include ++#endif ++ ++#include ++#include ++ ++#include "struct.h" ++#include "velocity_app.h" ++#ifdef USING_UCD_SNMP_ERRORMIB_MODULE ++#include "../ucd-snmp/errormib.h" ++#else ++#define setPerrorstatus(x) snmp_log_perror(x) ++#endif ++#include "util_funcs.h" ++#include "kernel.h" ++#include "errno.h" ++ ++static struct myvelocityApp *get_velocityApp_instance(struct myvelocityApp *, oid); ++struct myvelocityApp *velocityAppwatch = NULL; ++int numvelocityApps = 0; ++#define ID_SIZE 300 ++ ++void ++init_velocity_app(void) ++{ ++ ++ /* ++ * define the structure we're going to ask the agent to register our ++ * information at ++ */ ++ struct variable2 extensible_velocityApp_variables[] = { ++ {MIBINDEX, ASN_INTEGER, RONLY, var_extensible_velocityApp, 1, {MIBINDEX}}, ++ {ERRORNAME, ASN_OCTET_STR, RONLY, var_extensible_velocityApp, 1, ++ {ERRORNAME}}, ++ {APPPID, ASN_OCTET_STR, RONLY, var_extensible_velocityApp, 1, {APPPID}}, ++ {APPMIN, ASN_INTEGER, RONLY, var_extensible_velocityApp, 1, {APPMIN}}, ++ {APPMAX, ASN_INTEGER, RONLY, var_extensible_velocityApp, 1, {APPMAX}}, ++ {APPCOUNT, ASN_INTEGER, RONLY, var_extensible_velocityApp, 1, ++ {APPCOUNT}}, ++ {APPIDS, ASN_OCTET_STR, RONLY, var_extensible_velocityApp, 1, ++ {APPIDS}}, ++ {ERRORFLAG, ASN_INTEGER, RONLY, var_extensible_velocityApp, 1, ++ {ERRORFLAG}}, ++ {ERRORMSG, ASN_OCTET_STR, RONLY, var_extensible_velocityApp, 1, ++ {ERRORMSG}}, ++ }; ++ ++ /* ++ * Define the OID pointer to the top of the mib tree that we're ++ * registering underneath ++ */ ++ oid velocityApp_variables_oid[] = { 1, 3, 6, 1, 4, 1, 15601, 6, 1 }; ++ ++ /* ++ * register ourselves with the agent to handle our mib tree ++ */ ++ REGISTER_MIB("velocity/velocity_app", extensible_velocityApp_variables, variable2, ++ velocityApp_variables_oid); ++ ++ snmpd_register_config_handler("app", velocityApp_parse_config, ++ velocityApp_free_config, ++ "application-name [max-num] [min-num]"); ++} ++ ++ ++ ++/* ++ * Define snmpd.conf reading routines first. They get called ++ * automatically by the invocation of a macro in the proc.h file. ++ */ ++ ++void ++velocityApp_free_config(void) ++{ ++ struct myvelocityApp *ptmp, *ptmp2; ++ ++ for (ptmp = velocityAppwatch; ptmp != NULL;) { ++ ptmp2 = ptmp; ++ ptmp = ptmp->next; ++ free(ptmp2); ++ } ++ velocityAppwatch = NULL; ++ numvelocityApps = 0; ++} ++ ++/* ++ * find a give entry in the linked list associated with a proc name ++ */ ++static struct myvelocityApp * ++get_velocityApp_by_name(char *name) ++{ ++ struct myvelocityApp *ptmp; ++ ++ if (name == NULL) ++ return NULL; ++ ++ for (ptmp = velocityAppwatch; ptmp != NULL && strcmp(ptmp->name, name) != 0; ++ ptmp = ptmp->next); ++ return ptmp; ++} ++ ++#include ++#include ++#include ++ ++void ++velocityApp_parse_config(const char *token, char *cptr) ++{ ++ char tmpname[STRMAX]; ++ char tmppid[STRMAX]; ++ struct myvelocityApp **procp = &velocityAppwatch; ++ struct stat stat_buf; ++ const char none[] = "NONE"; ++ int statrc, retc; ++ char *tmpstr; ++ ++ /* ++ * don't allow two entries with the same name ++ */ ++ /* retc = strcpy(tmpstr,cptr); */ ++ tmpstr = cptr; ++ copy_nword(tmpstr, tmpname, sizeof(tmpname)); ++ if (get_velocityApp_by_name(tmpname) != NULL) { ++ config_perror("Already have an entry for this process."); ++ return; ++ } ++ DEBUGMSGTL(("velocity/velocity_app", "tmpname = %s \n", tmpname)); ++ tmpstr = skip_not_white(tmpstr); ++ tmpstr = skip_white(tmpstr); ++ copy_nword(tmpstr, tmppid, sizeof(tmppid)); ++ retc = strcmp(tmppid, none); ++ DEBUGMSGTL(("velocity/velocity_app", "tmppid = %s retc = %d\n", tmppid, retc)); ++ statrc = stat(tmppid, &stat_buf); ++ DEBUGMSGTL(("velocity/velocity_app", "tmppid = %s statrc = %d st_mode = %d\n", tmppid, statrc, S_ISREG(stat_buf.st_mode))); ++ if (retc == 0 || S_ISREG(stat_buf.st_mode)) { ++ DEBUGMSGTL(("velocity/velocity_app", "Valid app string %s %s\n", tmpname, tmppid)); ++ } ++ else { ++ config_perror("Incorrect syntax for app statement. Must give either keyword NONE or absolute file."); ++ return; ++ } ++ ++ /* ++ * skip past used ones ++ */ ++ while (*procp != NULL) ++ procp = &((*procp)->next); ++ ++ (*procp) = (struct myvelocityApp *) calloc(1, sizeof(struct myvelocityApp)); ++ if (*procp == NULL) ++ return; /* memory alloc error */ ++ numvelocityApps++; ++ /* ++ * not blank and not a comment ++ */ ++ copy_nword(cptr, (*procp)->name, sizeof((*procp)->name)); ++ cptr = skip_not_white(cptr); ++ cptr = skip_white(cptr); ++ copy_nword(cptr, (*procp)->pidfile, sizeof((*procp)->pidfile)); ++ DEBUGMSGTL(("velocity/velocity_app", "Read: %s %s\n", ++ (*procp)->name, (*procp)->pidfile)); ++ cptr = skip_not_white(cptr); ++ if ((cptr = skip_white(cptr))) { ++ (*procp)->max = atoi(cptr); ++ cptr = skip_not_white(cptr); ++ if ((cptr = skip_white(cptr))) ++ (*procp)->min = atoi(cptr); ++ else ++ (*procp)->min = 0; ++ } else { ++ (*procp)->max = 0; ++ (*procp)->min = 0; ++ } ++ DEBUGMSGTL(("velocity/velocity_app", "Read: %s (%d) (%d)\n", ++ (*procp)->name, (*procp)->max, (*procp)->min)); ++} ++ ++ ++static struct myvelocityApp * ++get_velocityApp_instance(struct myvelocityApp *proc, oid inst) ++{ ++ int i; ++ ++ if (proc == NULL) ++ return (NULL); ++ for (i = 1; (i != (int) inst) && (proc != NULL); i++) ++ proc = proc->next; ++ return (proc); ++} ++#include ++#include ++ ++/* ++ * The routine that handles everything ++ */ ++ ++u_char * ++var_extensible_velocityApp(struct variable *vp, ++ oid * name, ++ size_t * length, ++ int exact, ++ size_t * var_len, WriteMethod ** write_method) ++{ ++ ++ DIR *dir; ++ struct myvelocityApp *proc; ++ static long long_ret; ++ static char errmsg[ID_SIZE]; ++ ++ char * cmdline = NULL; ++ struct dirent *ent; ++ static char fn[19]; ++ FILE * fd; ++ char temp[ID_SIZE]; ++ size_t len = 0; ++ ssize_t read; ++ int statrc, retc; ++ struct stat stat_buff; ++ const char none[] = "NONE"; ++ char * temp2; ++ ++ if (header_simple_table ++ (vp, name, length, exact, var_len, write_method, numvelocityApps)) ++ return (NULL); ++ if ((proc = get_velocityApp_instance(velocityAppwatch, name[*length - 1]))) { ++ switch (vp->magic) { ++ case MIBINDEX: ++ long_ret = name[*length - 1]; ++ return ((u_char *) (&long_ret)); ++ case ERRORNAME: /* process name to check for */ ++ *var_len = strlen(proc->name); ++ return ((u_char *) (proc->name)); ++ case APPPID: ++ *var_len = strlen(proc->pidfile); ++ DEBUGMSGTL(("velocity/velocity_app", "pid file is %s\n", proc->name )); ++ return ((u_char *) (proc->pidfile)); ++ case APPMIN: ++ long_ret = proc->min; ++ return ((u_char *) (&long_ret)); ++ case APPMAX: ++ long_ret = proc->max; ++ return ((u_char *) (&long_ret)); ++ case APPCOUNT: ++ DEBUGMSGTL(("velocity/velocity_app", "pid file is %s\n", proc->pidfile )); ++ retc = strcmp(proc->pidfile, none); ++ DEBUGMSGTL(("velocity/velocity_app", "retc is %d, pid is %s, none is %s.\n", retc, proc->pidfile, none)); ++ DEBUGMSGTL(("velocity/velocity_app", "pid length is %d, none length is %d\n",strlen(proc->pidfile), strlen(none))); ++ if ( retc == 0 || strlen(proc->pidfile) == 0 ) { ++ DEBUGMSGTL(("velocity/velocity_app", "Calling count")); ++ long_ret = sh_count_velocityApps(proc->name); ++ } ++ else { ++ if (proc->pidfile != NULL) { ++ if ((fd = fopen(proc->pidfile, "r")) == NULL) break; ++ read = getline(&cmdline, &len, fd); ++ fclose(fd); ++ if (len == -1 ) break; ++ DEBUGMSGTL(("velocity/velocity_app", "Length returned is %d\n",len)); ++ DEBUGMSGTL(("velocity/velocity_app", "cmdline is %s\n",cmdline)); ++ cmdline = skip_white(cmdline); ++ copy_nword(cmdline, errmsg, sizeof(errmsg)); ++ sprintf(fn,"/proc/%s",errmsg); ++ DEBUGMSGTL(("velocity/velocity_app", "Filename is %s\n",fn)); ++ statrc = stat(fn, &stat_buff); ++ DEBUGMSGTL(("velocity/velocity_app", "statrc = %d\n",statrc)); ++ if (cmdline) ++ free(cmdline); ++ if (statrc == 0 ) { ++ DEBUGMSGTL(("velocity/velocity_app", "process found - %s\n", fn)); ++ long_ret = 1; ++ } ++ else { ++ DEBUGMSGTL(("velocity/velocity_app", "process not found - %s\n",fn)); ++ long_ret = 0; ++ } ++ } ++ } ++ DEBUGMSGTL(("velocity/velocity_app", "Return %d\n", long_ret)); ++ return ((u_char *) (&long_ret)); ++ case APPIDS: ++ if (strcmp(proc->pidfile, none) == 0 || strlen(proc->pidfile) == 0) { ++ if ((dir = opendir("/proc")) == NULL) { ++ sprintf(fn,"-1"); ++ return ((u_char *) fn); ++ } ++ errmsg[0] = 0; ++ while (NULL != (ent = readdir(dir))) { ++ if(!(ent->d_name[0] >= '0' && ent->d_name[0] <= '9')) continue; ++ /* read /proc/XX/cmdline */ ++ sprintf(fn,"/proc/%s/cmdline",ent->d_name); ++ if((fd = fopen(fn, "r")) == NULL) break; ++ read = getline(&cmdline,&len, fd); ++ fclose(fd); ++ if(read == -1) continue; ++ while(--read && !cmdline[read]); ++ while(--read) if(!cmdline[read]) cmdline[read] = ' '; ++ if(strstr(cmdline,proc->name) != NULL ) { ++ snprintf(temp,sizeof(errmsg),"%s %s", errmsg, ent->d_name); ++ ++ strcpy(errmsg,temp); ++ } ++ } ++ closedir(dir); ++ } ++ else { ++ DEBUGMSGTL(("velocity/velocity_app", "Appid\n")); ++ if ((fd = fopen(proc->pidfile, "r")) == NULL) break; ++ read = getline(&cmdline, &len, fd); ++ fclose(fd); ++ if (len == -1 ) break; ++ cmdline = skip_white(cmdline); ++ copy_nword(cmdline, errmsg, sizeof(errmsg)); ++ sprintf(fn,"/proc/%s",errmsg); ++ DEBUGMSGTL(("velocity/velocity_app", "Filename is %s\n",fn)); ++ statrc = stat(fn, &stat_buff); ++ DEBUGMSGTL(("velocity/velocity_app", "statrc = %d\n",statrc)); ++ if (statrc == 0 ) { ++ DEBUGMSGTL(("velocity/velocity_app", "process id is - %s \n", errmsg)); ++ } ++ else { ++ DEBUGMSGTL(("velocity/velocity_app", "process id should be - %s\n", errmsg)); ++ errmsg[0] = 0; ++ } ++ } ++ DEBUGMSGTL(("velocity/velocity_app", "errmsg string is %s\n", errmsg)); ++ if (cmdline) ++ free(cmdline); ++ *var_len = strlen(errmsg); ++ return ((u_char *) errmsg); ++ case ERRORFLAG: ++ if (strcmp(proc->pidfile, none) == 0 || strlen(proc->pidfile) == 0) { ++ long_ret = sh_count_velocityApps(proc->name); ++ } ++ else { ++ if ((fd = fopen(proc->pidfile, "r")) == NULL) break; ++ read = getline(&cmdline, &len, fd); ++ fclose(fd); ++ if (len == -1 ) break; ++ cmdline = skip_white(cmdline); ++ copy_nword(cmdline, errmsg, sizeof(errmsg)); ++ sprintf(fn,"/proc/%s",errmsg); ++ DEBUGMSGTL(("velocity/velocity_app", "Filename is %s\n",fn)); ++ statrc = stat(fn, &stat_buff); ++ DEBUGMSGTL(("velocity/velocity_app", "statrc = %d\n",statrc)); ++ if (cmdline) ++ free(cmdline); ++ if (statrc == 0 ) { ++ DEBUGMSGTL(("velocity/velocity_app", "process found - %s ", fn)); ++ long_ret = 1; ++ } ++ else { ++ DEBUGMSGTL(("velocity/velocity_app", "process not found - %s",fn)); ++ long_ret = 0; ++ } ++ } ++ if (long_ret >= 0 && ++ ((proc->min && long_ret < proc->min) || ++ (proc->max && long_ret > proc->max) || ++ (proc->min == 0 && proc->max == 0 && long_ret < 1))) { ++ long_ret = 1; ++ } else { ++ long_ret = 0; ++ } ++ return ((u_char *) (&long_ret)); ++ case ERRORMSG: ++ if (strcmp(proc->pidfile, none) == 0 || strlen(proc->pidfile) == 0) { ++ long_ret = sh_count_velocityApps(proc->name); ++ } ++ else { ++ if ((fd = fopen(proc->pidfile, "r")) == NULL) break; ++ read = getline(&cmdline, &len, fd); ++ fclose(fd); ++ if (len == -1 ) break; ++ cmdline = skip_white(cmdline); ++ copy_nword(cmdline, errmsg, sizeof(errmsg)); ++ sprintf(fn,"/proc/%s",errmsg); ++ DEBUGMSGTL(("velocity/velocity_app", "Filename is %s\n",fn)); ++ statrc = stat(fn, &stat_buff); ++ DEBUGMSGTL(("velocity/velocity_app", "statrc = %d\n",statrc)); ++ if (cmdline) ++ free(cmdline); ++ if (statrc == 0 ) { ++ DEBUGMSGTL(("velocity/velocity_app", "process found - %s\n ", fn)); ++ long_ret = 1; ++ } ++ else { ++ DEBUGMSGTL(("velocity/velocity_app", "process not found - %s\n",fn)); ++ long_ret = 0; ++ } ++ } ++ if (long_ret < 0) { ++ errmsg[0] = 0; /* catch out of mem errors return 0 count */ ++ } else if (proc->min && long_ret < proc->min) { ++ snprintf(errmsg, sizeof(errmsg), ++ "Too few %s running (# = %d)", ++ proc->name, (int) long_ret); ++ } else if (proc->max && long_ret > proc->max) { ++ snprintf(errmsg, sizeof(errmsg), ++ "Too many %s running (# = %d)", ++ proc->name, (int) long_ret); ++ } else if (proc->min == 0 && proc->max == 0 && long_ret < 1) { ++ snprintf(errmsg, sizeof(errmsg), ++ "No %s process running.", proc->name); ++ } else { ++ errmsg[0] = 0; ++ } ++ errmsg[ sizeof(errmsg)-1 ] = 0; ++ *var_len = strlen(errmsg); ++ return ((u_char *) errmsg); ++ } ++ return NULL; ++ } ++ return NULL; ++} ++ ++ ++int ++sh_count_velocityApps(char *velocityAppname) ++{ ++ DIR *dir; ++ char *cmdline = NULL; ++ struct dirent *ent; ++ FILE *fd; ++ size_t len; ++ char fn[18]; ++ int total = 0; ++ ++ if ((dir = opendir("/proc")) == NULL) return -1; ++ while (NULL != (ent = readdir(dir))) { ++ if(!(ent->d_name[0] >= '0' && ent->d_name[0] <= '9')) continue; ++ /* read /proc/XX/cmdline */ ++ sprintf(fn,"/proc/%s/cmdline",ent->d_name); ++ if((fd = fopen(fn, "r")) == NULL) break; ++ len = getline(&cmdline,&len,fd); ++ fclose(fd); ++ if(len == -1) continue; ++ cmdline[len] = 0; ++ while(--len && !cmdline[len]); ++ while(--len) if(!cmdline[len]) cmdline[len] = ' '; ++ if(strstr(cmdline,velocityAppname) != NULL ) total++; ++ if (cmdline) ++ free(cmdline); ++ } ++ closedir(dir); ++ return total; ++} ++ +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 +@@ -0,0 +1,38 @@ ++/* ++ * Application watching mib group ++ */ ++#ifndef _MIBGROUP_APP_H ++#define _MIBGROUP_APP_H ++ ++config_require(util_funcs) ++ ++ void init_velocity_app(void); ++ ++ extern FindVarMethod var_extensible_velocityApp; ++ int sh_count_velocityApps(char *); ++ int sh_list_velocityApps(char *, char *); ++ ++/* ++ * config file parsing routines ++ */ ++ void velocityApp_free_config(void); ++ void velocityApp_parse_config(const char *, char *); ++ ++struct myvelocityApp { ++ char name[STRMAX]; ++ char pidfile[STRMAX]; ++ int min; ++ int max; ++ struct myvelocityApp *next; ++}; ++ ++ ++#include "mibdefs.h" ++ ++#define APPPID 3 ++#define APPMIN 4 ++#define APPMAX 5 ++#define APPCOUNT 6 ++#define APPIDS 7 ++ ++#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 +@@ -0,0 +1,1595 @@ ++/* ++ * Velocity MIB - Running Software group implementation - velocity_swrun.c ++ * (also includes Running Software Performance group extensions to the ++ * standard host resources MIB) ++ */ ++ ++#include ++#if HAVE_STDLIB_H ++#include ++#endif ++#include ++#if HAVE_UNISTD_H ++#include ++#endif ++ ++#include ++#include ++#if HAVE_SYS_PSTAT_H ++#include ++#endif ++#if HAVE_SYS_USER_H ++#ifdef solaris2 ++#define _KMEMUSER ++#endif ++#include ++#endif ++#if HAVE_SYS_PROC_H ++#include ++#endif ++#if HAVE_KVM_H ++#include ++#endif ++#if HAVE_SYS_SYSCTL_H ++#include ++#endif ++#if HAVE_DIRENT_H && !defined(cygwin) ++#include ++#else ++# define dirent direct ++# if HAVE_SYS_NDIR_H ++# include ++# endif ++# if HAVE_SYS_DIR_H ++# include ++# endif ++# if HAVE_NDIR_H ++# include ++# endif ++#endif ++#ifdef cygwin ++#include ++#include ++#include ++#include ++#endif ++ ++#if _SLASH_PROC_METHOD_ ++#include ++#endif ++ ++#if HAVE_STRING_H ++#include ++#else ++#include ++#endif ++ ++#include ++ ++#include ++#include ++#include ++#include "host_res.h" ++#include "velocity_swrun.h" ++#include ++#include "kernel.h" ++#if solaris2 ++#include "kernel_sunos5.h" ++#endif ++ ++ /********************* ++ * ++ * Initialisation & common implementation functions ++ * ++ *********************/ ++void Init_VELOCITY_SWRun(void); ++int Get_Next_VELOCITY_SWRun(void); ++void End_VELOCITY_SWRun(void); ++int header_velocityswrun(struct variable *, oid *, size_t *, int, ++ size_t *, WriteMethod **); ++int header_velocityswrunEntry(struct variable *, oid *, size_t *, ++ int, size_t *, WriteMethod **); ++ ++#ifdef dynix ++pid_t nextproc; ++static prpsinfo_t lowpsinfo, mypsinfo; ++#endif ++#ifdef cygwin ++static struct external_pinfo *curproc; ++static struct external_pinfo lowproc; ++#elif !defined(linux) ++static int LowProcIndex; ++#endif ++#if defined(hpux10) || defined(hpux11) ++struct pst_status *proc_table; ++struct pst_dynamic pst_dyn; ++#elif HAVE_KVM_GETPROCS ++struct kinfo_proc *proc_table; ++#elif defined(solaris2) ++int *proc_table; ++#else ++struct proc *proc_table; ++#endif ++#ifndef dynix ++int current_proc_entry; ++#endif ++ ++ ++#define VELOCITYSWRUN_OSINDEX 1 ++ ++#define VELOCITYSWRUN_INDEX 2 ++#define VELOCITYSWRUN_NAME 3 ++#define VELOCITYSWRUN_ID 4 ++#define VELOCITYSWRUN_PATH 5 ++#define VELOCITYSWRUN_PARAMS 6 ++#define VELOCITYSWRUN_TYPE 7 ++#define VELOCITYSWRUN_STATUS 8 ++#define VELOCITYSWRUN_PPID 9 ++#define VELOCITYSWRUN_PGRP 10 ++ ++#define VELOCITYSWRUNPERF_CPU_USER 11 ++#define VELOCITYSWRUNPERF_CPU_SYS 12 ++#define VELOCITYSWRUNPERF_MEM 13 ++#define VELOCITYSWRUNPERF_CPU_CUMM_USER 14 ++#define VELOCITYSWRUNPERF_CPU_CUMM_SYS 15 ++#define VELOCITYSWRUNPERF_MIN_FAULT 16 ++#define VELOCITYSWRUNPERF_MAJ_FAULT 17 ++#define VELOCITYSWRUNPERF_MIN_FAULT_CUMM 18 ++#define VELOCITYSWRUNPERF_MAJ_FAULT_CUMM 19 ++#define VELOCITYSWRUNPERF_RSS 20 ++#define VELOCITYSWRUNPERF_PRIO 21 ++#define VELOCITYSWRUNPERF_ALL 22 ++#define VELOCITYSWRUNPERF_UID 23 ++#define VELOCITYSWRUNPERF_UNAME 24 ++ ++struct variable4 velocityswrun_variables[] = { ++ {VELOCITYSWRUN_OSINDEX, ASN_INTEGER, RONLY, var_velocityswrun, 1, {1}}, ++ {VELOCITYSWRUN_INDEX, ASN_INTEGER, RONLY, var_velocityswrun, 3, {2, 1, 1}}, ++ {VELOCITYSWRUN_NAME, ASN_OCTET_STR, RONLY, var_velocityswrun, 3, {2, 1, 2}}, ++ {VELOCITYSWRUN_ID, ASN_OBJECT_ID, RONLY, var_velocityswrun, 3, {2, 1, 3}}, ++ {VELOCITYSWRUN_PATH, ASN_OCTET_STR, RONLY, var_velocityswrun, 3, {2, 1, 4}}, ++ {VELOCITYSWRUN_PARAMS, ASN_OCTET_STR, RONLY, var_velocityswrun, 3, {2, 1, 5}}, ++ {VELOCITYSWRUN_TYPE, ASN_INTEGER, RONLY, var_velocityswrun, 3, {2, 1, 6}}, ++ {VELOCITYSWRUN_STATUS, ASN_INTEGER, RONLY, var_velocityswrun, 3, {2, 1, 7}}, ++ {VELOCITYSWRUN_PPID, ASN_INTEGER, RONLY, var_velocityswrun, 3, {2, 1, 8}}, ++ {VELOCITYSWRUN_PGRP, ASN_INTEGER, RONLY, var_velocityswrun, 3, {2, 1, 9}} ++}; ++ ++struct variable4 velocityswrunperf_variables[] = { ++ {VELOCITYSWRUNPERF_CPU_USER, ASN_INTEGER, RONLY, var_velocityswrun, 3, {1, 1, 1}}, ++ {VELOCITYSWRUNPERF_CPU_SYS, ASN_INTEGER, RONLY, var_velocityswrun, 3, {1, 1, 2}}, ++ {VELOCITYSWRUNPERF_MEM, ASN_INTEGER, RONLY, var_velocityswrun, 3, {1, 1, 3}}, ++ {VELOCITYSWRUNPERF_CPU_CUMM_USER, ASN_INTEGER, RONLY, var_velocityswrun, 3, {1, 1, 4}}, ++ {VELOCITYSWRUNPERF_CPU_CUMM_SYS, ASN_INTEGER, RONLY, var_velocityswrun, 3, {1, 1, 5}}, ++ {VELOCITYSWRUNPERF_MIN_FAULT, ASN_INTEGER, RONLY, var_velocityswrun, 3, {1, 1, 6}}, ++ {VELOCITYSWRUNPERF_MAJ_FAULT, ASN_INTEGER, RONLY, var_velocityswrun, 3, {1, 1, 7}}, ++ {VELOCITYSWRUNPERF_MIN_FAULT_CUMM, ASN_INTEGER, RONLY, var_velocityswrun, 3, {1, 1, 8}}, ++ {VELOCITYSWRUNPERF_MAJ_FAULT_CUMM, ASN_INTEGER, RONLY, var_velocityswrun, 3, {1, 1, 9}}, ++ {VELOCITYSWRUNPERF_RSS, ASN_INTEGER, RONLY, var_velocityswrun, 3, {1, 1, 10}}, ++ {VELOCITYSWRUNPERF_PRIO, ASN_INTEGER, RONLY, var_velocityswrun, 3, {1, 1, 11}}, ++ {VELOCITYSWRUNPERF_ALL, ASN_OCTET_STR, RONLY, var_velocityswrun, 3, {1, 1, 12}}, ++ {VELOCITYSWRUNPERF_UID, ASN_OCTET_STR, RONLY, var_velocityswrun, 3, {1, 1, 13}}, ++ {VELOCITYSWRUNPERF_UNAME, ASN_OCTET_STR, RONLY, var_velocityswrun, 3, {1, 1, 14}} ++}; ++ ++oid velocityswrun_variables_oid[] = { 1, 3, 6, 1, 4, 1, 15601, 4 }; ++oid velocityswrunperf_variables_oid[] = { 1, 3, 6, 1, 4, 1, 15601, 5 }; ++ ++#ifdef cygwin ++ ++/* ++ * a lot of this is "stolen" from cygwin ps.cc ++ */ ++ ++typedef BOOL(WINAPI * ENUMPROCESSMODULES) (HANDLE hProcess, ++ HMODULE * lphModule, ++ DWORD cb, ++ LPDWORD lpcbNeeded); ++ ++typedef DWORD(WINAPI * GETMODULEFILENAME) (HANDLE hProcess, ++ HMODULE hModule, ++ LPTSTR lpstrFIleName, ++ DWORD nSize); ++ ++typedef DWORD(WINAPI * GETPROCESSMEMORYINFO) (HANDLE hProcess, ++ PPROCESS_MEMORY_COUNTERS ++ pmc, DWORD nSize); ++ ++typedef HANDLE(WINAPI * CREATESNAPSHOT) (DWORD dwFlags, ++ DWORD th32ProcessID); ++ ++typedef BOOL(WINAPI * PROCESSWALK) (HANDLE hSnapshot, ++ LPPROCESSENTRY32 lppe); ++ ++ENUMPROCESSMODULES myEnumProcessModules; ++GETMODULEFILENAME myGetModuleFileNameEx; ++CREATESNAPSHOT myCreateToolhelp32Snapshot; ++PROCESSWALK myProcess32First; ++PROCESSWALK myProcess32Next; ++GETPROCESSMEMORYINFO myGetProcessMemoryInfo = NULL; ++cygwin_getinfo_types query = CW_GETPINFO; ++ ++static BOOL WINAPI ++dummyprocessmodules(HANDLE hProcess, ++ HMODULE * lphModule, DWORD cb, LPDWORD lpcbNeeded) ++{ ++ lphModule[0] = (HMODULE) * lpcbNeeded; ++ *lpcbNeeded = 1; ++ return 1; ++} ++ ++static DWORD WINAPI ++GetModuleFileNameEx95(HANDLE hProcess, ++ HMODULE hModule, LPTSTR lpstrFileName, DWORD n) ++{ ++ HANDLE h; ++ DWORD pid = (DWORD) hModule; ++ PROCESSENTRY32 proc; ++ ++ h = myCreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); ++ if (!h) ++ return 0; ++ proc.dwSize = sizeof(proc); ++ if (myProcess32First(h, &proc)) ++ do ++ if (proc.th32ProcessID == pid) { ++ CloseHandle(h); ++ strcpy(lpstrFileName, proc.szExeFile); ++ return 1; ++ } ++ while (myProcess32Next(h, &proc)); ++ CloseHandle(h); ++ return 0; ++} ++ ++#define FACTOR (0x19db1ded53ea710LL) ++#define NSPERSEC 10000000LL ++#define NSPERMSEC 10000LL ++ ++static time_t __stdcall ++to_time_t(PFILETIME ptr) ++{ ++ long rem; ++ long long x = ++ ((long long) ptr->dwHighDateTime << 32) + ++ ((unsigned) ptr->dwLowDateTime); ++ x -= FACTOR; ++ rem = x % NSPERSEC; ++ rem += NSPERSEC / 2; ++ x /= NSPERSEC; ++ x += rem / NSPERSEC; ++ return x; ++} ++ ++static long ++to_msec(PFILETIME ptr) ++{ ++ long long x = ++ ((long long) ptr->dwHighDateTime << 32) + ++ (unsigned) ptr->dwLowDateTime; ++ x /= NSPERMSEC; ++ return x; ++} ++ ++#endif /* cygwin */ ++ ++ ++void ++init_velocity_swrun(void) ++{ ++#ifdef cygwin ++ OSVERSIONINFO ver; ++ HMODULE h; ++ ++ memset(&ver, 0, sizeof ver); ++ ver.dwOSVersionInfoSize = sizeof ver; ++ GetVersionEx(&ver); ++ ++ if (ver.dwPlatformId == VER_PLATFORM_WIN32_NT) { ++ h = LoadLibrary("psapi.dll"); ++ if (h) { ++ myEnumProcessModules = ++ (ENUMPROCESSMODULES) GetProcAddress(h, ++ "EnumProcessModules"); ++ myGetModuleFileNameEx = ++ (GETMODULEFILENAME) GetProcAddress(h, ++ "GetModuleFileNameExA"); ++ myGetProcessMemoryInfo = ++ (GETPROCESSMEMORYINFO) GetProcAddress(h, ++ "GetProcessMemoryInfo"); ++ if (myEnumProcessModules && myGetModuleFileNameEx) ++ query = CW_GETPINFO_FULL; ++ else ++ snmp_log(LOG_ERR, "velocity_swrun failed NT init\n"); ++ } else ++ snmp_log(LOG_ERR, "velocity_swrun failed to load psapi.dll\n"); ++ } else { ++ h = GetModuleHandle("KERNEL32.DLL"); ++ myCreateToolhelp32Snapshot = ++ (CREATESNAPSHOT) GetProcAddress(h, "CreateToolhelp32Snapshot"); ++ myProcess32First = ++ (PROCESSWALK) GetProcAddress(h, "Process32First"); ++ myProcess32Next = (PROCESSWALK) GetProcAddress(h, "Process32Next"); ++ myEnumProcessModules = dummyprocessmodules; ++ myGetModuleFileNameEx = GetModuleFileNameEx95; ++ if (myCreateToolhelp32Snapshot && myProcess32First ++ && myProcess32Next) ++#if 0 ++ /* ++ * This doesn't work after all on Win98 SE ++ */ ++ query = CW_GETPINFO_FULL; ++#else ++ query = CW_GETPINFO; ++#endif ++ else ++ snmp_log(LOG_ERR, "velocity_swrun failed non-NT init\n"); ++ } ++#endif /* cygwin */ ++#ifdef PROC_SYMBOL ++ auto_nlist(PROC_SYMBOL, 0, 0); ++#endif ++#ifdef NPROC_SYMBOL ++ auto_nlist(NPROC_SYMBOL, 0, 0); ++#endif ++ ++ proc_table = 0; ++ ++ REGISTER_MIB("velocity/velocity_swrun", velocityswrun_variables, variable4, ++ velocityswrun_variables_oid); ++ REGISTER_MIB("velocity/velocity_swrun", velocityswrunperf_variables, variable4, ++ velocityswrunperf_variables_oid); ++} ++ ++/* ++ * header_velocityswrun(... ++ * Arguments: ++ * vp IN - pointer to variable entry that points here ++ * name IN/OUT - IN/name requested, OUT/name found ++ * length IN/OUT - length of IN/OUT oid's ++ * exact IN - TRUE if an exact match was requested ++ * var_len OUT - length of variable or 0 if function returned ++ * write_method ++ * ++ */ ++ ++int ++header_velocityswrun(struct variable *vp, ++ oid * name, ++ size_t * length, ++ int exact, size_t * var_len, WriteMethod ** write_method) ++{ ++#define VELOCITYSWRUN_NAME_LENGTH 9 ++ oid newname[MAX_OID_LEN]; ++ int result; ++ ++ DEBUGMSGTL(("velocity/velocity_swrun", "var_velocityswrun: \n")); ++ DEBUGMSGOID(("velocity/velocity_swrun", name, *length)); ++ DEBUGMSG(("velocity/velocity_swrun", " %d\n", exact)); ++ ++ memcpy((char *) newname, (char *) vp->name, vp->namelen * sizeof(oid)); ++ newname[VELOCITYSWRUN_NAME_LENGTH] = 0; ++ result = snmp_oid_compare(name, *length, newname, vp->namelen + 1); ++ if ((exact && (result != 0)) || (!exact && (result >= 0))) ++ return (MATCH_FAILED); ++ memcpy((char *) name, (char *) newname, ++ (vp->namelen + 1) * sizeof(oid)); ++ *length = vp->namelen + 1; ++ ++ *write_method = 0; ++ *var_len = sizeof(long); /* default to 'long' results */ ++ return (MATCH_SUCCEEDED); ++} ++ ++int ++header_velocityswrunEntry(struct variable *vp, ++ oid * name, ++ size_t * length, ++ int exact, ++ size_t * var_len, WriteMethod ** write_method) ++{ ++#define VELOCITYSWRUN_ENTRY_NAME_LENGTH 11 ++ oid newname[MAX_OID_LEN]; ++ int pid, LowPid = -1; ++ int result; ++ ++ DEBUGMSGTL(("velocity/velocity_swrun", "var_velocityswrunEntry: \n")); ++ DEBUGMSGOID(("velocity/velocity_swrun", name, *length)); ++ DEBUGMSG(("velocity/velocity_swrun", " %d\n", exact)); ++ ++ memcpy((char *) newname, (char *) vp->name, vp->namelen * sizeof(oid)); ++ ++ /* ++ * Find the "next" running process ++ */ ++ Init_VELOCITY_SWRun(); ++ for (;;) { ++ pid = Get_Next_VELOCITY_SWRun(); ++#ifndef linux ++#ifndef dynix ++ DEBUGMSG(("velocity/velocity_swrun", ++ "(index %d (entry #%d) ....", pid, current_proc_entry)); ++#else ++ DEBUGMSG(("velocity/velocity_swrun", "pid %d; nextproc %d ....\n", pid, ++ nextproc)); ++#endif ++#endif ++ if (pid == -1) ++ break; ++ newname[VELOCITYSWRUN_ENTRY_NAME_LENGTH] = pid; ++ DEBUGMSGOID(("velocity/velocity_swrun", newname, *length)); ++ DEBUGMSG(("velocity/velocity_swrun", "newname\n")); ++ result = snmp_oid_compare(name, *length, newname, vp->namelen + 1); ++ if (exact && (result == 0)) { ++ LowPid = pid; ++#ifdef cygwin ++ lowproc = *curproc; ++#elif dynix ++ memcpy(&lowpsinfo, &mypsinfo, sizeof(prpsinfo_t)); ++#elif !defined(linux) ++ LowProcIndex = current_proc_entry - 1; ++#endif ++ DEBUGMSGTL(("velocity/velocity_swrun", " saved\n")); ++ /* ++ * Save process status information ++ */ ++ break; ++ } ++ if ((!exact && (result < 0)) && (LowPid == -1 || pid < LowPid)) { ++ LowPid = pid; ++#ifdef cygwin ++ lowproc = *curproc; ++#elif !defined(linux) ++ LowProcIndex = current_proc_entry - 1; ++#endif ++ /* ++ * Save process status information ++ */ ++ DEBUGMSG(("velocity/velocity_swrun", " saved")); ++ } ++ DEBUGMSG(("velocity/velocity_swrun", "\n")); ++ } ++ End_VELOCITY_SWRun(); ++ ++ if (LowPid == -1) { ++ DEBUGMSGTL(("velocity/velocity_swrun", "... index out of range\n")); ++ return (MATCH_FAILED); ++ } ++ ++ newname[VELOCITYSWRUN_ENTRY_NAME_LENGTH] = LowPid; ++ memcpy((char *) name, (char *) newname, ++ (vp->namelen + 1) * sizeof(oid)); ++ *length = vp->namelen + 1; ++ *write_method = 0; ++ *var_len = sizeof(long); /* default to 'long' results */ ++ ++ DEBUGMSGTL(("velocity/velocity_swrun", "... get process stats\n")); ++ DEBUGMSGOID(("velocity/velocity_swrun", name, *length)); ++ DEBUGMSG(("velocity/velocity_swrun", "\n")); ++ return LowPid; ++} ++ ++ /********************* ++ * ++ * System specific implementation functions ++ * ++ *********************/ ++ ++ ++u_char * ++var_velocityswrun(struct variable * vp, ++ oid * name, ++ size_t * length, ++ int exact, size_t * var_len, WriteMethod ** write_method) ++{ ++ int pid = 0; ++ static char string[256]; ++#ifdef HAVE_SYS_PSTAT_H ++ struct pst_status proc_buf; ++#elif defined(solaris2) ++#if _SLASH_PROC_METHOD_ ++ static psinfo_t psinfo; ++ static psinfo_t *proc_buf; ++ int procfd; ++ char procfn[sizeof "/proc/00000/psinfo"]; ++#else ++ static struct proc *proc_buf; ++ char *cp1; ++#endif /* _SLASH_PROC_METHOD_ */ ++ static time_t when = 0; ++ time_t now; ++ static int oldpid = -1; ++#endif ++#if HAVE_KVM_GETPROCS ++ char **argv; ++#endif ++#ifdef linux ++ FILE *fp; ++ int fd; ++ char buf[256]; ++ char buff[1024]; ++ char uid[33]; ++ char gid[33]; ++ char unknown[] = "unknown"; ++ int bsize; ++ int i; ++ int uid1, uid2, uid3, uid4; ++ int gid1, gid2, gid3, gid4; ++ struct passwd* pwd; ++ struct group* grp; ++ char *username = NULL; ++ char *groupname = NULL; ++#endif ++ char *cp; ++ ++ if (vp->magic == VELOCITYSWRUN_OSINDEX) { ++ if (header_velocityswrun(vp, name, length, exact, var_len, write_method) ++ == MATCH_FAILED) ++ return NULL; ++ } else { ++ ++ pid = ++ header_velocityswrunEntry(vp, name, length, exact, var_len, ++ write_method); ++ if (pid == MATCH_FAILED) ++ return NULL; ++ } ++ ++#ifdef HAVE_SYS_PSTAT_H ++ if (pstat_getproc(&proc_buf, sizeof(struct pst_status), 0, pid) == -1) ++ return NULL; ++#elif defined(solaris2) ++ time(&now); ++ if (pid == oldpid) { ++ if (now != when) ++ oldpid = -1; ++ } ++ if (oldpid != pid || proc_buf == NULL) { ++#if _SLASH_PROC_METHOD_ ++ proc_buf = &psinfo; ++ sprintf(procfn, "/proc/%.5d/psinfo", pid); ++ if ((procfd = open(procfn, O_RDONLY)) != -1) { ++ if (read(procfd, proc_buf, sizeof(*proc_buf)) != ++ sizeof(*proc_buf)) ++ abort(); ++ close(procfd); ++ } else ++ proc_buf = NULL; ++#else ++ if (kd == NULL) ++ return NULL; ++ if ((proc_buf = kvm_getproc(kd, pid)) == NULL) ++ return NULL; ++#endif ++ oldpid = pid; ++ when = now; ++ } ++#endif ++ ++ switch (vp->magic) { ++ case VELOCITYSWRUN_OSINDEX: ++#if NO_DUMMY_VALUES ++ return NULL; ++#else ++ long_return = 1; /* Probably! */ ++ return (u_char *) & long_return; ++#endif ++ ++ case VELOCITYSWRUN_INDEX: ++ long_return = pid; ++ return (u_char *) & long_return; ++ case VELOCITYSWRUN_NAME: ++#ifdef HAVE_SYS_PSTAT_H ++ sprintf(string, "%s", proc_buf.pst_cmd); ++ cp = strchr(string, ' '); ++ if (cp != NULL) ++ *cp = '\0'; ++#elif defined(dynix) ++ sprintf(string, "%s", lowpsinfo.pr_fname); ++ cp = strchr(string, ' '); ++ if (cp != NULL) ++ *cp = '\0'; ++#elif defined(solaris2) ++#if _SLASH_PROC_METHOD_ ++ if (proc_buf) ++ strcpy(string, proc_buf->pr_fname); ++ else ++ strcpy(string, ""); ++#else ++ strcpy(string, proc_buf->p_user.u_comm); ++#endif ++#elif HAVE_KVM_GETPROCS ++ strcpy(string, proc_table[LowProcIndex].kp_proc.p_comm); ++#elif defined(linux) ++ sprintf(string, "/proc/%d/status", pid); ++ if ((fp = fopen(string, "r")) == NULL) ++ return NULL; ++ fgets(buf, sizeof(buf), fp); /* Name: process name */ ++ cp = buf; ++ while (*cp != ':') ++ ++cp; ++ ++cp; ++ while (isspace(*cp)) ++ ++cp; ++ strcpy(string, cp); ++ fclose(fp); ++#elif defined(cygwin) ++ if (lowproc.process_state & (PID_ZOMBIE | PID_EXITED)) ++ strcpy(string, ""); ++ else if (lowproc.ppid) { ++ cygwin_conv_to_posix_path(lowproc.progname, string); ++ cp = strrcvelocity(string, '/'); ++ if (cp) ++ strcpy(string, cp + 1); ++ } else if (query == CW_GETPINFO_FULL) { ++ DWORD n = lowproc.dwProcessId & 0xffff; ++ HANDLE h = ++ OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, ++ FALSE, n); ++ ++ if (h) { ++ HMODULE hm[1000]; ++ if (!myEnumProcessModules(h, hm, sizeof hm, &n)) { ++ snmp_log(LOG_DEBUG, "no module handle for %lu\n", n); ++ n = 0; ++ } ++ if (n ++ && myGetModuleFileNameEx(h, hm[0], string, ++ sizeof string)) { ++ cp = strrcvelocity(string, '\\'); ++ if (cp) ++ strcpy(string, cp + 1); ++ } else ++ strcpy(string, "*** unknown"); ++ CloseHandle(h); ++ } else { ++ snmp_log(LOG_INFO, "no process handle for %lu\n", n); ++ strcpy(string, "** unknown"); ++ } ++ } else ++ strcpy(string, "* unknown"); ++ cp = strchr(string, '\0') - 4; ++ if (cp > string && strcasecmp(cp, ".exe") == 0) ++ *cp = '\0'; ++#else ++#if NO_DUMMY_VALUES ++ return NULL; ++#endif ++ sprintf(string, "process name"); ++#endif ++ *var_len = strlen(string); ++ /* ++ * remove trailing newline ++ */ ++ if (*var_len) { ++ cp = string + *var_len - 1; ++ if (*cp == '\n') ++ --(*var_len); ++ } ++ return (u_char *) string; ++ case VELOCITYSWRUN_ID: ++ *var_len = nullOidLen; ++ return (u_char *) nullOid; ++ case VELOCITYSWRUN_PATH: ++#ifdef HAVE_SYS_PSTAT_H ++ /* ++ * Path not available - use argv[0] ++ */ ++ sprintf(string, "%s", proc_buf.pst_cmd); ++ cp = strchr(string, ' '); ++ if (cp != NULL) ++ *cp = '\0'; ++#elif defined(dynix) ++ /* ++ * Path not available - use argv[0] ++ */ ++ sprintf(string, "%s", lowpsinfo.pr_psargs); ++ cp = strchr(string, ' '); ++ if (cp != NULL) ++ *cp = '\0'; ++#elif defined(solaris2) ++#ifdef _SLASH_PROC_METHOD_ ++ if (proc_buf) ++ strcpy(string, proc_buf->pr_psargs); ++ else ++ sprintf(string, ""); ++ cp = strchr(string, ' '); ++ if (cp) ++ *cp = 0; ++#else ++ cp = proc_buf->p_user.u_psargs; ++ cp1 = string; ++ while (*cp && *cp != ' ') ++ *cp1++ = *cp++; ++ *cp1 = 0; ++#endif ++#elif HAVE_KVM_GETPROCS ++ strcpy(string, proc_table[LowProcIndex].kp_proc.p_comm); ++#elif defined(linux) ++ sprintf(string, "/proc/%d/cmdline", pid); ++ if ((fp = fopen(string, "r")) == NULL) ++ return NULL; ++ if (fgets(buf, sizeof(buf) - 1, fp)) /* argv[0] '\0' argv[1] '\0' .... */ ++ strcpy(string, buf); ++ else { ++ /* ++ * swapped out - no cmdline ++ */ ++ fclose(fp); ++ sprintf(string, "/proc/%d/status", pid); ++ if ((fp = fopen(string, "r")) == NULL) ++ return NULL; ++ fgets(buf, sizeof(buf), fp); /* Name: process name */ ++ cp = strchr(buf, ':'); ++ ++cp; ++ while (isspace(*cp)) ++ ++cp; ++ strcpy(string, cp); ++ cp = strchr(string, '\n'); ++ if (cp) ++ *cp = 0; ++ } ++ fclose(fp); ++#elif defined(cygwin) ++ if (lowproc.process_state & (PID_ZOMBIE | PID_EXITED)) ++ strcpy(string, ""); ++ else if (lowproc.ppid) ++ cygwin_conv_to_posix_path(lowproc.progname, string); ++ else if (query == CW_GETPINFO_FULL) { ++ DWORD n = lowproc.dwProcessId & 0xFFFF; ++ HANDLE h = ++ OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, ++ FALSE, n); ++ if (h) { ++ HMODULE hm[1000]; ++ if (!myEnumProcessModules(h, hm, sizeof hm, &n)) ++ n = 0; ++ if (!n ++ || !myGetModuleFileNameEx(h, hm[0], string, ++ sizeof string)) ++ strcpy(string, "*** unknown"); ++ CloseHandle(h); ++ } else ++ strcpy(string, "** unknown"); ++ } else ++ strcpy(string, "* unknown"); ++#else ++#if NO_DUMMY_VALUES ++ return NULL; ++#endif ++ sprintf(string, "/bin/wombat"); ++#endif ++ *var_len = strlen(string); ++ return (u_char *) string; ++ case VELOCITYSWRUN_PARAMS: ++#ifdef HAVE_SYS_PSTAT_H ++ cp = strchr(proc_buf.pst_cmd, ' '); ++ if (cp != NULL) { ++ cp++; ++ sprintf(string, "%s", cp); ++ } else ++ string[0] = '\0'; ++#elif defined(dynix) ++ cp = strchr(lowpsinfo.pr_psargs, ' '); ++ if (cp != NULL) { ++ cp++; ++ sprintf(string, "%s", cp); ++ } else ++ string[0] = '\0'; ++#elif defined(solaris2) ++#ifdef _SLASH_PROC_METHOD_ ++ if (proc_buf) { ++ cp = strchr(proc_buf->pr_psargs, ' '); ++ if (cp) ++ strcpy(string, cp + 1); ++ else ++ string[0] = 0; ++ } else ++ string[0] = 0; ++#else ++ cp = proc_buf->p_user.u_psargs; ++ while (*cp && *cp != ' ') ++ cp++; ++ if (*cp == ' ') ++ cp++; ++ strcpy(string, cp); ++#endif ++#elif HAVE_KVM_GETPROCS ++ string[0] = 0; ++ argv = kvm_getargv(kd, proc_table + LowProcIndex, sizeof(string)); ++ if (argv) ++ argv++; ++ while (argv && *argv) { ++ if (string[0] != 0) ++ strcat(string, " "); ++ strcat(string, *argv); ++ argv++; ++ } ++#elif defined(linux) ++ sprintf(string, "/proc/%d/cmdline", pid); ++ if ((fp = fopen(string, "r")) == NULL) ++ return NULL; ++ memset(buf, 0, sizeof(buf)); ++ ++ /* ++ * argv[0] '\0' argv[1] '\0' .... ++ */ ++ if (!fgets(buf, sizeof(buf) - 2, fp)) { ++ /* ++ * maybe be empty (even argv[0] is missing) ++ */ ++ string[0] = '\0'; ++ *var_len = 0; ++ fclose(fp); ++ return string; ++ } ++ ++ /* ++ * Skip over argv[0] ++ */ ++ cp = buf; ++ while (*cp) ++ ++cp; ++ ++cp; ++ /* ++ * Now join together separate arguments. ++ */ ++ while (1) { ++ while (*cp) ++ ++cp; ++ if (*(cp + 1) == '\0') ++ break; /* '\0''\0' => End of command line */ ++ *cp = ' '; ++ } ++ ++ cp = buf; ++ while (*cp) ++ ++cp; ++ ++cp; ++ strcpy(string, cp); ++ fclose(fp); ++#elif defined(cygwin) ++ string[0] = 0; ++#else ++#if NO_DUMMY_VALUES ++ return NULL; ++#endif ++ sprintf(string, "-h -q -v"); ++#endif ++ *var_len = strlen(string); ++ return (u_char *) string; ++ case VELOCITYSWRUNPERF_ALL: ++#if defined(linux) ++ sprintf(string, "/proc/%d/stat", pid); ++ if ((fp = fopen(string, "r")) == NULL) ++ return NULL; ++ fgets(buf, sizeof(buf), fp); ++ strcpy(string,buf); ++ ++ fclose(fp); ++#endif ++ *var_len = strlen(string); ++ return (u_char *) string; ++ case VELOCITYSWRUNPERF_UID: ++#if defined(linux) ++ sprintf(string, "/proc/%d/status", pid); ++ DEBUGMSG(("velocity/velocity_swrun", "In UID string=%s\n",string)); ++ if ((fd = open(string, O_RDONLY, 0)) == -1) ++ return NULL; ++ bsize = read(fd, buff, sizeof(buff)); ++ buff[bsize-1] = 0; ++ DEBUGMSG(("velocity/velocity_swrun", "In UID buff=%s\n",buff)); ++ cp = strstr(buff, "Uid:"); ++ DEBUGMSG(("velocity/velocity_swrun", "In UID cp=%s\n",cp)); ++ if (cp) ++ sscanf(cp, "%*s %s %*s %*s %*s %*s %s", uid, gid); ++ else { ++ return NULL; ++ } ++ strcpy(string,uid); ++ strcat(string," "); ++ strcat(string,gid); ++ DEBUGMSG(("velocity/velocity_swrun", "In UID end string=%s\n",string)); ++ close(fd); ++#endif ++ *var_len = strlen(string); ++ return (u_char *) string; ++ case VELOCITYSWRUNPERF_UNAME: ++#if defined(linux) ++ sprintf(string, "/proc/%d/status", pid); ++ DEBUGMSG(("velocity/velocity_swrun", "UName string=%s\n",string)); ++ if ((fd = open(string, O_RDONLY, 0)) == -1) ++ return NULL; ++ bsize = read(fd, buff, sizeof(buff)); ++ buff[bsize-1] = 0; ++ DEBUGMSG(("velocity/velocity_swrun", "UName buff=%s\n",buff)); ++ cp = strstr(buff, "Uid:"); ++ DEBUGMSG(("velocity/velocity_swrun", "UName cp=%s\n",cp)); ++ if (cp) ++ sscanf(cp, "%*s %d %*s %*s %*s %*s %d", &uid1, &gid1); ++ else { ++ return NULL; ++ } ++ DEBUGMSG(("velocity/velocity_swrun", "UName uid1=%d gid1=%d\n", uid1, gid1)); ++ pwd = getpwuid(uid1); ++ if ( pwd == NULL ) ++ username = unknown; ++ else username = pwd->pw_name; ++ grp = getgrgid(gid1); ++ if ( grp == NULL ) ++ groupname = unknown; ++ else groupname = grp->gr_name; ++/* strcpy(string,username); ++ strcat(string," "); ++ strcat(string,groupname); */ ++ sprintf(string,"%s %s %d %d", username, groupname, uid1, gid1); ++ DEBUGMSG(("velocity/velocity_swrun", "UName end string=%s\n",string)); ++ close(fd); ++#endif ++ *var_len = strlen(string); ++ return (u_char *) string; ++ case VELOCITYSWRUN_TYPE: ++#ifdef PID_MAXSYS ++ if (pid < PID_MAXSYS) ++ long_return = 2; /* operatingSystem */ ++ else ++#endif ++ long_return = 4; /* application */ ++ return (u_char *) & long_return; ++ case VELOCITYSWRUN_STATUS: ++#if defined(cygwin) ++ if (lowproc.process_state & PID_STOPPED) ++ long_return = 3; /* notRunnable */ ++ else if (lowproc.process_state & PID_ZOMBIE) ++ long_return = 4; /* invalid */ ++ else ++ long_return = 1; /* running */ ++#elif !defined(linux) ++#if defined(hpux10) || defined(hpux11) ++ switch (proc_table[LowProcIndex].pst_stat) { ++ case PS_STOP: ++ long_return = 3; /* notRunnable */ ++ break; ++ case PS_SLEEP: ++ long_return = 2; /* runnable */ ++ break; ++ case PS_RUN: ++ long_return = 1; /* running */ ++ break; ++ case PS_ZOMBIE: ++ case PS_IDLE: ++ case PS_OTHER: ++ default: ++ long_return = 4; /* invalid */ ++ break; ++ } ++#else ++#if HAVE_KVM_GETPROCS ++ switch (proc_table[LowProcIndex].kp_proc.p_stat) { ++#elif defined(dynix) ++ switch (lowpsinfo.pr_state) { ++#elif defined(solaris2) ++#if _SLASH_PROC_METHOD_ ++ switch (proc_buf ? proc_buf->pr_lwp.pr_state : SIDL) { ++#else ++ switch (proc_buf->p_stat) { ++#endif ++#else ++ switch (proc_table[LowProcIndex].p_stat) { ++#endif ++ case SSTOP: ++ long_return = 3; /* notRunnable */ ++ break; ++ case 0: ++#ifdef SSWAP ++ case SSWAP: ++#endif ++#ifdef SSLEEP ++ case SSLEEP: ++#endif ++#ifdef SWAIT ++ case SWAIT: ++#endif ++ long_return = 2; /* runnable */ ++ break; ++#ifdef SACTIVE ++ case SACTIVE: ++#endif ++#ifdef SRUN ++ case SRUN: ++#endif ++#ifdef SONPROC ++ case SONPROC: ++#endif ++ long_return = 1; /* running */ ++ break; ++ case SIDL: ++ case SZOMB: ++ default: ++ long_return = 4; /* invalid */ ++ break; ++ } ++#endif ++#else ++ sprintf(string, "/proc/%d/stat", pid); ++ if ((fp = fopen(string, "r")) != NULL) { ++ fgets(buf, sizeof(buf), fp); ++ cp = buf; ++ for (i = 0; i < 2; ++i) { /* skip two fields */ ++ while (*cp != ' ') ++ ++cp; ++ ++cp; ++ } ++ ++ switch (*cp) { ++ case 'R': ++ long_return = 1; /* running */ ++ break; ++ case 'S': ++ long_return = 2; /* runnable */ ++ break; ++ case 'D': ++ case 'T': ++ long_return = 3; /* notRunnable */ ++ break; ++ case 'Z': ++ default: ++ long_return = 4; /* invalid */ ++ break; ++ } ++ fclose(fp); ++ } else ++ long_return = 4; /* invalid */ ++#endif ++ return (u_char *) & long_return; ++ ++ case VELOCITYSWRUN_PPID: ++#if defined(linux) ++ sprintf(string, "/proc/%d/stat", pid); ++ if ((fp = fopen(string, "r")) == NULL) ++ return NULL; ++ fgets(buf, sizeof(buf), fp); ++ cp = buf; ++ for (i = 0; i < 3; ++i) { /* skip 3 fields */ ++ while (*cp != ' ') ++ ++cp; ++ ++cp; ++ } ++ ++ long_return = atoi(cp); /* Parent Process ID */ ++ ++ fclose(fp); ++#endif ++ return (u_char *) & long_return; ++ case VELOCITYSWRUN_PGRP: ++#if defined(linux) ++ sprintf(string, "/proc/%d/stat", pid); ++ if ((fp = fopen(string, "r")) == NULL) ++ return NULL; ++ fgets(buf, sizeof(buf), fp); ++ cp = buf; ++ for (i = 0; i < 4; ++i) { /* skip 4 fields */ ++ while (*cp != ' ') ++ ++cp; ++ ++cp; ++ } ++ ++ long_return = atoi(cp); /* Process group ID */ ++ ++ fclose(fp); ++#endif ++ return (u_char *) & long_return; ++ case VELOCITYSWRUNPERF_CPU_USER: ++#if defined(linux) ++ sprintf(string, "/proc/%d/stat", pid); ++ if ((fp = fopen(string, "r")) == NULL) ++ return NULL; ++ fgets(buf, sizeof(buf), fp); ++ cp = buf; ++ for (i = 0; i < 13; ++i) { /* skip 13 fields */ ++ while (*cp != ' ') ++ ++cp; ++ ++cp; ++ } ++ ++ long_return = atoi(cp); /* utime */ ++ fclose(fp); ++#endif ++ return (u_char *) & long_return; ++ case VELOCITYSWRUNPERF_CPU_SYS: ++#if defined(linux) ++ sprintf(string, "/proc/%d/stat", pid); ++ if ((fp = fopen(string, "r")) == NULL) ++ return NULL; ++ fgets(buf, sizeof(buf), fp); ++ cp = buf; ++ for (i = 0; i < 14; ++i) { /* skip 14 fields */ ++ while (*cp != ' ') ++ ++cp; ++ ++cp; ++ } ++ ++ long_return = atoi(cp); /* stime */ ++ fclose(fp); ++#endif ++ return (u_char *) & long_return; ++ case VELOCITYSWRUNPERF_CPU_CUMM_USER: ++#if defined(linux) ++ sprintf(string, "/proc/%d/stat", pid); ++ if ((fp = fopen(string, "r")) == NULL) ++ return NULL; ++ fgets(buf, sizeof(buf), fp); ++ cp = buf; ++ for (i = 0; i < 15; ++i) { /* skip 15 fields */ ++ while (*cp != ' ') ++ ++cp; ++ ++cp; ++ } ++ ++ long_return = atoi(cp); /* cutime */ ++ ++ fclose(fp); ++#endif ++ return (u_char *) & long_return; ++ case VELOCITYSWRUNPERF_CPU_CUMM_SYS: ++#if defined(linux) ++ sprintf(string, "/proc/%d/stat", pid); ++ if ((fp = fopen(string, "r")) == NULL) ++ return NULL; ++ fgets(buf, sizeof(buf), fp); ++ cp = buf; ++ for (i = 0; i < 16; ++i) { /* skip 16 fields */ ++ while (*cp != ' ') ++ ++cp; ++ ++cp; ++ } ++ ++ long_return = atoi(cp); /* cstime */ ++ ++ fclose(fp); ++#endif ++ return (u_char *) & long_return; ++ case VELOCITYSWRUNPERF_MIN_FAULT: ++#if defined(linux) ++ sprintf(string, "/proc/%d/stat", pid); ++ if ((fp = fopen(string, "r")) == NULL) ++ return NULL; ++ fgets(buf, sizeof(buf), fp); ++ cp = buf; ++ for (i = 0; i < 9; ++i) { /* skip 9 fields */ ++ while (*cp != ' ') ++ ++cp; ++ ++cp; ++ } ++ ++ long_return = atoi(cp); /* minflt */ ++ ++ fclose(fp); ++#endif ++ return (u_char *) & long_return; ++ case VELOCITYSWRUNPERF_MAJ_FAULT: ++#if defined(linux) ++ sprintf(string, "/proc/%d/stat", pid); ++ if ((fp = fopen(string, "r")) == NULL) ++ return NULL; ++ fgets(buf, sizeof(buf), fp); ++ cp = buf; ++ for (i = 0; i < 11; ++i) { /* skip 11 fields */ ++ while (*cp != ' ') ++ ++cp; ++ ++cp; ++ } ++ ++ long_return = atoi(cp); /* majflt */ ++ ++ fclose(fp); ++#endif ++ return (u_char *) & long_return; ++ case VELOCITYSWRUNPERF_MIN_FAULT_CUMM: ++#if defined(linux) ++ sprintf(string, "/proc/%d/stat", pid); ++ if ((fp = fopen(string, "r")) == NULL) ++ return NULL; ++ fgets(buf, sizeof(buf), fp); ++ cp = buf; ++ for (i = 0; i < 10; ++i) { /* skip 10 fields */ ++ while (*cp != ' ') ++ ++cp; ++ ++cp; ++ } ++ ++ long_return = atoi(cp); /* cminflt */ ++ ++ fclose(fp); ++#endif ++ return (u_char *) & long_return; ++ case VELOCITYSWRUNPERF_MAJ_FAULT_CUMM: ++#if defined(linux) ++ sprintf(string, "/proc/%d/stat", pid); ++ if ((fp = fopen(string, "r")) == NULL) ++ return NULL; ++ fgets(buf, sizeof(buf), fp); ++ cp = buf; ++ for (i = 0; i < 12; ++i) { /* skip 12 fields */ ++ while (*cp != ' ') ++ ++cp; ++ ++cp; ++ } ++ ++ long_return = atoi(cp); /* cmajflt */ ++ ++ fclose(fp); ++#endif ++ return (u_char *) & long_return; ++ case VELOCITYSWRUNPERF_RSS: ++#if defined(linux) ++ sprintf(string, "/proc/%d/stat", pid); ++ if ((fp = fopen(string, "r")) == NULL) ++ return NULL; ++ fgets(buf, sizeof(buf), fp); ++ cp = buf; ++ for (i = 0; i < 23; ++i) { /* skip 23 fields */ ++ while (*cp != ' ') ++ ++cp; ++ ++cp; ++ } ++ ++ long_return = atoi(cp); /* rss */ ++ ++ fclose(fp); ++#endif ++ return (u_char *) & long_return; ++ case VELOCITYSWRUNPERF_PRIO: ++#if defined(linux) ++ sprintf(string, "/proc/%d/stat", pid); ++ if ((fp = fopen(string, "r")) == NULL) ++ return NULL; ++ fgets(buf, sizeof(buf), fp); ++ cp = buf; ++ for (i = 0; i < 18; ++i) { /* skip 18 fields */ ++ while (*cp != ' ') ++ ++cp; ++ ++cp; ++ } ++ ++ long_return = atoi(cp); /* priority */ ++ ++ fclose(fp); ++#endif ++ return (u_char *) & long_return; ++ case VELOCITYSWRUNPERF_MEM: ++#ifdef HAVE_SYS_PSTAT_H ++ long_return = (proc_buf.pst_rssize << PGSHIFT) / 1024; ++#elif defined(dynix) ++ long_return = (lowpsinfo.pr_rssize * MMU_PAGESIZE) / 1024; ++#elif defined(solaris2) ++#if _SLASH_PROC_METHOD_ ++ long_return = proc_buf ? proc_buf->pr_rssize : 0; ++#else ++ long_return = proc_buf->p_swrss; ++#endif ++#elif HAVE_KVM_GETPROCS ++#if defined(freebsd3) && !defined(darwin) ++ long_return = ++ proc_table[LowProcIndex].kp_eproc.e_vm.vm_map.size / 1024; ++#else ++ long_return = proc_table[LowProcIndex].kp_eproc.e_vm.vm_tsize + ++ proc_table[LowProcIndex].kp_eproc.e_vm.vm_ssize + ++ proc_table[LowProcIndex].kp_eproc.e_vm.vm_dsize; ++ long_return = long_return * (getpagesize() / 1024); ++#endif ++#elif defined(linux) ++ sprintf(string, "/proc/%d/stat", pid); ++ if ((fp = fopen(string, "r")) == NULL) ++ return NULL; ++ fgets(buf, sizeof(buf), fp); ++ cp = buf; ++ for (i = 0; i < 22; ++i) { /* skip 22 fields */ ++ while (*cp != ' ') ++ ++cp; ++ ++cp; ++ } ++ long_return = atoi(cp) / 1024; /* perfmem in K */ ++ fclose(fp); ++#elif defined(cygwin) ++ { ++ DWORD n = lowproc.dwProcessId; ++ HANDLE h = ++ OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, ++ FALSE, n); ++ PROCESS_MEMORY_COUNTERS pmc; ++ ++ if (h) { ++ if (myGetProcessMemoryInfo ++ && myGetProcessMemoryInfo(h, &pmc, sizeof pmc)) ++ long_return = pmc.WorkingSetSize / 1024; ++ else { ++ snmp_log(LOG_INFO, "no process times for %lu (%lu)\n", ++ lowproc.pid, n); ++ long_return = 0; ++ } ++ CloseHandle(h); ++ } else { ++ snmp_log(LOG_INFO, "no process handle for %lu (%lu)\n", ++ lowproc.pid, n); ++ long_return = 0; ++ } ++ } ++#else ++#if NO_DUMMY_VALUES ++ return NULL; ++#endif ++ long_return = 16 * 1024; /* XXX - 16M! */ ++#endif ++ return (u_char *) & long_return; ++ default: ++ DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_velocityswrun\n", ++ vp->magic)); ++ } ++ return NULL; ++} ++ ++ ++ /********************* ++ * ++ * Internal implementation functions ++ * ++ *********************/ ++ ++#if defined(linux) ++ ++DIR *vsprocdir = NULL; ++struct dirent *procentry_p; ++ ++void ++Init_VELOCITY_SWRun(void) ++{ ++ if (vsprocdir != NULL) ++ closedir(vsprocdir); ++ vsprocdir = opendir("/proc"); ++} ++ ++int ++Get_Next_VELOCITY_SWRun(void) ++{ ++ int pid; ++ procentry_p = readdir(vsprocdir); ++ ++ if (procentry_p == NULL) ++ return -1; ++ ++ pid = atoi(procentry_p->d_name); ++ if (pid == 0) ++ return (Get_Next_VELOCITY_SWRun()); ++ return pid; ++} ++ ++void ++End_VELOCITY_SWRun(void) ++{ ++ if (vsprocdir) ++ closedir(vsprocdir); ++ vsprocdir = NULL; ++} ++ ++#elif defined(cygwin) ++ ++static pid_t curpid; ++ ++void ++Init_VELOCITY_SWRun(void) ++{ ++ cygwin_internal(CW_LOCK_PINFO, 1000); ++ curpid = 0; ++} ++ ++int ++Get_Next_VELOCITY_SWRun(void) ++{ ++ curproc = ++ (struct external_pinfo *) cygwin_internal(query, ++ curpid | CW_NEXTPID); ++ if (curproc) ++ curpid = curproc->pid; ++ else { ++ curpid = -1; ++ } ++ return curpid; ++} ++ ++void ++End_VELOCITY_SWRun(void) ++{ ++ cygwin_internal(CW_UNLOCK_PINFO); ++} ++ ++#elif defined(dynix) ++ ++void ++Init_VELOCITY_SWRun(void) ++{ ++ nextproc = 0; ++} ++ ++int ++Get_Next_VELOCITY_SWRun(void) ++{ ++ getprpsinfo_t *select = 0; ++ ++ DEBUGMSGTL(("velocity/velocity_swrun::GetNextVELOCITY_SWRun", ++ "nextproc == %d... &nextproc = %u\n", nextproc, ++ &nextproc)); ++ if ((nextproc = getprpsinfo(nextproc, select, &mypsinfo)) < 0) { ++ return -1; ++ } else { ++ DEBUGMSGTL(("velocity/velocity_swrun::GetNextVELOCITY_SWRun", ++ "getprpsinfo returned %d\n", nextproc)); ++ return mypsinfo.pr_pid; ++ } ++ ++} ++ ++void ++End_VELOCITY_SWRun(void) ++{ ++ /* ++ * just a stub... because it's declared ++ */ ++} ++ ++#else /* linux */ ++ ++static int nproc; ++ ++void ++Init_VELOCITY_SWRun(void) ++{ ++ size_t bytes; ++ static time_t iwhen = 0; ++ time_t now; ++ ++ time(&now); ++ if (now == iwhen) { ++ current_proc_entry = 0; ++ return; ++ } ++ iwhen = now; ++ ++#if defined(hpux10) || defined(hpux11) ++ pstat_getdynamic(&pst_dyn, sizeof(struct pst_dynamic), 1, 0); ++ nproc = pst_dyn.psd_activeprocs; ++ bytes = nproc * sizeof(struct pst_status); ++ if ((proc_table = ++ (struct pst_status *) realloc(proc_table, bytes)) == NULL) { ++ current_proc_entry = nproc + 1; ++ return; ++ } ++ pstat_getproc(proc_table, sizeof(struct pst_status), nproc, 0); ++ ++#elif defined(solaris2) ++ if (!getKstatInt("unix", "system_misc", "nproc", &nproc)) { ++ current_proc_entry = nproc + 1; ++ return; ++ } ++ bytes = nproc * sizeof(int); ++ if ((proc_table = (int *) realloc(proc_table, bytes)) == NULL) { ++ current_proc_entry = nproc + 1; ++ return; ++ } ++ { ++ DIR *f; ++ struct dirent *dp; ++#if _SLASH_PROC_METHOD_ == 0 ++ if (kd == NULL) { ++ current_proc_entry = nproc + 1; ++ return; ++ } ++#endif ++ f = opendir("/proc"); ++ current_proc_entry = 0; ++ while ((dp = readdir(f)) != NULL && current_proc_entry < nproc) ++ if (dp->d_name[0] != '.') ++ proc_table[current_proc_entry++] = atoi(dp->d_name); ++ closedir(f); ++ } ++#elif HAVE_KVM_GETPROCS ++ { ++ if (kd == NULL) { ++ nproc = 0; ++ return; ++ } ++ proc_table = kvm_getprocs(kd, KERN_PROC_ALL, 0, &nproc); ++ } ++#else ++ ++ current_proc_entry = 1; ++#ifndef bsdi2 ++ nproc = 0; ++ ++ if (auto_nlist(NPROC_SYMBOL, (char *) &nproc, sizeof(int)) == 0) { ++ snmp_log_perror("Init_VELOCITY_SWRun-auto_nlist NPROC"); ++ return; ++ } ++#endif ++ bytes = nproc * sizeof(struct proc); ++ ++ if (proc_table) ++ free((char *) proc_table); ++ if ((proc_table = (struct proc *) malloc(bytes)) == NULL) { ++ nproc = 0; ++ snmp_log_perror("Init_VELOCITY_SWRun-malloc"); ++ return; ++ } ++ ++ { ++ int proc_table_base; ++ if (auto_nlist ++ (PROC_SYMBOL, (char *) &proc_table_base, ++ sizeof(proc_table_base)) == 0) { ++ nproc = 0; ++ snmp_log_perror("Init_VELOCITY_SWRun-auto_nlist PROC"); ++ return; ++ } ++ if (klookup(proc_table_base, (char *) proc_table, bytes) == 0) { ++ nproc = 0; ++ snmp_log_perror("Init_VELOCITY_SWRun-klookup"); ++ return; ++ } ++ } ++#endif ++ current_proc_entry = 0; ++} ++ ++int ++Get_Next_VELOCITY_SWRun(void) ++{ ++ while (current_proc_entry < nproc) { ++#if defined(hpux10) || defined(hpux11) ++ return proc_table[current_proc_entry++].pst_pid; ++#elif defined(solaris2) ++ return proc_table[current_proc_entry++]; ++#elif HAVE_KVM_GETPROCS ++ if (proc_table[current_proc_entry].kp_proc.p_stat != 0) ++ return proc_table[current_proc_entry++].kp_proc.p_pid; ++#else ++ if (proc_table[current_proc_entry].p_stat != 0) ++ return proc_table[current_proc_entry++].p_pid; ++ else ++ ++current_proc_entry; ++#endif ++ ++ } ++ return -1; ++} ++ ++void ++End_VELOCITY_SWRun(void) ++{ ++ current_proc_entry = nproc + 1; ++} ++#endif ++ ++int ++vscount_processes(void) ++{ ++#if !(defined(linux) || defined(cygwin)) || defined(hpux10) || defined(hpux11) || defined(solaris2) || HAVE_KVM_GETPROCS ++ int i; ++#endif ++ int total = 0; ++ ++ Init_VELOCITY_SWRun(); ++#if defined(hpux10) || defined(hpux11) || HAVE_KVM_GETPROCS || defined(solaris2) ++ total = nproc; ++#else ++#if !defined(linux) && !defined(cygwin) && !defined(dynix) ++ for (i = 0; i < nproc; ++i) { ++ if (proc_table[i].p_stat != 0) ++#else ++ while (Get_Next_VELOCITY_SWRun() != -1) { ++#endif ++ ++total; ++ } ++#endif /* !hpux10 && !hpux11 && !HAVE_KVM_GETPROCS && !solaris2 */ ++ End_VELOCITY_SWRun(); ++ return total; ++} +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 +@@ -0,0 +1,13 @@ ++/* ++ * Velocity MIB - Running Software group interface - velocity_swrun.h ++ * (also includes Running Software Performance group extenstions to the ++ * standard host resources MIB) ++ */ ++#ifndef _MIBGROUP_VELOCITYSWRUN_H ++#define _MIBGROUP_VELOCITYSWRUN_H ++ ++extern void init_velocity_swrun(void); ++extern FindVarMethod var_velocityswrun; ++ ++ ++#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 +@@ -0,0 +1,403 @@ ++/* ++ * Velocity MIB - system group implementation - velocity_system.c ++ * ++ */ ++ ++#include ++#if HAVE_STRING_H ++#include ++#else ++#include ++#endif ++ ++#include ++#include ++ ++#include "host.h" ++#include "host_res.h" ++#include "velocity_system.h" ++#include ++ ++#ifdef HAVE_SYS_PROC_H ++#include ++#include "sys/proc.h" ++#endif ++#if HAVE_UTMPX_H ++#include ++#else ++#include ++#endif ++ ++#ifdef linux ++#ifdef HAVE_LINUX_TASKS_H ++#include ++#else ++/* ++ * If this file doesn't exist, then there is no hard limit on the number ++ * of processes, so return 0 for velocitySystemMaxProcesses. ++ */ ++#define NR_TASKS 0 ++#endif ++#endif ++ ++#if defined(hpux10) || defined(hpux11) ++#include ++#endif ++ ++#ifdef HAVE_SYS_SYSCTL_H ++#include ++#endif ++ ++#if !defined(UTMP_FILE) && defined(_PATH_UTMP) ++#define UTMP_FILE _PATH_UTMP ++#endif ++ ++#if defined(UTMP_FILE) && !HAVE_UTMPX_H ++void setutent(void); ++void endutent(void); ++struct utmp *getutent(void); ++#endif /* UTMP_FILE */ ++ ++ ++ /********************* ++ * ++ * Kernel & interface information, ++ * and internal forward declarations ++ * ++ *********************/ ++ ++static int get_load_dev(void); ++static int count_users(void); ++extern int count_processes(void); ++ ++ ++ /********************* ++ * ++ * Initialisation & common implementation functions ++ * ++ *********************/ ++ ++#define VELOCITYSYS_UPTIME 1 ++#define VELOCITYSYS_DATE 2 ++#define VELOCITYSYS_LOAD_DEV 3 ++#define VELOCITYSYS_LOAD_PARAM 4 ++#define VELOCITYSYS_USERS 5 ++#define VELOCITYSYS_PROCS 6 ++#define VELOCITYSYS_MAXPROCS 7 ++#define VELOCITYSYS_PAGEIN 8 ++#define VELOCITYSYS_PAGEOUT 9 ++#define VELOCITYSYS_SWAPIN 10 ++#define VELOCITYSYS_SWAPOUT 11 ++#define VELOCITYSYS_INTR 12 ++#define VELOCITYSYS_CTXT 13 ++#define VELOCITYSYS_PROCTOTAL 14 ++ ++#define VELOCITY_TYPE_PAGE 101 ++#define VELOCITY_TYPE_INTR 102 ++#define VELOCITY_TYPE_CTXT 103 ++#define VELOCITY_TYPE_SWAP 104 ++#define VELOCITY_TYPE_PROCTOTAL 105 ++ ++#define VELOCITY_IN 200 ++#define VELOCITY_OUT 201 ++ ++struct variable2 velocitysystem_variables[] = { ++ {VELOCITYSYS_UPTIME, ASN_TIMETICKS, RONLY, var_velocitysys, 1, {1}}, ++ {VELOCITYSYS_DATE, ASN_OCTET_STR, RONLY, var_velocitysys, 1, {2}}, ++ {VELOCITYSYS_LOAD_DEV, ASN_INTEGER, RONLY, var_velocitysys, 1, {3}}, ++ {VELOCITYSYS_LOAD_PARAM, ASN_OCTET_STR, RONLY, var_velocitysys, 1, {4}}, ++ {VELOCITYSYS_USERS, ASN_GAUGE, RONLY, var_velocitysys, 1, {5}}, ++ {VELOCITYSYS_PROCS, ASN_GAUGE, RONLY, var_velocitysys, 1, {6}}, ++ {VELOCITYSYS_MAXPROCS, ASN_INTEGER, RONLY, var_velocitysys, 1, {7}}, ++ {VELOCITYSYS_PAGEIN, ASN_INTEGER, RONLY, var_velocitysys, 1, {8}}, ++ {VELOCITYSYS_PAGEOUT, ASN_INTEGER, RONLY, var_velocitysys, 1, {9}}, ++ {VELOCITYSYS_SWAPIN, ASN_INTEGER, RONLY, var_velocitysys, 1, {10}}, ++ {VELOCITYSYS_SWAPOUT, ASN_INTEGER, RONLY, var_velocitysys, 1, {11}}, ++ {VELOCITYSYS_INTR, ASN_INTEGER, RONLY, var_velocitysys, 1, {12}}, ++ {VELOCITYSYS_CTXT, ASN_INTEGER, RONLY, var_velocitysys, 1, {13}}, ++ {VELOCITYSYS_PROCTOTAL, ASN_INTEGER, RONLY, var_velocitysys, 1, {14}} ++}; ++oid velocitysystem_variables_oid[] = { 1, 3, 6, 1, 4, 1, 15601, 1 }; ++ ++#ifdef linux ++int linux_stat(int, int); ++#endif ++ ++ ++ ++void ++init_velocity_system(void) ++{ ++#ifdef NPROC_SYMBOL ++ auto_nlist(NPROC_SYMBOL, 0, 0); ++#endif ++ ++ REGISTER_MIB("velocity/velocity_system", velocitysystem_variables, variable2, ++ velocitysystem_variables_oid); ++} ++ ++/* ++ * header_velocitysys(... ++ * Arguments: ++ * vp IN - pointer to variable entry that points here ++ * name IN/OUT - IN/name requested, OUT/name found ++ * length IN/OUT - length of IN/OUT oid's ++ * exact IN - TRUE if an exact match was requested ++ * var_len OUT - length of variable or 0 if function returned ++ * write_method ++ */ ++ ++int ++header_velocitysys(struct variable *vp, ++ oid * name, ++ size_t * length, ++ int exact, size_t * var_len, WriteMethod ** write_method) ++{ ++#define VELOCITYSYS_NAME_LENGTH 9 ++ oid newname[MAX_OID_LEN]; ++ int result; ++ ++ DEBUGMSGTL(("velocity/velocity_system", "var_velocitysys: ")); ++ DEBUGMSGOID(("velocity/velocity_system", name, *length)); ++ DEBUGMSG(("velocity/velocity_system", " %d\n", exact)); ++ ++ memcpy((char *) newname, (char *) vp->name, vp->namelen * sizeof(oid)); ++ newname[VELOCITYSYS_NAME_LENGTH] = 0; ++ result = snmp_oid_compare(name, *length, newname, vp->namelen + 1); ++ if ((exact && (result != 0)) || (!exact && (result >= 0))) ++ return (MATCH_FAILED); ++ memcpy((char *) name, (char *) newname, ++ (vp->namelen + 1) * sizeof(oid)); ++ *length = vp->namelen + 1; ++ ++ *write_method = 0; ++ *var_len = sizeof(long); /* default to 'long' results */ ++ return (MATCH_SUCCEEDED); ++} ++ ++int ++linux_stat(int stat_type, int in_or_out) ++{ ++ FILE *fp; ++ char buf[100]; ++ int in = -1, out = -1; ++ ++ if ((fp = fopen("/proc/stat", "r")) == NULL) ++ return -1; ++ ++ while (fgets(buf, sizeof(buf), fp) != NULL) { ++ if ((!strncmp(buf, "page", 4) && stat_type == VELOCITY_TYPE_PAGE) || ++ (!strncmp(buf, "intr", 4) && stat_type == VELOCITY_TYPE_INTR) || ++ (!strncmp(buf, "ctxt", 4) && stat_type == VELOCITY_TYPE_CTXT) || ++ (!strncmp(buf, "processes", 9) && stat_type == VELOCITY_TYPE_PROCTOTAL) || ++ (!strncmp(buf, "swap", 4) && stat_type == VELOCITY_TYPE_SWAP)) { ++ sscanf(buf, "%*s %d %d", &in, &out); ++ DEBUGMSGTL(("string found", " %s type - %d\n", buf, stat_type)); ++ break; ++ } ++ else { ++ DEBUGMSGTL(("string not found", " %s type - %d\n", buf, stat_type )); ++ } ++ } ++ ++ fclose(fp); ++ return (in_or_out == VELOCITY_IN ? in : out); ++ ++} ++ ++ ++ ++ /********************* ++ * ++ * System specific implementation functions ++ * ++ *********************/ ++ ++u_char * ++var_velocitysys(struct variable * vp, ++ oid * name, ++ size_t * length, ++ int exact, size_t * var_len, WriteMethod ** write_method) ++{ ++ static char string[100]; ++ time_t now; ++#ifndef NR_TASKS ++ int nproc = 0; ++#endif ++#ifdef linux ++ FILE *fp; ++#endif ++#if CAN_USE_SYSCTL && defined(CTL_KERN) && defined(KERN_MAXPROC) ++ static int maxproc_mib[] = { CTL_KERN, KERN_MAXPROC }; ++ int buf_size; ++#endif ++#if defined(hpux10) || defined(hpux11) ++ struct pst_static pst_buf; ++#endif ++ ++ if (header_velocitysys(vp, name, length, exact, var_len, write_method) == ++ MATCH_FAILED) ++ return NULL; ++ ++ switch (vp->magic) { ++ case VELOCITYSYS_UPTIME: ++ long_return = get_uptime(); ++ return (u_char *) & long_return; ++ case VELOCITYSYS_DATE: ++ (void *) time(&now); ++ return (u_char *) date_n_time(&now, var_len); ++ case VELOCITYSYS_LOAD_DEV: ++ long_return = get_load_dev(); ++ return (u_char *) & long_return; ++ case VELOCITYSYS_LOAD_PARAM: ++#ifdef linux ++ fp = fopen("/proc/cmdline", "r"); ++ fgets(string, sizeof(string), fp); ++ fclose(fp); ++#else ++#if NO_DUMMY_VALUES ++ return NULL; ++#endif ++ sprintf(string, "ask Dave"); /* XXX */ ++#endif ++ *var_len = strlen(string); ++ return (u_char *) string; ++ case VELOCITYSYS_PAGEIN: ++ long_return = linux_stat(VELOCITY_TYPE_PAGE,VELOCITY_IN); ++ return (u_char *) & long_return; ++ case VELOCITYSYS_PAGEOUT: ++ long_return = linux_stat(VELOCITY_TYPE_PAGE,VELOCITY_OUT); ++ return (u_char *) & long_return; ++ case VELOCITYSYS_SWAPIN: ++ long_return = linux_stat(VELOCITY_TYPE_SWAP,VELOCITY_IN); ++ return (u_char *) & long_return; ++ case VELOCITYSYS_SWAPOUT: ++ long_return = linux_stat(VELOCITY_TYPE_SWAP,VELOCITY_OUT); ++ return (u_char *) & long_return; ++ case VELOCITYSYS_CTXT: ++ long_return = linux_stat(VELOCITY_TYPE_CTXT,VELOCITY_IN); ++ return (u_char *) & long_return; ++ case VELOCITYSYS_PROCTOTAL: ++ long_return = linux_stat(VELOCITY_TYPE_PROCTOTAL,VELOCITY_IN); ++ return (u_char *) & long_return; ++ case VELOCITYSYS_INTR: ++#ifdef linux ++ long_return = linux_stat(VELOCITY_TYPE_INTR,VELOCITY_IN); ++#endif ++ return (u_char *) & long_return; ++ case VELOCITYSYS_USERS: ++ long_return = count_users(); ++ return (u_char *) & long_return; ++ case VELOCITYSYS_PROCS: ++#if USING_VELOCITY_VELOCITY_SWRUN_MODULE ++ long_return = count_processes(); ++#else ++#if NO_DUMMY_VALUES ++ return NULL; ++#endif ++ long_return = 0; ++#endif ++ return (u_char *) & long_return; ++ case VELOCITYSYS_MAXPROCS: ++#if defined(NR_TASKS) ++ long_return = NR_TASKS; /* */ ++#elif CAN_USE_SYSCTL && defined(CTL_KERN) && defined(KERN_MAXPROC) ++ buf_size = sizeof(nproc); ++ if (sysctl(maxproc_mib, 2, &nproc, &buf_size, NULL, 0) < 0) ++ return NULL; ++ long_return = nproc; ++#elif defined(hpux10) || defined(hpux11) ++ pstat_getstatic(&pst_buf, sizeof(struct pst_static), 1, 0); ++ long_return = pst_buf.max_proc; ++#elif defined(NPROC_SYMBOL) ++ auto_nlist(NPROC_SYMBOL, (char *) &nproc, sizeof(int)); ++ long_return = nproc; ++#else ++#if NO_DUMMY_VALUES ++ return NULL; ++#endif ++ long_return = 0; ++#endif ++ return (u_char *) & long_return; ++ default: ++ DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_velocitysys\n", ++ vp->magic)); ++ } ++ return NULL; ++} ++ ++ ++ /********************* ++ * ++ * Internal implementation functions ++ * ++ *********************/ ++ ++ /* ++ * Return the DeviceIndex corresponding ++ * to the boot device ++ */ ++static int ++get_load_dev(void) ++{ ++ return (HRDEV_DISK << HRDEV_TYPE_SHIFT); /* XXX */ ++} ++ ++static int ++count_users(void) ++{ ++ int total = 0; ++#if HAVE_UTMPX_H ++#define setutent setutxent ++#define getutent getutxent ++#define endutent endutxent ++ struct utmpx *utmp_p; ++#else ++ struct utmp *utmp_p; ++#endif ++ ++ setutent(); ++ while ((utmp_p = getutent()) != NULL) { ++#ifndef UTMP_HAS_NO_TYPE ++ if (utmp_p->ut_type == USER_PROCESS) ++#endif ++ ++total; ++ } ++ endutent(); ++ return total; ++} ++ ++#if defined(UTMP_FILE) && !HAVE_UTMPX_H ++ ++static FILE *utmp_file; ++static struct utmp utmp_rec; ++ ++void ++setutent(void) ++{ ++ if (utmp_file) ++ fclose(utmp_file); ++ utmp_file = fopen(UTMP_FILE, "r"); ++} ++ ++void ++endutent(void) ++{ ++ if (utmp_file) { ++ fclose(utmp_file); ++ utmp_file = NULL; ++ } ++} ++ ++struct utmp * ++getutent(void) ++{ ++ if (!utmp_file) ++ return NULL; ++ while (fread(&utmp_rec, sizeof(utmp_rec), 1, utmp_file) == 1) ++ if (*utmp_rec.ut_name && *utmp_rec.ut_line) ++ return &utmp_rec; ++ return NULL; ++} ++ ++#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 +@@ -0,0 +1,12 @@ ++/* ++ * Velocity MIB - system group interface - velocity_system.h ++ * ++ */ ++#ifndef _MIBGROUP_VELOCITYSYSTEM_H ++#define _MIBGROUP_VELOCITYSYSTEM_H ++ ++extern void init_velocity_system(void); ++extern FindVarMethod var_velocitysys; ++ ++ ++#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 +@@ -0,0 +1,671 @@ ++VELOCITY-MIB DEFINITIONS ::= BEGIN ++ ++IMPORTS ++MODULE-IDENTITY, OBJECT-TYPE, mib-2, ++Integer32, Counter32, Gauge32, TimeTicks, enterprises FROM SNMPv2-SMI ++ ++TEXTUAL-CONVENTION, DisplayString, ++TruthValue, DateAndTime, AutonomousType FROM SNMPv2-TC ++ ++MODULE-COMPLIANCE, OBJECT-GROUP FROM SNMPv2-CONF ++ ++InterfaceIndexOrZero FROM IF-MIB; ++ ++velocityMibModule MODULE-IDENTITY ++ LAST-UPDATED "200607310000Z" -- 31 July 2006 ++ ORGANIZATION "Velocity Software Inc." ++ CONTACT-INFO ++ "Dennis Andrews ++ Postal: Velocity Software, Inc. ++ 106-D Castro St. ++ Mountain View, CA 94041 ++ USA ++ Phone: 650-964-8867 ++ Fax: 650-964-9012 ++ Email: dennis@velocitysoftware.com" ++ DESCRIPTION ++ "This MIB is an extension of the host MIB. This MIB currently ++ only runs on linux. This is the original version." ++ ::= { velocityMIBAdminInfo 1 } ++ ++velocity OBJECT IDENTIFIER ::= { enterprises 15601 } ++ ++velocitySystem OBJECT IDENTIFIER ::= { velocity 1 } ++velocitySWRun OBJECT IDENTIFIER ::= { velocity 4 } ++velocitySWRunPerf OBJECT IDENTIFIER ::= { velocity 5 } ++velocityAppTable OBJECT IDENTIFIER ::= { velocity 6 } ++velocityMIBAdminInfo OBJECT IDENTIFIER ::= { velocity 7 } ++ ++-- The Host Resources System Group ++ ++velocitySystemUptime OBJECT-TYPE ++ SYNTAX TimeTicks ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The amount of time since this host was last ++ initialized. Note that this is different from ++ sysUpTime in the SNMPv2-MIB [RFC1907] because ++ sysUpTime is the uptime of the network management ++ portion of the system." ++ ::= { velocitySystem 1 } ++ ++velocitySystemDate OBJECT-TYPE ++ SYNTAX DateAndTime ++ MAX-ACCESS read-write ++ STATUS current ++ DESCRIPTION ++ "The host's notion of the local date and time of day." ++ ::= { velocitySystem 2 } ++ ++velocitySystemInitialLoadDevice OBJECT-TYPE ++ SYNTAX Integer32 (1..2147483647) ++ MAX-ACCESS read-write ++ STATUS current ++ DESCRIPTION ++ "The index of the velocityDeviceEntry for the device from ++ which this host is configured to load its initial ++ operating system configuration (i.e., which operating ++ system code and/or boot parameters). ++ ++ Note that writing to this object just changes the ++ configuration that will be used the next time the ++ operating system is loaded and does not actually cause ++ the reload to occur." ++ ::= { velocitySystem 3 } ++ ++velocitySystemInitialLoadParameters OBJECT-TYPE ++ SYNTAX InternationalDisplayString (SIZE (0..128)) ++ MAX-ACCESS read-write ++ STATUS current ++ DESCRIPTION ++ "This object contains the parameters (e.g. a pathname ++ and parameter) supplied to the load device when ++ requesting the initial operating system configuration ++ from that device. ++ ++ Note that writing to this object just changes the ++ configuration that will be used the next time the ++ operating system is loaded and does not actually cause ++ the reload to occur." ++ ::= { velocitySystem 4 } ++ ++velocitySystemNumUsers OBJECT-TYPE ++ SYNTAX Gauge32 ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The number of user sessions for which this host is ++ storing state information. A session is a collection ++ of processes requiring a single act of user ++ authentication and possibly subject to collective job ++ control." ++ ::= { velocitySystem 5 } ++ ++velocitySystemProcesses OBJECT-TYPE ++ SYNTAX Gauge32 ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The number of process contexts currently loaded or ++ running on this system." ++ ::= { velocitySystem 6 } ++ ++velocitySystemMaxProcesses OBJECT-TYPE ++ SYNTAX Integer32 (0..2147483647) ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The maximum number of process contexts this system ++ can support. If there is no fixed maximum, the value ++ should be zero. On systems that have a fixed maximum, ++ this object can help diagnose failures that occur when ++ this maximum is reached." ++ ::= { velocitySystem 7 } ++ ++velocitySystemPageIn OBJECT-TYPE ++ SYNTAX Integer32 (0..2147483647) ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "Total number of pages that the system paged in" ++ ::= { velocitySystem 8 } ++ ++velocitySystemPageOut OBJECT-TYPE ++ SYNTAX Integer32 (0..2147483647) ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "Total number of pages that the system paged out" ++ ::= { velocitySystem 9 } ++ ++velocitySystemSwapIn OBJECT-TYPE ++ SYNTAX Integer32 (0..2147483647) ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "Total number of swap pages that have been brought in" ++ ::= { velocitySystem 10 } ++ ++velocitySystemSwapOut OBJECT-TYPE ++ SYNTAX Integer32 (0..2147483647) ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "Total number of swap pages that have been swapped out" ++ ::= { velocitySystem 11 } ++ ++velocitySystemInterupts OBJECT-TYPE ++ SYNTAX Integer32 (0..2147483647) ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "Total number of interupts since system boot" ++ ::= { velocitySystem 12 } ++ ++velocitySystemContext OBJECT-TYPE ++ SYNTAX Integer32 (0..2147483647) ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "Total number of context switches the system had done." ++ ::= { velocitySystem 13 } ++ ++velocitySystemProcessTotal OBJECT-TYPE ++ SYNTAX Integer32 (0..2147483647) ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "Total number of processes the system has started since boot." ++ ::= { velocitySystem 14 } ++ ++ ++ ++ ++-- The Velocity Running Software Group ++-- ++-- The velocitySWRunTable contains an entry for each distinct piece of ++-- software that is running or loaded into physical or virtual ++-- memory in preparation for running. This includes the velocity's ++-- operating system, device drivers, and applications. ++ ++velocitySWOSIndex OBJECT-TYPE ++ SYNTAX Integer32 (1..2147483647) ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The value of the velocitySWRunIndex for the velocitySWRunEntry ++ that represents the primary operating system running ++ on this velocity. This object is useful for quickly and ++ uniquely identifying that primary operating system." ++ ::= { velocitySWRun 1 } ++ ++velocitySWRunTable OBJECT-TYPE ++ SYNTAX SEQUENCE OF VelocitySWRunEntry ++ MAX-ACCESS not-accessible ++ STATUS current ++ DESCRIPTION ++ "The (conceptual) table of software running on the ++ velocity." ++ ::= { velocitySWRun 2 } ++ ++velocitySWRunEntry OBJECT-TYPE ++ SYNTAX VelocitySWRunEntry ++ MAX-ACCESS not-accessible ++ STATUS current ++ DESCRIPTION ++ "A (conceptual) entry for one piece of software ++ running on the velocity Note that because the installed ++ software table only contains information for software ++ stored locally on this velocity, not every piece of ++ running software will be found in the installed ++ software table. This is true of software that was ++ loaded and run from a non-local source, such as a ++ network-mounted file system. ++ ++ As an example of how objects in this table are named, ++ an instance of the velocitySWRunName object might be named ++ velocitySWRunName.1287" ++ INDEX { velocitySWRunIndex } ++ ::= { velocitySWRunTable 1 } ++ ++VelocitySWRunEntry ::= SEQUENCE { ++ velocitySWRunIndex Integer32, ++ velocitySWRunName InternationalDisplayString, ++ velocitySWRunID ProductID, ++ velocitySWRunPath InternationalDisplayString, ++ velocitySWRunParameters InternationalDisplayString, ++ velocitySWRunType INTEGER, ++ velocitySWRunStatus INTEGER, ++ velocitySWRunPPID Integer32, ++ velocitySWRunPGRP Integer32 ++ } ++ ++velocitySWRunIndex OBJECT-TYPE ++ SYNTAX Integer32 (1..2147483647) ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "A unique value for each piece of software running on ++ the velocity. Wherever possible, this should be the ++ system's native, unique identification number." ++ ::= { velocitySWRunEntry 1 } ++ ++velocitySWRunName OBJECT-TYPE ++ SYNTAX InternationalDisplayString (SIZE (0..64)) ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "A textual description of this running piece of ++ software, including the manufacturer, revision, and ++ the name by which it is commonly known. If this ++ software was installed locally, this should be the ++ same string as used in the corresponding ++ velocitySWInstalledName." ++ ::= { velocitySWRunEntry 2 } ++ ++velocitySWRunID OBJECT-TYPE ++ SYNTAX ProductID ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The product ID of this running piece of software." ++ ::= { velocitySWRunEntry 3 } ++ ++velocitySWRunPath OBJECT-TYPE ++ SYNTAX InternationalDisplayString (SIZE(0..128)) ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "A description of the location on long-term storage ++ (e.g. a disk drive) from which this software was ++ loaded." ++ ::= { velocitySWRunEntry 4 } ++ ++velocitySWRunParameters OBJECT-TYPE ++ SYNTAX InternationalDisplayString (SIZE(0..128)) ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "A description of the parameters supplied to this ++ software when it was initially loaded." ++ ::= { velocitySWRunEntry 5 } ++ ++velocitySWRunType OBJECT-TYPE ++ SYNTAX INTEGER { ++ unknown(1), ++ operatingSystem(2), ++ deviceDriver(3), ++ application(4) ++ } ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The type of this software." ++ ::= { velocitySWRunEntry 6 } ++ ++velocitySWRunStatus OBJECT-TYPE ++ SYNTAX INTEGER { ++ running(1), ++ runnable(2), -- waiting for resource ++ -- (i.e., CPU, memory, IO) ++ notRunnable(3), -- loaded but waiting for event ++ invalid(4) -- not loaded ++ } ++ MAX-ACCESS read-write ++ STATUS current ++ DESCRIPTION ++ "The status of this running piece of software. ++ Setting this value to invalid(4) shall cause this ++ software to stop running and to be unloaded. Sets to ++ other values are not valid." ++ ::= { velocitySWRunEntry 7 } ++ ++velocitySWRunPPID OBJECT-TYPE ++ SYNTAX Integer32 (1..2147483647) ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The ID of the parent process." ++ ::= { velocitySWRunEntry 8 } ++ ++velocitySWRunPGRP OBJECT-TYPE ++ SYNTAX Integer32 (1..2147483647) ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The ID of the process group that the process belongs to." ++ ::= { velocitySWRunEntry 9 } ++ ++ ++-- The Velocity Resources Running Software Performance Group ++-- ++-- The velocitySWRunPerfTable contains an entry corresponding to ++-- each entry in the velocitySWRunTable. ++ ++velocitySWRunPerfTable OBJECT-TYPE ++ SYNTAX SEQUENCE OF VelocitySWRunPerfEntry ++ MAX-ACCESS not-accessible ++ STATUS current ++ DESCRIPTION ++ "The (conceptual) table of running software ++ performance metrics." ++ ::= { velocitySWRunPerf 1 } ++ ++velocitySWRunPerfEntry OBJECT-TYPE ++ SYNTAX VelocitySWRunPerfEntry ++ MAX-ACCESS not-accessible ++ STATUS current ++ DESCRIPTION ++ "A (conceptual) entry containing software performance ++ metrics. As an example, an instance of the ++ velocitySWRunPerfCPU object might be named ++ velocitySWRunPerfCPU.1287" ++ AUGMENTS { velocitySWRunEntry } -- This table augments information in ++ -- the velocitySWRunTable. ++ ::= { velocitySWRunPerfTable 1 } ++ ++VelocitySWRunPerfEntry ::= SEQUENCE { ++ velocitySWRunPerfCPUUser Integer32, ++ velocitySWRunPerfCPUSys Integer32, ++ velocitySWRunPerfMem KBytes, ++ velocitySWRunPerfCPUCummUser Integer32, ++ velocitySWRunPerfCPUCummSys Integer32, ++ velocitySWRunPerfMinFault Integer32, ++ velocitySWRunPerfMajFault Integer32, ++ velocitySWRunPerfMinFaultCumm Integer32, ++ velocitySWRunPerfMajFaultCumm Integer32, ++ velocitySWRunPerfRss Integer32, ++ velocitySWRunPerfPrio Integer32, ++ velocitySWRunPerfAll InternationalDisplayString, ++ velocitySWRunPerfUID InternationalDisplayString, ++ velocitySWRunPerfUName InternationalDisplayString ++} ++ ++velocitySWRunPerfCPUUser OBJECT-TYPE ++ SYNTAX Integer32 (0..2147483647) ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The number of centi-seconds of the User's CPU ++ resources consumed by this process. Note that on a ++ multi-processor system, this value may increment by ++ more than one centi-second in one centi-second of real ++ (wall clock) time." ++ ::= { velocitySWRunPerfEntry 1 } ++ ++velocitySWRunPerfCPUSys OBJECT-TYPE ++ SYNTAX Integer32 (0..2147483647) ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The number of centi-seconds of the system's CPU ++ resources consumed by this process. Note that on a ++ multi-processor system, this value may increment by ++ more than one centi-second in one centi-second of real ++ (wall clock) time." ++ ::= { velocitySWRunPerfEntry 2 } ++ ++velocitySWRunPerfMem OBJECT-TYPE ++ SYNTAX KBytes ++ UNITS "KBytes" ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The total amount of real system memory allocated to ++ this process." ++ ::= { velocitySWRunPerfEntry 3 } ++ ++velocitySWRunPerfCPUCummUser OBJECT-TYPE ++ SYNTAX Integer32 (0..2147483647) ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The number of cummulative centi-seconds of the total user's CPU ++ resources consumed by this process. Note that on a ++ multi-processor system, this value may increment by ++ more than one centi-second in one centi-second of real ++ (wall clock) time." ++ ::= { velocitySWRunPerfEntry 4 } ++ ++velocitySWRunPerfCPUCummSys OBJECT-TYPE ++ SYNTAX Integer32 (0..2147483647) ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The number of cummulative centi-seconds of the total system's CPU ++ resources consumed by this process. Note that on a ++ multi-processor system, this value may increment by ++ more than one centi-second in one centi-second of real ++ (wall clock) time." ++ ::= { velocitySWRunPerfEntry 5 } ++ ++velocitySWRunPerfMinFault OBJECT-TYPE ++ SYNTAX Integer32 (0..2147483647) ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The number of minor page faults. (Those that have not ++ required loading a page from disk.)" ++ ::= { velocitySWRunPerfEntry 6 } ++ ++velocitySWRunPerfMajFault OBJECT-TYPE ++ SYNTAX Integer32 (0..2147483647) ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The number of major page faults. (Those that have ++ required loading a page from disk.)" ++ ::= { velocitySWRunPerfEntry 7 } ++ ++velocitySWRunPerfMinFaultCumm OBJECT-TYPE ++ SYNTAX Integer32 (0..2147483647) ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The number of minor page faults for this process and its ++ children. (Those that have not required loading a page ++ from disk.)" ++ ::= { velocitySWRunPerfEntry 8 } ++ ++velocitySWRunPerfMajFaultCumm OBJECT-TYPE ++ SYNTAX Integer32 (0..2147483647) ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The number of major page faults. for this process and its ++ children. (Those that have required loading a page from disk.)" ++ ::= { velocitySWRunPerfEntry 9 } ++ ++velocitySWRunPerfRss OBJECT-TYPE ++ SYNTAX Integer32 (0..2147483647) ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The number of pages in real memory minus 3 for administrative ++ purposes. This is just the pages which count towards text, ++ data, or stack space. This does not include pages which ++ have not been demand-loaded in, or which are swapped out." ++ ::= { velocitySWRunPerfEntry 10 } ++ ++velocitySWRunPerfPrio OBJECT-TYPE ++ SYNTAX Integer32 (0..2147483647) ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The standard nice value, plus fifteen. The value is never ++ negative in the kernel." ++ ::= { velocitySWRunPerfEntry 11 } ++ ++velocitySWRunPerfAll OBJECT-TYPE ++ SYNTAX InternationalDisplayString (SIZE (0..256)) ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The complete information from the stat file for the given process" ++ ::= { velocitySWRunPerfEntry 12 } ++ ++velocitySWRunPerfUID OBJECT-TYPE ++ SYNTAX InternationalDisplayString (SIZE(0..128)) ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The owning user ID and group ID of this process." ++ ::= { velocitySWRunPerfEntry 13 } ++ ++velocitySWRunPerfUName OBJECT-TYPE ++ SYNTAX InternationalDisplayString (SIZE(0..128)) ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The name of the owning user ID and group of this process." ++ ::= { velocitySWRunPerfEntry 14 } ++ ++velocityAppTable OBJECT-TYPE ++ SYNTAX SEQUENCE OF AppEntry ++ MAX-ACCESS not-accessible ++ STATUS current ++ DESCRIPTION ++ "A table containing a list of applications that are of special ++ interest. The process table is searched for the given string ++ that identifies the given process(s). Other than being able to ++ return the process ids of interest this is the same MIB is the ++ UCD-snmp proc MIB. " ++ ::= { velocity 6 } ++ ++velocityAppEntry OBJECT-TYPE ++ SYNTAX velocityAppEntry ++ MAX-ACCESS not-accessible ++ STATUS current ++ DESCRIPTION ++ "An entry containing an application and its statistics." ++ INDEX { appIndex } ++ ::= { velocityAppTable 1 } ++ ++velocityAppEntry ::= SEQUENCE { ++ velocityAppIndex Integer32, ++ velocityAppNames DisplayString, ++ velocityAppPid DisplayString, ++ velocityAppMin Integer32, ++ velocityAppMax Integer32, ++ velocityAppCount Integer32, ++ velocityAppIds DisplayString, ++ velocityAppErrorFlag Integer32, ++ velocityAppErrMessage DisplayString ++} ++ ++velocityAppIndex OBJECT-TYPE ++ SYNTAX Integer32 (0..65535) ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "Reference Index for each observed application." ++ ::= { velocityAppEntry 1 } ++ ++velocityAppNames OBJECT-TYPE ++ SYNTAX DisplayString ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The application name we're counting/checking on." ++ ::= { velocityAppEntry 2 } ++ ++velocityAppPid OBJECT-TYPE ++ SYNTAX DisplayString ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The absolute location of the PID file for the application." ++ ::= { velocityAppEntry 3 } ++ ++velocityAppMin OBJECT-TYPE ++ SYNTAX Integer32 ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The minimum number of processes for that applicationes that should be ++ running. An error flag is generated if the number of ++ running processes is < the minimum." ++ ::= { velocityAppEntry 4 } ++ ++velocityAppMax OBJECT-TYPE ++ SYNTAX Integer32 ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The maximum number of processes for that application that should be ++ running. An error flag is generated if the number of ++ running processes is > the maximum." ++ ::= { velocityAppEntry 5 } ++ ++velocityAppCount OBJECT-TYPE ++ SYNTAX Integer32 ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The number of current applications running with the name ++ in question." ++ ::= { velocityAppEntry 6 } ++ ++velocityAppIds OBJECT-TYPE ++ SYNTAX DisplayString ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The list of process Ids that match the Application name." ++ ::= { velocityAppEntry 7 } ++ ++velocityAppErrorFlag OBJECT-TYPE ++ SYNTAX Integer32 ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "A Error flag to indicate trouble with a application. It ++ goes to 1 if there is an error, 0 if no error." ++ ::= { velocityAppEntry 100 } ++ ++velocityAppErrMessage OBJECT-TYPE ++ SYNTAX DisplayString ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "An error message describing the problem (if one exists)." ++ ::= { velocityAppEntry 101 } ++ ++velocityMIBCompliances OBJECT IDENTIFIER ::= { velocityMIBAdminInfo 2 } ++velocityMIBGroups OBJECT IDENTIFIER ::= { velocityMIBAdminInfo 3 } ++ ++ velocitySystemGroup OBJECT-GROUP ++ OBJECTS { ++ velocitySystemUptime, velocitySystemDate, ++ velocitySystemInitialLoadDevice, ++ velocitySystemInitialLoadParameters, ++ velocitySystemNumUsers, velocitySystemProcesses, ++ velocitySystemMaxProcesses ++ } ++ STATUS current ++ DESCRIPTION ++ "The Velocity System Group." ++ ::= { velocityMIBGroups 1 } ++ ++ velocitySWRunGroup OBJECT-GROUP ++ OBJECTS { ++ velocitySWOSIndex, velocitySWRunIndex, velocitySWRunName, ++ velocitySWRunID, velocitySWRunPath, velocitySWRunParameters, ++ velocitySWRunType, velocitySWRunStatus, velocitySWRunPPID, ++ velocitySWRunPGRP ++ } ++ STATUS current ++ DESCRIPTION ++ "The Velocity Resources Running Software Group." ++ ::= { velocityMIBGroups 4 } ++ ++ velocitySWRunPerfGroup OBJECT-GROUP ++ OBJECTS { velocitySWRunPerfCPUUser, velocitySWRunPerfCPUSys, velocitySWRunPerfMem, velocitySWRunPerfCPUCummUser, velocitySWRunPerfCPUCummSys } ++ STATUS current ++ DESCRIPTION ++ "The Velocity Resources Running Software ++ Performance Group." ++ ::= { velocityMIBGroups 5 } ++ ++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 +@@ -0,0 +1,23 @@ ++VELOCITY-TYPES DEFINITIONS ::= BEGIN ++ ++IMPORTS ++ MODULE-IDENTITY, OBJECT-IDENTITY FROM SNMPv2-SMI ++ ++velocityMibModule MODULE-IDENTITY ++ LAST-UPDATED "200607310000Z" -- 31 July 2006 ++ ORGANIZATION "Velocity Software Inc." ++ CONTACT-INFO ++ "Dennis Andrews ++ Postal: Velocity Software, Inc. ++ 106-D Castro St. ++ Mountain View, CA 94041 ++ USA ++ Phone: 650-964-8867 ++ Fax: 650-964-9012 ++ Email: dennis@velocitysoftware.com" ++ DESCRIPTION ++ "This MIB is an extension of the host MIB. This MIB currently ++ only runs on linux. This is the original version." ++ ::= { velocityMIBAdminInfo 4 } ++ ++END diff --git a/net-snmp-5.3_vendorperl.patch b/net-snmp-5.4.2_vendorperl.patch similarity index 61% rename from net-snmp-5.3_vendorperl.patch rename to net-snmp-5.4.2_vendorperl.patch index f1c4180..47aeba7 100644 --- a/net-snmp-5.3_vendorperl.patch +++ b/net-snmp-5.4.2_vendorperl.patch @@ -1,8 +1,8 @@ Index: Makefile.in =================================================================== ---- Makefile.in.orig -+++ Makefile.in -@@ -167,7 +167,7 @@ +--- Makefile.in.orig 2007-06-08 22:32:56.000000000 +0200 ++++ Makefile.in 2008-10-24 15:30:52.442885040 +0200 +@@ -169,7 +169,7 @@ perlmakefiles: net-snmp-config-x fi perlinstall: diff --git a/net-snmp.changes b/net-snmp.changes index 5a40c03..828ec05 100644 --- a/net-snmp.changes +++ b/net-snmp.changes @@ -1,3 +1,43 @@ +------------------------------------------------------------------- +Fri Oct 24 16:54:46 CEST 2008 - mrueckert@suse.de + +- added net-snmp-5.4.2_velocity-mib.patch (FATE#303556) + +------------------------------------------------------------------- +Fri Oct 24 16:43:34 CEST 2008 - mrueckert@suse.de + +- refreshed patches to apply cleanly: + old: net-snmp-5.1.2-snmpconf-selinux.patch + new: net-snmp-5.4.2_snmpconf-selinux.patch + old: net-snmp-5.2.1-overflow.diff + new: net-snmp-5.4.2_overflow.patch + old: net-snmp-5.2.1.testing.empty_arptable.patch + new: net-snmp-5.4.2_testing.empty_arptable.patch + old: net-snmp-5.3.0.1-audit.diff + new: nmp-5.4.2_audit.patch + old: net-snmp-5.3_vendorperl.patch + new: net-snmp-5.4.2_vendorperl.patch + old: net-snmp-5.4.1-autoconf.diff + new: net-snmp-5.4.2_autoconf.patch + old: net-snmp-5.4.1_perl_tk_warning.patch + new: net-snmp-5.4.2_perl_tk_warning.patch + old: net-snmp-5.4_net-snmp-config_headercheck.patch + new: net-snmp-5.4.2_net-snmp-config_headercheck.patch + +------------------------------------------------------------------- +Fri Oct 24 14:43:35 CEST 2008 - kkeil@suse.de + +- more IPv6 support from IBM (mainline backports) (bnc#437208) + Fix-for-tcpConnnectionTable-tcpListenerTable-udpEn.patch + Fix-for-IPv6-Interface-Table.patch + Fix-for-Internet-Address-Table.patch + Add-ICMP-Statistics-Tables-support.patch + Add-Default-Router-Table-support.patch + Add-IPv6-support-on-Internet-Address-Translation-Tab.patch + Fix-for-Internet-Address-Prefix-Table.patch + Add-IPv6-Scope-Zone-Index.patch + Improve-IP-Statistics-tables.patch + ------------------------------------------------------------------- Mon Oct 20 17:05:34 CEST 2008 - mrueckert@suse.de diff --git a/net-snmp.logrotate b/net-snmp.logrotate index 12d13fe..86cb504 100644 --- a/net-snmp.logrotate +++ b/net-snmp.logrotate @@ -11,7 +11,7 @@ postrotate /etc/init.d/snmpd try-restart ||: if [ -x /etc/init.d/snmptrapd ] ; then \ - /etc/init.d/snmptrapd try-restart ; \ + /etc/init.d/snmptrapd try-restart ||: ; \ fi endscript diff --git a/net-snmp.spec b/net-snmp.spec index a486117..5ca784d 100644 --- a/net-snmp.spec +++ b/net-snmp.spec @@ -20,7 +20,7 @@ Name: net-snmp Version: 5.4.2 -Release: 7 +Release: 8 # License: BSD 3-Clause; X11/MIT Group: Productivity/Networking/Other @@ -59,21 +59,31 @@ Source5: net-snmp.logrotate Source6: test_installed Source7: net-snmp.sysconfig Source8: net-snmp-rpmlintrc -Patch: net-snmp-5.3.0.1-audit.diff -Patch1: net-snmp-5.4.1-autoconf.diff +Patch: net-snmp-5.4.2_audit.patch +Patch1: net-snmp-5.4.2_autoconf.patch # unused patch atm Patch2: net-snmp-5.2.1-socket_path.diff Patch3: net-snmp-5.4.rc2-versinfo.diff -Patch4: net-snmp-5.2.1-overflow.diff -Patch5: net-snmp-5.2.1.testing.empty_arptable.patch +Patch4: net-snmp-5.4.2_overflow.patch +Patch5: net-snmp-5.4.2_testing.empty_arptable.patch Patch6: net-snmp-5.1.1-pie.patch -Patch7: net-snmp-5.3_vendorperl.patch -Patch8: net-snmp-5.4_net-snmp-config_headercheck.patch -Patch9: net-snmp-5.4.1_perl_tk_warning.patch -Patch10: net-snmp-5.1.2-snmpconf-selinux.patch +Patch7: net-snmp-5.4.2_vendorperl.patch +Patch8: net-snmp-5.4.2_net-snmp-config_headercheck.patch +Patch9: net-snmp-5.4.2_perl_tk_warning.patch +Patch10: net-snmp-5.4.2_snmpconf-selinux.patch Patch11: net-snmp-5.3.0.1_trap-agent-addr_v2.patch Patch12: net-snmp-5.4.1.2-etherlike-mib-revised_1.patch Patch13: net-snmp-5.4.1.2-rmon-mib-revised.patch +Patch14: net-snmp-5.4.2_velocity-mib.patch +Patch15: Fix-for-tcpConnnectionTable-tcpListenerTable-udpEn.patch +Patch16: Fix-for-IPv6-Interface-Table.patch +Patch17: Fix-for-Internet-Address-Table.patch +Patch18: Add-ICMP-Statistics-Tables-support.patch +Patch19: Add-Default-Router-Table-support.patch +Patch20: Add-IPv6-support-on-Internet-Address-Translation-Tab.patch +Patch21: Fix-for-Internet-Address-Prefix-Table.patch +Patch22: Add-IPv6-Scope-Zone-Index.patch +Patch23: Improve-IP-Statistics-tables.patch # Summary: SNMP Daemon @@ -193,16 +203,25 @@ Authors: %patch7 %patch8 %patch9 -%patch10 -p1 +%patch10 %patch11 %patch12 %patch13 +%patch14 +%patch15 -p1 +%patch16 -p1 +%patch17 -p1 +%patch18 -p1 +%patch19 -p1 +%patch20 -p1 +%patch21 -p1 +%patch22 -p1 +%patch23 -p1 find -name "CVS" -type d | xargs -r %{__rm} -rfv find -name ".cvsignore" | xargs -r %{__rm} -fv -find -name "*.orig" | xargs -r %{__rm} -fv %build -#autoconf +autoreconf -fi # possibly add later # --with-python-modules \ => need python-setuptools # ip-mib/ipv4InterfaceTable ip-mib/ipv6InterfaceTable @@ -216,10 +235,14 @@ export CFLAGS="$CFLAGS -fstack-protector-all" --with-mib-modules="misc/ipfwacc \ ucd-snmp/diskio \ etherlike-mib rmon-mib \ + velocity \ %if 0%{?with_sensors} ucd-snmp/lmSensors \ %endif - smux" \ + smux \ + ip-mib/ipv4InterfaceTable ip-mib/ipv6InterfaceTable \ + ip-mib/ipDefaultRouterTable ip-mib/ipAddressPrefixTable \ + ip-mib/ipv6ScopeZoneIndexTable ip-mib/ipIfStatsTable" \ --with-persistent-directory=/var/lib/net-snmp \ --with-agentx-socket=%{netsnmp_agentx_socket_dir_fhs}/master \ --with-sys-location="unknown" \ @@ -397,6 +420,37 @@ fi %{_bindir}/tkmib %changelog +* Fri Oct 24 2008 mrueckert@suse.de +- added net-snmp-5.4.2_velocity-mib.patch (FATE#303556) +* Fri Oct 24 2008 mrueckert@suse.de +- refreshed patches to apply cleanly: + old: net-snmp-5.1.2-snmpconf-selinux.patch + new: net-snmp-5.4.2_snmpconf-selinux.patch + old: net-snmp-5.2.1-overflow.diff + new: net-snmp-5.4.2_overflow.patch + old: net-snmp-5.2.1.testing.empty_arptable.patch + new: net-snmp-5.4.2_testing.empty_arptable.patch + old: net-snmp-5.3.0.1-audit.diff + new: nmp-5.4.2_audit.patch + old: net-snmp-5.3_vendorperl.patch + new: net-snmp-5.4.2_vendorperl.patch + old: net-snmp-5.4.1-autoconf.diff + new: net-snmp-5.4.2_autoconf.patch + old: net-snmp-5.4.1_perl_tk_warning.patch + new: net-snmp-5.4.2_perl_tk_warning.patch + old: net-snmp-5.4_net-snmp-config_headercheck.patch + new: net-snmp-5.4.2_net-snmp-config_headercheck.patch +* Fri Oct 24 2008 kkeil@suse.de +- more IPv6 support from IBM (mainline backports) (bnc#437208) + Fix-for-tcpConnnectionTable-tcpListenerTable-udpEn.patch + Fix-for-IPv6-Interface-Table.patch + Fix-for-Internet-Address-Table.patch + Add-ICMP-Statistics-Tables-support.patch + Add-Default-Router-Table-support.patch + Add-IPv6-support-on-Internet-Address-Translation-Tab.patch + Fix-for-Internet-Address-Prefix-Table.patch + Add-IPv6-Scope-Zone-Index.patch + Improve-IP-Statistics-tables.patch * Mon Oct 20 2008 mrueckert@suse.de - remove lzma-alpha-devel. rpm-devel has to require it if it is really needed diff --git a/rc.net-snmp b/rc.net-snmp index 3b697e8..835f3f5 100644 --- a/rc.net-snmp +++ b/rc.net-snmp @@ -81,7 +81,7 @@ case "$1" in # do not even try to start if the log file is (2GB-1MB) big. # the snmpd doesnt handle LFS properly # - SNMPD_LOGFILE="/var/log/net-snmpd.log" + SNMPD_LOGFILE="${SNMPD_LOGFILE:-/var/log/net-snmpd.log}" if [ -e "$SNMPD_LOGFILE" ] ; then SNMPD_SIZE_LOGFILE="$(stat -c "%s" $SNMPD_LOGFILE)" SNMPD_SIZE_MAX="1073741824" @@ -126,7 +126,7 @@ case "$1" in killproc -TERM $SNMPD rc_status -v ; rc_reset # we also need to make sure all agents die - if test -n $agents; then + if test -n "$agents"; then for agent in $AGENTDIR/*; do test -x $agent || continue echo -ne "\tShutting down `basename $agent`:"