Hi,
I am having a MIB which has two indexes.
One is the ipaddress type and another is the ipaddress.
I am using mib2c to generate the code for the mib with
mib2c.iterate.conf as helper.
The problem I am facing is that I am able to create the row using the
following command(plz tell me if the command is wrong).
snmpset -c public 127.0.0.1 mVgSipDnsServerRowStatus.1.\"10.1.5.100\" i
4
After this I am trying to modify the column of the row created using
snmpset -c public 127.0.0.1
mVgSipDnsServerPriority.1.\"10.1.5.100\" i 2
for which the subagent is giving segmentation fault.
Using gdb I found out that the problem is with 'table_entry =
netsnmp_extract_iterator_context()' which is returning null.
The following is the mib.
| | +--mVgSipDnsServerTable(6)
| | | |
| | | +--mVgSipDnsServerEntry(1)
| | | | Index: mVgSipDnsServerIPAddressType,
mVgSipDnsServerIpAddress
| | | |
| | | +-- ---- EnumVal
mVgSipDnsServerIPAddressType(1)
| | | | Textual Convention: InetAddressType
| | | | Values: unknown(0), ipv4(1), ipv6(2),
ipv4z(3), ipv6z(4), dns(16)
| | | +-- ---- String mVgSipDnsServerIpAddress(2)
| | | | Textual Convention: InetAddress
| | | | Size: 0..255
| | | +-- CR-- INTEGER mVgSipDnsServerPriority(3)
| | | | Range: 1..2
| | | +-- CR-- EnumVal mVgSipDnsServerRowStatus(4)
| | | Textual Convention: RowStatus
| | | Values: active(1), notInService(2),
notReady(3), createAndGo(4), createAndWait(5), destroy(6)
The following is the handler function in which in the 'case
MODE_SET_ACTION' the following line is returning null
'table_entry = netsnmp_extract_iterator_context()'
int
mVgSipDnsServerTable_handler(netsnmp_mib_handler *handler,
netsnmp_handler_registration *reginfo,
netsnmp_agent_request_info *reqinfo,
netsnmp_request_info *requests)
{
netsnmp_request_info *request;
netsnmp_table_request_info *table_info;
struct mVgSipDnsServerTable_entry *table_entry;
opcode scacOpCode;
tableName scacTableName;
int scacIndex=0,scacMask=0,ret;
short scacTempVar = 0;
retCode scacRet = A_SUCCESS;
static int mVgSipCnt = 0;
char scacTempIp[LengthOfIp] = {0};
printf("In %s wid %d\n",__FUNCTION__,reqinfo->mode);
switch (reqinfo->mode) {
case MODE_SET_RESERVE1:
for (request = requests; request; request = request->next) {
table_entry = (struct mVgSipDnsServerTable_entry *)
netsnmp_extract_iterator_context(request);
table_info = netsnmp_extract_table_info(request);
switch (table_info->colnum) {
case COLUMN_MVGSIPDNSSERVERPRIORITY:
/*
* or possibly 'netsnmp_check_vb_int_range'
*/
ret = netsnmp_check_vb_int(request->requestvb);
if (ret != SNMP_ERR_NOERROR) {
netsnmp_set_request_error(reqinfo, request, ret);
return SNMP_ERR_NOERROR;
}
break;
case COLUMN_MVGSIPDNSSERVERROWSTATUS:
ret = netsnmp_check_vb_rowstatus(request->requestvb,
(table_entry ?
RS_ACTIVE :
RS_NONEXISTENT));
if (ret != SNMP_ERR_NOERROR) {
netsnmp_set_request_error(reqinfo, request, ret);
return SNMP_ERR_NOERROR;
}
break;
default:
netsnmp_set_request_error(reqinfo, request,
SNMP_ERR_NOTWRITABLE);
return SNMP_ERR_NOERROR;
}
if(!table_entry)
printf("Null in MODE_SET_RESERVE1\n");
else
printf("Not Null in MODE_SET_RESERVE1\n");
}
break;
case MODE_SET_RESERVE2:
for (request = requests; request; request = request->next) {
table_entry = (struct mVgSipDnsServerTable_entry *)
netsnmp_extract_iterator_context(request);
table_info = netsnmp_extract_table_info(request);
switch (table_info->colnum) {
case COLUMN_MVGSIPDNSSERVERROWSTATUS:
switch (*request->requestvb->val.integer) {
case RS_CREATEANDGO:
case RS_CREATEANDWAIT:
table_entry =
mVgSipDnsServerTable_createEntry(*table_info->
indexes->val.
integer,
(char
*)table_info->
indexes->next_variable->val.
string,
table_info->
indexes->next_variable->val_len);
if (table_entry) {
netsnmp_insert_iterator_context(request,
table_entry);
} else {
netsnmp_set_request_error(reqinfo, request,
SNMP_ERR_RESOURCEUNAVAILABLE);
return SNMP_ERR_NOERROR;
}
}
}
if(!table_entry)
printf("Null in MODE_SET_RESERVE2\n");
else
printf("Not Null in MODE_SET_RESERVE2\n");
}
break;
case MODE_SET_FREE:
for (request = requests; request; request = request->next) {
table_entry = (struct mVgSipDnsServerTable_entry *)
netsnmp_extract_iterator_context(request);
table_info = netsnmp_extract_table_info(request);
switch (table_info->colnum) {
case COLUMN_MVGSIPDNSSERVERROWSTATUS:
switch (*request->requestvb->val.integer) {
case RS_CREATEANDGO:
case RS_CREATEANDWAIT:
if (table_entry && !table_entry->valid) {
mVgSipDnsServerTable_removeEntry(table_entry);
}
}
}
}
break;
case MODE_SET_ACTION:
for (request = requests; request; request = request->next) {
table_entry = (struct mVgSipDnsServerTable_entry *)
netsnmp_extract_iterator_context(request);
table_info = netsnmp_extract_table_info(request);
if(!table_entry)
printf("Null\n");
else
printf("Not Null\n");
switch (table_info->colnum) {
case COLUMN_MVGSIPDNSSERVERPRIORITY:
table_entry->old_mVgSipDnsServerPriority =
table_entry->mVgSipDnsServerPriority;
table_entry->mVgSipDnsServerPriority =
*request->requestvb->val.integer;
break;
}
if(!table_entry)
printf("Null in MODE_SET_ACTION\n");
else
printf("Not Null in MODE_SET_ACTION\n");
}
/*
* Check the internal consistency of an active row
*/
for (request = requests; request; request = request->next) {
table_entry = (struct mVgSipDnsServerTable_entry *)
netsnmp_extract_iterator_context(request);
table_info = netsnmp_extract_table_info(request);
switch (table_info->colnum) {
case COLUMN_MVGSIPDNSSERVERROWSTATUS:
switch (*request->requestvb->val.integer) {
case RS_ACTIVE:
case RS_CREATEANDGO:
// if ( /* XXX */ ) {
// netsnmp_set_request_error(reqinfo, request,
//
SNMP_ERR_INCONSISTENTVALUE);
return SNMP_ERR_NOERROR;
// }
}
}
}
break;
case MODE_SET_UNDO:
for (request = requests; request; request = request->next) {
table_entry = (struct mVgSipDnsServerTable_entry *)
netsnmp_extract_iterator_context(request);
table_info = netsnmp_extract_table_info(request);
switch (table_info->colnum) {
case COLUMN_MVGSIPDNSSERVERPRIORITY:
table_entry->mVgSipDnsServerPriority =
table_entry->old_mVgSipDnsServerPriority;
table_entry->old_mVgSipDnsServerPriority = 0;
break;
case COLUMN_MVGSIPDNSSERVERROWSTATUS:
switch (*request->requestvb->val.integer) {
case RS_CREATEANDGO:
case RS_CREATEANDWAIT:
if (table_entry && !table_entry->valid) {
mVgSipDnsServerTable_removeEntry(table_entry);
}
}
break;
}
}
break;
case MODE_SET_COMMIT:
for (request = requests; request; request = request->next) {
table_entry = (struct mVgSipDnsServerTable_entry *)
netsnmp_extract_iterator_context(request);
table_info = netsnmp_extract_table_info(request);
switch (table_info->colnum) {
case COLUMN_MVGSIPDNSSERVERROWSTATUS:
switch (*request->requestvb->val.integer) {
case RS_CREATEANDGO:
table_entry->valid = 1;
/*
* Fall-through
*/
case RS_ACTIVE:
table_entry->mVgSipDnsServerRowStatus = RS_ACTIVE;
break;
case RS_CREATEANDWAIT:
table_entry->valid = 1;
/*
* Fall-through
*/
case RS_NOTINSERVICE:
table_entry->mVgSipDnsServerRowStatus =
RS_NOTINSERVICE;
break;
case RS_DESTROY:
mVgSipDnsServerTable_removeEntry(table_entry);
}
}
if(!table_entry)
printf("Null in MODE_SET_COMMIT\n");
else
printf("Not Null in MODE_SET_COMMIT\n");
}
break;
}
return SNMP_ERR_NOERROR;
}
Plz help me
Thanks
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.