On Tue, 30 Aug 2005 18:38:51 +0800 Jim wrote:
JS>    On the man page of "snmptrap" I found there is type for counter32 but
JS> no counter64 ###

You are right, it's missing. Try this patch against 5.2.1.2, and see if it
helps.

-- 
NOTE: messages sent directly to me, instead of the lists, will be deleted
      unless they are requests for paid consulting services.

Robert Story; NET-SNMP Junkie
Support: <http://www.net-snmp.org/> <irc://irc.freenode.net/#net-snmp>  
Archive: <http://sourceforge.net/mailarchive/forum.php?forum=net-snmp-users>

You are lost in a twisty maze of little standards, all different. 
--- ../x-5.2.1.x/snmplib/snmp_api.c	2005-06-30 11:12:53.000000000 -0400
+++ snmplib/snmp_api.c	2005-09-09 17:23:06.325001119 -0400
@@ -6525,8 +6528,8 @@
 #ifdef OPAQUE_SPECIAL_TYPES
     double          dtmp;
     float           ftmp;
-    struct counter64 c64tmp;
 #endif                          /* OPAQUE_SPECIAL_TYPES */
+    struct counter64 c64tmp;
 
 #ifndef DISABLE_MIB_LOADING
     tp = get_tree(name, name_length, get_tree_head());
@@ -6555,6 +6558,9 @@
         case TYPE_COUNTER:
             type = 'c';
             break;
+        case TYPE_COUNTER64:
+            type = 'C';
+            break;
         case TYPE_TIMETICKS:
             type = 't';
             break;
@@ -6663,6 +6669,21 @@
             goto fail;
         break;
 
+    case 'C':
+#ifndef DISABLE_MIB_LOADING
+        if (check && tp->type != TYPE_COUNTER64) {
+            value = "Counter64";
+            result = SNMPERR_VALUE;
+            goto type_error;
+        }
+#endif /* DISABLE_MIB_LOADING */
+        if (read64(&c64tmp, value))
+            snmp_pdu_add_variable(pdu, name, name_length, ASN_COUNTER64,
+                                  (u_char *) & c64tmp, sizeof(c64tmp));
+        else
+            goto fail;
+        break;
+
     case 't':
 #ifndef DISABLE_MIB_LOADING
         if (check && tp->type != TYPE_TIMETICKS) {

Reply via email to