Revision a7a7372a proto/ospf/neighbor.c

View differences:

proto/ospf/neighbor.c
33 33
static void ackd_timer_hook(timer * t);
34 34

  
35 35
static void
36
init_lists(struct ospf_neighbor *n)
36
init_lists(struct ospf_proto *p, struct ospf_neighbor *n)
37 37
{
38 38
  s_init_list(&(n->lsrql));
39
  n->lsrqh = ospf_top_new(n->pool);
39
  n->lsrqh = ospf_top_new(p, n->pool);
40 40

  
41 41
  s_init_list(&(n->lsrtl));
42
  n->lsrth = ospf_top_new(n->pool);
42
  n->lsrth = ospf_top_new(p, n->pool);
43
}
44

  
45
static void
46
release_lsrtl(struct ospf_proto *p, struct ospf_neighbor *n)
47
{
48
  struct top_hash_entry *ret, *en;
49

  
50
  WALK_SLIST(ret, n->lsrtl)
51
  {
52
    en = ospf_hash_find_entry(p->gr, ret);
53
    if (en)
54
      en->ret_count--;
55
  }
43 56
}
44 57

  
45 58
/* Resets LSA request and retransmit lists.
......
47 60
 * it is reset during entering EXCHANGE state.
48 61
 */
49 62
static void
50
reset_lists(struct ospf_neighbor *n)
63
reset_lists(struct ospf_proto *p, struct ospf_neighbor *n)
51 64
{
65
  release_lsrtl(p,n);
52 66
  ospf_top_free(n->lsrqh);
53 67
  ospf_top_free(n->lsrth);
54
  init_lists(n);
68
  init_lists(p, n);
55 69
}
56 70

  
57 71
struct ospf_neighbor *
......
68 82
  n->csn = 0;
69 83
  n->state = NEIGHBOR_DOWN;
70 84

  
71
  init_lists(n);
85
  init_lists(p, n);
72 86
  s_init(&(n->dbsi), &(p->lsal));
73 87

  
74 88
  n->inactim = tm_new(pool);
......
360 374
      s_get(&(n->dbsi));
361 375
      s_init(&(n->dbsi), &p->lsal);
362 376

  
377
      /* Add MaxAge LSA entries to retransmission list */
378
      ospf_add_flushed_to_lsrt(p, n);
379

  
380
      /* FIXME: Why is this here ? */
363 381
      ospf_reset_lsack_queue(n);
364 382
    }
365 383
    else
......
388 406
      if (n->state >= NEIGHBOR_EXSTART)
389 407
	if (!can_do_adj(n))
390 408
	{
391
	  reset_lists(n);
409
	  reset_lists(p,n);
392 410
	  neigh_chstate(n, NEIGHBOR_2WAY);
393 411
	}
394 412
      break;
......
399 417
  case INM_BADLSREQ:
400 418
    if (n->state >= NEIGHBOR_EXCHANGE)
401 419
    {
402
      reset_lists(n);
420
      reset_lists(p, n);
403 421
      neigh_chstate(n, NEIGHBOR_EXSTART);
404 422
    }
405 423
    break;
......
407 425
  case INM_KILLNBR:
408 426
  case INM_LLDOWN:
409 427
  case INM_INACTTIM:
410
    reset_lists(n);
428
    reset_lists(p, n);
411 429
    neigh_chstate(n, NEIGHBOR_DOWN);
412 430
    break;
413 431

  
414 432
  case INM_1WAYREC:
415
    reset_lists(n);
433
    reset_lists(p, n);
416 434
    neigh_chstate(n, NEIGHBOR_INIT);
417 435
    break;
418 436

  
......
552 570
      nn->found = 0;
553 571
  }
554 572

  
555
  s_get(&(n->dbsi));
556 573
  neigh_chstate(n, NEIGHBOR_DOWN);
574

  
575
  s_get(&(n->dbsi));
576
  release_lsrtl(p, n);
557 577
  rem_node(NODE n);
558 578
  rfree(n->pool);
559 579
  OSPF_TRACE(D_EVENTS, "Deleting neigbor %R", n->rid);
......
620 640
}
621 641

  
622 642
static void
623
rxmt_timer_hook(timer * timer)
643
rxmt_timer_hook(timer *t)
624 644
{
625
  struct ospf_neighbor *n = (struct ospf_neighbor *) timer->data;
645
  struct ospf_neighbor *n = t->data;
626 646
  struct ospf_proto *p = n->ifa->oa->po;
627 647

  
628 648
  DBG("%s: RXMT timer fired on interface %s for neigh %I\n",
......
631 651
  switch (n->state)
632 652
  {
633 653
  case NEIGHBOR_EXSTART:
634
    ospf_send_dbdes(n, 1);
654
    ospf_send_dbdes(p, n, 1);
635 655
    return;
636 656

  
637 657
  case NEIGHBOR_EXCHANGE:
638 658
  if (n->myimms & DBDES_MS)
639
    ospf_send_dbdes(n, 0);
659
    ospf_send_dbdes(p, n, 0);
640 660
  case NEIGHBOR_LOADING:
641 661
    ospf_send_lsreq(p, n);
642 662
    return;
......
653 673
}
654 674

  
655 675
static void
656
ackd_timer_hook(timer * t)
676
ackd_timer_hook(timer *t)
657 677
{
658 678
  struct ospf_neighbor *n = t->data;
659
  ospf_lsack_send(n, ACKL_DELAY);
679
  struct ospf_proto *p = n->ifa->oa->po;
680

  
681
  DBG("%s: ACKD timer fired on interface %s for neigh %I\n",
682
      p->p.name, n->ifa->ifname, n->ip);
683

  
684
  ospf_send_lsack(p, n, ACKL_DELAY);
660 685
}

Also available in: Unified diff