I took your advice and tried a single getnext.
No matter what index I write, it always receives 0,0,0,what-i-insert
(the first 3 are received as 0, only the fourth is received properly).
Is my index read wrong? Does ipAddress saved in " idx->val.integer " ?

Thank you,
Naama


----------------------------GET NEXT FUNC-------------------------------
static struct nsCommonConfigDataForwardRoutesTable_entry *
nsCommonConfigDataForwardRoutesTable_get_next_entry
    (netsnmp_handler_registration *reginfo, netsnmp_request_info
*request,
     int column, netsnmp_variable_list * indexes)
{
    struct nsCommonConfigDataForwardRoutesTable_entry *row = NULL;
    oid             build_space[MAX_OID_LEN];
    size_t          build_space_len = 0;
    size_t          index_oid_len = 0;
    netsnmp_variable_list               *idx = indexes;
   ..............

                key_pointer->dest_ip = *(idx->val.integer);
                idx = idx->next_variable;
                key_pointer->dest_subnet = *(idx->val.integer);
                idx = idx->next_variable;
                key_pointer->next_hop_ip = *(idx->val.integer);
                idx = idx->next_variable;
                key_pointer->table_id = *(idx->val.integer);

                ...........................................
                .....................get info for row + update
"key_pointer"...........
                row = &DataForwardRoutes_entry;

                    idx = indexes;
                    *(idx->val.integer) = key_pointer->dest_ip;
                    idx = idx->next_variable;
                    *(idx->val.integer) = key_pointer->dest_subnet;
                    idx = idx->next_variable;
                    *(idx->val.integer) = key_pointer->next_hop_ip;
                    idx = idx->next_variable;
                    *(idx->val.integer) = key_pointer->table_id;

                  ====>  I printed the value of  all "idx->val.integer"
and it is OK.

                    /*
                     * ... and update the requested OID to match this
instance
                     */
                    memcpy(build_space, reginfo->rootoid,       /*
registered oid */
                           reginfo->rootoid_len * sizeof(oid));
                    build_space_len = reginfo->rootoid_len;
                    build_space[build_space_len++] = 1; /* entry */
                    build_space[build_space_len++] = column;    /*
column */
                    build_oid_noalloc(build_space + build_space_len,
                                      MAX_OID_LEN - build_space_len,
&index_oid_len,
                                      NULL, 0, indexes);
                    snmp_set_var_objid(request->requestvb, build_space,
                                       build_space_len + index_oid_len);

    /*
     * Finally, return the data structure for this row 
     */
    return row;
}


-----Original Message-----
From: dave.shi...@gmail.com [mailto:dave.shi...@gmail.com] On Behalf Of
Dave Shield
Sent: Monday, July 23, 2012 9:33 PM
To: Naama Bar Menachem
Cc: net-snmp-users@lists.sourceforge.net
Subject: Re: problem with get_next when ipAddress as table index

On 23 July 2012 17:06, Naama Bar Menachem
<naama.barmenac...@novelsat.com> wrote:
> I don't think it is the reason for the issue for 2 reasons:
> 1. I see that the LAST index is actually updated (table-id) and all 
> other 3 are not updated (all of type ipAddress)

The issue is not whether the index values are changed or not.
The problem that I was pointing out was that you are building the
response OID from those index values, but the code only seems to include
the first one.

The obvious way to check this would be to issue a single "snmpgetnext"
request for an instance within this table, and report what answer you
get back.


> 2. I have another table with multiple indices, all integers, and with 
> same code (which is automatically generated by mib2c) it works fine

If you say so - then fine.
I've no idea what the code of the two modules actually looks like, so
cannot really comment whether it is the same or not.

Dave

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users

Reply via email to