Hi Roert:

     Thanks!

My net-snmp version is 5.1.2.
Yes, it is very consistent. If I run snmpd with the following command line 
options it doesn't give me the error message.  

/usr/sbin/snmpd -Lsd -L -f -Dgenie -p /var/run/snmpd.pid

But if I start the snmpd with the following command line options it gives me 
the error as long as I walk from the table level. 
/usr/sbin/snmpd -Lsd -Lf /dev/null -p /var/run/snmpd.pid

I thought it may have something to do the way my program handling the !exact. 
But I don't understand is if the handling in my code doesn't cover all the oid 
comparison how come one command line always bump into the problem and the 
another command line doesn't have this problem. 

The logic of how I handle the exact and !exact for table is as following - the 
skeleton is copied from the ipAddr.c under mibII.

Var_exporterTable()
{
memcpy((char *) current, (char *) vp->name,
            (int) vp->namelen * sizeof(oid));

        //
        // tcp_read (list of ip address and data) from another process. 
        //
        memcpy( (router_flow_t *)router_data, (router_flow_t 
*)para->router_flow, sizeof(router_flow_t) * MAX_DEVICE_NUM);
        ........
        for (i = 0; i < ATM_MAX_DEVICE_NUM; i++)
{
 // ....
        sprintf(ip_string , convert2ipv4(router_data[i].router_ip));
        sscanf(ip_string, "%d.%d.%d.%d", &ip1[i], &ip2[i], &ip3[i], &ip4[i]);
        num_routers++;
       }

i=0; 
for (;;)
    {
        if (i >= num_routers) break;
        op = current + 14;
        *op++ = k= ip1[i];
        *op++ = k= ip2[i];
        *op++ = k= ip3[i];
        *op++ = k= ip4[i];
   
               if (exact)
              {
                     if (snmp_oid_compare(current, 18, name, *length) == 0)
                     {
                                     memcpy((char *) lowest, (char *) current,
                                                     18 * sizeof(oid));
                                     get_lowest = 1;
                                     index = i;
                                      break; /* no need to search further */
                    }
             } else {
                     if ((snmp_oid_compare(current, 18, name, *length) > 0) &&
                               (!get_lowest
                                 || (snmp_oid_compare(current, 18, lowest, 18) 
< 0)) )
                    {
                                index = i;
                                memcpy((char *) lowest, (char *) current,
                                        18 * sizeof(oid));
                                get_lowest = 1;
                    }
                }
               i++;
             }
            
        // if (!get_lowest)  -> I thought I need this one but with this line 
only one instance is built. (eg. 1.3.6 ....9999. ....?.A.B.C.D)
            // return (NULL);  -> So I commented out.
        memcpy((char *) name, (char *) lowest, 18 * sizeof(oid));
       *length = 18;
      *write_method =0;
      *var_len = sizeof(long_return);

        switch(vp->magic) {
             case GEATMEXPORTERIPADDR:
                long_return = router_data[index].router_ip;     
                 return (u_char*) &long_return;

              case:  .......
}

Thanks,
Jim
-----Original Message-----
From: Robert Story [mailto:[EMAIL PROTECTED]
Sent: Wednesday, July 13, 2005 8:32 PM
To: Jim Su
Cc: Jim Su; Net-Snmp-Users
Subject: Re: Error: OID not increasing

On Mon, 11 Jul 2005 15:50:43 +0800 Jim wrote:
JS>          I noticed the difference as following -
JS> If the snmpd is started with the following options : -f -L -Dge it's okay.
JS> No error occurred.
JS>          If snmpd is started with the following options:    -Lsd -Lf
JS>          /dev/null -p /var/run/snmpd.pid then the error occurred. It maybe
JS>          just coincident but I have no explanation why the same code of
JS>          snmpd with different result if the options are different..

Is it consistent? If you swap command lines, it always work/doesn't work?

What release are you running?

--
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.

--
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.323 / Virus Database: 267.8.12/46 - Release Date: 2005/7/11

-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.323 / Virus Database: 267.8.14/48 - Release Date: 2005/7/13
 

Reply via email to