Question for Handling the WRONGVALUE error

This is a discussion on Question for Handling the WRONGVALUE error within the SNMP Coders forums, part of the Networking and Network Related category; Hello list, I'm new to net-snmp. Following the mib2c man page, I generated a pair of souce code, ...


Go Back   Usenet Forums > Networking and Network Related > SNMP Coders

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 07-29-2005
Lin, Zihui
 
Posts: n/a
Default Question for Handling the WRONGVALUE error

Hello list,

I'm new to net-snmp. Following the mib2c man page, I generated a pair of

souce code, and modified them a little bit.
The management object is an OCTET STRING, and the idea is, I want to
verify=20
the string when people SETing the value. If a malformed IPadress was
set,=20
then a WRONGVALUE error should be returned.

The handler works well when the verification success, but if it failed
for=20
once, even I SET some good strings after that, it fails also. I have
tried
to put the verify code to RESERVE2, but the result is the same.
So now if my subagent detected a wrong value once, it fails for ever. :(
What's problem? What can I do in this situation?

Thanks in advance,=20
Zihui

Here is the implementation code:

int
handle_observedNetworks(netsnmp_mib_handler *handler,
netsnmp_handler_registration *reginfo,
netsnmp_agent_request_info *reqinfo,
netsnmp_request_info *requests)

{
DEBUGMSGTL(("observedNetworks",
"continuing request, mode =3D %d\n",
reqinfo->mode));
switch (reqinfo->mode) {

/** GET is simple here */
case MODE_GET:
snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR,
(u_char *) observedNetworks_str,
strlen(observedNetworks_str));
break; =20

case MODE_SET_RESERVE1:

if ( requests->requestvb->type !=3D ASN_OCTET_STR) {

netsnmp_set_request_error(
reqinfo,
requests,
SNMP_ERR_WRONGVALUE //some error
);
return;
}
break;

case MODE_SET_RESERVE2:
break;

case MODE_SET_FREE:
break;

case MODE_SET_ACTION:

if (!verify_ip_range(requests->requestvb->val.string) ){
netsnmp_set_request_error(reqinfo, requests,
SNMP_ERR_BADVALUE);
}

strncpy(observedNetworks_str, requests->requestvb->val.string,
256);
break;

case MODE_SET_COMMIT:
break;

case MODE_SET_UNDO:
break;

default:
snmp_log(LOG_ERR, "unknown mode (%d) in
handle_observedNetworks\n",
reqinfo->mode);
return SNMP_ERR_GENERR;
}

return SNMP_ERR_NOERROR;
}


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO September
19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/...et-snmp-coders
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 10:26 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0