示例#1
0
文件: icmp.c 项目: DYFeng/infinidb
int
icmp_handler(netsnmp_mib_handler          *handler,
             netsnmp_handler_registration *reginfo,
             netsnmp_agent_request_info   *reqinfo,
             netsnmp_request_info         *requests)
{
    netsnmp_request_info  *request;
    netsnmp_variable_list *requestvb;
    long     ret_value;
    oid      subid;
#ifdef USES_TRADITIONAL_ICMPSTAT
    int      i;
#endif

    /*
     * The cached data should already have been loaded by the
     *    cache handler, higher up the handler chain.
     * But just to be safe, check this and load it manually if necessary
     */
#ifndef hpux11
    if (!netsnmp_cache_is_valid(reqinfo, reginfo->handlerName)) {
        netsnmp_assert("cache" == "valid"); /* always false */
        icmp_load( NULL, NULL );	/* XXX - check for failure */
    }
#endif


    /*
     * 
     *
     */
    DEBUGMSGTL(("mibII/icmp", "Handler - mode %s\n",
                    se_find_label_in_slist("agent_mode", reqinfo->mode)));
    switch (reqinfo->mode) {
    case MODE_GET:
        for (request=requests; request; request=request->next) {
            requestvb = request->requestvb;
            subid = requestvb->name[OID_LENGTH(icmp_oid)];  /* XXX */
            DEBUGMSGTL(( "mibII/icmp", "oid: "));
            DEBUGMSGOID(("mibII/icmp", requestvb->name,
                                       requestvb->name_length));
            DEBUGMSG((   "mibII/icmp", "\n"));

            switch (subid) {
#ifdef USES_SNMP_DESIGNED_ICMPSTAT
    case ICMPINMSGS:
        ret_value = icmpstat.icmpInMsgs;
        break;
    case ICMPINERRORS:
        ret_value = icmpstat.icmpInErrors;
        break;
    case ICMPINDESTUNREACHS:
        ret_value = icmpstat.icmpInDestUnreachs;
        break;
    case ICMPINTIMEEXCDS:
        ret_value = icmpstat.icmpInTimeExcds;
        break;
    case ICMPINPARMPROBS:
        ret_value = icmpstat.icmpInParmProbs;
        break;
    case ICMPINSRCQUENCHS:
        ret_value = icmpstat.icmpInSrcQuenchs;
        break;
    case ICMPINREDIRECTS:
        ret_value = icmpstat.icmpInRedirects;
        break;
    case ICMPINECHOS:
        ret_value = icmpstat.icmpInEchos;
        break;
    case ICMPINECHOREPS:
        ret_value = icmpstat.icmpInEchoReps;
        break;
    case ICMPINTIMESTAMPS:
        ret_value = icmpstat.icmpInTimestamps;
        break;
    case ICMPINTIMESTAMPREPS:
        ret_value = icmpstat.icmpInTimestampReps;
        break;
    case ICMPINADDRMASKS:
        ret_value = icmpstat.icmpInAddrMasks;
        break;
    case ICMPINADDRMASKREPS:
        ret_value = icmpstat.icmpInAddrMaskReps;
        break;
    case ICMPOUTMSGS:
        ret_value = icmpstat.icmpOutMsgs;
        break;
    case ICMPOUTERRORS:
        ret_value = icmpstat.icmpOutErrors;
        break;
    case ICMPOUTDESTUNREACHS:
        ret_value = icmpstat.icmpOutDestUnreachs;
        break;
    case ICMPOUTTIMEEXCDS:
        ret_value = icmpstat.icmpOutTimeExcds;
        break;
    case ICMPOUTPARMPROBS:
        ret_value = icmpstat.icmpOutParmProbs;
        break;
    case ICMPOUTSRCQUENCHS:
        ret_value = icmpstat.icmpOutSrcQuenchs;
        break;
    case ICMPOUTREDIRECTS:
        ret_value = icmpstat.icmpOutRedirects;
        break;
    case ICMPOUTECHOS:
        ret_value = icmpstat.icmpOutEchos;
        break;
    case ICMPOUTECHOREPS:
        ret_value = icmpstat.icmpOutEchoReps;
        break;
    case ICMPOUTTIMESTAMPS:
        ret_value = icmpstat.icmpOutTimestamps;
        break;
    case ICMPOUTTIMESTAMPREPS:
        ret_value = icmpstat.icmpOutTimestampReps;
        break;
    case ICMPOUTADDRMASKS:
        ret_value = icmpstat.icmpOutAddrMasks;
        break;
    case ICMPOUTADDRMASKREPS:
        ret_value = icmpstat.icmpOutAddrMaskReps;
        break;
#else                          /* USES_SNMP_DESIGNED_ICMPSTAT */

#ifdef USES_TRADITIONAL_ICMPSTAT
    case ICMPINMSGS:
        ret_value = icmpstat.icps_badcode +
            icmpstat.icps_tooshort +
            icmpstat.icps_checksum + icmpstat.icps_badlen;
        for (i = 0; i <= ICMP_MAXTYPE; i++)
            ret_value += icmpstat.icps_inhist[i];
        break;
    case ICMPINERRORS:
        ret_value = icmpstat.icps_badcode +
            icmpstat.icps_tooshort +
            icmpstat.icps_checksum + icmpstat.icps_badlen;
        break;
    case ICMPINDESTUNREACHS:
        ret_value = icmpstat.icps_inhist[ICMP_UNREACH];
        break;
    case ICMPINTIMEEXCDS:
        ret_value = icmpstat.icps_inhist[ICMP_TIMXCEED];
        break;
    case ICMPINPARMPROBS:
        ret_value = icmpstat.icps_inhist[ICMP_PARAMPROB];
        break;
    case ICMPINSRCQUENCHS:
        ret_value = icmpstat.icps_inhist[ICMP_SOURCEQUENCH];
        break;
    case ICMPINREDIRECTS:
        ret_value = icmpstat.icps_inhist[ICMP_REDIRECT];
        break;
    case ICMPINECHOS:
        ret_value = icmpstat.icps_inhist[ICMP_ECHO];
        break;
    case ICMPINECHOREPS:
        ret_value = icmpstat.icps_inhist[ICMP_ECHOREPLY];
        break;
    case ICMPINTIMESTAMPS:
        ret_value = icmpstat.icps_inhist[ICMP_TSTAMP];
        break;
    case ICMPINTIMESTAMPREPS:
        ret_value = icmpstat.icps_inhist[ICMP_TSTAMPREPLY];
        break;
    case ICMPINADDRMASKS:
        ret_value = icmpstat.icps_inhist[ICMP_MASKREQ];
        break;
    case ICMPINADDRMASKREPS:
        ret_value = icmpstat.icps_inhist[ICMP_MASKREPLY];
        break;
    case ICMPOUTMSGS:
        ret_value = icmpstat.icps_oldshort + icmpstat.icps_oldicmp;
        for (i = 0; i <= ICMP_MAXTYPE; i++)
            ret_value += icmpstat.icps_outhist[i];
        break;
    case ICMPOUTERRORS:
        ret_value = icmpstat.icps_oldshort + icmpstat.icps_oldicmp;
        break;
    case ICMPOUTDESTUNREACHS:
        ret_value = icmpstat.icps_outhist[ICMP_UNREACH];
        break;
    case ICMPOUTTIMEEXCDS:
        ret_value = icmpstat.icps_outhist[ICMP_TIMXCEED];
        break;
    case ICMPOUTPARMPROBS:
        ret_value = icmpstat.icps_outhist[ICMP_PARAMPROB];
        break;
    case ICMPOUTSRCQUENCHS:
        ret_value = icmpstat.icps_outhist[ICMP_SOURCEQUENCH];
        break;
    case ICMPOUTREDIRECTS:
        ret_value = icmpstat.icps_outhist[ICMP_REDIRECT];
        break;
    case ICMPOUTECHOS:
        ret_value = icmpstat.icps_outhist[ICMP_ECHO];
        break;
    case ICMPOUTECHOREPS:
        ret_value = icmpstat.icps_outhist[ICMP_ECHOREPLY];
        break;
    case ICMPOUTTIMESTAMPS:
        ret_value = icmpstat.icps_outhist[ICMP_TSTAMP];
        break;
    case ICMPOUTTIMESTAMPREPS:
        ret_value = icmpstat.icps_outhist[ICMP_TSTAMPREPLY];
        break;
    case ICMPOUTADDRMASKS:
        ret_value = icmpstat.icps_outhist[ICMP_MASKREQ];
        break;
    case ICMPOUTADDRMASKREPS:
        ret_value = icmpstat.icps_outhist[ICMP_MASKREPLY];
        break;
#else                          /* USES_TRADITIONAL_ICMPSTAT */

#ifdef hpux11
    case ICMPINMSGS:
    case ICMPINERRORS:
    case ICMPINDESTUNREACHS:
    case ICMPINTIMEEXCDS:
    case ICMPINPARMPROBS:
    case ICMPINSRCQUENCHS:
    case ICMPINREDIRECTS:
    case ICMPINECHOS:
    case ICMPINECHOREPS:
    case ICMPINTIMESTAMPS:
    case ICMPINTIMESTAMPREPS:
    case ICMPINADDRMASKS:
    case ICMPINADDRMASKREPS:
    case ICMPOUTMSGS:
    case ICMPOUTERRORS:
    case ICMPOUTDESTUNREACHS:
    case ICMPOUTTIMEEXCDS:
    case ICMPOUTPARMPROBS:
    case ICMPOUTSRCQUENCHS:
    case ICMPOUTREDIRECTS:
    case ICMPOUTECHOS:
    case ICMPOUTECHOREPS:
    case ICMPOUTTIMESTAMPS:
    case ICMPOUTTIMESTAMPREPS:
    case ICMPOUTADDRMASKS:
    case ICMPOUTADDRMASKREPS:
	/*
	 * This is a bit of a hack, to shoehorn the HP-UX 11
	 * single-object retrieval approach into the caching
	 * architecture.
	 */
	if (icmp_load(NULL, (void*)subid) == -1 ) {
            netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT);
            continue;
	}
        ret_value = icmpstat;
        break;
#else                          /* hpux11 */

#ifdef WIN32
    case ICMPINMSGS:
        ret_value = icmpstat.stats.icmpInStats.dwMsgs;
        break;
    case ICMPINERRORS:
        ret_value = icmpstat.stats.icmpInStats.dwErrors;
        break;
    case ICMPINDESTUNREACHS:
        ret_value = icmpstat.stats.icmpInStats.dwDestUnreachs;
        break;
    case ICMPINTIMEEXCDS:
        ret_value = icmpstat.stats.icmpInStats.dwTimeExcds;
        break;
    case ICMPINPARMPROBS:
        ret_value = icmpstat.stats.icmpInStats.dwParmProbs;
        break;
    case ICMPINSRCQUENCHS:
        ret_value = icmpstat.stats.icmpInStats.dwSrcQuenchs;
        break;
    case ICMPINREDIRECTS:
        ret_value = icmpstat.stats.icmpInStats.dwRedirects;
        break;
    case ICMPINECHOS:
        ret_value = icmpstat.stats.icmpInStats.dwEchos;
        break;
    case ICMPINECHOREPS:
        ret_value = icmpstat.stats.icmpInStats.dwEchoReps;
        break;
    case ICMPINTIMESTAMPS:
        ret_value = icmpstat.stats.icmpInStats.dwTimestamps;
        break;
    case ICMPINTIMESTAMPREPS:
        ret_value = icmpstat.stats.icmpInStats.dwTimestampReps;
        break;
    case ICMPINADDRMASKS:
        ret_value = icmpstat.stats.icmpInStats.dwAddrMasks;
        break;
    case ICMPINADDRMASKREPS:
        ret_value = icmpstat.stats.icmpInStats.dwAddrMaskReps;
        break;
    case ICMPOUTMSGS:
        ret_value = icmpstat.stats.icmpOutStats.dwMsgs;
        break;
    case ICMPOUTERRORS:
        ret_value = icmpstat.stats.icmpOutStats.dwErrors;
        break;
    case ICMPOUTDESTUNREACHS:
        ret_value = icmpstat.stats.icmpOutStats.dwDestUnreachs;
        break;
    case ICMPOUTTIMEEXCDS:
        ret_value = icmpstat.stats.icmpOutStats.dwTimeExcds;
        break;
    case ICMPOUTPARMPROBS:
        ret_value = icmpstat.stats.icmpOutStats.dwParmProbs;
        break;
    case ICMPOUTSRCQUENCHS:
        ret_value = icmpstat.stats.icmpOutStats.dwSrcQuenchs;
        break;
    case ICMPOUTREDIRECTS:
        ret_value = icmpstat.stats.icmpOutStats.dwRedirects;
        break;
    case ICMPOUTECHOS:
        ret_value = icmpstat.stats.icmpOutStats.dwEchos;
        break;
    case ICMPOUTECHOREPS:
        ret_value = icmpstat.stats.icmpOutStats.dwEchoReps;
        break;
    case ICMPOUTTIMESTAMPS:
        ret_value = icmpstat.stats.icmpOutStats.dwTimestamps;
        break;
    case ICMPOUTTIMESTAMPREPS:
        ret_value = icmpstat.stats.icmpOutStats.dwTimestampReps;
        break;
    case ICMPOUTADDRMASKS:
        ret_value = icmpstat.stats.icmpOutStats.dwAddrMasks;
        break;
    case ICMPOUTADDRMASKREPS:
        ret_value = icmpstat.stats.icmpOutStats.dwAddrMaskReps;
        break;
#endif                          /* WIN32 */
#endif                          /* hpux11 */
#endif                          /* USES_TRADITIONAL_ICMPSTAT */
#endif                          /* USES_SNMP_DESIGNED_ICMPSTAT */
	    }
	    snmp_set_var_typed_value(request->requestvb, ASN_COUNTER,
			             (u_char *)&ret_value, sizeof(ret_value));
	}
        break;

    case MODE_GETNEXT:
    case MODE_GETBULK:
    case MODE_SET_RESERVE1:
    case MODE_SET_RESERVE2:
    case MODE_SET_ACTION:
    case MODE_SET_COMMIT:
    case MODE_SET_FREE:
    case MODE_SET_UNDO:
        snmp_log(LOG_WARNING, "mibII/icmp: Unsupported mode (%d)\n",
                               reqinfo->mode);
        break;
    default:
        snmp_log(LOG_WARNING, "mibII/icmp: Unrecognised mode (%d)\n",
                               reqinfo->mode);
        break;
    }

    return SNMP_ERR_NOERROR;
}
示例#2
0
int
netsnmp_is_cache_valid(netsnmp_agent_request_info * reqinfo)
{
    return netsnmp_cache_is_valid(reqinfo, CACHE_NAME);
}
示例#3
0
/** Implements the cache handler */
int
netsnmp_cache_helper_handler(netsnmp_mib_handler * handler,
                             netsnmp_handler_registration * reginfo,
                             netsnmp_agent_request_info * reqinfo,
                             netsnmp_request_info * requests)
{
    char addrstr[32];

    netsnmp_cache  *cache = NULL;
    netsnmp_handler_args cache_hint;

    DEBUGMSGTL(("helper:cache_handler", "Got request (%d) for %s: ",
                reqinfo->mode, reginfo->handlerName));
    DEBUGMSGOID(("helper:cache_handler", reginfo->rootoid,
                 reginfo->rootoid_len));
    DEBUGMSG(("helper:cache_handler", "\n"));

    netsnmp_assert(handler->flags & MIB_HANDLER_AUTO_NEXT);

    cache = (netsnmp_cache *) handler->myvoid;
    if (netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID,
                               NETSNMP_DS_AGENT_NO_CACHING) ||
        !cache || !cache->enabled || !cache->load_cache) {
        DEBUGMSGT(("helper:cache_handler", " caching disabled or "
                   "cache not found, disabled or had no load method\n"));
        return SNMP_ERR_NOERROR;
    }
    snprintf(addrstr,sizeof(addrstr), "%ld", (long int)cache);
    DEBUGMSGTL(("helper:cache_handler", "using cache %s: ", addrstr));
    DEBUGMSGOID(("helper:cache_handler", cache->rootoid, cache->rootoid_len));
    DEBUGMSG(("helper:cache_handler", "\n"));

    /*
     * Make the handler-chain parameters available to
     * the cache_load hook routine.
     */
    cache_hint.handler = handler;
    cache_hint.reginfo = reginfo;
    cache_hint.reqinfo = reqinfo;
    cache_hint.requests = requests;
    cache->cache_hint = &cache_hint;

    switch (reqinfo->mode) {

    case MODE_GET:
    case MODE_GETNEXT:
    case MODE_GETBULK:
#ifndef NETSNMP_NO_WRITE_SUPPORT
    case MODE_SET_RESERVE1:
#endif /* !NETSNMP_NO_WRITE_SUPPORT */

        /*
         * only touch cache once per pdu request, to prevent a cache
         * reload while a module is using cached data.
         *
         * XXX: this won't catch a request reloading the cache while
         * a previous (delegated) request is still using the cache.
         * maybe use a reference counter?
         */
        if (netsnmp_cache_is_valid(reqinfo, addrstr))
            break;

        /*
         * call the load hook, and update the cache timestamp.
         * If it's not already there, add to reqinfo
         */
        netsnmp_cache_check_and_reload(cache);
        netsnmp_cache_reqinfo_insert(cache, reqinfo, addrstr);
        /** next handler called automatically - 'AUTO_NEXT' */
        break;

#ifndef NETSNMP_NO_WRITE_SUPPORT
    case MODE_SET_RESERVE2:
    case MODE_SET_FREE:
    case MODE_SET_ACTION:
    case MODE_SET_UNDO:
        netsnmp_assert(netsnmp_cache_is_valid(reqinfo, addrstr));
        /** next handler called automatically - 'AUTO_NEXT' */
        break;

        /*
         * A (successful) SET request wouldn't typically trigger a reload of
         *  the cache, but might well invalidate the current contents.
         * Only do this on the last pass through.
         */
    case MODE_SET_COMMIT:
        if (cache->valid && 
            ! (cache->flags & NETSNMP_CACHE_DONT_INVALIDATE_ON_SET) ) {
            cache->free_cache(cache, cache->magic);
            cache->valid = 0;
        }
        /** next handler called automatically - 'AUTO_NEXT' */
        break;
#endif /* NETSNMP_NO_WRITE_SUPPORT */

    default:
        snmp_log(LOG_WARNING, "cache_handler: Unrecognised mode (%d)\n",
                 reqinfo->mode);
        netsnmp_request_set_error_all(requests, SNMP_ERR_GENERR);
        return SNMP_ERR_GENERR;
    }
    if (cache->flags & NETSNMP_CACHE_RESET_TIMER_ON_USE)
        netsnmp_set_monotonic_marker(&cache->timestampM);
    return SNMP_ERR_NOERROR;
}
示例#4
0
/**
 * Handle request for sctpStats.
 * Handles only one request at a time, serialize_handler is automatically added by netsnmp_register_scalar_group.
 */
