BGP Flowspec validation: Removed in-route optimization for multithreading compatibility
This commit is contained in:
parent
24773af9e0
commit
8a4bc4fdbf
5 changed files with 6 additions and 13 deletions
|
@ -267,7 +267,6 @@ typedef struct rte {
|
||||||
struct {
|
struct {
|
||||||
u8 suppressed; /* Used for deterministic MED comparison */
|
u8 suppressed; /* Used for deterministic MED comparison */
|
||||||
s8 stale; /* Route is LLGR_STALE, -1 if unknown */
|
s8 stale; /* Route is LLGR_STALE, -1 if unknown */
|
||||||
struct rtable *base_table; /* Base table for Flowspec validation */
|
|
||||||
} bgp;
|
} bgp;
|
||||||
#endif
|
#endif
|
||||||
} u;
|
} u;
|
||||||
|
|
|
@ -2831,12 +2831,16 @@ static rte *
|
||||||
rt_flowspec_update_rte(rtable *tab, rte *r)
|
rt_flowspec_update_rte(rtable *tab, rte *r)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_BGP
|
#ifdef CONFIG_BGP
|
||||||
if ((r->attrs->source != RTS_BGP) || !r->u.bgp.base_table)
|
if (r->attrs->source != RTS_BGP)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
struct bgp_channel *bc = (struct bgp_channel *) r->sender;
|
||||||
|
if (!bc->base_table)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
const net_addr *n = r->net->n.addr;
|
const net_addr *n = r->net->n.addr;
|
||||||
struct bgp_proto *p = (void *) r->src->proto;
|
struct bgp_proto *p = (void *) r->src->proto;
|
||||||
int valid = rt_flowspec_check(r->u.bgp.base_table, tab, n, r->attrs, p->is_interior);
|
int valid = rt_flowspec_check(bc->base_table, tab, n, r->attrs, p->is_interior);
|
||||||
int dest = valid ? RTD_NONE : RTD_UNREACHABLE;
|
int dest = valid ? RTD_NONE : RTD_UNREACHABLE;
|
||||||
|
|
||||||
if (dest == r->attrs->dest)
|
if (dest == r->attrs->dest)
|
||||||
|
|
|
@ -453,7 +453,6 @@ struct bgp_parse_state {
|
||||||
jmp_buf err_jmpbuf;
|
jmp_buf err_jmpbuf;
|
||||||
|
|
||||||
struct hostentry *hostentry;
|
struct hostentry *hostentry;
|
||||||
struct rtable *base_table;
|
|
||||||
adata *mpls_labels;
|
adata *mpls_labels;
|
||||||
|
|
||||||
/* Cached state for bgp_rte_update() */
|
/* Cached state for bgp_rte_update() */
|
||||||
|
|
|
@ -1025,9 +1025,6 @@ bgp_apply_flow_validation(struct bgp_parse_state *s, const net_addr *n, rta *a)
|
||||||
int valid = rt_flowspec_check(c->base_table, c->c.table, n, a, s->proto->is_interior);
|
int valid = rt_flowspec_check(c->base_table, c->c.table, n, a, s->proto->is_interior);
|
||||||
a->dest = valid ? RTD_NONE : RTD_UNREACHABLE;
|
a->dest = valid ? RTD_NONE : RTD_UNREACHABLE;
|
||||||
|
|
||||||
/* Set rte.bgp.base_table later from this state variable */
|
|
||||||
s->base_table = c->base_table;
|
|
||||||
|
|
||||||
/* Invalidate cached rta if dest changes */
|
/* Invalidate cached rta if dest changes */
|
||||||
if (s->cached_rta && (s->cached_rta->dest != a->dest))
|
if (s->cached_rta && (s->cached_rta->dest != a->dest))
|
||||||
{
|
{
|
||||||
|
@ -1398,7 +1395,6 @@ bgp_rte_update(struct bgp_parse_state *s, const net_addr *n, u32 path_id, rta *a
|
||||||
e->pflags = 0;
|
e->pflags = 0;
|
||||||
e->u.bgp.suppressed = 0;
|
e->u.bgp.suppressed = 0;
|
||||||
e->u.bgp.stale = -1;
|
e->u.bgp.stale = -1;
|
||||||
e->u.bgp.base_table = s->base_table;
|
|
||||||
rte_update3(&s->channel->c, n, e, s->last_src);
|
rte_update3(&s->channel->c, n, e, s->last_src);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2462,8 +2458,6 @@ bgp_decode_nlri(struct bgp_parse_state *s, u32 afi, byte *nlri, uint len, ea_lis
|
||||||
s->last_id = 0;
|
s->last_id = 0;
|
||||||
s->last_src = s->proto->p.main_source;
|
s->last_src = s->proto->p.main_source;
|
||||||
|
|
||||||
s->base_table = NULL;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* IPv4 BGP and MP-BGP may be used together in one update, therefore we do not
|
* IPv4 BGP and MP-BGP may be used together in one update, therefore we do not
|
||||||
* add BA_NEXT_HOP in bgp_decode_attrs(), but we add it here independently for
|
* add BA_NEXT_HOP in bgp_decode_attrs(), but we add it here independently for
|
||||||
|
|
|
@ -82,10 +82,7 @@ pipe_rt_notify(struct proto *P, struct channel *src_ch, net *n, rte *new, rte *o
|
||||||
#ifdef CONFIG_BGP
|
#ifdef CONFIG_BGP
|
||||||
/* Hack to cleanup cached value */
|
/* Hack to cleanup cached value */
|
||||||
if (e->src->proto->proto == &proto_bgp)
|
if (e->src->proto->proto == &proto_bgp)
|
||||||
{
|
|
||||||
e->u.bgp.stale = -1;
|
e->u.bgp.stale = -1;
|
||||||
e->u.bgp.base_table = NULL;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue