Revision c27b2449 proto/ospf/ospf.c

View differences:

proto/ospf/ospf.c
278 278
  return
279 279
    new->u.ospf.metric1 == old->u.ospf.metric1 &&
280 280
    new->u.ospf.metric2 == old->u.ospf.metric2 &&
281
    new->u.ospf.tag == old->u.ospf.tag;
281
    new->u.ospf.tag == old->u.ospf.tag &&
282
    new->u.ospf.router_id == old->u.ospf.router_id;
282 283
}
283 284

  
284 285
static ea_list *
285 286
ospf_build_attrs(ea_list * next, struct linpool *pool, u32 m1, u32 m2,
286
		 u32 tag)
287
		 u32 tag, u32 rid)
287 288
{
288 289
  struct ea_list *l =
289
    lp_alloc(pool, sizeof(struct ea_list) + 3 * sizeof(eattr));
290
    lp_alloc(pool, sizeof(struct ea_list) + 4 * sizeof(eattr));
290 291

  
291 292
  l->next = next;
292 293
  l->flags = EALF_SORTED;
293
  l->count = 3;
294
  l->count = 4;
294 295
  l->attrs[0].id = EA_OSPF_METRIC1;
295 296
  l->attrs[0].flags = 0;
296 297
  l->attrs[0].type = EAF_TYPE_INT | EAF_TEMP;
......
303 304
  l->attrs[2].flags = 0;
304 305
  l->attrs[2].type = EAF_TYPE_INT | EAF_TEMP;
305 306
  l->attrs[2].u.data = tag;
307
  l->attrs[3].id = EA_OSPF_ROUTER_ID;
308
  l->attrs[3].flags = 0;
309
  l->attrs[3].type = EAF_TYPE_INT | EAF_TEMP;
310
  l->attrs[3].u.data = rid;
306 311
  return l;
307 312
}
308 313

  
......
435 440

  
436 441
  if (p == e->attrs->proto)
437 442
    return -1;			/* Reject our own routes */
438
  *attrs = ospf_build_attrs(*attrs, pool, LSINFINITY, 10000, 0);
443
  *attrs = ospf_build_attrs(*attrs, pool, LSINFINITY, 10000, 0, 0);
439 444
  return 0;			/* Leave decision to the filters */
440 445
}
441 446

  
......
443 448
ospf_make_tmp_attrs(struct rte *rt, struct linpool *pool)
444 449
{
445 450
  return ospf_build_attrs(NULL, pool, rt->u.ospf.metric1, rt->u.ospf.metric2,
446
			  rt->u.ospf.tag);
451
			  rt->u.ospf.tag, rt->u.ospf.router_id);
447 452
}
448 453

  
449 454
void
......
452 457
  rt->u.ospf.metric1 = ea_get_int(attrs, EA_OSPF_METRIC1, LSINFINITY);
453 458
  rt->u.ospf.metric2 = ea_get_int(attrs, EA_OSPF_METRIC2, 10000);
454 459
  rt->u.ospf.tag = ea_get_int(attrs, EA_OSPF_TAG, 0);
460
  rt->u.ospf.router_id = ea_get_int(attrs, EA_OSPF_ROUTER_ID, 0);
455 461
}
456 462

  
457 463
/**
......
569 575
  {
570 576
    buf += bsprintf(buf, " [%x]", rte->u.ospf.tag);
571 577
  }
578
  if (rte->u.ospf.router_id)
579
    buf += bsprintf(buf, " [%R]", rte->u.ospf.router_id);
572 580
}
573 581

  
574 582
static int
......
583 591
    bsprintf(buf, "metric2");
584 592
    return GA_NAME;
585 593
  case EA_OSPF_TAG:
586
    bsprintf(buf, "tag: %08x", a->u.data);
594
    bsprintf(buf, "tag: %08x (%u)", a->u.data, a->u.data);
595
    return GA_FULL;
596
 case EA_OSPF_ROUTER_ID:
597
   bsprintf(buf, "router_id: %R (%u)", a->u.data, a->u.data);
587 598
    return GA_FULL;
588 599
  default:
589 600
    return GA_UNKNOWN;

Also available in: Unified diff