Revision 6f8bbaa1 proto/ospf/lsreq.c

View differences:

proto/ospf/lsreq.c
54 54
{
55 55
  struct ospf_iface *ifa = n->ifa;
56 56
  struct ospf_lsreq_header *lsrs;
57
  struct top_hash_entry *en;
57
  struct top_hash_entry *req;
58 58
  struct ospf_packet *pkt;
59 59
  uint i, lsr_max, length;
60 60

  
61 61
  /* RFC 2328 10.9 */
62 62

  
63
  if (EMPTY_SLIST(n->lsrql))
64
  {
65
    if (n->state == NEIGHBOR_LOADING)
66
      ospf_neigh_sm(n, INM_LOADDONE);
67
    return;
68
  }
63
  /* ASSERT((n->state >= NEIGHBOR_EXCHANGE) && !EMPTY_SLIST(n->lsrql)); */
69 64

  
70 65
  pkt = ospf_tx_buffer(ifa);
71 66
  ospf_pkt_fill_hdr(ifa, pkt, LSREQ_P);
72 67
  ospf_lsreq_body(p, pkt, &lsrs, &lsr_max);
73 68

  
74
  /* We send smaller LSREQ to prevent multiple LSACKs as answer */
75
  lsr_max = lsr_max / 4;
76

  
77 69
  i = 0;
78
  WALK_SLIST(en, n->lsrql)
70
  WALK_SLIST(req, n->lsrql)
79 71
  {
80 72
    if (i == lsr_max)
81 73
      break;
82 74

  
83 75
    DBG("Requesting %uth LSA: Type: %04u, ID: %R, RT: %R, SN: 0x%x, Age %u\n",
84
	i, en->lsa_type, en->lsa.id, en->lsa.rt, en->lsa.sn, en->lsa.age);
76
	i, req->lsa_type, req->lsa.id, req->lsa.rt, req->lsa.sn, req->lsa.age);
85 77

  
86
    u32 etype = lsa_get_etype(&en->lsa, p);
78
    u32 etype = lsa_get_etype(&req->lsa, p);
87 79
    lsrs[i].type = htonl(etype);
88
    lsrs[i].rt = htonl(en->lsa.rt);
89
    lsrs[i].id = htonl(en->lsa.id);
80
    lsrs[i].rt = htonl(req->lsa.rt);
81
    lsrs[i].id = htonl(req->lsa.id);
90 82
    i++;
91 83
  }
92 84

  
85
  /* We store the position to see whether requested LSAs have been received */
86
  n->lsrqi = req;
87

  
93 88
  length = ospf_pkt_hdrlen(p) + i * sizeof(struct ospf_lsreq_header);
94 89
  pkt->length = htons(length);
95 90

  

Also available in: Unified diff