Revision a9c38203 proto/rip/rip.c

View differences:

proto/rip/rip.c
7 7
 *	Can be freely distributed and used under the terms of the GNU GPL.
8 8
 *
9 9
 	FIXME: IpV6 support: packet size
10
	FIXME: (nonurgent) IpV6 support: receive "route using" blocks
11
	FIXME: (nonurgent) IpV6 support: generate "nexthop" blocks
10
	FIXME: (nonurgent) IPv6 support: receive "route using" blocks
11
	FIXME: (nonurgent) IPv6 support: generate "nexthop" blocks
12 12
		next hops are only advisory, and they are pretty ugly in IpV6.
13 13
		I suggest just forgetting about them.
14 14

  
15 15
	FIXME: (nonurgent): fold rip_connection into rip_interface?
16 16

  
17
	FIXME: (nonurgent) allow bigger frequencies than 1 regular update in 6 seconds (?)
18 17
	FIXME: propagation of metric=infinity into main routing table may or may not be good idea.
19 18
 */
20 19

  
......
162 161
    FIB_ITERATE_START(&P->rtable, &c->iter, z) {
163 162
      struct rip_entry *e = (struct rip_entry *) z;
164 163

  
165
      if (!rif->triggered || (!(e->updated < now-5))) {
164
      if (!rif->triggered || (!(e->updated < now-2))) {		/* FIXME: Should be probably 1 or some different algorithm */
166 165
	nullupdate = 0;
167 166
	i = rip_tx_prepare( p, packet->block + i, e, rif, i );
168 167
	if (i >= maxi) {
......
557 556
  DBG( "RIP: Broadcasting routing tables\n" );
558 557
  {
559 558
    struct rip_interface *rif;
559

  
560
    if ( P_CF->period > 2 ) {		/* Bring some randomness into sending times */
561
      if (! (P->tx_count % P_CF->period)) P->rnd_count = random_u32() % 2;
562
    } else P->rnd_count = P->tx_count % P_CF->period;
563

  
560 564
    WALK_LIST( rif, P->interfaces ) {
561 565
      struct iface *iface = rif->iface;
562 566

  
563 567
      if (!iface) continue;
564 568
      if (rif->mode & IM_QUIET) continue;
565 569
      if (!(iface->flags & IF_UP)) continue;
570
      rif->triggered = P->rnd_count;
566 571

  
567
      rif->triggered = (P->tx_count % 6);
568 572
      rip_sendto( p, IPA_NONE, 0, rif );
569 573
    }
570
    P->tx_count ++;
574
    P->tx_count++;
575
    P->rnd_count--;
571 576
  }
572 577

  
573 578
  DBG( "RIP: tick tock done\n" );
......
595 600
  init_list( &P->interfaces );
596 601
  P->timer = tm_new( p->pool );
597 602
  P->timer->data = p;
598
  P->timer->randomize = 2;
599
  P->timer->recurrent = (P_CF->period / 6) - 1; 
600
  if (P_CF->period < 12) {
601
    log(L_WARN "Period %d is too low. So I am using 12 which is the lowest possible value.", P_CF->period);
602
    P->timer->recurrent = 1;
603
  }
603
  P->timer->recurrent = 1;
604 604
  P->timer->hook = rip_timer;
605
  tm_start( P->timer, 5 );
605
  tm_start( P->timer, 2 );
606 606
  rif = new_iface(p, NULL, 0, NULL);	/* Initialize dummy interface */
607 607
  add_head( &P->interfaces, NODE rif );
608 608
  CHK_MAGIC;

Also available in: Unified diff