Did anyone find a working example of a bgp-as-path filter?
The writing of documentation was clearly interrupted halfway and it is not complete now.
There is a special paragraph that says:
There are two common ways how to operate with AS Path data:
convert whole AS path to string and let regexp operate on the string (ROS v6 or Cisco style)
let regexp operate on each entry in the AS path as a number (ROS v7, Juniper style)
The latter method is much faster and less resource-intensive than the string matching approach.
That is clear. We have to use a new method to look in AS path entries. I think that is reasonable, but nowhere it is specified how the match statements should look.
I need filter rules that match a certain AS at:
the begin of the AS path (this can probably be replaced with bgp-input-remote-as now)
the originating AS (this would be matched using " 1234$" in the v6 syntax but now we supposedly can match “the last item of the AS list” with a literal number. but how?)
some AS occurring anywhere in the path.
It should not be difficult to add examples for these cases to the documentation, and then the full capabilities can be documented later.
Can you PLEASE post an example showing the syntax of a filter rule that does matching with bgp-as-path?
Is the above mentioned claim that v7 matches on separate entries of the path instead of on an ASCII string representing the entire path (already) true?
Okay, i have found the solution… When exporting the routes, and you are filtering as-path for “beginns with”, you have to add your own ASN in first position. So you do not check against the received protocol, it will check against what will sent out to the bgp-peer. That is strange to have to check for my own ASN.
As I wrote above (at a time when all of this simply did not work due to bugs, that have been fixed now) there is a “bgp-input-remote-as” you can use for that.