Skip to content
Snippets Groups Projects
Commit 75242749 authored by Oliver Herms's avatar Oliver Herms
Browse files

BGP: Fix calculation of maximum BGP update size for non first update

parent 8b9426ff
No related branches found
No related tags found
No related merge requests found
......@@ -117,11 +117,8 @@ func (u *UpdateSender) sender(aggrTime time.Duration) {
}
u.toSendMu.Lock()
overhead := u.updateOverhead()
for key, pathNLRIs := range u.toSend {
budget = packet.MaxLen - packet.HeaderLen - packet.MinUpdateLen - int(pathNLRIs.path.BGPPath.Length()) - overhead
budget = u.getBudget(pathNLRIs)
pathAttrs, err = packet.PathAttributes(pathNLRIs.path, u.iBGP, u.rrClient)
if err != nil {
......@@ -141,7 +138,7 @@ func (u *UpdateSender) sender(aggrTime time.Duration) {
if budget < 0 {
updatesPrefixes = append(updatesPrefixes, prefixes)
prefixes = make([]*bnet.Prefix, 0, 1)
budget = packet.MaxLen - int(pathNLRIs.path.BGPPath.Length()) - overhead
budget = u.getBudget(pathNLRIs)
}
prefixes = append(prefixes, pfx)
......@@ -160,6 +157,10 @@ func (u *UpdateSender) sender(aggrTime time.Duration) {
}
}
func (u *UpdateSender) getBudget(pathNLRIs *pathPfxs) int {
return packet.MaxLen - packet.HeaderLen - packet.MinUpdateLen - int(pathNLRIs.path.BGPPath.Length()) - u.updateOverhead()
}
func (u *UpdateSender) updateOverhead() int {
if u.addressFamily.afi == packet.IPv4AFI && !u.addressFamily.multiProtocol {
return 0
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment