mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2025-01-18 06:51:54 +00:00
Merge commit 'b6923f6386b04340d6b2b6a75fbe83c392f207ca' into mq-merge-step-1
This commit is contained in:
commit
23025ab5f8
@ -546,9 +546,6 @@ bgp_conn_enter_openconfirm_state(struct bgp_conn *conn)
|
|||||||
bgp_conn_set_state(conn, BS_OPENCONFIRM);
|
bgp_conn_set_state(conn, BS_OPENCONFIRM);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct bgp_af_caps dummy_af_caps = { };
|
|
||||||
static const struct bgp_af_caps basic_af_caps = { .ready = 1 };
|
|
||||||
|
|
||||||
void
|
void
|
||||||
bgp_conn_enter_established_state(struct bgp_conn *conn)
|
bgp_conn_enter_established_state(struct bgp_conn *conn)
|
||||||
{
|
{
|
||||||
@ -604,20 +601,6 @@ bgp_conn_enter_established_state(struct bgp_conn *conn)
|
|||||||
const struct bgp_af_caps *loc = bgp_find_af_caps(local, c->afi);
|
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);
|
const struct bgp_af_caps *rem = bgp_find_af_caps(peer, c->afi);
|
||||||
|
|
||||||
/* Use default if capabilities were not announced */
|
|
||||||
if (!local->length && (c->afi == BGP_AF_IPV4))
|
|
||||||
loc = &basic_af_caps;
|
|
||||||
|
|
||||||
if (!peer->length && (c->afi == BGP_AF_IPV4))
|
|
||||||
rem = &basic_af_caps;
|
|
||||||
|
|
||||||
/* Ignore AFIs that were not announced in multiprotocol capability */
|
|
||||||
if (!loc || !loc->ready)
|
|
||||||
loc = &dummy_af_caps;
|
|
||||||
|
|
||||||
if (!rem || !rem->ready)
|
|
||||||
rem = &dummy_af_caps;
|
|
||||||
|
|
||||||
int active = loc->ready && rem->ready;
|
int active = loc->ready && rem->ready;
|
||||||
c->c.disabled = !active;
|
c->c.disabled = !active;
|
||||||
c->c.reloadable = p->route_refresh || c->cf->import_table;
|
c->c.reloadable = p->route_refresh || c->cf->import_table;
|
||||||
|
@ -173,8 +173,11 @@ bgp_create_notification(struct bgp_conn *conn, byte *buf)
|
|||||||
|
|
||||||
/* Capability negotiation as per RFC 5492 */
|
/* Capability negotiation as per RFC 5492 */
|
||||||
|
|
||||||
const struct bgp_af_caps *
|
static const struct bgp_af_caps dummy_af_caps = { };
|
||||||
bgp_find_af_caps(struct bgp_caps *caps, u32 afi)
|
static const struct bgp_af_caps basic_af_caps = { .ready = 1 };
|
||||||
|
|
||||||
|
static const struct bgp_af_caps *
|
||||||
|
bgp_find_af_caps_(struct bgp_caps *caps, u32 afi)
|
||||||
{
|
{
|
||||||
struct bgp_af_caps *ac;
|
struct bgp_af_caps *ac;
|
||||||
|
|
||||||
@ -185,6 +188,23 @@ bgp_find_af_caps(struct bgp_caps *caps, u32 afi)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const struct bgp_af_caps *
|
||||||
|
bgp_find_af_caps(struct bgp_caps *caps, u32 afi)
|
||||||
|
{
|
||||||
|
const struct bgp_af_caps *ac = bgp_find_af_caps_(caps, afi);
|
||||||
|
|
||||||
|
/* Return proper capability if found */
|
||||||
|
if (ac)
|
||||||
|
return ac;
|
||||||
|
|
||||||
|
/* Use default if capabilities were not announced */
|
||||||
|
if (!caps->length && (afi == BGP_AF_IPV4))
|
||||||
|
return &basic_af_caps;
|
||||||
|
|
||||||
|
/* Ignore AFIs that were not announced in multiprotocol capability */
|
||||||
|
return &dummy_af_caps;
|
||||||
|
}
|
||||||
|
|
||||||
static struct bgp_af_caps *
|
static struct bgp_af_caps *
|
||||||
bgp_get_af_caps(struct bgp_caps **pcaps, u32 afi)
|
bgp_get_af_caps(struct bgp_caps **pcaps, u32 afi)
|
||||||
{
|
{
|
||||||
@ -692,8 +712,7 @@ bgp_check_capabilities(struct bgp_conn *conn)
|
|||||||
const struct bgp_af_caps *rem = bgp_find_af_caps(remote, c->afi);
|
const struct bgp_af_caps *rem = bgp_find_af_caps(remote, c->afi);
|
||||||
|
|
||||||
/* Find out whether this channel will be active */
|
/* Find out whether this channel will be active */
|
||||||
int active = loc && loc->ready &&
|
int active = loc->ready && rem->ready;
|
||||||
((rem && rem->ready) || (!remote->length && (c->afi == BGP_AF_IPV4)));
|
|
||||||
|
|
||||||
/* Mandatory must be active */
|
/* Mandatory must be active */
|
||||||
if (c->cf->mandatory && !active)
|
if (c->cf->mandatory && !active)
|
||||||
@ -2440,7 +2459,7 @@ bgp_create_update_bmp(struct bgp_channel *c, byte *buf, struct bgp_bucket *buck,
|
|||||||
.proto = p,
|
.proto = p,
|
||||||
.channel = c,
|
.channel = c,
|
||||||
.pool = tmp_linpool,
|
.pool = tmp_linpool,
|
||||||
.mp_reach = (c->afi != BGP_AF_IPV4) || (rem && rem->ext_next_hop),
|
.mp_reach = (c->afi != BGP_AF_IPV4) || rem->ext_next_hop,
|
||||||
.as4_session = 1,
|
.as4_session = 1,
|
||||||
.add_path = c->add_path_rx,
|
.add_path = c->add_path_rx,
|
||||||
.mpls = c->desc->mpls,
|
.mpls = c->desc->mpls,
|
||||||
|
Loading…
Reference in New Issue
Block a user