Revision 48e5f32d proto/ospf/dbdes.c

View differences:

proto/ospf/dbdes.c
103 103
    length = sizeof(struct ospf_dbdes_packet);
104 104
    op->length = htons(length);
105 105

  
106
    OSPF_PACKET(ospf_dump_dbdes, pkt, "DBDES packet sent to %I via %s", n->ip, ifa->iface->name);
106
    OSPF_PACKET(ospf_dump_dbdes, pkt, "DBDES packet sent to %I via %s", n->ip, ifa->ifname);
107 107
    ospf_send_to(ifa, n->ip);
108 108
    break;
109 109

  
......
115 115
      snode *sn;
116 116
      struct ospf_lsa_header *lsa;
117 117

  
118
      pkt = n->ldbdes;
118
      if (n->ldd_bsize != ifa->tx_length)
119
      {
120
	mb_free(n->ldd_buffer);
121
	n->ldd_buffer = mb_allocz(n->pool, ifa->tx_length);
122
	n->ldd_bsize = ifa->tx_length;
123
      }
124

  
125
      pkt = n->ldd_buffer;
119 126
      op = (struct ospf_packet *) pkt;
120 127

  
121 128
      ospf_pkt_fill_hdr(ifa, pkt, DBDES_P);
......
124 131
      pkt->options = hton_opt(oa->options);
125 132

  
126 133
      j = i = (ospf_pkt_maxsize(ifa) - sizeof(struct ospf_dbdes_packet)) / sizeof(struct ospf_lsa_header);	/* Number of possible lsaheaders to send */
127
      lsa = (n->ldbdes + sizeof(struct ospf_dbdes_packet));
134
      lsa = (n->ldd_buffer + sizeof(struct ospf_dbdes_packet));
128 135

  
129 136
      if (n->myimms.bit.m)
130 137
      {
......
175 182

  
176 183
  case NEIGHBOR_LOADING:
177 184
  case NEIGHBOR_FULL:
178
    length = ntohs(((struct ospf_packet *) n->ldbdes)->length);
185
    length = n->ldd_buffer ? ntohs(((struct ospf_packet *) n->ldd_buffer)->length) : 0;
179 186

  
180 187
    if (!length)
181 188
    {
......
184 191
      return;
185 192
    }
186 193

  
187
    /* Copy last sent packet again */
188
    pkt = ospf_tx_buffer(ifa);
189
    memcpy(pkt, n->ldbdes, length);
194
    /* Send last packet from ldd buffer */
190 195

  
191
    OSPF_PACKET(ospf_dump_dbdes, pkt, "DBDES packet sent to %I via %s", n->ip, ifa->iface->name);
196
    OSPF_PACKET(ospf_dump_dbdes, n->ldd_buffer, "DBDES packet sent to %I via %s", n->ip, ifa->ifname);
197

  
198
    sk_set_tbuf(ifa->sk, n->ldd_buffer);
192 199
    ospf_send_to(ifa, n->ip);
200
    sk_set_tbuf(ifa->sk, NULL);
193 201

  
194 202
    if(n->myimms.bit.ms) tm_start(n->rxmt_timer, n->ifa->rxmtint);		/* Restart timer */
195 203

  
......
262 270
  u32 ps_options = ntoh_opt(ps->options);
263 271
  u16 ps_iface_mtu = ntohs(ps->iface_mtu);
264 272
  
265
  OSPF_PACKET(ospf_dump_dbdes, ps, "DBDES packet received from %I via %s", n->ip, ifa->iface->name);
273
  OSPF_PACKET(ospf_dump_dbdes, ps, "DBDES packet received from %I via %s", n->ip, ifa->ifname);
266 274

  
267 275
  ospf_neigh_sm(n, INM_HELLOREC);
268 276

  
......
279 287
      return;
280 288
  case NEIGHBOR_EXSTART:
281 289

  
282
    if ((ps_iface_mtu != ifa->iface->mtu) && (ifa->type != OSPF_IT_VLINK)
290
    if ((ifa->type != OSPF_IT_VLINK) && (ps_iface_mtu != ifa->iface->mtu)
283 291
	&& (ps_iface_mtu != 0) && (ifa->iface->mtu != 0))
284 292
      log(L_WARN "OSPF: MTU mismatch with neighbour %I on interface %s (remote %d, local %d)",
285
	  n->ip, ifa->iface->name, ps_iface_mtu, ifa->iface->mtu);
293
	  n->ip, ifa->ifname, ps_iface_mtu, ifa->iface->mtu);
286 294

  
287 295
    if ((ps->imms.bit.m && ps->imms.bit.ms && ps->imms.bit.i)
288 296
	&& (n->rid > po->router_id) && (size == sizeof(struct ospf_dbdes_packet)))
......
361 369
    {
362 370
      if (ps_ddseq != n->dds)	/* MASTER */
363 371
      {
364
	OSPF_TRACE(D_PACKETS,
365
		   "dbdes - sequence mismatch neighbor %I (master)", n->ip);
372
	OSPF_TRACE(D_PACKETS, "dbdes - sequence mismatch neighbor %I (master)",
373
		   n->ip);
366 374
	ospf_neigh_sm(n, INM_SEQMIS);
367 375
	break;
368 376
      }
......
383 391
    {
384 392
      if (ps_ddseq != (n->dds + 1))	/* SLAVE */
385 393
      {
386
	OSPF_TRACE(D_PACKETS, "dbdes - sequence mismatch neighbor %I (slave)",
387
		   n->ip);
394
	OSPF_TRACE(D_PACKETS, "dbdes - sequence mismatch neighbor %I (slave)", n->ip);
388 395
	ospf_neigh_sm(n, INM_SEQMIS);
389 396
	break;
390 397
      }

Also available in: Unified diff