int
sctp_stats_handler(netsnmp_mib_handler *handler,
                   netsnmp_handler_registration *reginfo,
                   netsnmp_agent_request_info *reqinfo,
                   netsnmp_request_info *request)
{
    netsnmp_variable_list *requestvb;
    int             subid;
    int             ret;

    DEBUGMSGTL(("sctp:scalars:stats", "Handler - mode %s\n",
                se_find_label_in_slist("agent_mode", reqinfo->mode)));
    if (reqinfo->mode != MODE_GET) {
        snmp_log(LOG_WARNING, "sctp/stats: Unsupported mode (%d)\n",
                 reqinfo->mode);
        return SNMP_ERR_NOERROR;
    }

    requestvb = request->requestvb;
    subid = requestvb->name[OID_LENGTH(sctp_stats_oid)];
    DEBUGMSGTL(("sctp:scalars:stats", "oid: "));
    DEBUGMSGOID(("sctp:scalars:stats", requestvb->name,
                 requestvb->name_length));
    DEBUGMSG(("sctp:scalars:stats", "\n"));


    /*
     * Load the cache if it was not loaded before 
     */
    if (!netsnmp_cache_is_valid(reqinfo, reginfo->handlerName)) {
        DEBUGMSGTL(("sctp:scalars:stats", "cache is not valid!\n"));
        ret = netsnmp_access_sctp_stats_load(NULL, NULL);
        if (ret < 0) {
            DEBUGMSGTL(("sctp:scalars:stats",
                        "could not load sctp stats!\n"));
            netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT);
            return SNMP_ERR_NOERROR;
        }
    }

    switch (subid) {

    case SCTP_CURRESTAB:
        snmp_set_var_typed_value(request->requestvb, ASN_GAUGE,
                                 (u_char *) & sctp_stats.curr_estab,
                                 sizeof(sctp_stats.curr_estab));
        break;

    case SCTP_ACTIVEESTABS:
        snmp_set_var_typed_value(request->requestvb, ASN_COUNTER,
                                 (u_char *) & sctp_stats.active_estabs,
                                 sizeof(sctp_stats.active_estabs));
        break;

    case SCTP_PASSIVEESTABS:
        snmp_set_var_typed_value(request->requestvb, ASN_COUNTER,
                                 (u_char *) & sctp_stats.passive_estabs,
                                 sizeof(sctp_stats.passive_estabs));
        break;

    case SCTP_ABORTEDS:
        snmp_set_var_typed_value(request->requestvb, ASN_COUNTER,
                                 (u_char *) & sctp_stats.aborteds,
                                 sizeof(sctp_stats.aborteds));
        break;

    case SCTP_SHUTDOWNS:
        snmp_set_var_typed_value(request->requestvb, ASN_COUNTER,
                                 (u_char *) & sctp_stats.shutdowns,
                                 sizeof(sctp_stats.shutdowns));
        break;

    case SCTP_OUTOFBLUES:
        snmp_set_var_typed_value(request->requestvb, ASN_COUNTER,
                                 (u_char *) & sctp_stats.out_of_blues,
                                 sizeof(sctp_stats.out_of_blues));
        break;

    case SCTP_CHECKSUMERRORS:
        snmp_set_var_typed_value(request->requestvb, ASN_COUNTER,
                                 (u_char *) & sctp_stats.checksum_errors,
                                 sizeof(sctp_stats.checksum_errors));
        break;

    case SCTP_OUTCTRLCHUNKS:
        snmp_set_var_typed_value(request->requestvb, ASN_COUNTER64,
                                 (u_char *) & sctp_stats.out_ctrl_chunks,
                                 sizeof(sctp_stats.out_ctrl_chunks));
        break;

    case SCTP_OUTORDERCHUNKS:
        snmp_set_var_typed_value(request->requestvb, ASN_COUNTER64,
                                 (u_char *) & sctp_stats.out_order_chunks,
                                 sizeof(sctp_stats.out_order_chunks));
        break;

    case SCTP_OUTUNORDERCHUNKS:
        snmp_set_var_typed_value(request->requestvb, ASN_COUNTER64,
                                 (u_char *) &
                                 sctp_stats.out_unorder_chunks,
                                 sizeof(sctp_stats.out_unorder_chunks));
        break;

    case SCTP_INCTRLCHUNKS:
        snmp_set_var_typed_value(request->requestvb, ASN_COUNTER64,
                                 (u_char *) & sctp_stats.in_ctrl_chunks,
                                 sizeof(sctp_stats.in_ctrl_chunks));
        break;

    case SCTP_INORDERCHUNKS:
        snmp_set_var_typed_value(request->requestvb, ASN_COUNTER64,
                                 (u_char *) & sctp_stats.in_order_chunks,
                                 sizeof(sctp_stats.in_order_chunks));
        break;

    case SCTP_INUNORDERCHUNKS:
        snmp_set_var_typed_value(request->requestvb, ASN_COUNTER64,
                                 (u_char *) & sctp_stats.in_unorder_chunks,
                                 sizeof(sctp_stats.in_unorder_chunks));
        break;

    case SCTP_FRAGUSRMSGS:
        snmp_set_var_typed_value(request->requestvb, ASN_COUNTER64,
                                 (u_char *) & sctp_stats.frag_usr_msgs,
                                 sizeof(sctp_stats.frag_usr_msgs));
        break;

    case SCTP_REASMUSRMSGS:
        snmp_set_var_typed_value(request->requestvb, ASN_COUNTER64,
                                 (u_char *) & sctp_stats.reasm_usr_msgs,
                                 sizeof(sctp_stats.reasm_usr_msgs));
        break;

    case SCTP_OUTSCTPPACKS:
        snmp_set_var_typed_value(request->requestvb, ASN_COUNTER64,
                                 (u_char *) & sctp_stats.out_sctp_packs,
                                 sizeof(sctp_stats.out_sctp_packs));
        break;

    case SCTP_INSCTPPACKS:
        snmp_set_var_typed_value(request->requestvb, ASN_COUNTER64,
                                 (u_char *) & sctp_stats.in_sctp_packs,
                                 sizeof(sctp_stats.in_sctp_packs));
        break;

    case SCTP_DISCONTINUITYTIME:
        snmp_set_var_typed_value(request->requestvb, ASN_TIMETICKS,
                                 (u_char *) &
                                 sctp_stats.discontinuity_time,
                                 sizeof(sctp_stats.discontinuity_time));
        break;

    default:
        snmp_log(LOG_WARNING, "sctp/stats: Unsupported subid (%d)\n",
                 subid);
        break;
    }
    return SNMP_ERR_NOERROR;
}
示例#5
0
/**
 * Handle request for sctpParams.
 * Handles only one request at a time, serialize_handler is automatically added by netsnmp_register_scalar_group.
 */
int
sctp_params_handler(netsnmp_mib_handler *handler,
                    netsnmp_handler_registration *reginfo,
                    netsnmp_agent_request_info *reqinfo,
                    netsnmp_request_info *request)
{
    netsnmp_variable_list *requestvb;
    int             subid;
    int             ret;

    DEBUGMSGTL(("sctp:scalars:params", "Handler - mode %s\n",
                se_find_label_in_slist("agent_mode", reqinfo->mode)));
    if (reqinfo->mode != MODE_GET) {
        snmp_log(LOG_WARNING, "sctp/params: Unsupported mode (%d)\n",
                 reqinfo->mode);
        return SNMP_ERR_NOERROR;
    }

    requestvb = request->requestvb;
    subid = requestvb->name[OID_LENGTH(sctp_stats_oid)];
    DEBUGMSGTL(("sctp:scalars:params", "oid: "));
    DEBUGMSGOID(("sctp:scalars:params", requestvb->name,
                 requestvb->name_length));
    DEBUGMSG(("sctp:scalars:params", "\n"));

    /*
     * Load the cache if it was not loaded before 
     */
    if (!netsnmp_cache_is_valid(reqinfo, reginfo->handlerName)) {
        DEBUGMSGTL(("sctp:scalars:params", "cache is not valid!\n"));
        ret = netsnmp_access_sctp_params_load(NULL, NULL);
        if (ret < 0) {
            DEBUGMSGTL(("sctp:scalars:params",
                        "could not load sctp stats!\n"));
            netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT);
            return SNMP_ERR_NOERROR;
        }
    }

    switch (subid) {

    case SCTP_RTOALGORITHM:
        snmp_set_var_typed_value(request->requestvb, ASN_INTEGER,
                                 (u_char *) & sctp_params.rto_algorithm,
                                 sizeof(sctp_params.rto_algorithm));
        break;

    case SCTP_RTOMIN:
        snmp_set_var_typed_value(request->requestvb, ASN_UNSIGNED,
                                 (u_char *) & sctp_params.rto_min,
                                 sizeof(sctp_params.rto_min));
        break;

    case SCTP_RTOMAX:
        snmp_set_var_typed_value(request->requestvb, ASN_UNSIGNED,
                                 (u_char *) & sctp_params.rto_max,
                                 sizeof(sctp_params.rto_max));
        break;

    case SCTP_RTOINITIAL:
        snmp_set_var_typed_value(request->requestvb, ASN_UNSIGNED,
                                 (u_char *) & sctp_params.rto_initial,
                                 sizeof(sctp_params.rto_initial));
        break;

    case SCTP_MAXASSOCS:
        snmp_set_var_typed_value(request->requestvb, ASN_INTEGER,
                                 (u_char *) & sctp_params.max_assocs,
                                 sizeof(sctp_params.max_assocs));
        break;

    case SCTP_VALCOOKIELIFE:
        snmp_set_var_typed_value(request->requestvb, ASN_UNSIGNED,
                                 (u_char *) & sctp_params.val_cookie_life,
                                 sizeof(sctp_params.val_cookie_life));
        break;

    case SCTP_MAXINITRETR:
        snmp_set_var_typed_value(request->requestvb, ASN_UNSIGNED,
                                 (u_char *) & sctp_params.max_init_retr,
                                 sizeof(sctp_params.max_init_retr));
        break;

    default:
        snmp_log(LOG_WARNING, "sctp/params: Unsupported subid (%d)\n",
                 subid);
        break;
    }
    return SNMP_ERR_NOERROR;
}
示例#6
0
文件: udp.c 项目: DYFeng/infinidb
int
udp_handler(netsnmp_mib_handler          *handler,
            netsnmp_handler_registration *reginfo,
            netsnmp_agent_request_info   *reqinfo,
            netsnmp_request_info         *requests)
{
    netsnmp_request_info  *request;
    netsnmp_variable_list *requestvb;
    long     ret_value = -1;
    oid      subid;
    int      type = ASN_COUNTER;

    /*
     * The cached data should already have been loaded by the
     *    cache handler, higher up the handler chain.
     * But just to be safe, check this and load it manually if necessary
     */
#ifndef hpux11
    if (!netsnmp_cache_is_valid(reqinfo, reginfo->handlerName)) {
        netsnmp_assert("cache" == "valid"); /* always false */
        udp_load( NULL, NULL );	/* XXX - check for failure */
    }
#endif


    /*
     * 
     *
     */
    DEBUGMSGTL(("mibII/udpScalar", "Handler - mode %s\n",
                    se_find_label_in_slist("agent_mode", reqinfo->mode)));
    switch (reqinfo->mode) {
    case MODE_GET:
        for (request=requests; request; request=request->next) {
            requestvb = request->requestvb;
            subid = requestvb->name[OID_LENGTH(udp_oid)];  /* XXX */
            DEBUGMSGTL(( "mibII/udpScalar", "oid: "));
            DEBUGMSGOID(("mibII/udpScalar", requestvb->name,
                                            requestvb->name_length));
            DEBUGMSG((   "mibII/udpScalar", "\n"));

            switch (subid) {
#ifdef USES_SNMP_DESIGNED_UDPSTAT
    case UDPINDATAGRAMS:
        ret_value = udpstat.udpInDatagrams;
        break;
    case UDPNOPORTS:
#ifdef solaris2
        ret_value = udp_load(NULL, (void *)UDPNOPORTS);
	if (ret_value == -1) {
            netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT);
            continue;
	}
        break;
#else
        ret_value = udpstat.udpNoPorts;
        break;
#endif
    case UDPOUTDATAGRAMS:
        ret_value = udpstat.udpOutDatagrams;
        break;
    case UDPINERRORS:
        ret_value = udpstat.udpInErrors;
        break;
#else			/* USES_SNMP_DESIGNED_UDPSTAT */

#ifdef USES_TRADITIONAL_UDPSTAT
#ifdef HAVE_SYS_TCPIPSTATS_H
    /*
     * This actually reads statistics for *all* the groups together,
     * so we need to isolate the UDP-specific bits.  
     */
#define udpstat          udpstat.udpstat
#endif
    case UDPINDATAGRAMS:
#if STRUCT_UDPSTAT_HAS_UDPS_IPACKETS
        ret_value = udpstat.udps_ipackets;
        break;
#else
        netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT);
        continue;
#endif

    case UDPNOPORTS:
#if STRUCT_UDPSTAT_HAS_UDPS_NOPORT
        ret_value = udpstat.udps_noport;
        break;
#else
        netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT);
        continue;
#endif

    case UDPOUTDATAGRAMS:
#if STRUCT_UDPSTAT_HAS_UDPS_OPACKETS
        ret_value = udpstat.udps_opackets;
        break;
#else
        netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT);
        continue;
