lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-users] SNMP


From: Trampas Stern
Subject: [lwip-users] SNMP
Date: Thu, 12 Mar 2020 16:51:56 -0400

I am using the latest lwip from git and noticed that my SNMP stopped working, below is by general configuration, does anyone see an issue? 

If I do SNMP walk it get the generic data but not the private mib...

/* sensortable .1.3.6.1.4.1.26381.1.2 */
static const struct snmp_table_node sensor_table = SNMP_TABLE_CREATE(
2, sensor_table_columns,
sensor_table_get_cell_instance, sensor_table_get_next_cell_instance,
sensor_table_get_value, snmp_set_test_ok, sensor_table_set_value);

/* sensorcount .1.3.6.1.4.1.26381.1.1 */
static const struct snmp_scalar_node sensor_count = SNMP_SCALAR_CREATE_NODE_READONLY(
1, SNMP_ASN1_TYPE_INTEGER, sensor_count_get_value);

static const struct snmp_node* const example_nodes[] = {
&sensor_count.node.node,
&sensor_table.node.node

};
static const struct snmp_tree_node example_node = SNMP_CREATE_TREE_NODE(1, example_nodes);

static const u32_t prvmib_base_oid[] = { 1,3,6,1,4,1,SNMP_LWIP_ENTERPRISE_OID,1 };
const struct snmp_mib mib_private = SNMP_MIB_CREATE(prvmib_base_oid, &example_node.node);

void lwip_privmib_init(void);

static const struct snmp_mib *mibs[] = {
&mib2,
&mib_private
#if LWIP_SNMP_V3
, &snmpframeworkmib
, &snmpusmmib
#endif
};

char syscontact_str[20] ="root";
u16_t syscontact_len = strlen(syscontact_str);
char syslocation_str[20]= "TRIMM EAGLE SNMP";
u16_t syslocation_len = strlen(syslocation_str);
u8_t * sysname_str = (u8_t*) "Xilinx";
u8_t sysname_len = sizeof("Xilinx");
u16_t bufsize = 64;
const u8_t * sysdescr = (u8_t*) "minimal_example";
const u16_t sysdescr_len = sizeof("minimal_example");




bool TaskSNMP::init(void)
{
s32_t __attribute__((unused)) req_nr ;
ip_addr_t addr;


//lwip_privmib_init();
snmp_mib2_set_syscontact((u8_t *)syscontact_str, &syscontact_len,sizeof(syscontact_str));
snmp_mib2_set_syslocation((u8_t *)syslocation_str, &syslocation_len,sizeof(syscontact_str));
snmp_mib2_set_sysdescr((const u8_t*)"View", NULL);
//snmp_set_auth_traps_enabled(1);

snmp_set_default_trap_version(Trimm::getInstance().getConfig().snmp_version);


snmp_set_mibs(mibs, LWIP_ARRAYSIZE(mibs));
snmp_init();

_state=0;
xxxx::getInstance().get_snmp_trap_ip_addr(_trap_ip);
addr.addr=IPADDR4_INIT_BYTES(_trap_ip[0],_trap_ip[1],_trap_ip[2],_trap_ip[3]);
snmp_trap_dst_ip_set(0, &addr);
snmp_trap_dst_enable(0, 1);

//  snmp_send_inform_generic(SNMP_GENTRAP_COLDSTART, NULL, &req_nr);
snmp_send_trap_generic(SNMP_GENTRAP_COLDSTART);

return true;
}

reply via email to

[Prev in Thread] Current Thread [Next in Thread]