Search
j0ke.net Open Build Service
>
Projects
>
GFS
>
net-snmp
> net-snmp-5.3.0.1_missing_ifNumber.patch
Sign Up
|
Log In
Username
Password
Cancel
Overview
Repositories
Revisions
Requests
Users
Advanced
Attributes
Meta
File net-snmp-5.3.0.1_missing_ifNumber.patch of Package net-snmp (Revision 2)
Currently displaying revision
2
,
show latest
https://sourceforge.net/tracker/?func=detail&atid=112694&aid=1399369&group_id=12694 Index: agent/mibgroup/if-mib/ifTable/ifTable.c =================================================================== --- agent/mibgroup/if-mib/ifTable/ifTable.c.orig +++ agent/mibgroup/if-mib/ifTable/ifTable.c @@ -44,6 +44,12 @@ ifTable_registration ifTable_user_contex void initialize_table_ifTable(void); void shutdown_table_ifTable(void); +static int +_if_number_handler(netsnmp_mib_handler *handler, + netsnmp_handler_registration *reginfo, + netsnmp_agent_request_info *reqinfo, + netsnmp_request_info *requests); + /** * Initializes the ifTable module @@ -135,6 +141,24 @@ initialize_table_ifTable(void) * call interface initialization code */ _ifTable_initialize_interface(user_context, flags); + + /* + * register scalar for ifNumber + */ + { + oid reg_oid[] = + { IFTABLE_NUMBER }; + netsnmp_handler_registration *myreg; + + myreg = + netsnmp_create_handler_registration("if number", + _if_number_handler, + ®_oid, + OID_LENGTH(reg_oid), + HANDLER_CAN_RONLY); + netsnmp_register_instance(myreg); + } + } /* initialize_table_ifTable */ /** @@ -2307,5 +2331,26 @@ ifTable_check_dependencies(ifTable_rowre return rc; } /* ifTable_check_dependencies */ + +static int +_if_number_handler(netsnmp_mib_handler *handler, + netsnmp_handler_registration *reginfo, + netsnmp_agent_request_info *reqinfo, + netsnmp_request_info *requests) +{ + if (MODE_GET == reqinfo->mode) { + int val = ifTable_container_size(); + snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER, + (u_char *) &val, sizeof(val)); + } else + netsnmp_assert("bad mode in RO handler"); + + if (handler->next && handler->next->access_method) + return netsnmp_call_next_handler(handler, reginfo, reqinfo, + requests); + + return SNMP_ERR_NOERROR; +} + /** @} */ /** @{ */ Index: agent/mibgroup/if-mib/ifTable/ifTable_constants.h =================================================================== --- agent/mibgroup/if-mib/ifTable/ifTable_constants.h.orig +++ agent/mibgroup/if-mib/ifTable/ifTable_constants.h @@ -15,6 +15,7 @@ extern "C" { * scalars */ #define IFTABLE_LAST_CHANGE 1,3,6,1,2,1,31,1,5 +#define IFTABLE_NUMBER 1,3,6,1,2,1,2,1,0 /*