summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDonatas Abraitis <donatas@opensourcerouting.org>2022-04-25 09:34:36 +0200
committerDonatas Abraitis <donatas@opensourcerouting.org>2022-04-25 13:05:22 +0200
commit77e3d82167b97a1ff4abe59d6e4f12086a61d9f9 (patch)
tree5c68e86eaa6fd6b9734e40928b6bee1390377299 /lib
parentMerge pull request #11064 from opensourcerouting/fix/allow_only_euid_0_runnin... (diff)
downloadfrr-77e3d82167b97a1ff4abe59d6e4f12086a61d9f9.tar.xz
frr-77e3d82167b97a1ff4abe59d6e4f12086a61d9f9.zip
bgpd: Add `set as-path replace <any|ASN>` cmd for route-maps
``` route-map tstas permit 10 set as-path replace 1 exit ``` Before: ``` donatas-laptop(config-router-af)# do show ip bgp 10.10.10.10/32 BGP routing table entry for 10.10.10.10/32, version 13 Paths: (1 available, best #1, table default) Advertised to non peer-group peers: 192.168.10.65 65000 1 2 3 123 192.168.10.65 from 192.168.10.65 (10.10.10.11) Origin IGP, metric 0, valid, external, best (First path received) Last update: Mon Apr 25 10:39:50 2022 ``` After: ``` donatas-laptop(config-router-af)# do show ip bgp 10.10.10.10/32 BGP routing table entry for 10.10.10.10/32, version 15 Paths: (1 available, best #1, table default) Advertised to non peer-group peers: 192.168.10.65 65000 65010 2 3 123 192.168.10.65 from 192.168.10.65 (10.10.10.11) Origin IGP, metric 0, valid, external, best (First path received) Last update: Mon Apr 25 10:40:16 2022 ``` Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/routemap.h1
-rw-r--r--lib/routemap_cli.c5
2 files changed, 6 insertions, 0 deletions
diff --git a/lib/routemap.h b/lib/routemap.h
index 3ef60222b..13dafe684 100644
--- a/lib/routemap.h
+++ b/lib/routemap.h
@@ -370,6 +370,7 @@ DECLARE_QOBJ_TYPE(route_map);
(strmatch(A, "frr-bgp-route-map:as-path-prepend"))
#define IS_SET_AS_EXCLUDE(A) \
(strmatch(A, "frr-bgp-route-map:as-path-exclude"))
+#define IS_SET_AS_REPLACE(A) (strmatch(A, "frr-bgp-route-map:as-path-replace"))
#define IS_SET_IPV6_NH_GLOBAL(A) \
(strmatch(A, "frr-bgp-route-map:ipv6-nexthop-global"))
#define IS_SET_IPV6_VPN_NH(A) \
diff --git a/lib/routemap_cli.c b/lib/routemap_cli.c
index 315007be1..ff98a14c4 100644
--- a/lib/routemap_cli.c
+++ b/lib/routemap_cli.c
@@ -1197,6 +1197,11 @@ void route_map_action_show(struct vty *vty, const struct lyd_node *dnode,
yang_dnode_get_string(
dnode,
"./rmap-set-action/frr-bgp-route-map:exclude-as-path"));
+ } else if (IS_SET_AS_REPLACE(action)) {
+ vty_out(vty, " set as-path replace %s\n",
+ yang_dnode_get_string(
+ dnode,
+ "./rmap-set-action/frr-bgp-route-map:replace-as-path"));
} else if (IS_SET_AS_PREPEND(action)) {
if (yang_dnode_exists(
dnode,