16242256 linkUpDownNotifications does not work as described in snmpd.conf man page s11-update
authorMohana Rao Gorai <mohana.gorai@oracle.com>
Tue, 18 Mar 2014 08:39:20 -0700
branchs11-update
changeset 2989 b14351c01d53
parent 2987 01d2e6a3aae8
child 2991 5b038555a590
16242256 linkUpDownNotifications does not work as described in snmpd.conf man page 15819411 SUNBT7201970 There is no "PORTNUMBER" info for "traphandle" in solaris11 snmptra 15754602 SUNBT7111031 snmpd dumping during walk as strs test suite winds down its connect
components/net-snmp/patches/032.15754602.hr_proc.patch
components/net-snmp/patches/033.16242256.linkUpDown_notifictns.patch
components/net-snmp/patches/034.15819411.trapd_conf_manpage.patch
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/patches/032.15754602.hr_proc.patch	Tue Mar 18 08:39:20 2014 -0700
@@ -0,0 +1,15 @@
+Source : http://net-snmp.svn.sourceforge.net/viewvc/net-snmp?view=revision&revision=17415
+
+------------------------------------------------------------------------------------------
+--- a/agent/mibgroup/host/hr_proc.c	Fri May 11 17:32:30 2007
++++ b/agent/mibgroup/host/hr_proc.c	Fri Jun 14 11:27:57 2013
[email protected]@ -175,7 +175,8 @@
+         return (u_char *) nullOid;
+     case HRPROC_LOAD:
+         cpu = netsnmp_cpu_get_byIdx( proc_idx & HRDEV_TYPE_MASK, 0 );
+-        if ( !cpu || !cpu->history || !cpu->history[0].total_hist )
++        if ( !cpu || !cpu->history || !cpu->history[0].total_hist ||
++				( cpu->history[0].total_hist == cpu->total_ticks ))
+             return NULL;
+ 
+         long_return  = (cpu->idle_ticks  - cpu->history[0].idle_hist)*100;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/patches/033.16242256.linkUpDown_notifictns.patch	Tue Mar 18 08:39:20 2014 -0700
@@ -0,0 +1,136 @@
+Source : http://net-snmp.svn.sourceforge.net/viewvc/net-snmp?revision=16984&view=revision
+
+------------------------------------------------------------------------------------------
+--- a/agent/mibgroup/disman/event/mteObjects.h	Wed Sep 28 16:36:38 2005
++++ b/agent/mibgroup/disman/event/mteObjects.h	Fri Mar 29 07:56:26 2013
[email protected]@ -53,6 +53,7 @@
+                                  char *owner,   char   *oname,
+                                  oid  *suffix,  size_t  sfx_len );
+ int  mteObjects_internal_vblist( netsnmp_variable_list *vblist,
+-                                 char *oname,   struct mteTrigger *trigger);
++                                 char *oname,   struct mteTrigger *trigger,
++								  netsnmp_session *s);
+ 
+ #endif                          /* MTEOBJECTS_H */
+--- a/agent/mibgroup/disman/event/mteObjects.c	Tue Sep 19 12:06:06 2006
++++ b/agent/mibgroup/disman/event/mteObjects.c	Fri Mar 29 08:06:13 2013
[email protected]@ -335,7 +335,9 @@
+ 
+ int
+ mteObjects_internal_vblist( netsnmp_variable_list *vblist,
+-                            char   *oname, struct mteTrigger *trigger)
++                            char   *oname,
++							 struct mteTrigger *trigger,
++							 netsnmp_session   *sess)
+ {
+     netsnmp_variable_list *var = NULL, *vp;
+     oid mteHotTrigger[] = {1, 3, 6, 1, 2, 1, 88, 2, 1, 1, 0};
[email protected]@ -343,7 +345,12 @@
+     oid mteHotContext[] = {1, 3, 6, 1, 2, 1, 88, 2, 1, 3, 0};
+     oid mteHotOID[]     = {1, 3, 6, 1, 2, 1, 88, 2, 1, 4, 0};
+     oid mteHotValue[]   = {1, 3, 6, 1, 2, 1, 88, 2, 1, 5, 0};
++	oid ifIndexOid[]    = {1, 3, 6, 1, 2, 1, 2, 2, 1, 1, 0};
++	oid ifAdminStatus[] = {1, 3, 6, 1, 2, 1, 2, 2, 1, 7, 0};
++	oid ifOperStatus[]  = {1, 3, 6, 1, 2, 1, 2, 2, 1, 8, 0};
+ 
++	oid if_index;
++
+     /*
+      * Construct the varbinds for this (internal) event...
+      */
[email protected]@ -370,6 +377,40 @@
+                               trigger->mteTriggerFired->type,
+                               trigger->mteTriggerFired->val.string,
+                               trigger->mteTriggerFired->val_len);
++	} else if ((!strcmp(oname, "_linkUpDown"  ))) {
++		/*
++		 * The ifOperStatus varbind that triggered this entry
++		 * is held in the trigger->mteTriggerFired field
++		 *
++		 * We can retrieve the ifIndex and ifOperStatus values
++		 * from this varbind.  But first we need to tweak the
++		 * static ifXXX OID arrays to include the correct index.
++		 * (or this could be passed in from the calling routine?)
++		 *
++		 * Unfortunately we don't have the current AdminStatus value,
++		 * so we'll need to make another query to retrieve that.
++		 */
++		if_index = trigger->mteTriggerFired->name[10];
++		ifIndexOid[10] = if_index;
++		ifAdminStatus[10] = if_index;
++		ifOperStatus[10] = if_index;
++		snmp_varlist_add_variable( &var,
++				ifIndexOid, OID_LENGTH(ifIndexOid),
++				ASN_INTEGER, &if_index, sizeof(if_index));
++
++		/* Set up a dummy varbind for ifAdminStatus... */
++		snmp_varlist_add_variable( &var,
++				ifAdminStatus, OID_LENGTH(ifAdminStatus),
++				ASN_INTEGER,
++				trigger->mteTriggerFired->val.integer,
++				trigger->mteTriggerFired->val_len);
++		/* ... then retrieve the actual value */
++		netsnmp_query_get(var->next_variable, sess);
++		snmp_varlist_add_variable( &var,
++				ifOperStatus, OID_LENGTH(ifOperStatus),
++				ASN_INTEGER,
++				trigger->mteTriggerFired->val.integer,
++				trigger->mteTriggerFired->val_len);
+     } else {
+         DEBUGMSGTL(("disman:event:objects",
+                     "Unknown internal objects tag (%s)\n", oname));
+--- a/agent/mibgroup/disman/event/mteEvent.c	Mon Jul  2 07:02:29 2007
++++ b/agent/mibgroup/disman/event/mteEvent.c	Fri Mar 29 09:46:24 2013
[email protected]@ -266,7 +266,7 @@
+     return fired;
+ }
+ 
+-
++#ifdef __NOT_NEEDED
+ void
+ _insert_internal_objects( netsnmp_variable_list *vblist, char *oname,
+                           struct mteTrigger *trigger)
[email protected]@ -322,6 +322,7 @@
+     vp->next_variable     = vblist->next_variable;
+     vblist->next_variable = var;
+ }
++#endif
+ 
+ int
+ _mteEvent_fire_notify( struct mteEvent   *entry,     /* The event to fire  */
[email protected]@ -331,6 +332,8 @@
+     netsnmp_variable_list *var, *v2;
+     oid    snmptrap_oid[]   = { 1,3,6,1,6,3,1,1,4,1,0 };
+     size_t snmptrap_oid_len = OID_LENGTH(snmptrap_oid);
++	netsnmp_session *s;
++
+          /*
+           * The Event-MIB specification says that objects from the
+           *   mteEventTable should come after those from the trigger,
[email protected]@ -394,9 +397,10 @@
+      */
+     v2 = var->next_variable;
+     if (entry->session)
+-        netsnmp_query_get( v2, entry->session );
++		s = entry->session;
+     else
+-        netsnmp_query_get( v2, trigger->session );
++		s = trigger->session;
++	netsnmp_query_get( v2, s );
+ 
+     /*
+      * ... add any "internal" objects...
[email protected]@ -405,11 +409,11 @@
+     if (strcmp(entry->mteNotifyOwner, "_snmpd") == 0) {
+         DEBUGMSGTL(("disman:event:fire", "Adding event objects (internal)\n"));
+         if ( !strictOrdering ) {
+-            mteObjects_internal_vblist(var, entry->mteNotifyObjects, trigger);
++            mteObjects_internal_vblist(var, entry->mteNotifyObjects, trigger, s);
+         } else {
+             for (v2 = var; v2 && v2->next_variable; v2=v2->next_variable)
+                 ;
+-            mteObjects_internal_vblist(v2, entry->mteNotifyObjects, trigger);
++            mteObjects_internal_vblist(v2, entry->mteNotifyObjects, trigger, s);
+         }
+     }
+ 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/patches/034.15819411.trapd_conf_manpage.patch	Tue Mar 18 08:39:20 2014 -0700
@@ -0,0 +1,19 @@
+--- a/man/snmptrapd.conf.5.def	2006-09-25 01:42:15.000000000 -0700
++++ b/man/snmptrapd.conf.5.def	2014-02-24 04:30:55.947050368 -0800
[email protected]@ -199,12 +199,11 @@
+ program.
+ The input format is as follows, one entry per line:
+ .RS
+-.IP HOSTNAME
+-The name of the host that sent the notification, as determined by
+-.IR gethostbyaddr(3) .
++.IP HOSTDETAILS
++The details of the host that sent the notification in the format :
++.IP
++Host : HOSTNAME (PROTOCOL: [IPADDRESS]:PORTNO)
+ .br
+-.IP IPADDRESS
+-The IP address of the host that sent the notification.
+ .\"
+ .\" XXX - What about non-IPv4 transports?
+ .\"