Hi Claudio,
On Fri, Nov 23, 2018 at 03:55:18PM +0100, Claudio Jeker wrote:
> For origin validation I chacked the source_as in struct rde_aspath
> this is not really the right place. It should be in struct aspath
> since that holds all the ASPATH related stuff. Change this, move
> aspath_match out of util.c back into rde_attr.c and adjust code to use
> the cached value also in match from any source-as XYZ rules.
> This last bit causes a minor behavioural change since the old code
> extracted the last non AS_SET asnumber. The new code follows the ROA
> RFC and returns the rightmost AS for AS_SEQUENCE, the local AS for
> empty paths and AS_NONE (which is 0) for everything else.
> So now 'match from any source-as 0' will return all paths that do not
> have a final AS_SEQUENCE segment.
>
> The reason for this change is that I don't want to have two different
> behaviours for what we call source-as (the one in roa-set and the one on a
> filter).
Something is off, it seems 'source-as 0' is matching anything that has
an AS_SET attribute set:
$ bgpctl show rib source-as 0 | head
flags: * = Valid, > = Selected, I = via IBGP, A = Announced,
S = Stale, E = Error
origin validation state: N = not-found, V = valid, ! = invalid
origin: i = IGP, e = EGP, ? = Incomplete
flags ovs destination gateway lpref med aspath origin
I*> N 5.39.176.0/21 192.147.168.1 100 0 2914 8530 {
198753 } ?
I*> N 5.101.110.0/24 192.147.168.1 100 0 2914 14061 {
46652 } i
I*> N 5.175.0.0/19 192.147.168.1 100 0 2914 1299 20773
{ 8972 } i
I*> N 8.41.202.0/24 192.147.168.1 100 0 2914 13789
30372 { 40179 } i
Similarly, this should return at least 5.39.176.0/21:
$ bgpctl show rib source-as 8530
flags: * = Valid, > = Selected, I = via IBGP, A = Announced,
S = Stale, E = Error
origin validation state: N = not-found, V = valid, ! = invalid
origin: i = IGP, e = EGP, ? = Incomplete
flags ovs destination gateway lpref med aspath origin
I*> N 80.87.16.0/20 192.147.168.1 100 0 2914 8530 ?
I*> N 87.236.128.0/21 192.147.168.1 100 0 2914 8530 ?
I*> N 88.151.152.0/21 192.147.168.1 100 0 2914 8530 ?
I*> N 89.38.120.0/21 192.147.168.1 100 0 2914 8530 i
I*> N 93.115.176.0/20 192.147.168.1 100 0 2914 8530 i
I*> N 185.52.144.0/22 192.147.168.1 100 0 2914 8530 ?
Kind regards,
Job