ttg icon indicating copy to clipboard operation
ttg copied to clipboard

Improve handling "Error in packet Reason: (noSuchName)" situation

Open lazna opened this issue 8 years ago • 5 comments

Rare case: Two network devices have (accidentaly) same IP addres and SNMP community, one support 64bit counters but second one dont.

Reading packets from 64bit conuter aware device, but (probably) ARP table record expires and device supported only 32bit counters is queried with -x parameter and get error. SNMPGET display "Error in packet Reason: (noSuchName) There is no such variable name in this MIB. Failed object: .1.3.6.1.2.1.31.1.1.1.10.2" in such situation, but TTG computate with 0 in this case which usually give non-sence results.

Shouldnt be better to terminate TTG with corresponding error message and exitcode?

lazna avatar Dec 23 '17 10:12 lazna

Good question. Its probably a good idea to terminate. But what about other errors, should ttg terminate on timeout for instance?

tenox7 avatar Dec 25 '17 20:12 tenox7

What about this: Default behaviour is to terminate on any error, but offer another option "e.g. -t Dont terminate on error" with accorging behaviour. Print error text into output line is an option too, but what if people (sometimes me) expect strictly formated output for parsing? Or print error message into STDERR only?? I do not know what solution is better, but I am pretty sure ttg should not count with 0 if get error by SNMP, this is very confusing. Yesterday I sit on it few hours to discovery from where 0 value came from :-/

lazna avatar Dec 25 '17 20:12 lazna

Thanks for finding it out! A flag like -t sounds sounds like a simple thing to do. Let me look at it.

tenox7 avatar Dec 27 '17 07:12 tenox7

I looked at the code and the default behavior is to terminate on any SNMP error.

stat=snmp_synch_response(ses, pdu, &resp); if (stat != STAT_SUCCESS || resp->errstat != SNMP_ERR_NOERROR) perr(resp);

perr() is terminating with exit(1) unconditionally

Are you saying that ttg is printing Error in packet but then it continues and doesn't exit?

tenox7 avatar Dec 29 '17 07:12 tenox7

Yes, but I am not a C programmer so I cant comment your code.

lazna avatar Feb 07 '18 13:02 lazna