Thank you for your quick response.
I have a NET-SNMP agent with a table registered at OID .1.3.6.1.3.1.1.1.1.5 and
the table entry defined at .1.3.6.1.3.1.1.1.1.5.1
When I perform an snmpgetnext .1.3.6.1.3.1.1.1.1.5.1 .1.3.6.1.3.1.1.1.1.5.2,
the first request to netsnmp_extract_table_info(request) goes well but the
second returns NULL and then the agent crashes at the if statement.
I have done the next modification to workaround this problem:
table_info = netsnmp_extract_table_info(request);
if(table_info==NULL){
snmp_log(LOG_ERR,"returned NULL table_info.\n");
request->processed = 1;
}else{
if (table_info->colnum < tbl_info->min_column - 1) {
/* XXX: optimize better than this */
/* for now, just increase to colnum-1 */
/* we need to jump to the lowest result of the min_column
and take it, comparing to nothing from the request */
table_info->colnum = tbl_info->min_column - 1;
} else if (table_info->colnum > tbl_info->max_column) {
request->processed = 1;
}
}
Because of this I was wondering if it should be controlled whether table_info
is NULL or if there is any other hidden problem to be solved.
Thank you for any advice or comment,
David
On Tue, 2006-02-21 at 12:14 +0100, Fernández Piñas, David wrote:
> I have seen at table_iterator.c the next lines of code in function
> netsnmp_table_iterator_helper_handler:
>
> table_info = netsnmp_extract_table_info(request);
> if (table_info->colnum < tbl_info->min_column - 1) {
>
> Should it be checked whether table_info is NULL before executing if
> statement?
It would probably be sensible, yes - even if only to log an error.
DF> Something like that: snmp_log(LOG_ERR,"NULL table_info.\n");
> Should table_info ever be NULL?
No.
'table_info' holds the information about the basic structure of the table, as
provided when the table was first registered.
If this is NULL, then the table processing will not work.
Dave
-------------------------------------------------------------------------------------------------------------------
Este correo electrónico y, en su caso, cualquier fichero anexo al mismo,
contiene información de carácter confidencial exclusivamente dirigida a su
destinatario o destinatarios. Queda prohibida su divulgación, copia o
distribución a terceros sin la previa autorización escrita de Indra. En el caso
de haber recibido este correo electrónico por error, se ruega notificar
inmediatamente esta circunstancia mediante reenvío a la dirección electrónica
del remitente. POR FAVOR, ANTES DE IMPRIMIR ESTE CORREO ELECTRÓNICO CONSIDERE
SU APORTACIÓN A LA CONSERVACIÓN DEL MEDIO AMBIENTE POR LA REDUCCIÓN DE CONSUMO
DE PAPEL.
The information in this e-mail and in any attachments is confidential and
solely for the attention and use of the named addressee(s). You are hereby
notified that any dissemination, distribution or copy of this communication is
prohibited without the prior written consent of Indra. If you have received
this communication in error, please, notify the sender by reply e-mail. PLEASE
CONSIDER YOUR ENVIRONMENTAL RESPONSIBILITY BEFORE PRINTING THIS E-MAIL.
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid3432&bid#0486&dat1642
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders