osrg / gobgp

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

add-path with vrf issue #1661

Closed dbarrosop closed 6 years ago

dbarrosop commented 6 years ago

Hello, trying to use add-path in VRFs with gobgp doesn't seem to work. Imagine a peer configured with the following code:

    r, err := c.AddNeighbor(context.Background(), &pb.AddNeighborRequest{
        Peer: &pb.Peer{
            Conf: &pb.PeerConf{
                Vrf:             vrf,
                Description:     "this is a test",
                LocalAs:         65000,
                PeerAs:          peerAS,
                NeighborAddress: neighborAddress},
            EbgpMultihop: &pb.EbgpMultihop{
                Enabled:     true,
                MultihopTtl: 64},
            AddPaths: &pb.AddPaths{
                Config: &pb.AddPathsConfig{
                    Receive: true,
                    SendMax: 8,
                },
            },
        },
    })

And add-path rx enabled on the server as can be seen here:

    Neighbor caps:    refresh AS4 add-path-rx add-path-tx
    Session:          external multihop AS4 add-path-rx

Now, if I try to set different add-path routes:

/ # gobgp vrf red rib add 10.231.231.0/24 identifier 10 nexthop 10.100.0.1
/ # gobgp vrf red rib add 10.231.231.0/24 identifier 20 nexthop 10.100.0.2
/ # gobgp vrf red rib
   Network              Next Hop             AS_PATH              Age        Attrs
   10.231.231.0/24      10.100.0.1                                00:00:42   [{Origin: ?}]
   10.231.231.0/24      10.100.0.2                                00:00:14   [{Origin: ?}]

The last one will always win. i suspect the path identifier is not being sent properly.

Regards

fujita commented 6 years ago

I guess that Tolocal() needs to set up an identifier. However, if you expect gobgp to send the identifier that you specified via the API, there is another tricky issue about this. Currently, gobgp treats a path added via the API in the same way as received from a peer. gobgp internally manage identifiers to send.

fujita commented 6 years ago

Fixed. Let create a new issue if you need gobgp to send the identifier that you specified via the api.

dbarrosop commented 6 years ago

Thanks! I don't have a particular use case to really care about the identifier other than it makes it simpler for CI purposes :P