Revision 7e5f769d

View differences:

proto/bgp/bgp.c
491 491
}
492 492

  
493 493
static const struct bgp_af_caps dummy_af_caps = { };
494
static const struct bgp_af_caps basic_af_caps = { .ready = 1 };
494 495

  
495 496
void
496 497
bgp_conn_enter_established_state(struct bgp_conn *conn)
......
541 542
    const struct bgp_af_caps *loc = bgp_find_af_caps(local, c->afi);
542 543
    const struct bgp_af_caps *rem = bgp_find_af_caps(peer,  c->afi);
543 544

  
545
    /* Use default if capabilities were not announced */
546
    if (!local->length && (c->afi == BGP_AF_IPV4))
547
      loc = &basic_af_caps;
548

  
549
    if (!peer->length && (c->afi == BGP_AF_IPV4))
550
      rem = &basic_af_caps;
551

  
544 552
    /* Ignore AFIs that were not announced in multiprotocol capability */
545 553
    if (!loc || !loc->ready)
546 554
      loc = &dummy_af_caps;
proto/bgp/bgp.h
215 215
  u8 llgr_aware;			/* Long-lived GR capability, RFC draft */
216 216

  
217 217
  u16 af_count;				/* Number of af_data items */
218
  u16 length;				/* Length of capabilities in OPEN msg */
218 219

  
219 220
  struct bgp_af_caps af_data[0];	/* Per-AF capability data */
220 221
};
proto/bgp/packets.c
217 217
  struct bgp_af_caps *ac;
218 218
  uint any_ext_next_hop = 0;
219 219
  uint any_add_path = 0;
220
  byte *buf_head = buf;
220 221
  byte *data;
221 222

  
222 223
  /* Prepare bgp_caps structure */
......
394 395
    data[-1] = buf - data;
395 396
  }
396 397

  
398
  caps->length = buf - buf_head;
399

  
397 400
  return buf;
398 401
}
399 402

  
......
405 408
  int i, cl;
406 409
  u32 af;
407 410

  
411
  caps->length += len;
412

  
408 413
  while (len > 0)
409 414
  {
410 415
    if (len < 2 || len < (2 + pos[1]))

Also available in: Unified diff