diff options
author | Trisha Biswas <tbiswas@fastly.com> | 2023-04-14 04:28:37 +0200 |
---|---|---|
committer | Ondrej Zajicek <santiago@crfreenet.org> | 2023-04-14 04:28:37 +0200 |
commit | 9e44ace3928a19560058dc713fcbff3a8bad3b3c (patch) | |
tree | a67a8a28a0b2c8a394a948977fbecaef7f7e1de1 /proto | |
parent | dc139fb6438f0864e83a9dc71e7c212c5acaf3ef (diff) |
BGP: Add 'allow bgp_med' option for EBGP sessions
This option allows to treat bgp_med as regular transitive attribute
on EBGP sessions (without hacks in filters).
Minor changes from committer.
Diffstat (limited to 'proto')
-rw-r--r-- | proto/bgp/attrs.c | 2 | ||||
-rw-r--r-- | proto/bgp/bgp.h | 1 | ||||
-rw-r--r-- | proto/bgp/config.Y | 1 |
3 files changed, 3 insertions, 1 deletions
diff --git a/proto/bgp/attrs.c b/proto/bgp/attrs.c index 1e234b16..204151c3 100644 --- a/proto/bgp/attrs.c +++ b/proto/bgp/attrs.c @@ -1834,7 +1834,7 @@ bgp_update_attrs(struct bgp_proto *p, struct bgp_channel *c, rte *e, ea_list *at /* MULTI_EXIT_DESC attribute - accept only if set in export filter */ a = bgp_find_attr(attrs0, BA_MULTI_EXIT_DISC); - if (a && !(a->fresh)) + if (a && !a->fresh && !p->cf->allow_med) bgp_unset_attr(&attrs, pool, BA_MULTI_EXIT_DISC); } diff --git a/proto/bgp/bgp.h b/proto/bgp/bgp.h index 0461ea28..302f58e7 100644 --- a/proto/bgp/bgp.h +++ b/proto/bgp/bgp.h @@ -108,6 +108,7 @@ struct bgp_config { int interpret_communities; /* Hardwired handling of well-known communities */ int allow_local_as; /* Allow that number of local ASNs in incoming AS_PATHs */ int allow_local_pref; /* Allow LOCAL_PREF in EBGP sessions */ + int allow_med; /* Allow BGP_MED in EBGP sessions */ int allow_as_sets; /* Allow AS_SETs in incoming AS_PATHs */ int enforce_first_as; /* Enable check for neighbor AS as first AS in AS_PATH */ int gr_mode; /* Graceful restart mode (BGP_GR_*) */ diff --git a/proto/bgp/config.Y b/proto/bgp/config.Y index a2dfa747..013d14af 100644 --- a/proto/bgp/config.Y +++ b/proto/bgp/config.Y @@ -199,6 +199,7 @@ bgp_proto: | 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 ALLOW BGP_LOCAL_PREF bool ';' { BGP_CFG->allow_local_pref = $4; } + | bgp_proto ALLOW BGP_MED bool ';' { BGP_CFG->allow_med = $4; } | bgp_proto ALLOW AS SETS bool ';' { BGP_CFG->allow_as_sets = $5; } | bgp_proto GRACEFUL RESTART bool ';' { BGP_CFG->gr_mode = $4; } | bgp_proto GRACEFUL RESTART AWARE ';' { BGP_CFG->gr_mode = BGP_GR_AWARE; } |