#endif

    case UDPINERRORS:
        ret_value = udpstat.udps_hdrops + udpstat.udps_badsum +
#ifdef STRUCT_UDPSTAT_HAS_UDPS_DISCARD
            udpstat.udps_discard +
#endif
#ifdef STRUCT_UDPSTAT_HAS_UDPS_FULLSOCK
            udpstat.udps_fullsock +
#endif
            udpstat.udps_badlen;
        break;
#ifdef HAVE_SYS_TCPIPSTATS_H
#undef udpstat
#endif
#else			/* USES_TRADITIONAL_UDPSTAT */

#ifdef hpux11
    case UDPINDATAGRAMS:
    case UDPNOPORTS:
    case UDPOUTDATAGRAMS:
    case UDPINERRORS:
	/*
	 * This is a bit of a hack, to shoehorn the HP-UX 11
	 * single-object retrieval approach into the caching
	 * architecture.
	 */
	if (udp_load(NULL, (void*)subid) == -1 ) {
            netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT);
            continue;
	}
        ret_value = udpstat;
        break;
#else			/* hpux11 */
#ifdef WIN32
    case UDPINDATAGRAMS:
        ret_value = udpstat.dwInDatagrams;
        break;
    case UDPNOPORTS:
        ret_value = udpstat.dwNoPorts;
        break;
    case UDPOUTDATAGRAMS:
        ret_value = udpstat.dwOutDatagrams;
        break;
    case UDPINERRORS:
        ret_value = udpstat.dwInErrors;
        break;
