summaryrefslogtreecommitdiff
path: root/lib/routemap_cli.c
AgeCommit message (Collapse)Author
2025-02-27bgpd: add match ecommunity <exact|any> optionsPhilippe Guibert
The exact-match and the any options are missing for the extended communities. Add missing options that are present on the match operations for communities and large-communities. > route-map rmap permit 1 > match extcommunity 1 > exit > ! > route-map rmap permit 2 > match extcommunity 2 any > exit > ! > route-map rmap permit 3 > match extcommunity 3 exact-match > exit Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2025-02-27bgpd: add 'match extcommunity-count' command to restrict comm countPhilippe Guibert
Add a mechanism in route-map to filter out route-map which have a list of extended communities greater than the given number. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2025-01-14bgpd: add 'match community-count' command to restrict comm countPhilippe Guibert
Add a mechanism in route-map to filter out route-map which have a list of communities greater than the given number. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2024-10-16Merge pull request #16946 from opensourcerouting/fix/match_src-peerRuss White
bgpd: Implement match src-peer ... command
2024-10-15bgpd: Implement `set metric aigp` commandDonatas Abraitis
Same as `set metric igp`, but in this case accumulated IGP metric is being sent as MED attribute. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-10-15bgpd: Implement `set metric igp` commandDonatas Abraitis
Set metric automatically from the path info (IGP protocol). Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-10-10bgpd: Move some non BGP-specific route-map functions to libDonatas Abraitis
They are managed under `frr-route-map`, not under `frr-bgp-route-map`. Fixes: https://github.com/FRRouting/frr/issues/17055 Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-09-27bgpd: Implement `match src-peer ...` commandDonatas Abraitis
To match source peer on the outgoing direction. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-08-15*: Fix spelling errors foundDonald Sharp
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-05-10lib: Allow doing match/set tag untaggedDonatas Abraitis
In route-map: `match tag untagged`. E.g. Cisco/Juniper allows that, but they use `match tag 0` instead. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-04-22bgpd: Implement draft-li-idr-link-bandwidth-ext-01Donatas Abraitis
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-02-04*: use af-specific autocompletion for prefix-lists when possibleIgor Ryzhov
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2023-11-29lib: all: remove './' from xpath 22% speedupChristian Hopps
fixes #8299 Signed-off-by: Christian Hopps <chopps@labn.net>
2023-10-02bgpd: add 'match community-list any' functionPhilippe Guibert
There is no match mechanism to match one community from the incoming community-list. Add the 'any' keyword to the 'match route-map' command of communit-list and large-community-list. > match community-list AAA any > match large-community-list AAA any Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2023-07-31bgpd: add set extended-comm-list <> delete commandFarid Mihoub
Signed-off-by: Farid Mihoub <farid.mihoub@6wind.com> Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2023-06-26bgpd: add colored extended communities supportFrancois Dumontet
add support of color extended community, conforming to RFC 9012. This extended community will be added to the existing one, RT,SOO and Node Target. The configuration will be made through the route-map service. find above a configuration example: router bgp 65001 bgp router-id 192.168.1.1 no bgp ebgp-requires-policy no bgp network import-check neighbor 192.168.1.2 remote-as external neighbor 192.168.1.3 remote-as external neighbor 192.168.1.4 remote-as external address-family ipv4 unicast network 10.10.10.10/24 route-map rmap exit-address-family ! route-map rmap permit 10 set extcommunity color 55555 200 exit Signed-off-by: Francois Dumontet <francois.dumontet@6wind.com>
2023-05-11bgpd: Implement `match source-protocol` for route-mapsDonatas Abraitis
The main idea is to filter routes by matching source (originating) protocol for outgoing direction. For instance, filter outgoing routes to an arbitrary router that are static only. Or filter out only routes learned from RIP. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-04-25Merge pull request #13310 from ↵Russ White
opensourcerouting/feature/bgpd_node_target_extended_community bgpd: Add Node Target Extended Communities support
2023-04-18lib, ospfd, yang: add route map set for min/max metricJafar Al-Gharaibeh
Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
2023-04-14bgpd: Implement Node Target Extended CommunitiesDonatas Abraitis
kttps://datatracker.ietf.org/doc/html/draft-ietf-idr-node-target-ext-comm unet> sh r1 vtysh -c 'sh ip bgp nei 192.168.1.2 adver' BGP table version is 1, local router ID is 192.168.1.1, vrf id 0 Default local pref 100, local AS 65001 Status codes: s suppressed, d damped, h history, * valid, > best, = multipath, i internal, r RIB-failure, S Stale, R Removed Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self Origin codes: i - IGP, e - EGP, ? - incomplete RPKI validation codes: V valid, I invalid, N Not found Network Next Hop Metric LocPrf Weight Path *> 10.10.10.10/32 0.0.0.0 0 32768 i Total number of prefixes 1 unet> sh r1 vtysh -c 'sh ip bgp nei 192.168.1.3 adver' BGP table version is 1, local router ID is 192.168.1.1, vrf id 0 Default local pref 100, local AS 65001 Status codes: s suppressed, d damped, h history, * valid, > best, = multipath, i internal, r RIB-failure, S Stale, R Removed Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self Origin codes: i - IGP, e - EGP, ? - incomplete RPKI validation codes: V valid, I invalid, N Not found Network Next Hop Metric LocPrf Weight Path *> 10.10.10.10/32 0.0.0.0 0 32768 i Total number of prefixes 1 unet> sh r2 vtysh -c 'show ip bgp 10.10.10.10/32' % Network not in table unet> sh r3 vtysh -c 'show ip bgp 10.10.10.10/32' BGP routing table entry for 10.10.10.10/32, version 1 Paths: (1 available, best #1, table default) Advertised to non peer-group peers: 192.168.1.1 65001 192.168.1.1 from 192.168.1.1 (192.168.1.1) Origin IGP, metric 0, valid, external, best (First path received) Extended Community: NT:192.168.1.3 NT:192.168.1.4 Last update: Tue Apr 11 23:19:33 2023 unet> Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-02-09*: auto-convert to SPDX License IDsDavid Lamparter
Done with a combination of regex'ing and banging my head against a wall. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-11-03Merge pull request #12196 from opensourcerouting/xref-vtyshDonald Sharp
*: rewrite `extract.pl` using `xref` infra
2022-10-26build, vtysh: extract vtysh commands from .xrefDavid Lamparter
Rather than running selected source files through the preprocessor and a bunch of perl regex'ing to get the list of all DEFUNs, use the data collected in frr.xref. This not only eliminates issues we've been having with preprocessor failures due to nonexistent header files, but is also much faster. Where extract.pl would take 5s, this now finishes in 0.2s. And since this is a non-parallelizable build step towards the end of the build (dependent on a lot of other things being done already), the speedup is actually noticeable. Also files containing CLI no longer need to be listed in `vtysh_scan` since the .xref data covers everything. `#ifndef VTYSH_EXTRACT_PL` checks are equally obsolete. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-10-26bgpd: Implement Accumulated IGP Metric Attribute for BGPDonatas Abraitis
https://www.rfc-editor.org/rfc/rfc7311.html Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-09-13Merge pull request #11899 from ↵Russ White
opensourcerouting/feature/route_validation_extended_community bgpd: Implement Origin Validation State via extended communities
2022-09-05bgpd: add resolution for l3vpn traffic over gre interfacesPhilippe Guibert
When a route imported from l3vpn is analysed, the nexthop from default VRF is looked up against a valid MPLS path. Generally, this is done on backbones with a MPLS signalisation transport layer like LDP. Generally, the BGP connection is multiple hops away. That scenario is already working. There is case where it is possible to run L3VPN over GRE interfaces, and where there is no LSP path over that GRE interface: GRE is just here to tunnel MPLS traffic. On that case, the nexthop given in the path does not have MPLS path, but should be authorized to convey MPLS traffic provided that the user permits it via a configuration command. That commit introduces a new command that can be activated in route-map: > set l3vpn next-hop encapsulation gre That command authorizes the nexthop tracking engine to accept paths that o have a GRE interface as output, independently of the presence of an LSP path or not. A configuration example is given below. When bgp incoming vpnv4 updates are received, the nexthop of NLRI is 192.168.0.2. Based on nexthop tracking service from zebra, BGP knows that the output interface to reach 192.168.0.2 is r1-gre0. Because that interface is not MPLS based, but is a GRE tunnel, then the update will be using that nexthop to be installed. interface r1-gre0 ip address 192.168.0.1/24 exit router bgp 65500 bgp router-id 1.1.1.1 neighbor 192.168.0.2 remote-as 65500 ! address-family ipv4 unicast no neighbor 192.168.0.2 activate exit-address-family ! address-family ipv4 vpn neighbor 192.168.0.2 activate neighbor 192.168.0.2 route-map rmap in exit-address-family exit ! router bgp 65500 vrf vrf1 bgp router-id 1.1.1.1 no bgp network import-check ! address-family ipv4 unicast network 10.201.0.0/24 redistribute connected label vpn export 101 rd vpn export 444:1 rt vpn both 52:100 export vpn import vpn exit-address-family exit ! route-map rmap permit 1 set l3vpn next-hop encapsulation gre exit Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2022-09-04bgpd: Handle Origin Validation State extended community via route-map matchDonatas Abraitis
Add an ability to match via route-maps. An additional route-map command `match rpki-extcommunity <invalid|notfound|valid>` added. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-04-25bgpd: Add `set as-path replace <any|ASN>` cmd for route-mapsDonatas Abraitis
``` 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>
2022-04-11lib: Remove deprecated routemap_optimization_cmdDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-03-31bgpd: Show `match script SCRIPT` in running configDonatas Abraitis
Before: ``` route-map lua permit 10 exit ``` After: ``` route-map lua permit 10 match script rm exit ``` Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2021-12-03lib: routemap config output cleanupIgor Ryzhov
Just a small cleanup to unify the code and remove duplication. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-11-24bgpd: Add an ability to match ipv6 next-hop by prefix-listDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-11-23lib: Use autocomplete for `route-map <name> <action> <seq>`Donatas Abraitis
``` exit1-debian-11(config)# route-map ? RMAP_NAME Route map tag belekas testas ``` Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-11-23bgpd: Add an ability to match ipv6 next-hop by access-listDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-11-19bgpd, lib: fix inconsistency of match ip/ipv6 next-hop commandsIgor Ryzhov
For IPv4 matching, we have "match ip next-hop address A.B.C.D". For IPv6 matching, we have "match ipv6 next-hop X:X::X:X". To have consistency, let's add "address" keyword to IPv6 commands. Old commands are preserved as hidden for backward compatibility. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-10-31lib: Add autocomplete for access-listsDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-10-28lib: Add autocomplete for prefix-list under route-mapsDonatas Abraitis
``` exit1-debian-9(config-route-map)# match ip route-source prefix-list ? <cr> PREFIXLIST_NAME IP prefix-list name p1 p2 ``` Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-10-25Merge pull request #9824 from idryzhov/nb-cli-const-lyd-nodeDonald Sharp
lib: northbound cli show/cmd functions must not modify data nodes
2021-10-13lib: northbound cli show/cmd functions must not modify data nodesIgor Ryzhov
To ensure this, add a const modifier to functions' arguments. Would be great do this initially and avoid this large code change, but better late than never. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-10-08*: cleanup number-named access-lists in CLIIgor Ryzhov
There's no more difference between number-named and word-named access-lists. This commit removes separate arguments for number-named ACLs from CLI. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-09-01Merge pull request #9439 from ton31337/feature/set_ext_community_to_noneRuss White
bgpd: Route-map `set extcommunity none`
2021-08-26Merge pull request #9331 from idryzhov/explicit-exitChristian Hopps
*: explicitly print "exit" at the end of every node config
2021-08-24lib: remove the dependency on bgpd codeIgor Ryzhov
The library code should not depend on a specific daemon's code. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-08-23*: explicitly print "exit" at the end of every node configIgor Ryzhov
There is a possibility that the same line can be matched as a command in some node and its parent node. In this case, when reading the config, this line is always executed as a command of the child node. For example, with the following config: ``` router ospf network 193.168.0.0/16 area 0 ! mpls ldp discovery hello interval 111 ! ``` Line `mpls ldp` is processed as command `mpls ldp-sync` inside the `router ospf` node. This leads to a complete loss of `mpls ldp` node configuration. To eliminate this issue and all possible similar issues, let's print an explicit "exit" at the end of every node config. This commit also changes indentation for a couple of existing exit commands so that all existing commands are on the same level as their corresponding node-entering commands. Fixes #9206. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-08-18bgpd: Add an ability to set extcommunity to none in route-mapsDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-08-03bgpd: Keep extcommunity bandwidth commands persistent in route-mapsDonatas Abraitis
~/frr# vtysh -c 'conf' -c 'route-map testas permit 10' -c 'set extcommunity bandwidth 321' ~/frr# vtysh -c 'show route-map testas' | grep 321 extcommunity bandwidth 321 non-transitive ~/frr# vtysh -c 'sh run' | grep 321 ~/frr# Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-07-21bgpd: Add route-map `match alias` commandDonatas Abraitis
Will be handy to filter BGP prefixes by using BGP community alias instead of numerical community values. Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-06-07bgpd: Add "set evpn gateway-ip" clause for route-mapAmeya Dharkar
- Add following set clause for route-maps "set evpn gateway-ip <ipv4|ipv6 >A.B.C.D|X:X::X:X" - When this route-map is applied as outboubd policy in BGP, it will set the gateway-ip in BGP attribute For EVPN type-5 routes. Example configuration: route-map RMAP-EVPN_GWIP permit 5 set evpn gateway-ip ipv4 50.0.2.12 set evpn gateway-ip ipv6 50:0:2::12 router bgp 101 bgp router-id 10.100.0.1 neighbor 10.0.1.2 remote-as 102 ! address-family l2vpn evpn neighbor 10.0.1.2 activate neighbor 10.0.1.2 route-map RMAP-EVPN_GWIP out advertise-all-vni exit-address-family Signed-off-by: Ameya Dharkar <adharkar@vmware.com>
2021-04-09lib, doc: add "route-map NAME optimization" commandIgor Ryzhov
Currently we have a "route-map optimization" command which is entered from inside the route-map entry but actually applies to the whole route-map. In addition, this command is not shown in the running-config and not stored to the startup-config during "write". Let's add a new command on the config node level to control this setting and show it in the running-config to make possible to save it during "write". The old command is saved for the backward compatibility but hidden and marked as deprecated. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-04-06lib: convert route-map optimization to NBIgor Ryzhov
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>