osrg / gobgp

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

Single update for l3vpn-ipv4-unicast routes #1667

Open denizaydin opened 6 years ago

denizaydin commented 6 years ago

I have tried to send multiple routes for with the same rd and same attributes. But each route is sent via a single update. This could be a serious problem for huge number of routes in a vrf like "Internet in a vrf" scenarios. I have already mailed this issue in project mailing list.

Link to thread in sourceforge : https://sourceforge.net/p/gobgp/mailman/message/36311616/

Below is the answer of Iwase Yasuke

You mean GoBGP packs multiple NLRIs in to a single UPDATE message when ipv4-unicast, but does not pack NLRIs when l3vpn-ipv4-unicast and separates them for each UPDATE messages, right?

I've tested on my local with the following codes, as you said, l3vpn-ipv4-unicast routes are not packed as a single UPDATE message.

// add ipv4 routes
attrs := []bgp.PathAttributeInterface{
    bgp.NewPathAttributeOrigin(0),
    bgp.NewPathAttributeNextHop("10.0.0.1"),
    bgp.NewPathAttributeAsPath(nil),
}
ipv4Path1 := table.NewPath(nil, bgp.NewIPAddrPrefix(24, "172.16.1.0"), false, attrs, time.Now(), false)
ipv4Path2 := table.NewPath(nil, bgp.NewIPAddrPrefix(24, "172.16.2.0"), false, attrs, time.Now(), false)
if _, err := s.AddPath("", []*table.Path{ipv4Path1, ipv4Path2}); err != nil {
    log.Fatal(err)
}

// add vpnv4 routes
labels := bgp.NewMPLSLabelStack(100)
rd, err := bgp.ParseRouteDistinguisher("65000:100")
if err != nil {
    log.Fatal(err)
}
nlri1 := bgp.NewLabeledVPNIPAddrPrefix(24, "172.17.1.0", *labels, rd)
attrs1 := []bgp.PathAttributeInterface{
    bgp.NewPathAttributeOrigin(0),
    bgp.NewPathAttributeAsPath(nil),
    bgp.NewPathAttributeMpReachNLRI("10.0.0.1", []bgp.AddrPrefixInterface{nlri1}),
}
vpnv4Path1 := table.NewPath(nil, nlri1, false, attrs1, time.Now(), false)
nlri2 := bgp.NewLabeledVPNIPAddrPrefix(24, "172.17.2.0", *labels, rd)
attrs2 := []bgp.PathAttributeInterface{
    bgp.NewPathAttributeOrigin(0),
    bgp.NewPathAttributeAsPath(nil),
    bgp.NewPathAttributeMpReachNLRI("10.0.0.1", []bgp.AddrPrefixInterface{nlri2}),
}
vpnv4Path2 := table.NewPath(nil, nlri2, false, attrs2, time.Now(), false)
if _, err := s.AddPath("", []*table.Path{vpnv4Path1, vpnv4Path2}); err != nil {
    log.Fatal(err)
}

And also I found that the packaging mechanism for ipv4-unicast are does not implemented to other address families. https://github.com/osrg/gobgp/blob/master/table/message.go

"packerMP" and "packerV4" packs paths to be sent into UPDATE messages, only "packerV4" compares hash of path attributes and compress paths into a single UPDATE message. https://github.com/osrg/gobgp/blob/756cc9162afb675dd7ca159b6f07a6d5b927bcc1/table/message.go#L377-L398

fujita commented 6 years ago

Yeah, currently, only ipv4-unicast routes could be merged into an update message.