Hi,Dave

I'm really sorry,I changed the name of My table & files,so when you
encounter the
rsfwSysAntivirusTable_handler ,yeah,it equals rsfwTable_handler ,and the
same
as the files.

Also,sorry for my poor english.

forgive me please!
Thanks for your help!


Regards,

Jiang

On 12/22/06, jiang jilin <[EMAIL PROTECTED]> wrote:

Thanks for your reply,Dave.

Maybe,I should modify the rsfwTable_handler routine shown as follows,

 /** handles requests for the rsfwTable table */
int
rsfwTable_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 rsfwTable_entry *table_entry;


    switch (reqinfo->mode) {
        /*
         * Read-support (also covers GetNext requests)
         */
       case MODE_GET:
        for (request = requests; request; request = request->next) {
            table_entry = (struct rsfwTable_entry *)
                netsnmp_extract_iterator_context(request);

            table_info = netsnmp_extract_table_info(request);



            switch (table_info->colnum) {
            case COLUMN_RSFWFILES:

                snmp_set_var_typed_integer(request->requestvb,
ASN_COUNTER,
                                           table_entry->
                                           rsfwFiles);
                break;
            case COLUMN_RSFWFILESINSCAN:

                snmp_set_var_typed_integer(request->requestvb,
ASN_COUNTER,
                                           table_entry->
                                           rsfwFilesInScan);

                break;
            default:
                /*
                 * An unsupported/unreadable column (if applicable)
                 */

                snmp_set_var_typed_value(request->requestvb,
                                         SNMP_NOSUCHOBJECT, NULL, 0);
            }
        }
        break;

    }
    DEBUGMSGTL(("rising","END ...handler of antivirusTable\n"));
    return SNMP_ERR_NOERROR;
}
you know,I used GDB to debug the agent,and I traced the procedure at
the routine  rsfwTable_handler.

gdb>bt
#0  rsfwTable_handler (handler=0x80a1e60, reginfo=0x80a1ea0,
    reqinfo=0x80e75c8, requests=0x810ebe0) at rfw/rs.c:332
#1  0xb7e20902 in netsnmp_call_handler (next_handler=0x80a1e60,
    reginfo=0x80a1ea0, reqinfo=0x80e75c8, requests=0x810ebe0)
    at agent_handler.c:428
#2  0xb7e20f33 in netsnmp_call_next_handler (current=0x80a1b38,
    reginfo=0x80a1ea0, reqinfo=0x80e75c8, requests=0x810ebe0)
    at agent_handler.c:533
#3  0xb7dfbf09 in netsnmp_table_iterator_helper_handler
(handler=0x80a1b38,
    reginfo=0x80a1ea0, reqinfo=0x80e75c8, requests=0x810ebe0)
    at table_iterator.c:781
#4  0xb7e20902 in netsnmp_call_handler (next_handler=0x80a1b38,
    reginfo=0x80a1ea0, reqinfo=0x80e75c8, requests=0x810ebe0)
    at agent_handler.c:428
#5  0xb7e20f33 in netsnmp_call_next_handler (current=0x80a28a0,
    reginfo=0x80a1ea0, reqinfo=0x80e75c8, requests=0x810ebe0)
    at agent_handler.c:533
#6  0xb7e01f3f in table_helper_handler (handler=0x80a28a0,
reginfo=0x80a1ea0,
    reqinfo=0x80e75c8, requests=0x810ebe0) at table.c:619
#7  0xb7e20902 in netsnmp_call_handler (next_handler=0x80a28a0,
    reginfo=0x80a1ea0, reqinfo=0x80e75c8, requests=0x810ebe0)
    at agent_handler.c:428
#8  0xb7e20cf8 in netsnmp_call_handlers (reginfo=0x80a1ea0,
reqinfo=0x80e75c8,
    requests=0x810ebe0) at agent_handler.c:509
#9  0xb7e160f7 in handle_var_requests (asp=0x810e218) at snmp_agent.c:2474
#10 0xb7e17478 in handle_pdu (asp=0x810e218) at snmp_agent.c:3251
#11 0xb7e1702d in netsnmp_handle_request (asp=0x810e218,
status=1927183776)


gdb>n
0xb7e95d73      358                     break;
gdb>n
335         switch (reqinfo->mode) {
gdb>n
342             for (request = requests; request; request = request->next)
{
(gdb)
343                 table_entry = (struct rsfwTable_entry *)
(gdb)
347                 table_info = netsnmp_extract_table_info(request);
(gdb)
0xb7e95ce6      358                     break;

(gdb)
352                 switch (table_info->colnum) {
(gdb)
361                     snmp_set_var_typed_integer(request->requestvb,
ASN_COUNTER,
(gdb)

Program received signal SIGSEGV, Segmentation fault.
0xb7e95b20 in rsfwTable_handler (handler=0x80a1e60,
    reginfo=0x80a1ea0, reqinfo=0x0, requests=0x810ebe0) at rfw/rs.c:361
361                     snmp_set_var_typed_integer(request->requestvb,
ASN_COUNTER,
so far,we''ve seen that the result the agent  received signal SIGSEGV,and
again,I found the pointer reqinfo had been NULL(==0) with using GDB.Hereis its 
output:

Breakpoint 1, rsfwSysAntivirusTable_handler (handler=0x80a1e60,
    reginfo=0x80a1ea0, reqinfo=0x80e75c8, requests=0x810ebe0) at
rfw/rising.c:332
332         DEBUGMSGTL(("rising","handler of antivirusTable\n"));
(gdb) n
0xb7ed1d73      358                     break;
(gdb)
335         switch (reqinfo->mode) {
(gdb) p request
$1 = (netsnmp_request_info *) 0xb7ed1910
(gdb) p reqinfo
$2 = (netsnmp_agent_request_info *) 0x0

So,we all will understand why the agent crashed,as you see,the agent works
well after I added some code to assure the POINTERs != NULL.Howerver,I'm
not sure that what I did is right.so,you may help me ?

And I've another question,How add my private MODULE to the default ? You
konw,I mean when everyone use snmpget,snmpwalk and so forth to manipulate my
private OID,there is no need to pass the argument "-m ALL" or something
else equivalent.

Also,in the agent,I've add the lines as follows to the file some.h
config_require(rfw/rs)
config_add_mib(RS-MIB)
config_add_mib(RS-FW-MIB)

Many thanks, Dave!
Best wishes!

Jiang





On 12/22/06, Dave Shield <[EMAIL PROTECTED]> wrote:
>
> On 21/12/06, jiang jilin <[EMAIL PROTECTED]> wrote:
> > I've found that agent crashed at function "myTable_handler ".Anynoe
> can help
> > me resolve the problem?
>
> Try running the agent under a debugger, or running the debugger
> on the core file from the crash.   A backtrace should indicate
> where exactly the crash is occuring.
>   What does this code look like?
>
> Dave
>


-------------------------------------------------------------------------
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-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

Reply via email to