Revision 48e5f32d proto/ospf/lsupd.c

View differences:

proto/ospf/lsupd.c
278 278
      struct ospf_packet *op;
279 279
      struct ospf_lsa_header *lh;
280 280

  
281
      pk = ospf_tx_buffer(ifa);
282
      op = &pk->ospf_packet;
283

  
284
      ospf_pkt_fill_hdr(ifa, pk, LSUPD_P);
285
      pk->lsano = htonl(1);
286

  
287 281
      /* Check iface buffer size */
288
      int len2 = sizeof(struct ospf_lsupd_packet) + (hn ? ntohs(hn->length) : hh->length);
289
      if (len2 > ospf_pkt_bufsize(ifa))
282
      uint len2 = sizeof(struct ospf_lsupd_packet) + (hn ? ntohs(hn->length) : hh->length);
283
      if (ospf_iface_assure_bufsize(ifa, len2) < 0)
290 284
      {
291 285
	/* Cannot fit in a tx buffer, skip that iface */
292 286
	log(L_ERR "OSPF: LSA too large to flood on %s (Type: %04x, Id: %R, Rt: %R)", 
293
	    ifa->iface->name, hh->type, hh->id, hh->rt);
287
	    ifa->ifname, hh->type, hh->id, hh->rt);
294 288
	continue;
295 289
      }
296 290

  
291
      pk = ospf_tx_buffer(ifa);
292
      op = &pk->ospf_packet;
293

  
294
      ospf_pkt_fill_hdr(ifa, pk, LSUPD_P);
295
      pk->lsano = htonl(1);
296

  
297 297
      lh = (struct ospf_lsa_header *) (pk + 1);
298 298

  
299 299
      /* Copy LSA into the packet */
......
322 322

  
323 323
      op->length = htons(len);
324 324

  
325
      OSPF_PACKET(ospf_dump_lsupd, pk, "LSUPD packet flooded via %s", ifa->iface->name);
325
      OSPF_PACKET(ospf_dump_lsupd, pk, "LSUPD packet flooded via %s", ifa->ifname);
326 326

  
327 327
      switch (ifa->type)
328 328
      {
......
406 406
	  break;
407 407

  
408 408
	/* LSA is larger than MTU, check buffer size */
409
	if (len2 > ospf_pkt_bufsize(n->ifa))
409
	if (ospf_iface_assure_bufsize(n->ifa, len2) < 0)
410 410
	{
411 411
	  /* Cannot fit in a tx buffer, skip that */
412 412
	  log(L_ERR "OSPF: LSA too large to send (Type: %04x, Id: %R, Rt: %R)", 
......
414 414
	  lsr = NODE_NEXT(lsr);
415 415
	  continue;
416 416
	}
417

  
418
	/* TX buffer could be reallocated */
419
	pkt = ospf_tx_buffer(n->ifa);
420
	buf = (void *) pkt;
417 421
      }
418 422

  
419 423
      /* Copy the LSA to the packet */
......
432 436
    pkt->lsano = htonl(lsano);
433 437
    pkt->ospf_packet.length = htons(len);
434 438
    OSPF_PACKET(ospf_dump_lsupd, pkt, "LSUPD packet sent to %I via %s",
435
		n->ip, n->ifa->iface->name);
439
		n->ip, n->ifa->ifname);
436 440
    ospf_send_to(n->ifa, n->ip);
437 441
  }
438 442
}
......
455 459
  }
456 460

  
457 461
  struct ospf_lsupd_packet *ps = (void *) ps_i;
458
  OSPF_PACKET(ospf_dump_lsupd, ps, "LSUPD packet received from %I via %s", n->ip, ifa->iface->name);
462
  OSPF_PACKET(ospf_dump_lsupd, ps, "LSUPD packet received from %I via %s", n->ip, ifa->ifname);
459 463

  
460 464
  if (n->state < NEIGHBOR_EXCHANGE)
461 465
  {

Also available in: Unified diff