Exemple #1
0
int
icmp_load(netsnmp_cache *cache, void *vmagic)
{
    long            ret_value = -1;

    ret_value = linux_read_icmp_stat(&icmpstat);

    if ( ret_value < 0 ) {
        DEBUGMSGTL(("mibII/icmp", "Failed to load ICMP Group (linux)\n"));
    } else {
        DEBUGMSGTL(("mibII/icmp", "Loaded ICMP Group (linux)\n"));
    }
    return ret_value;
}
Exemple #2
0
int
icmp_stats_load(netsnmp_cache *cache, void *vmagic)
{

	/*
         * note don't bother using the passed in cache
	 * and vmagic pointers.  They are useless as they
	 * currently point to the icmp system stats cache
	 * since I see little point in registering another
	 * cache for this table.  Its not really needed
	 */

	int i;
	struct icmp_mib v4icmp;
	struct icmp6_mib v6icmp;
	for(i=0;i<2;i++) {
		switch(i) {
			case 0:
				linux_read_icmp_stat(&v4icmp);
				icmp_stats_table[i].icmpStatsInMsgs = v4icmp.icmpInMsgs;
				icmp_stats_table[i].icmpStatsInErrors = v4icmp.icmpInErrors;
				icmp_stats_table[i].icmpStatsOutMsgs = v4icmp.icmpOutMsgs;
				icmp_stats_table[i].icmpStatsOutErrors = v4icmp.icmpOutErrors;
				break;
			default:
				memset(&icmp_stats_table[i],0,
					sizeof(struct icmp_stats_table_entry));
				linux_read_icmp6_stat(&v6icmp);
				icmp_stats_table[i].icmpStatsInMsgs = v6icmp.icmp6InMsgs;
				icmp_stats_table[i].icmpStatsInErrors = v6icmp.icmp6InErrors;
				icmp_stats_table[i].icmpStatsOutMsgs = v6icmp.icmp6OutMsgs;
				icmp_stats_table[i].icmpStatsOutErrors = v6icmp.icmp6OutDestUnreachs +
					v6icmp.icmp6OutPktTooBigs +  v6icmp.icmp6OutTimeExcds +
					v6icmp.icmp6OutParmProblems;
				break;
		}
		icmp_stats_table[i].ipVer=i+1;
	}

	return 0;
}