mirror of
https://gitlab.labs.nic.cz/labs/bird.git
synced 2024-05-11 16:54:54 +00:00
Implements 'allow local as' option.
Similar to allowas-in option on other routers.
This commit is contained in:
@@ -950,8 +950,9 @@ bgp_create_attrs(struct bgp_proto *p, rte *e, ea_list **attrs, struct linpool *p
|
||||
static inline int
|
||||
bgp_as_path_loopy(struct bgp_proto *p, rta *a)
|
||||
{
|
||||
int num = p->cf->allow_local_as + 1;
|
||||
eattr *e = ea_find(a->eattrs, EA_CODE(EAP_BGP, BA_AS_PATH));
|
||||
return (e && as_path_is_member(e->u.ptr, p->local_as));
|
||||
return (e && (num > 0) && as_path_contains(e->u.ptr, p->local_as, num));
|
||||
}
|
||||
|
||||
static inline int
|
||||
|
@@ -44,6 +44,7 @@ struct bgp_config {
|
||||
int passive; /* Do not initiate outgoing connection */
|
||||
int interpret_communities; /* Hardwired handling of well-known communities */
|
||||
int secondary; /* Accept also non-best routes (i.e. RA_ACCEPTED) */
|
||||
int allow_local_as; /* Allow that number of local ASNs in incoming AS_PATHs */
|
||||
unsigned connect_retry_time;
|
||||
unsigned hold_time, initial_hold_time;
|
||||
unsigned keepalive_time;
|
||||
|
@@ -26,7 +26,7 @@ CF_KEYWORDS(BGP, LOCAL, NEIGHBOR, AS, HOLD, TIME, CONNECT, RETRY,
|
||||
PREFER, OLDER, MISSING, LLADDR, DROP, IGNORE, ROUTE, REFRESH,
|
||||
INTERPRET, COMMUNITIES, BGP_ORIGINATOR_ID, BGP_CLUSTER_LIST, IGP,
|
||||
TABLE, GATEWAY, DIRECT, RECURSIVE, MED, TTL, SECURITY, DETERMINISTIC,
|
||||
SECONDARY)
|
||||
SECONDARY, ALLOW)
|
||||
|
||||
CF_GRAMMAR
|
||||
|
||||
@@ -108,6 +108,8 @@ bgp_proto:
|
||||
| bgp_proto PASSIVE bool ';' { BGP_CFG->passive = $3; }
|
||||
| bgp_proto INTERPRET COMMUNITIES bool ';' { BGP_CFG->interpret_communities = $4; }
|
||||
| bgp_proto SECONDARY bool ';' { BGP_CFG->secondary = $3; }
|
||||
| bgp_proto ALLOW LOCAL AS ';' { BGP_CFG->allow_local_as = -1; }
|
||||
| bgp_proto ALLOW LOCAL AS expr ';' { BGP_CFG->allow_local_as = $5; }
|
||||
| bgp_proto IGP TABLE rtable ';' { BGP_CFG->igp_table = $4; }
|
||||
| bgp_proto TTL SECURITY bool ';' { BGP_CFG->ttl_security = $4; }
|
||||
;
|
||||
|
Reference in New Issue
Block a user