summaryrefslogtreecommitdiff
path: root/proto
diff options
context:
space:
mode:
Diffstat (limited to 'proto')
-rw-r--r--proto/bgp/attrs.c7
-rw-r--r--proto/bgp/packets.c14
-rw-r--r--proto/mrt/mrt.c4
-rw-r--r--proto/ospf/ospf.c2
-rw-r--r--proto/static/static.c2
5 files changed, 21 insertions, 8 deletions
diff --git a/proto/bgp/attrs.c b/proto/bgp/attrs.c
index f4f7d15a..9f31c28b 100644
--- a/proto/bgp/attrs.c
+++ b/proto/bgp/attrs.c
@@ -2074,14 +2074,17 @@ bgp_rte_mergable(rte *pri, rte *sec)
u32 p, s;
/* Skip suppressed routes (see bgp_rte_recalculate()) */
- /* LLGR draft - depreference stale routes */
- if (pri->pflags != sec->pflags)
+ if ((pri->pflags ^ sec->pflags) & BGP_REF_SUPPRESSED)
return 0;
/* RFC 4271 9.1.2.1. Route resolvability test */
if (rta_resolvable(pri->attrs) != rta_resolvable(sec->attrs))
return 0;
+ /* LLGR draft - depreference stale routes */
+ if (rte_stale(pri) != rte_stale(sec))
+ return 0;
+
/* Start with local preferences */
x = ea_find(pri->attrs->eattrs, EA_CODE(PROTOCOL_BGP, BA_LOCAL_PREF));
y = ea_find(sec->attrs->eattrs, EA_CODE(PROTOCOL_BGP, BA_LOCAL_PREF));
diff --git a/proto/bgp/packets.c b/proto/bgp/packets.c
index c88165bc..2ebe2581 100644
--- a/proto/bgp/packets.c
+++ b/proto/bgp/packets.c
@@ -2324,6 +2324,9 @@ bgp_create_update(struct bgp_channel *c, byte *buf)
again: ;
+ struct lp_state tmpp;
+ lp_save(tmp_linpool, &tmpp);
+
/* Initialize write state */
struct bgp_write_state s = {
.proto = p,
@@ -2354,6 +2357,7 @@ again: ;
if (EMPTY_LIST(buck->prefixes))
{
bgp_free_bucket(c, buck);
+ lp_restore(tmp_linpool, &tmpp);
goto again;
}
@@ -2367,7 +2371,10 @@ again: ;
bgp_defer_bucket(c, buck);
if (!res)
+ {
+ lp_restore(tmp_linpool, &tmpp);
goto again;
+ }
goto done;
}
@@ -2378,7 +2385,7 @@ again: ;
done:
BGP_TRACE_RL(&rl_snd_update, D_PACKETS, "Sending UPDATE");
p->stats.tx_updates++;
- lp_flush(s.pool);
+ lp_restore(tmp_linpool, &tmpp);
return res;
}
@@ -2507,6 +2514,9 @@ bgp_rx_update(struct bgp_conn *conn, byte *pkt, uint len)
bgp_start_timer(conn->hold_timer, conn->hold_time);
+ struct lp_state tmpp;
+ lp_save(tmp_linpool, &tmpp);
+
/* Initialize parse state */
struct bgp_parse_state s = {
.proto = p,
@@ -2588,7 +2598,7 @@ bgp_rx_update(struct bgp_conn *conn, byte *pkt, uint len)
done:
rta_free(s.cached_rta);
- lp_flush(s.pool);
+ lp_restore(tmp_linpool, &tmpp);
return;
}
diff --git a/proto/mrt/mrt.c b/proto/mrt/mrt.c
index 589e43fb..58b8b671 100644
--- a/proto/mrt/mrt.c
+++ b/proto/mrt/mrt.c
@@ -557,8 +557,8 @@ mrt_table_dump_init(pool *pp)
struct mrt_table_dump_state *s = mb_allocz(pool, sizeof(struct mrt_table_dump_state));
s->pool = pool;
- s->linpool = lp_new(pool, 4080);
- s->peer_lp = lp_new(pool, 4080);
+ s->linpool = lp_new(pool);
+ s->peer_lp = lp_new(pool);
mrt_buffer_init(&s->buf, pool, 2 * MRT_ATTR_BUFFER_SIZE);
/* We lock the current config as we may reference it indirectly by filter */
diff --git a/proto/ospf/ospf.c b/proto/ospf/ospf.c
index d651d48d..ab77de02 100644
--- a/proto/ospf/ospf.c
+++ b/proto/ospf/ospf.c
@@ -299,7 +299,7 @@ ospf_start(struct proto *P)
p->lsab_size = 256;
p->lsab_used = 0;
p->lsab = mb_alloc(P->pool, p->lsab_size);
- p->nhpool = lp_new(P->pool, 12*sizeof(struct nexthop));
+ p->nhpool = lp_new(P->pool);
init_list(&(p->iface_list));
init_list(&(p->area_list));
fib_init(&p->rtf, P->pool, ospf_get_af(p), sizeof(ort), OFFSETOF(ort, fn), 0, NULL);
diff --git a/proto/static/static.c b/proto/static/static.c
index 8e0a3489..d027a8e6 100644
--- a/proto/static/static.c
+++ b/proto/static/static.c
@@ -475,7 +475,7 @@ static_start(struct proto *P)
struct static_route *r;
if (!static_lp)
- static_lp = lp_new(&root_pool, LP_GOOD_SIZE(1024));
+ static_lp = lp_new(&root_pool);
if (p->igp_table_ip4)
rt_lock_table(p->igp_table_ip4);