On 07/10/2013 10:44 AM, zhuyj wrote: > On 07/10/2013 10:34 AM, zhuyj wrote: >> Hi, >> >> Attempting to create a new entry with a zero index fails silently. >> >> root@localhost:/root> snmpset -v 2c -c public 192.168.2.15 >> .1.3.6.1.6.3.12.1.2.1.9.0.25 i 5 >> SNMP-TARGET-MIB::snmpTargetAddrRowStatus.'..' = INTEGER: >> createAndWait(5) >> root@localhost:/root> snmpget -v 2c -c NETMAN 192.168.2.15 >> .1.3.6.1.6.3.12.1.2.1.9.0.25 i 5 >> snmp_build: unknown failuresnmpget: Error building ASN.1 >> representation (Can't build OID for variable) >> >> Notice that there is no error when setting, only when trying to get. >> >> The version: >> >> usr@ubuntu1004:~$ snmpset --version >> NET-SNMP version: 5.7.2 >> usr@ubuntu1004:~$ snmpget --version >> NET-SNMP version: 5.7.2 >> usr@ubuntu1004:~$ snmpd --version >> >> NET-SNMP version: 5.7.2 >> Web: http://www.net-snmp.org/ >> Email: net-snmp-coders@lists.sourceforge.net >> >> I want to support 0.25 in snmpAdminString. What should I pay >> attention to? >> >> Best regards. >> >> zhuyj >> > agent/mibgroup/target/snmpTargetAddrEntry.c: snmpTargetAddr_createNewRow > > ... > for (i = 0; i < (int) newNameLen; i++) { > temp_struct->name[i] = (char) name[i + snmpTargetAddrOIDLen]; > } > > temp_struct->name[newNameLen] = '\0'; > temp_struct->rowStatus = SNMP_ROW_NOTREADY; > ... > After name is set 0.25, 0 is set as terminated. So there are two 0 > (NULL) in a string. > So 0.25 can not be found. > I want to fix this. But how should I do? > If I fix this, will this fix take effect other mib files? > I search snmpTarget. And I found that SNMP-COMMUNITY-MIB.txt,SNMP- > NOTIFICATION-MIB.txt,DISMAN-EVENT- MIB.txt,SNMP-PROXY-MIB.txt depend > on it. > Anyone can discuss this with me? > > Zhuyj > > I want to modify the temp_struct->name to 32, then memset(temp_struct->name, -1 ,32 ); when this name is set, it will not end with 0 (NUL). when snmpget or snmpwalk is executed, it will parse this 32 bytes string. When -1 is confronted, it will end. the string before -1 is returned.
Can the above method work? Zhu Yanjun ------------------------------------------------------------------------------ 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-coders mailing list Net-snmp-coders@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/net-snmp-coders