Fixed nasty segfault in rip.
This commit is contained in:
parent
10f5c47d2e
commit
ec21aecfdd
2 changed files with 11 additions and 2 deletions
|
@ -155,6 +155,7 @@ typedef struct rte {
|
||||||
byte metric; /* RIP metric */
|
byte metric; /* RIP metric */
|
||||||
u16 tag; /* External route tag */
|
u16 tag; /* External route tag */
|
||||||
bird_clock_t lastmodX; /* Strange kind of last modification time */
|
bird_clock_t lastmodX; /* Strange kind of last modification time */
|
||||||
|
struct rip_entry *entry;
|
||||||
} rip;
|
} rip;
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_OSPF
|
#ifdef CONFIG_OSPF
|
||||||
|
|
|
@ -298,6 +298,7 @@ advertise_entry( struct proto *p, struct rip_block *b, ip_addr whotoldme )
|
||||||
n = net_get( p->table, b->network, pxlen );
|
n = net_get( p->table, b->network, pxlen );
|
||||||
r = rte_get_temp(a);
|
r = rte_get_temp(a);
|
||||||
r->u.rip.metric = ntohl(b->metric) + rif->metric;
|
r->u.rip.metric = ntohl(b->metric) + rif->metric;
|
||||||
|
r->u.rip.entry = NULL;
|
||||||
if (r->u.rip.metric > P_CF->infinity) r->u.rip.metric = P_CF->infinity;
|
if (r->u.rip.metric > P_CF->infinity) r->u.rip.metric = P_CF->infinity;
|
||||||
r->u.rip.tag = ntohl(b->tag);
|
r->u.rip.tag = ntohl(b->tag);
|
||||||
r->net = n;
|
r->net = n;
|
||||||
|
@ -438,7 +439,7 @@ static void
|
||||||
rip_timer(timer *t)
|
rip_timer(timer *t)
|
||||||
{
|
{
|
||||||
struct proto *p = t->data;
|
struct proto *p = t->data;
|
||||||
struct rip_entry *e, *et;
|
struct fib_node *e, *et;
|
||||||
|
|
||||||
CHK_MAGIC;
|
CHK_MAGIC;
|
||||||
DBG( "RIP: tick tock\n" );
|
DBG( "RIP: tick tock\n" );
|
||||||
|
@ -456,7 +457,10 @@ rip_timer(timer *t)
|
||||||
|
|
||||||
if (now - rte->u.rip.lastmodX > P_CF->timeout_time) {
|
if (now - rte->u.rip.lastmodX > P_CF->timeout_time) {
|
||||||
TRACE(D_EVENTS, "RIP: entry is too old: %I", rte->net->n.prefix );
|
TRACE(D_EVENTS, "RIP: entry is too old: %I", rte->net->n.prefix );
|
||||||
e->metric = P_CF->infinity;
|
if (rte->u.rip.entry) {
|
||||||
|
rte->u.rip.entry->metric = P_CF->infinity;
|
||||||
|
rte->u.rip.metric = P_CF->infinity;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (now - rte->u.rip.lastmodX > P_CF->garbage_time) {
|
if (now - rte->u.rip.lastmodX > P_CF->garbage_time) {
|
||||||
|
@ -772,6 +776,7 @@ rip_rt_notify(struct proto *p, struct network *net, struct rte *new, struct rte
|
||||||
e->nexthop = new->attrs->gw;
|
e->nexthop = new->attrs->gw;
|
||||||
e->metric = 0;
|
e->metric = 0;
|
||||||
e->whotoldme = IPA_NONE;
|
e->whotoldme = IPA_NONE;
|
||||||
|
new->u.rip.entry = e;
|
||||||
|
|
||||||
e->tag = ea_get_int(attrs, EA_RIP_TAG, 0);
|
e->tag = ea_get_int(attrs, EA_RIP_TAG, 0);
|
||||||
e->metric = ea_get_int(attrs, EA_RIP_METRIC, 1);
|
e->metric = ea_get_int(attrs, EA_RIP_METRIC, 1);
|
||||||
|
@ -880,6 +885,9 @@ rip_reconfigure(struct proto *p, struct proto_config *c)
|
||||||
struct rip_proto_config *new = (struct rip_proto_config *) c;
|
struct rip_proto_config *new = (struct rip_proto_config *) c;
|
||||||
int generic = sizeof(struct proto_config) + sizeof(list) /* + sizeof(struct password_item *) */;
|
int generic = sizeof(struct proto_config) + sizeof(list) /* + sizeof(struct password_item *) */;
|
||||||
|
|
||||||
|
/* FIXME: patt_same needed */
|
||||||
|
return 0;
|
||||||
|
|
||||||
if (!password_same(P_CF->passwords,
|
if (!password_same(P_CF->passwords,
|
||||||
new->passwords))
|
new->passwords))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in a new issue