mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-12-22 17:51:53 +00:00
Implements route reload for OSPF.
This commit is contained in:
parent
63542845df
commit
f75747073e
@ -77,6 +77,7 @@
|
|||||||
#include "ospf.h"
|
#include "ospf.h"
|
||||||
|
|
||||||
|
|
||||||
|
static int ospf_reload_routes(struct proto *p);
|
||||||
static void ospf_rt_notify(struct proto *p, net * n, rte * new, rte * old UNUSED, ea_list * attrs);
|
static void ospf_rt_notify(struct proto *p, net * n, rte * new, rte * old UNUSED, ea_list * attrs);
|
||||||
static void ospf_ifa_notify(struct proto *p, unsigned flags, struct ifa *a);
|
static void ospf_ifa_notify(struct proto *p, unsigned flags, struct ifa *a);
|
||||||
static int ospf_rte_better(struct rte *new, struct rte *old);
|
static int ospf_rte_better(struct rte *new, struct rte *old);
|
||||||
@ -234,9 +235,10 @@ ospf_init(struct proto_config *c)
|
|||||||
{
|
{
|
||||||
struct proto *p = proto_new(c, sizeof(struct proto_ospf));
|
struct proto *p = proto_new(c, sizeof(struct proto_ospf));
|
||||||
|
|
||||||
p->import_control = ospf_import_control;
|
|
||||||
p->make_tmp_attrs = ospf_make_tmp_attrs;
|
p->make_tmp_attrs = ospf_make_tmp_attrs;
|
||||||
p->store_tmp_attrs = ospf_store_tmp_attrs;
|
p->store_tmp_attrs = ospf_store_tmp_attrs;
|
||||||
|
p->import_control = ospf_import_control;
|
||||||
|
p->reload_routes = ospf_reload_routes;
|
||||||
p->accept_ra_types = RA_OPTIMAL;
|
p->accept_ra_types = RA_OPTIMAL;
|
||||||
p->rt_notify = ospf_rt_notify;
|
p->rt_notify = ospf_rt_notify;
|
||||||
p->if_notify = ospf_iface_notify;
|
p->if_notify = ospf_iface_notify;
|
||||||
@ -345,6 +347,19 @@ schedule_rtcalc(struct proto_ospf *po)
|
|||||||
po->calcrt = 1;
|
po->calcrt = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
ospf_reload_routes(struct proto *p)
|
||||||
|
{
|
||||||
|
struct proto_ospf *po = (struct proto_ospf *) p;
|
||||||
|
|
||||||
|
if (po->calcrt != 2)
|
||||||
|
OSPF_TRACE(D_EVENTS, "Scheduling routing table calculation with route reload");
|
||||||
|
|
||||||
|
po->calcrt = 2;
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* area_disp - invokes origination of
|
* area_disp - invokes origination of
|
||||||
* router LSA and routing table cleanup
|
* router LSA and routing table cleanup
|
||||||
|
@ -719,7 +719,8 @@ struct proto_ospf
|
|||||||
unsigned tick;
|
unsigned tick;
|
||||||
struct top_graph *gr; /* LSA graph */
|
struct top_graph *gr; /* LSA graph */
|
||||||
slist lsal; /* List of all LSA's */
|
slist lsal; /* List of all LSA's */
|
||||||
int calcrt; /* Routing table calculation scheduled? */
|
int calcrt; /* Routing table calculation scheduled?
|
||||||
|
0=no, 1=normal, 2=forced reload */
|
||||||
int cleanup; /* Should I cleanup after RT calculation? */
|
int cleanup; /* Should I cleanup after RT calculation? */
|
||||||
list iface_list; /* Interfaces we really use */
|
list iface_list; /* Interfaces we really use */
|
||||||
list area_list;
|
list area_list;
|
||||||
|
@ -1133,6 +1133,9 @@ rt_sync(struct proto_ospf *po)
|
|||||||
struct area_net *anet;
|
struct area_net *anet;
|
||||||
int flush;
|
int flush;
|
||||||
|
|
||||||
|
/* This is used for forced reload of routes */
|
||||||
|
int reload = (po->calcrt == 2);
|
||||||
|
|
||||||
OSPF_TRACE(D_EVENTS, "Starting routing table synchronisation");
|
OSPF_TRACE(D_EVENTS, "Starting routing table synchronisation");
|
||||||
|
|
||||||
DBG("Now syncing my rt table with nest's\n");
|
DBG("Now syncing my rt table with nest's\n");
|
||||||
@ -1142,7 +1145,7 @@ again1:
|
|||||||
{
|
{
|
||||||
nf = (ort *) nftmp;
|
nf = (ort *) nftmp;
|
||||||
check_sum_lsa(po, nf, ORT_NET);
|
check_sum_lsa(po, nf, ORT_NET);
|
||||||
if (memcmp(&nf->n, &nf->o, sizeof(orta)))
|
if (reload || memcmp(&nf->n, &nf->o, sizeof(orta)))
|
||||||
{ /* Some difference */
|
{ /* Some difference */
|
||||||
net *ne;
|
net *ne;
|
||||||
rta a0;
|
rta a0;
|
||||||
|
Loading…
Reference in New Issue
Block a user