#endif			/* WIN32 */
#endif			/* hpux11 */
#endif			/* USES_TRADITIONAL_UDPSTAT */
#endif			/* USES_SNMP_DESIGNED_UDPSTAT */

	    }
	    snmp_set_var_typed_value(request->requestvb, (u_char)type,
			             (u_char *)&ret_value, sizeof(ret_value));
	}
        break;

    case MODE_GETNEXT:
    case MODE_GETBULK:
    case MODE_SET_RESERVE1:
    case MODE_SET_RESERVE2:
    case MODE_SET_ACTION:
    case MODE_SET_COMMIT:
    case MODE_SET_FREE:
    case MODE_SET_UNDO:
        snmp_log(LOG_WARNING, "mibII/udp: Unsupported mode (%d)\n",
                               reqinfo->mode);
        break;
    default:
        snmp_log(LOG_WARNING, "mibII/udp: Unrecognised mode (%d)\n",
                               reqinfo->mode);
        break;
    }

    return SNMP_ERR_NOERROR;
}
示例#7
0
int
tcp_handler(netsnmp_mib_handler          *handler,
            netsnmp_handler_registration *reginfo,
            netsnmp_agent_request_info   *reqinfo,
            netsnmp_request_info         *requests)
{
    netsnmp_request_info  *request;
    netsnmp_variable_list *requestvb;
    long     ret_value = -1;
    oid      subid;
    int      type = ASN_COUNTER;

    /*
     * The cached data should already have been loaded by the
     *    cache handler, higher up the handler chain.
     * But just to be safe, check this and load it manually if necessary
     */
#if defined(_USE_FIRST_PROTOCOL)
    tcp_load(NULL, NULL);
#elif !defined(hpux11)
    if (!netsnmp_cache_is_valid(reqinfo, reginfo->handlerName)) {
        netsnmp_assert(!"cache == valid"); /* always false */
        tcp_load( NULL, NULL );	/* XXX - check for failure */
    }
#endif


    /*
     * 
     *
     */
    DEBUGMSGTL(("mibII/tcpScalar", "Handler - mode %s\n",
                    se_find_label_in_slist("agent_mode", reqinfo->mode)));
    switch (reqinfo->mode) {
    case MODE_GET:
        for (request=requests; request; request=request->next) {
            requestvb = request->requestvb;
            subid = requestvb->name[OID_LENGTH(tcp_oid)];  /* XXX */

            DEBUGMSGTL(( "mibII/tcpScalar", "oid: "));
            DEBUGMSGOID(("mibII/tcpScalar", requestvb->name,
                                            requestvb->name_length));
            DEBUGMSG((   "mibII/tcpScalar", "\n"));
            switch (subid) {
#ifdef USES_SNMP_DESIGNED_TCPSTAT
    case TCPRTOALGORITHM:
        ret_value = tcpstat.tcpRtoAlgorithm;
        type = ASN_INTEGER;
        break;
    case TCPRTOMIN:
        ret_value = tcpstat.tcpRtoMin;
        type = ASN_INTEGER;
        break;
    case TCPRTOMAX:
        ret_value = tcpstat.tcpRtoMax;
        type = ASN_INTEGER;
        break;
    case TCPMAXCONN:
        ret_value = tcpstat.tcpMaxConn;
        type = ASN_INTEGER;
        break;
    case TCPACTIVEOPENS:
        ret_value = tcpstat.tcpActiveOpens;
        break;
    case TCPPASSIVEOPENS:
        ret_value = tcpstat.tcpPassiveOpens;
        break;
    case TCPATTEMPTFAILS:
        ret_value = tcpstat.tcpAttemptFails;
        break;
    case TCPESTABRESETS:
        ret_value = tcpstat.tcpEstabResets;
        break;
    case TCPCURRESTAB:
        ret_value = tcpstat.tcpCurrEstab;
        type = ASN_GAUGE;
        break;
    case TCPINSEGS:
        ret_value = tcpstat.tcpInSegs;
        break;
    case TCPOUTSEGS:
        ret_value = tcpstat.tcpOutSegs;
        break;
    case TCPRETRANSSEGS:
        ret_value = tcpstat.tcpRetransSegs;
        break;
    case TCPINERRS:
#ifdef solaris2
        ret_value = tcp_load(NULL, (void *)TCPINERRS);
	if (ret_value == -1) {
            netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT);
            continue;
	}
        break;
#elif defined(linux)
        if (tcpstat.tcpInErrsValid) {
            ret_value = tcpstat.tcpInErrs;
            break;
	} else {
            netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT);
            continue;
	}
#else			/* linux */
        netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT);
        continue;
#endif			/* solaris2 */
    case TCPOUTRSTS:
#ifdef linux
        if (tcpstat.tcpOutRstsValid) {
            ret_value = tcpstat.tcpOutRsts;
            break;
	}
#endif			/* linux */
        netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT);
        continue;
#elif defined(USES_TRADITIONAL_TCPSTAT) && !defined(_USE_FIRST_PROTOCOL)
#ifdef HAVE_SYS_TCPIPSTATS_H
    /*
     * This actually reads statistics for *all* the groups together,
     * so we need to isolate the TCP-specific bits.  
     */
#define tcpstat          tcpstat.tcpstat
#endif
    case TCPRTOALGORITHM:      /* Assume Van Jacobsen's algorithm */
        ret_value = 4;
        type = ASN_INTEGER;
        break;
    case TCPRTOMIN:
#ifdef TCPTV_NEEDS_HZ
        ret_value = TCPTV_MIN;
#else
        ret_value = TCPTV_MIN / PR_SLOWHZ * 1000;
#endif
        type = ASN_INTEGER;
        break;
    case TCPRTOMAX:
#ifdef TCPTV_NEEDS_HZ
        ret_value = TCPTV_REXMTMAX;
#else
        ret_value = TCPTV_REXMTMAX / PR_SLOWHZ * 1000;
#endif
        type = ASN_INTEGER;
        break;
    case TCPMAXCONN:
        ret_value = -1;		/* Dynamic maximum */
        type = ASN_INTEGER;
        break;
    case TCPACTIVEOPENS:
        ret_value = tcpstat.tcps_connattempt;
        break;
    case TCPPASSIVEOPENS:
        ret_value = tcpstat.tcps_accepts;
        break;
        /*
         * NB:  tcps_drops is actually the sum of the two MIB
         *      counters tcpAttemptFails and tcpEstabResets.
         */
    case TCPATTEMPTFAILS:
        ret_value = tcpstat.tcps_conndrops;
        break;
    case TCPESTABRESETS:
        ret_value = tcpstat.tcps_drops;
        break;
    case TCPCURRESTAB:
