problem with get_next when ipAddress as table index
"Naama Bar Menachem" <[email protected]>
| Newsgroups | gmane.network.net-snmp.user |
|---|---|
| Message-ID | <[email protected]> |
Hi all
I have a table with 4 indices, 3 of them are of type ipAddress (see MIB
below).
Using mib2c with "mib2c.raw-table.conf" configuration file I got a c
file with function
"nsCommonConfigDataForwardRoutesTable_get_next_entry".
On the "get-next" function
* I receive the indices
* get the information from server
* updated the table's row
*updated the indices (idx->val.integer) with new value (next)
But the next time the function is approached (on "walk") - it does not
"remember" the indices of type ipAddress, but it does remember the int
index.
"idx->val.integer" is zero for the first 3 indices (of type ipAddress)
AM I DOING SOMETHING WRONG?
I also copied the function below.
----------------------------MIB-------------------------------
nsCommonConfigDataForwardRoutesTable OBJECT-TYPE
SYNTAX SEQUENCE OF CommonConfigDataForwardRoutesEntry
MAX-ACCESS not-accessible
STATUS current
DESCRIPTION
"A list of Routes parameters"
::= { nsCommonConfigDataForwardRoutes 1 }
nsCommonConfigDataForwardRoutesEntry OBJECT-TYPE
SYNTAX CommonConfigDataForwardRoutesEntry
MAX-ACCESS not-accessible
STATUS current
DESCRIPTION "Conceptual row in table for each neighbor."
INDEX { nsCommonConfigDataForwardPolicyRouteDestIpAddress,
nsCommonConfigDataForwardPolicyRouteDestSubnetMask,
nsCommonConfigDataForwardPolicyRouteNexthopIpAddress,
nsCommonConfigDataForwardPolicyRouteTableId }
::= { nsCommonConfigDataForwardRoutesTable 1 }
CommonConfigDataForwardRoutesEntry ::=
SEQUENCE {
nsCommonConfigDataForwardPolicyRouteDestIpAddress
IpAddress,
nsCommonConfigDataForwardPolicyRouteDestSubnetMask
IpAddress,
nsCommonConfigDataForwardPolicyRouteNexthopIpAddress
IpAddress,
nsCommonConfigDataForwardPolicyRouteTableId
Unsigned32,
nsCommonConfigDataForwardPolicyRouteAdminStatus INTEGER
}
----------------------------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;
}
Best Regards,
Naama Bar Menachem
SW Eng.
This e-mail may contain confidential and/or privileged information. If
you are not the intended recipient or have received this e-mail in error
please notify the sender immediately and destroy this e-mail. Any
unauthorized copying, disclosure or distribution of the material in this
e-mail is strictly forbidden.
------------------------------------------------------------------------------
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
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
image001.jpg
(image/jpeg, 13.7 KB) - not displayed