I'm using net-snmp-5.7.2.

And I met an issue when I tried to set IP-MIB::ipv4InterfaceEnableStatus
I got the following error when I set it to 2(stop):
Error in packet.
Reason: wrongLength (The set value has an illegal length from what the agent 
expects)

I reviewed the code, and found the it failed at the following code:

        rc = netsnmp_check_vb_type_and_size(var, ASN_INTEGER,
                                            sizeof(rowreq_ctx->data.
                                                   ipv4InterfaceEnableStatus));

It is in function _ipv4InterfaceTable_check_column() in file 
"agent/mibgroup/ip-mib/ipv4InterfaceTable/ipv4InterfaceTable_interface.c"

The rowreq_ctx->data.ipv4InterfaceEnableStatus is refer to admin_status in 
struct netsnmp_interface_entry:
typedef struct netsnmp_interface_entry_s {
    ......

    char  admin_status;

    .......
} netsnmp_interface_entry;


But in ipMIB, it is defined as an INTEGER:
ifAdminStatus OBJECT-TYPE
SYNTAX  INTEGER {
up(1),       -- ready to pass packets
               down(2),
                testing(3)   -- in some test mode
            }

I also found _ifTable_check_column() in file 
"agent/mibgroup/if-mib/ifTable/ifTable_interface.c" has another different 
method to handle it:
case COLUMN_IFADMINSTATUS:
        /** special case: we are using exernal storage w/smaller data size
         ** for storage, so we can't use sizeof on data context. So we
         ** just check that it's the expected size. The enum tests below
         ** will ensure that there is no data overflow. */
        rc = netsnmp_check_vb_type_and_size(var, ASN_INTEGER,
                                            sizeof(u_long))


So I think the admin_status in netsnmp_interface_entry should be defined  u_int 
to avoid the column check problem.


Thanks,
Peilong

------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users

Reply via email to