Revision f4a60a9b proto/ospf/ospf.c

View differences:

proto/ospf/ospf.c
102 102
static int ospf_import_control(struct proto *P, rte **new, ea_list **attrs, struct linpool *pool);
103 103
static struct ea_list *ospf_make_tmp_attrs(struct rte *rt, struct linpool *pool);
104 104
static void ospf_store_tmp_attrs(struct rte *rt, struct ea_list *attrs);
105
static int ospf_reload_routes(struct proto *P);
105
static void ospf_reload_routes(struct channel *C);
106 106
static int ospf_rte_better(struct rte *new, struct rte *old);
107 107
static int ospf_rte_same(struct rte *new, struct rte *old);
108 108
static void ospf_disp(timer *timer);
......
297 297
}
298 298

  
299 299
static struct proto *
300
ospf_init(struct proto_config *c)
300
ospf_init(struct proto_config *CF)
301 301
{
302
  struct ospf_config *oc = (struct ospf_config *) c;
303
  struct proto *P = proto_new(c, sizeof(struct ospf_proto));
302
  struct ospf_config *cf = (struct ospf_config *) CF;
303
  struct proto *P = proto_new(CF);
304

  
305
  P->main_channel = proto_add_channel(P, proto_cf_main_channel(CF));
304 306

  
305
  P->accept_ra_types = RA_OPTIMAL;
306 307
  P->rt_notify = ospf_rt_notify;
307 308
  P->if_notify = ospf_if_notify;
308
  P->ifa_notify = oc->ospf2 ? ospf_ifa_notify2 : ospf_ifa_notify3;
309
  P->ifa_notify = cf->ospf2 ? ospf_ifa_notify2 : ospf_ifa_notify3;
309 310
  P->import_control = ospf_import_control;
310 311
  P->reload_routes = ospf_reload_routes;
311 312
  P->make_tmp_attrs = ospf_make_tmp_attrs;
......
389 390
  p->calcrt = 1;
390 391
}
391 392

  
392
static int
393
ospf_reload_routes(struct proto *P)
393
static void
394
ospf_reload_routes(struct channel *C)
394 395
{
395
  struct ospf_proto *p = (struct ospf_proto *) P;
396
  struct ospf_proto *p = (struct ospf_proto *) C->proto;
396 397

  
397
  if (p->calcrt != 2)
398
    OSPF_TRACE(D_EVENTS, "Scheduling routing table calculation with route reload");
398
  if (p->calcrt == 2)
399
    return;
399 400

  
401
  OSPF_TRACE(D_EVENTS, "Scheduling routing table calculation with route reload");
400 402
  p->calcrt = 2;
401

  
402
  return 1;
403 403
}
404 404

  
405 405

  
......
637 637
 * nonbroadcast network, cost of interface, etc.
638 638
 */
639 639
static int
640
ospf_reconfigure(struct proto *P, struct proto_config *c)
640
ospf_reconfigure(struct proto *P, struct proto_config *CF)
641 641
{
642 642
  struct ospf_proto *p = (struct ospf_proto *) P;
643 643
  struct ospf_config *old = (struct ospf_config *) (P->cf);
644
  struct ospf_config *new = (struct ospf_config *) c;
644
  struct ospf_config *new = (struct ospf_config *) CF;
645 645
  struct ospf_area_config *nac;
646 646
  struct ospf_area *oa, *oax;
647 647
  struct ospf_iface *ifa, *ifx;
648 648
  struct ospf_iface_patt *ip;
649 649

  
650
  if (proto_get_router_id(c) != p->router_id)
650
  if (proto_get_router_id(CF) != p->router_id)
651 651
    return 0;
652 652

  
653 653
  if (p->ospf2 != new->ospf2)
......
659 659
  if (old->abr != new->abr)
660 660
    return 0;
661 661

  
662
  if (!proto_configure_channel(P, &P->main_channel, proto_cf_main_channel(CF)))
663
    return 0;
664

  
662 665
  p->stub_router = new->stub_router;
663 666
  p->merge_external = new->merge_external;
664 667
  p->asbr = new->asbr;
......
1465 1468
  .template =		"ospf%d",
1466 1469
  .attr_class =		EAP_OSPF,
1467 1470
  .preference =		DEF_PREF_OSPF,
1471
  .channel_mask =	NB_IP,
1472
  .proto_size =		sizeof(struct ospf_proto),
1468 1473
  .config_size =	sizeof(struct ospf_config),
1469 1474
  .init =		ospf_init,
1470 1475
  .dump =		ospf_dump,

Also available in: Unified diff