diff options
| author | Philippe Guibert <philippe.guibert@6wind.com> | 2023-06-13 14:53:03 +0200 | 
|---|---|---|
| committer | Philippe Guibert <philippe.guibert@6wind.com> | 2023-06-19 18:04:44 +0200 | 
| commit | 92550adfc77d9d01a2d7a96d67d8a5d27f7b6877 (patch) | |
| tree | 03aba5159dd9ba8a06f27793648f166596715c53 /bgpd/bgp_aspath.c | |
| parent | 0fb16305200113a92e3862e05d6833217f935211 (diff) | |
bgpd: add 'set as-path exclude all' command
It is not possible to flush all the incoming as-path list
from a given BGP update.
Add a route-map set command to remove all as-paths
from a given AS path. Add the necessary tests.
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Diffstat (limited to 'bgpd/bgp_aspath.c')
| -rw-r--r-- | bgpd/bgp_aspath.c | 18 | 
1 files changed, 18 insertions, 0 deletions
diff --git a/bgpd/bgp_aspath.c b/bgpd/bgp_aspath.c index 2c0de43c9b..22c9fe0e66 100644 --- a/bgpd/bgp_aspath.c +++ b/bgpd/bgp_aspath.c @@ -1598,6 +1598,24 @@ struct aspath *aspath_filter_exclude(struct aspath *source,  	return newpath;  } +struct aspath *aspath_filter_exclude_all(struct aspath *source) +{ +	struct aspath *newpath; + +	newpath = aspath_new(source->asnotation); + +	aspath_str_update(newpath, false); +	/* We are happy returning even an empty AS_PATH, because the +	 * administrator +	 * might expect this very behaviour. There's a mean to avoid this, if +	 * necessary, +	 * by having a match rule against certain AS_PATH regexps in the +	 * route-map index. +	 */ +	aspath_free(source); +	return newpath; +} +  /* Add specified AS to the leftmost of aspath. */  static struct aspath *aspath_add_asns(struct aspath *aspath, as_t asno,  				      uint8_t type, unsigned num)  | 
