Hi,
My name is Lilach, I work in GO Networks as an embedded programmer.
I found one bug with get bulk - in table_array_ext_data.c, when getting
a new parameter in get bulk the counter doesn't reset.
This is a patch for resetting the counter in find_next_row.
@@ -32,6 +32,15 @@
* snmp.h:#define SNMP_MSG_INTERNAL_SET_UNDO 5
*/
+ //Lilach - struct copied in order to reset table count (get bulk)
+typedef struct binary_array_table {
+ size_t max_size; /* Size of the current data
table */
+ size_t count; /* Index of the next free
entry */
+ int dirty;
+ int data_size; /* Size of an individual
entry */
+ void **data; /* The table itself */
+} binary_array_table_struct;
+
static const char *mode_name[] = {
"Reserve 1",
"Reserve 2",
@@ -229,7 +238,8 @@
static NETSNMP_INLINE netsnmp_index *
find_next_row(netsnmp_table_request_info *tblreq_info,
- table_container_data * tad)
+ table_container_data * tad,
+ netsnmp_container *request_group)
{
netsnmp_index *row = NULL;
netsnmp_index index;
@@ -264,7 +274,20 @@
tblreq_info->colnum = 0;
if (tblreq_info->colnum != 0)
- row = CONTAINER_FIRST(tad->table);
+ {
+ row = CONTAINER_FIRST(tad->table);
+ //Lilach reset table count in get bulk
+ //g =
SNMP_MALLOC_TYPEDEF(netsnmp_request_group);
+ //i =
SNMP_MALLOC_TYPEDEF(netsnmp_request_group_item);
+ int i;
+ for (i=0
;i<((binary_array_table_struct*)request_group->container_data)->count;i+
+ )
+ {
+
free(((netsnmp_request_group*)((binary_array_table_struct*)request_group
->container_data)->data[i])->list);//free i
+
free(((binary_array_table_struct*)request_group->container_data)->data[i
]);//free g
+ }
+
((binary_array_table_struct*)request_group->container_data)->count=0;
+
+ }
}
}
@@ -372,7 +395,7 @@
/*
* find the row
*/
- row = find_next_row(tblreq_info, tad);
+ row = find_next_row(tblreq_info, tad,request_group);
if (!row) {
/*
* no results found.
Another bug we have is that when making a big request for getbulk, the
snmp should fill the PDU and then stop. We get a full packet, in
fregments with the entire request.
Did anyone find a solotion for that?
Thanks, Lilach
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders