0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2025-03-11 17:08:46 +00:00

Merge commit '54430df9' into thread-next

This commit is contained in:
Maria Matejka 2022-11-07 10:09:01 +01:00
commit 34e803c6c3
6 changed files with 51 additions and 20 deletions

View File

@ -985,6 +985,9 @@ static int reconfigure_type; /* Hack to propagate type info to channel_reconfig
int
channel_reconfigure(struct channel *c, struct channel_config *cf)
{
/* Touched by reconfiguration */
c->stale = 0;
/* FIXME: better handle these changes, also handle in_keep_filtered */
if ((c->table != cf->table->table) ||
(cf->ra_mode && (c->ra_mode != cf->ra_mode)) ||

View File

@ -2025,6 +2025,10 @@ bgp_preexport(struct channel *C, rte *e)
struct bgp_proto *src = bgp_rte_proto(e);
struct bgp_channel *c = (struct bgp_channel *) C;
/* Ignore non-BGP channels */
if (C->channel != &channel_bgp)
return -1;
/* Reject our routes */
if (src == p)
return -1;
@ -2232,6 +2236,10 @@ bgp_rt_notify(struct proto *P, struct channel *C, const net_addr *n, rte *new, c
struct bgp_bucket *buck;
struct rte_src *path;
/* Ignore non-BGP channels */
if (C->channel != &channel_bgp)
return;
if (new)
{
struct ea_list *attrs = bgp_update_attrs(p, c, new, new->attrs, tmp_linpool);

View File

@ -263,7 +263,7 @@ static inline struct bgp_channel *
bgp_find_channel(struct bgp_proto *p, u32 afi)
{
struct bgp_channel *c;
WALK_LIST(c, p->p.channels)
BGP_WALK_CHANNELS(p, c)
if (c->afi == afi)
return c;
@ -597,7 +597,7 @@ bgp_conn_enter_established_state(struct bgp_conn *conn)
/* Summary state of ADD_PATH RX for active channels */
uint summary_add_path_rx = 0;
WALK_LIST(c, p->p.channels)
BGP_WALK_CHANNELS(p, c)
{
const struct bgp_af_caps *loc = bgp_find_af_caps(local, c->afi);
const struct bgp_af_caps *rem = bgp_find_af_caps(peer, c->afi);
@ -679,7 +679,7 @@ bgp_conn_enter_established_state(struct bgp_conn *conn)
p->channel_count = num;
p->summary_add_path_rx = summary_add_path_rx;
WALK_LIST(c, p->p.channels)
BGP_WALK_CHANNELS(p, c)
{
if (c->c.disabled)
continue;
@ -758,7 +758,7 @@ bgp_handle_graceful_restart(struct bgp_proto *p)
p->gr_active_num = 0;
struct bgp_channel *c;
WALK_LIST(c, p->p.channels)
BGP_WALK_CHANNELS(p, c)
{
/* FIXME: perhaps check for channel state instead of disabled flag? */
if (c->c.disabled)
@ -898,7 +898,7 @@ bgp_graceful_restart_timeout(timer *t)
if (p->llgr_ready)
{
struct bgp_channel *c;
WALK_LIST(c, p->p.channels)
BGP_WALK_CHANNELS(p, c)
{
/* Channel is not in GR and is already flushed */
if (!c->gr_active)
@ -1447,6 +1447,10 @@ bgp_reload_routes(struct channel *C)
struct bgp_proto *p = (void *) C->proto;
struct bgp_channel *c = (void *) C;
/* Ignore non-BGP channels */
if (C->channel != &channel_bgp)
return;
ASSERT(p->conn && p->route_refresh);
bgp_schedule_packet(p->conn, c, PKT_ROUTE_REFRESH);
}
@ -1457,6 +1461,10 @@ bgp_feed_begin(struct channel *C, int initial)
struct bgp_proto *p = (void *) C->proto;
struct bgp_channel *c = (void *) C;
/* Ignore non-BGP channels */
if (C->channel != &channel_bgp)
return;
/* This should not happen */
if (!p->conn)
return;
@ -1488,6 +1496,10 @@ bgp_feed_end(struct channel *C)
struct bgp_proto *p = (void *) C->proto;
struct bgp_channel *c = (void *) C;
/* Ignore non-BGP channels */
if (C->channel != &channel_bgp)
return;
if (c->feed_out_table)
{
c->feed_out_table = 0;
@ -1610,7 +1622,7 @@ bgp_start(struct proto *P)
if (p->p.gr_recovery && p->cf->gr_mode)
{
struct bgp_channel *c;
WALK_LIST(c, p->p.channels)
BGP_WALK_CHANNELS(p, c)
channel_graceful_restart_lock(&c->c);
}
@ -1769,7 +1781,7 @@ bgp_init(struct proto_config *CF)
/* Add all channels */
struct bgp_channel_config *cc;
WALK_LIST(cc, CF->channels)
BGP_CF_WALK_CHANNELS(cf, cc)
proto_add_channel(P, &cc->c);
return P;
@ -1915,7 +1927,7 @@ bgp_find_channel_config(struct bgp_config *cf, u32 afi)
{
struct bgp_channel_config *cc;
WALK_LIST(cc, cf->c.channels)
BGP_CF_WALK_CHANNELS(cf, cc)
if (cc->afi == afi)
return cc;
@ -2065,7 +2077,7 @@ bgp_postconfig(struct proto_config *CF)
struct bgp_channel_config *cc;
WALK_LIST(cc, CF->channels)
BGP_CF_WALK_CHANNELS(cf, cc)
{
/* Handle undefined import filter */
if (cc->c.in_filter == FILTER_UNDEF)
@ -2172,20 +2184,16 @@ bgp_reconfigure(struct proto *P, struct proto_config *CF)
WALK_LIST(C, p->p.channels)
C->stale = 1;
WALK_LIST(cc, new->c.channels)
BGP_CF_WALK_CHANNELS(new, cc)
{
C = (struct channel *) bgp_find_channel(p, cc->afi);
same = proto_configure_channel(P, &C, &cc->c) && same;
if (C)
C->stale = 0;
}
WALK_LIST_DELSAFE(C, C2, p->p.channels)
if (C->stale)
same = proto_configure_channel(P, &C, NULL) && same;
if (same && (p->start_state > BSS_PREPARE))
bgp_update_bfd(p, new->bfd);
@ -2630,6 +2638,9 @@ bgp_show_proto_info(struct proto *P)
{
channel_show_info(&c->c);
if (c->c.channel != &channel_bgp)
continue;
if (p->gr_active_num)
cli_msg(-1006, " Neighbor GR: %s", bgp_gr_states[c->gr_active]);

View File

@ -500,6 +500,9 @@ struct bgp_parse_state {
#define BGP_RX_BUFFER_EXT_SIZE 65535
#define BGP_TX_BUFFER_EXT_SIZE 65535
#define BGP_CF_WALK_CHANNELS(P,C) WALK_LIST(C, P->c.channels) if (C->c.channel == &channel_bgp)
#define BGP_WALK_CHANNELS(P,C) WALK_LIST(C, P->p.channels) if (C->c.channel == &channel_bgp)
static inline int bgp_channel_is_ipv4(struct bgp_channel *c)
{ return BGP_AFI(c->afi) == BGP_AFI_IPV4; }

View File

@ -262,7 +262,7 @@ bgp_prepare_capabilities(struct bgp_conn *conn)
}
/* Allocate and fill per-AF fields */
WALK_LIST(c, p->p.channels)
BGP_WALK_CHANNELS(p, c)
{
ac = &caps->af_data[caps->af_count++];
ac->afi = c->afi;
@ -681,7 +681,7 @@ bgp_check_capabilities(struct bgp_conn *conn)
/* This is partially overlapping with bgp_conn_enter_established_state(),
but we need to run this just after we receive OPEN message */
WALK_LIST(c, p->p.channels)
BGP_WALK_CHANNELS(p, c)
{
const struct bgp_af_caps *loc = bgp_find_af_caps(local, c->afi);
const struct bgp_af_caps *rem = bgp_find_af_caps(remote, c->afi);

View File

@ -299,12 +299,13 @@ rpki_cache_change_state(struct rpki_cache *cache, const enum rpki_cache_state ne
case RPKI_CS_NO_INCR_UPDATE_AVAIL:
/* Server was unable to answer the last Serial Query and sent Cache Reset. */
rpki_cache_change_state(cache, RPKI_CS_RESET);
break;
case RPKI_CS_ERROR_NO_DATA_AVAIL:
/* No validation records are available on the cache server. */
rpki_cache_change_state(cache, RPKI_CS_RESET);
if (old_state == RPKI_CS_ESTABLISHED)
rpki_cache_change_state(cache, RPKI_CS_RESET);
else
rpki_schedule_next_retry(cache);
break;
case RPKI_CS_ERROR_FATAL:
@ -488,6 +489,11 @@ rpki_retry_hook(timer *tm)
}
break;
case RPKI_CS_NO_INCR_UPDATE_AVAIL:
case RPKI_CS_ERROR_NO_DATA_AVAIL:
rpki_cache_change_state(cache, RPKI_CS_RESET);
break;
default:
rpki_cache_change_state(cache, RPKI_CS_CONNECTING);
break;