#ifdef USING_MIBII_TCPTABLE_MODULE
        ret_value = TCP_Count_Connections();
#else
        ret_value = 0;
#endif
        type = ASN_GAUGE;
        break;
    case TCPINSEGS:
        ret_value = tcpstat.tcps_rcvtotal;
        break;
    case TCPOUTSEGS:
        /*
         * RFC 1213 defines this as the number of segments sent
         * "excluding those containing only retransmitted octets"
         */
        ret_value = tcpstat.tcps_sndtotal - tcpstat.tcps_sndrexmitpack;
        break;
    case TCPRETRANSSEGS:
        ret_value = tcpstat.tcps_sndrexmitpack;
        break;
    case TCPINERRS:
        ret_value = tcpstat.tcps_rcvbadsum + tcpstat.tcps_rcvbadoff
#ifdef HAVE_STRUCT_TCPSTAT_TCPS_RCVMEMDROP
            + tcpstat.tcps_rcvmemdrop
#endif
            + tcpstat.tcps_rcvshort;
        break;
    case TCPOUTRSTS:
        ret_value = tcpstat.tcps_sndctrl - tcpstat.tcps_closed;
        break;
#ifdef HAVE_SYS_TCPIPSTATS_H
#undef tcpstat
#endif
#elif defined(hpux11)
    case TCPRTOALGORITHM:
    case TCPRTOMIN:
    case TCPRTOMAX:
    case TCPMAXCONN:
    case TCPCURRESTAB:
        if (subid == TCPCURRESTAB)
           type = ASN_GAUGE;
	else
           type = ASN_INTEGER;
    case TCPACTIVEOPENS:
    case TCPPASSIVEOPENS:
    case TCPATTEMPTFAILS:
    case TCPESTABRESETS:
    case TCPINSEGS:
    case TCPOUTSEGS:
    case TCPRETRANSSEGS:
    case TCPINERRS:
    case TCPOUTRSTS:
	/*
	 * This is a bit of a hack, to shoehorn the HP-UX 11
	 * single-object retrieval approach into the caching
	 * architecture.
	 */
	if (tcp_load(NULL, (void*)subid) == -1 ) {
            netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT);
            continue;
	}
        ret_value = tcpstat;
        break;
#elif defined (WIN32) || defined (cygwin)
    case TCPRTOALGORITHM:
        ret_value = tcpstat.dwRtoAlgorithm;
        type = ASN_INTEGER;
        break;
    case TCPRTOMIN:
        ret_value = tcpstat.dwRtoMin;
        type = ASN_INTEGER;
        break;
    case TCPRTOMAX:
        ret_value = tcpstat.dwRtoMax;
        type = ASN_INTEGER;
        break;
    case TCPMAXCONN:
        ret_value = tcpstat.dwMaxConn;
        type = ASN_INTEGER;
        break;
    case TCPACTIVEOPENS:
        ret_value = tcpstat.dwActiveOpens;
        break;
    case TCPPASSIVEOPENS:
        ret_value = tcpstat.dwPassiveOpens;
        break;
    case TCPATTEMPTFAILS:
        ret_value = tcpstat.dwAttemptFails;
        break;
    case TCPESTABRESETS:
        ret_value = tcpstat.dwEstabResets;
        break;
    case TCPCURRESTAB:
        ret_value = tcpstat.dwCurrEstab;
        type = ASN_GAUGE;
        break;
    case TCPINSEGS:
        ret_value = tcpstat.dwInSegs;
        break;
    case TCPOUTSEGS:
        ret_value = tcpstat.dwOutSegs;
        break;
    case TCPRETRANSSEGS:
        ret_value = tcpstat.dwRetransSegs;
        break;
    case TCPINERRS:
        ret_value = tcpstat.dwInErrs;
        break;
    case TCPOUTRSTS:
        ret_value = tcpstat.dwOutRsts;
        break;
#elif defined(_USE_FIRST_PROTOCOL)
    case TCPRTOALGORITHM:
        ret_value = 4;
        type = ASN_INTEGER;
        break;
    case TCPRTOMIN:
        ret_value = 0;
        type = ASN_INTEGER;
        break;
    case TCPRTOMAX:
        ret_value = 0;
        type = ASN_INTEGER;
        break;
    case TCPMAXCONN:
        ret_value = -1;
        type = ASN_INTEGER;
        break;
    case TCPACTIVEOPENS:
        ret_value = ps_proto.u.tcp.initiated;
        break;
    case TCPPASSIVEOPENS:
        ret_value = ps_proto.u.tcp.accepted;
        break;
    case TCPATTEMPTFAILS:
        ret_value = ps_proto.u.tcp.dropped;
        break;
    case TCPESTABRESETS:
        ret_value = ps_proto.u.tcp.dropped;
        break;
    case TCPCURRESTAB:
        /* this value is currently missing */
        ret_value = 0; /*ps_proto.u.tcp.established;*/
        type = ASN_GAUGE;
        break;
    case TCPINSEGS:
        ret_value = ps_proto.u.tcp.ipackets;
        break;
    case TCPOUTSEGS:
        ret_value = ps_proto.u.tcp.opackets;
        break;
    case TCPRETRANSSEGS:
        ret_value = 0;
        break;
    case TCPINERRS:
        ret_value = ps_proto.u.tcp.ierrors;
        break;
    case TCPOUTRSTS:
        ret_value = 0;
        break;
#endif			/* USES_SNMP_DESIGNED_TCPSTAT */

    case TCPCONNTABLE:
        /*
	 * This is not actually a valid scalar object.
	 * The table registration should take precedence,
	 *   so skip this subtree, regardless of architecture.
	 */
        netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT);
        continue;

	    }
	    snmp_set_var_typed_value(request->requestvb, (u_char)type,
			             (u_char *)&ret_value, sizeof(ret_value));
	}
        break;

    case MODE_GETNEXT:
    case MODE_GETBULK:
    case MODE_SET_RESERVE1:
    case MODE_SET_RESERVE2:
    case MODE_SET_ACTION:
    case MODE_SET_COMMIT:
    case MODE_SET_FREE:
    case MODE_SET_UNDO:
        snmp_log(LOG_WARNING, "mibII/tcp: Unsupported mode (%d)\n",
                               reqinfo->mode);
        break;
    default:
        snmp_log(LOG_WARNING, "mibII/tcp: Unrecognised mode (%d)\n",
                               reqinfo->mode);
        break;
    }

    return SNMP_ERR_NOERROR;
}
示例#8
0
文件: icmp.c 项目: millken/zhuxianB30
int
icmp_stats_table_handler(netsnmp_mib_handler  *handler,
                 netsnmp_handler_registration *reginfo,
                 netsnmp_agent_request_info   *reqinfo,
                 netsnmp_request_info         *requests)
{
	netsnmp_request_info  *request;
	netsnmp_variable_list *requestvb;
	netsnmp_table_request_info *table_info;
	struct icmp_stats_table_entry   *entry;
	oid      subid;
#ifndef hpux11
	if (!netsnmp_cache_is_valid(reqinfo, reginfo->handlerName)) {
		netsnmp_assert(!"cache == valid"); /* always false */
		icmp_load( NULL, NULL );	/* XXX - check for failure */
	}
#endif

	switch (reqinfo->mode) {
		case MODE_GET:
			for (request=requests; request; request=request->next) {
				requestvb = request->requestvb;
				entry = (struct icmp_stats_table_entry *)netsnmp_extract_iterator_context(request);
				if (!entry)
					continue;
				table_info = netsnmp_extract_table_info(request);
				subid      = table_info->colnum;

				switch (subid) {
					case ICMP_STAT_INMSG:
						snmp_set_var_typed_value(requestvb, ASN_COUNTER,
							(u_char *)&entry->icmpStatsInMsgs, sizeof(uint32_t));
						break;
					case ICMP_STAT_INERR:
						snmp_set_var_typed_value(requestvb, ASN_COUNTER,
							(u_char *)&entry->icmpStatsInErrors, sizeof(uint32_t));
						break;
					case ICMP_STAT_OUTMSG:
						snmp_set_var_typed_value(requestvb, ASN_COUNTER,
							(u_char *)&entry->icmpStatsOutMsgs, sizeof(uint32_t));
						break;
					case ICMP_STAT_OUTERR:
						snmp_set_var_typed_value(requestvb, ASN_COUNTER,
							(u_char *)&entry->icmpStatsOutErrors, sizeof(uint32_t));
						break;
					default:
						snmp_log(LOG_WARNING, "mibII/icmpStatsTable: Unrecognised column (%d)\n",(int)subid);
				}
			}
			break;
		case MODE_GETNEXT:
		case MODE_GETBULK:
		case MODE_SET_RESERVE1:
		case MODE_SET_RESERVE2:
		case MODE_SET_ACTION:
		case MODE_SET_COMMIT:
		case MODE_SET_FREE:
		case MODE_SET_UNDO:
			snmp_log(LOG_WARNING, "mibII/icmpStatsTable: Unsupported mode (%d)\n",
				reqinfo->mode);
			break;
		default:
			snmp_log(LOG_WARNING, "mibII/icmpStatsTable: Unrecognised mode (%d)\n",
				reqinfo->mode);
			break;

	}

	return SNMP_ERR_NOERROR;
}