Hi,
 
In net-snmp version 5.3.0.1, when system date/time is changed, then the traps 
are not forwarded.
 
We have used snmp_alarm_register_hr() with SA_REPEAT flag for forwarding traps 
every 100msec.
 
With the following fix in snmplib/snmp_alarm.c open souce code, it is working 
fine.
 
   281  int
   282  get_next_alarm_delay_time(struct timeval *delta)
   283  {
   284      struct snmp_alarm *sa_ptr;
   285      struct timeval  t_diff, t_now;
   286
   287      sa_ptr = sa_find_next();
   288
   289      if (sa_ptr) {
   290          gettimeofday(&t_now, 0);
   291
   292          if ((t_now.tv_sec > sa_ptr->t_next.tv_sec) ||
   293              ((t_now.tv_sec == sa_ptr->t_next.tv_sec) &&
   294               (t_now.tv_usec > sa_ptr->t_next.tv_usec))) {
   295              /*
   296               * Time has already passed.  Return the smallest possible 
amount of
   297               * time.
   298               */
   299              delta->tv_sec = 0;
   300              delta->tv_usec = 1;
   301              return sa_ptr->clientreg;
   302          } else {
   303              /*
   304               * Time is still in the future.
   305               */
   306              t_diff.tv_sec = sa_ptr->t_next.tv_sec - t_now.tv_sec;
   307              t_diff.tv_usec = sa_ptr->t_next.tv_usec - t_now.tv_usec;
   308
   309              while (t_diff.tv_usec < 0) {
   310                  t_diff.tv_sec -= 1;
   311                  t_diff.tv_usec += 1000000;
   312              }
   313
   314              /* Fix given to handle the time change
   315                 to past time */
   316              if((t_diff.tv_sec > sa_ptr->t.tv_sec) ||
   317                 ((t_diff.tv_sec == sa_ptr->t.tv_sec) &&
   318                  (t_diff.tv_usec >  sa_ptr->t.tv_usec)))
   319              {
   320                sa_ptr->t_next.tv_sec = t_now.tv_sec;
   321                sa_ptr->t_next.tv_usec = t_now.tv_usec;
   322                t_diff.tv_sec = 0;
   323                t_diff.tv_usec = 1;
   324              }
   325
   326              delta->tv_sec = t_diff.tv_sec;
   327              delta->tv_usec = t_diff.tv_usec;
   328              return sa_ptr->clientreg;
   329          }
   330      }
   331
   332      /*
   333       * Nothing Left.
   334       */
   335      return 0;
   336  }

 
Can anyone review this fix? Can anyone mail me the procedure for modifying 
net-snmp open source code?
 
 
Thanx,
Devi.U
 


============================================================================================================================
 
Disclaimer:

This message and the information contained herein is proprietary and 
confidential and subject to the Tech Mahindra policy statement, you may review 
at <a 
href="http://www.techmahindra.com/Disclaimer.html";>http://www.techmahindra.com/Disclaimer.html</a>
 externally and <a 
href="http://tim.techmahindra.com/Disclaimer.html";>http://tim.techmahindra.com/Disclaimer.html</a>
 internally within Tech Mahindra.

============================================================================================================================
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to