Page MenuHomeVyOS Platform

Documentation for as-path-list regular expressions
Open, NormalPublicFEATURE REQUEST

Description

Summary

Add documentation for regular expressions for as-path-lists.

Use case

Writing regular expression is very hard, if the syntax is unspecified. https://docs.vyos.io/en/latest/configuration/policy/as-path-list.html gives a trivial example. I assume, that this gets sent as is to FRR, however as far as I can tell FRR also has not documented what they are doing here. The only thing that I found is this example here: https://docs.frrouting.org/en/latest/bgp.html#bogon-asn-filter-policy-configuration-example

Additional information

The NLNOG route filtering guide gives examples for matching ranges of ASNs, however these examples show a different syntax that what the "documentation" at FRR shows. https://bgpfilterguide.nlnog.net/guides/bogon_asns/#frr-vtysh
There are also examples for VyOS there, which are basically the FRR config wrapped in VyOS commands with the same expressions.

Details

Version
-
Is it a breaking change?
Perfectly compatible
Issue type
Documentation update

Event Timeline

Viacheslav triaged this task as Normal priority.Apr 9 2025, 3:40 PM

@991jo As far as I can tell, the documentation for both VyOS and FRR are simply correct - both bgp as-path access-list and show bgp ipvX regex render AS paths as text and run a POSIX regular expression against them. There's no range expansion or other fanciness beyond special handling of the '_' match - just a space-separated text string of ASNs vs a regexec()'d pattern.

The relevant code: https://github.com/FRRouting/frr/blob/master/bgpd/bgp_filter.c, bgp_filter.h, bgp_aspath.h and bgp_regex.c.

However, if you are keen, it is possible to generate a generic regex match from a number range. If you wished to introduce some extended syntax to the VyOS config generator, that could be bolted on to give FRR a nice regex to use, what you're asking about would be possible. I'd suggest something that doesn't clash with existing regex or AS-path syntax - so not 123-456, maybe a 123:456?

However, the result of this range expansion would look pretty similar to the NLNOG mikrotik v6 examples, excessively large ranges may cause performance problems.

We reviewed this issue and are planning to submit a documentation pull request for it this afternoon.