osrg / gobgp

BGP implemented in the Go Programming Language
https://osrg.github.io/gobgp/
Apache License 2.0
3.62k stars 687 forks source link

Policy prefix-set is not take effect in vpnv4 prefix #2115

Open grandhuhu opened 5 years ago

grandhuhu commented 5 years ago

In "Route Reflector"(RR) case, I define global policy to filter prefix, the neighbor` afs-safi is "l3vpn-ipv4-unicast". When I use policy-community-set to filter prefix, it works, but it does not work when I use the prefix-set like this: [[defined-sets.prefix-sets]] prefix-set-name = "ps2" [[defined-sets.prefix-sets.prefix-list]] ip-prefix = "131.1.1.0/24" [[defined-sets.prefix-sets.prefix-list]] ip-prefix = "131.2.1.0/24" [[defined-sets.prefix-sets.prefix-list]] ip-prefix = "135.1.1.0/24" [[defined-sets.prefix-sets.prefix-list]] ip-prefix = "135.2.1.0/24"

[[policy-definitions]] name = "pd5" [[policy-definitions.statements]] name = "statement5" [policy-definitions.statements.conditions.match-prefix-set] prefix-set = "ps2" match-set-options = "any" [policy-definitions.statements.actions] route-disposition = "accept-route" [policy-definitions.statements.actions.bgp-actions] set-med = "600" set-next-hop = "100.100.100.100"

grandhuhu commented 5 years ago

I saw the code in policy.go line 1454 and function is PrefixCondition. In 1466 line: case bgp.RF_IPv4_UC: masklen = path.GetNlri().(*bgp.IPAddrPrefix).Length key = keyf(path.GetNlri().(*bgp.IPAddrPrefix).Prefix, int(masklen)) case bgp.RF_IPv6_UC: masklen = path.GetNlri().(*bgp.IPv6AddrPrefix).Length key = keyf(path.GetNlri().(*bgp.IPv6AddrPrefix).Prefix, int(masklen)) Is it not support for vnpv4 prefix?

fujita commented 5 years ago

You are right. What policy representations are used for vpnv4 prefix in other bgp implementations?