mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-12-22 17:51:53 +00:00
After contemplating about RIP route timeouts for a long time, I've implemented
protocol callbacks for route insertion and deletion from the central table. RIP should maintain its own per-protocol queue of existing routes, scan it periodically and call rte_discard() for routes that have timed out.
This commit is contained in:
parent
570ce189d7
commit
5b22683d2f
@ -58,7 +58,6 @@ struct proto {
|
|||||||
unsigned debug; /* Debugging flags */
|
unsigned debug; /* Debugging flags */
|
||||||
pool *pool; /* Local objects */
|
pool *pool; /* Local objects */
|
||||||
unsigned preference; /* Default route preference */
|
unsigned preference; /* Default route preference */
|
||||||
int ready; /* Already initialized */
|
|
||||||
|
|
||||||
void (*if_notify)(struct proto *, unsigned flags, struct iface *new, struct iface *old);
|
void (*if_notify)(struct proto *, unsigned flags, struct iface *new, struct iface *old);
|
||||||
void (*rt_notify)(struct proto *, struct network *net, struct rte *new, struct rte *old);
|
void (*rt_notify)(struct proto *, struct network *net, struct rte *new, struct rte *old);
|
||||||
@ -69,6 +68,8 @@ struct proto {
|
|||||||
|
|
||||||
int (*rta_same)(struct rtattr *, struct rtattr *);
|
int (*rta_same)(struct rtattr *, struct rtattr *);
|
||||||
int (*rte_better)(struct rte *, struct rte *);
|
int (*rte_better)(struct rte *, struct rte *);
|
||||||
|
int (*rte_insert)(struct network *, struct rte *);
|
||||||
|
int (*rte_remove)(struct network *, struct rte *);
|
||||||
|
|
||||||
/* Reconfigure function? */
|
/* Reconfigure function? */
|
||||||
/* Interface patterns */
|
/* Interface patterns */
|
||||||
|
@ -123,6 +123,7 @@ net *net_get(rtable *tab, unsigned tos, ip_addr addr, unsigned len);
|
|||||||
rte *rte_find(net *net, struct proto *p);
|
rte *rte_find(net *net, struct proto *p);
|
||||||
rte *rte_get_temp(struct rtattr *);
|
rte *rte_get_temp(struct rtattr *);
|
||||||
void rte_update(net *net, struct proto *p, rte *new);
|
void rte_update(net *net, struct proto *p, rte *new);
|
||||||
|
void rte_discard(net *net, rte *old);
|
||||||
void rte_dump(net *, rte *);
|
void rte_dump(net *, rte *);
|
||||||
void rt_dump(rtable *);
|
void rt_dump(rtable *);
|
||||||
void rt_dump_all(void);
|
void rt_dump_all(void);
|
||||||
|
@ -198,8 +198,20 @@ rte_update(net *net, struct proto *p, rte *new)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (old)
|
if (old)
|
||||||
|
{
|
||||||
|
if (p->rte_remove)
|
||||||
|
p->rte_remove(net, old);
|
||||||
rte_free(old);
|
rte_free(old);
|
||||||
|
}
|
||||||
new->lastmod = now;
|
new->lastmod = now;
|
||||||
|
if (p->rte_insert)
|
||||||
|
p->rte_insert(net, new);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
rte_discard(net *net, rte *old) /* Non-filtered route deletion, used during garbage collection */
|
||||||
|
{
|
||||||
|
rte_update(net, old->attrs->proto, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
Reference in New Issue
Block a user