Re: SNMPERR_NOT_IN_TIME_WINDOW

sanjaykumar <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
Thanks Smith .........

I have some real concern about "not in time window"

Following is actual scenario :

1. I am trying to send the snmpinform request using snmptrap.c
(apps/snmptrapd)

2. "To reduce the waiting time" of
inform response I have done the some changes in snmptrap.c and
snmp_client.c(snmplib)

changes in snmptrap.c:

if (inform) {

/* status = snmp_synch_response(ss, pdu, &response); */ /* I have commented this function call */

/* callback registration */

ss->callback = snmp_synch_input; /*
Callback to receive the RESPONSE*/

ss->callback_magic = (void *)state;

status = snmp_send(ss, pdu); /* This is use JUST to send the inform request */

}

3. I have created a thread to wait for inform response.

This thread have is waiting at "select" to receive the inform response

function definition is :

int

inform_receive()

{

int numfds, count;

fd_set fdset;

struct timeval timeout, *tvp;

int block;

int sock_id;

sock_id = 0;

numfds = 0;

FD_ZERO(&fdset);

while (1) {

tvp = &timeout;

timerclear(tvp);

sock_id = snmp_get_sock_fd();
/* This function will give ONLY the
inform request "fd" */

//printf("\n**** sock_id received: %d ***\n", sock_id);

FD_SET(sock_id, &fdset);

numfds = sock_id + 1;

#if 1

/* currently static values for timeout */

tvp->tv_sec = 0; /* waiting time is made to 1
sec to reduce the processing time*/

tvp->tv_usec = 0;

#endif

count = select(numfds, &fdset, 0, 0, tvp);

if (count > 0) {

snmp_read(&fdset); /*
This will read the response and invoked the callback */

} else {

switch (count) {

case 0:

//printf("\n **** timeout ****\n");

snmp_timeout();

break;

case -1:

if (errno == EINTR) {

continue;

} else {

snmp_errno = SNMPERR_GENERR;
/*MTCRITICAL_RESOURCE */

/*

* CAUTION! if another thread closed the socket(s)

* waited on here, the session structure was freed.

* It would be nice, but we can't rely on the
pointer.

* ss->s_snmp_errno = SNMPERR_GENERR;

* ss->s_errno = errno;

*/

snmp_set_detail(strerror(errno));

}

/*

* FALLTHRU

*/default:

//state->status = STAT_ERROR;

//state->waiting = 0;

// printf("\n 9. response msg => state->status: %d
***\n\n\n", state->status);

}

}

}

#if 0

if ( ss->flags &= SNMP_FLAGS_RESP_CALLBACK ) {

void (*cb)(void);

cb = ss->myvoid;

cb(); /* Used to invoke
'netsnmp_check_outstanding_agent_requests();'

on internal AgentX queries. */

}

#endif

return 0;

}

4. Now I am sending the different inform request at different
scenario [as per Packet Cable Spec]

5. I am getting the following ERROR

" SNMPERR_NOT_IN_TIME_WINDOW *** resending the request *** "

from function "_sess_process_packet" in
snmp_api.c

[ _sess_process_packet(void *sessp,
netsnmp_session * sp,

struct snmp_internal_session *isp,

netsnmp_transport *transport,

void *opaque, int olength,

u_char * packetptr, int length) ]

>From following line of CODE : in snmp_api.c

**************************************************************************

if (callback == NULL

|| callback(NETSNMP_CALLBACK_OP_RECEIVED_MESSAGE, sp,

pdu->reqid, pdu, magic) == 1) {

if (pdu->command == SNMP_MSG_REPORT) {

if (sp->s_snmp_errno == SNMPERR_NOT_IN_TIME_WINDOW ||

snmpv3_get_report_type(pdu) ==

SNMPERR_NOT_IN_TIME_WINDOW) {

/*

* trigger immediate retry on recoverable Reports

* * (notInTimeWindow), incr_retries == TRUE to prevent

* * inifinite resend

*/

if (rp->retries <= sp->retries) {

printf("\n
SNMPERR_NOT_IN_TIME_WINDOW*** resending the request *** \n");

snmp_resend_request(slp, rp, TRUE);

break;

}

} else {

if (SNMPV3_IGNORE_UNAUTH_REPORTS) {

break;

}

}

**************************************************************************************

Could You Help me out to recognize the problem why "SNMPERR_NOT_IN_TIME_WINDOW"

If possible could anybody suggest me how I need to proceed.

If you have any query to understand the above scenario Please write me.

Thanks and Best Regards,

Sanjay

Smith, Nathan wrote:

This is an SNMPv3 issue where SNMP traffic between a manager and agent
contains incompatible values of snmpEngineBoots and snmpEngineTime.
Despite the name this issue is not due to wall time (GMT) settings on
the manager or agent.

For a description of these scalars see

http://net-snmp.sourceforge.net/docs/mibs/snmpFrameworkMIB.html

Here's a simplified explanation of the problem, leaving out some key
concepts regarding proper SNMPv3 communication:

The agent increments snmpEngineTime once per second. When operating
properly the manager is aware of this value, and includes it, along with
snmpEngineBoots, in communication with the agent.

When the agent's snmpEngineTime reaches a certain threshold, it's reset
to 0, and the agent then increments snmpEngineBoots by 1.
Both of these counters are part of the security model of SNMPv3. When
used correctly they help prevent replay attacks.

When the manager's and agent's snmpEngineTime differs enough (over 160
seconds? probably also implementation specific), the agent will send a
usmNotInTimeWindows error to the manager.

So this error is most likely due to your manager not keeping updated
values of snmpEngineTime and snmpEngineBoots.

-- Nate

-----Original Message-----
From: sanjaykumar [ mailto:[email protected] ]
Sent: Thursday, October 15, 2009 7:12 AM
To: [email protected]
Subject: SNMPERR_NOT_IN_TIME_WINDOW

Hi All,
I very frequently get the error
"SNMPERR_NOT_IN_TIME_WINDOW".

What are the reason for this ???
where shall I look to resolve this issue ??
Does it depends on the current time of agent and manager system ???

Regards,
Sanjay

-----------------------------------------------------------------------

-------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart
your
developing skills, take BlackBerry mobile applications to market and
stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference

_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.