summaryrefslogtreecommitdiff
path: root/proto/bgp
diff options
context:
space:
mode:
Diffstat (limited to 'proto/bgp')
-rw-r--r--proto/bgp/attrs.c7
-rw-r--r--proto/bgp/packets.c14
2 files changed, 17 insertions, 4 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;
}