Commit b8a3608a authored by Ondřej Zajíček's avatar Ondřej Zajíček

BGP: Cleanup channels when going down

When going up, uncleaned old channel state may trigger unexpected
conditions crashing bird.
parent 5a50a989
Pipeline #44659 passed with stages
in 3 minutes and 47 seconds
...@@ -1692,6 +1692,11 @@ bgp_channel_cleanup(struct channel *C) ...@@ -1692,6 +1692,11 @@ bgp_channel_cleanup(struct channel *C)
if (c->igp_table_ip6) if (c->igp_table_ip6)
rt_unlock_table(c->igp_table_ip6); rt_unlock_table(c->igp_table_ip6);
c->index = 0;
/* Cleanup rest of bgp_channel starting at pool field */
memset(&(c->pool), 0, sizeof(struct bgp_channel) - OFFSETOF(struct bgp_channel, pool));
} }
static inline struct bgp_channel_config * static inline struct bgp_channel_config *
......
...@@ -299,12 +299,16 @@ struct bgp_channel { ...@@ -299,12 +299,16 @@ struct bgp_channel {
/* Rest are BGP specific data */ /* Rest are BGP specific data */
struct bgp_channel_config *cf; struct bgp_channel_config *cf;
pool *pool; /* XXXX */
u32 afi; u32 afi;
u32 index; u32 index;
const struct bgp_af_desc *desc; const struct bgp_af_desc *desc;
rtable *igp_table_ip4; /* Table for recursive IPv4 next hop lookups */
rtable *igp_table_ip6; /* Table for recursive IPv6 next hop lookups */
/* Rest are zeroed when down */
pool *pool;
HASH(struct bgp_bucket) bucket_hash; /* Hash table of route buckets */ HASH(struct bgp_bucket) bucket_hash; /* Hash table of route buckets */
struct bgp_bucket *withdraw_bucket; /* Withdrawn routes */ struct bgp_bucket *withdraw_bucket; /* Withdrawn routes */
list bucket_queue; /* Queue of buckets to send (struct bgp_bucket) */ list bucket_queue; /* Queue of buckets to send (struct bgp_bucket) */
...@@ -312,8 +316,6 @@ struct bgp_channel { ...@@ -312,8 +316,6 @@ struct bgp_channel {
HASH(struct bgp_prefix) prefix_hash; /* Prefixes to be sent */ HASH(struct bgp_prefix) prefix_hash; /* Prefixes to be sent */
slab *prefix_slab; /* Slab holding prefix nodes */ slab *prefix_slab; /* Slab holding prefix nodes */
rtable *igp_table_ip4; /* Table for recursive IPv4 next hop lookups */
rtable *igp_table_ip6; /* Table for recursive IPv6 next hop lookups */
ip_addr next_hop_addr; /* Local address for NEXT_HOP attribute */ ip_addr next_hop_addr; /* Local address for NEXT_HOP attribute */
ip_addr link_addr; /* Link-local version of next_hop_addr */ ip_addr link_addr; /* Link-local version of next_hop_addr */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment