diff --git a/protocols/bgp/packet/nlri.go b/protocols/bgp/packet/nlri.go index bd55739c034a9a368ca129101ddc4308d897a8c4..526ab712fdd85b360fad0891913a2b99129de848 100644 --- a/protocols/bgp/packet/nlri.go +++ b/protocols/bgp/packet/nlri.go @@ -12,7 +12,7 @@ import ( ) const ( - pathIdentifierLen = 4 + PathIdentifierLen = 4 ) // NLRI represents a Network Layer Reachability Information @@ -63,7 +63,7 @@ func decodeNLRI(buf *bytes.Buffer, afi uint16, addPath bool) (*NLRI, uint8, erro return nil, consumed, errors.Wrap(err, "Unable to decode path identifier") } - consumed += pathIdentifierLen + consumed += PathIdentifierLen } pfxLen, err := buf.ReadByte() diff --git a/protocols/bgp/server/update_sender.go b/protocols/bgp/server/update_sender.go index 095d5339caf8219b1b8f152c21d5da3a64135680..86c7601dc70097b68b78784bfcdd794d9a2da9d6 100644 --- a/protocols/bgp/server/update_sender.go +++ b/protocols/bgp/server/update_sender.go @@ -132,7 +132,7 @@ func (u *UpdateSender) sender(aggrTime time.Duration) { budget -= int(packet.BytesInAddr(pfx.Pfxlen())) + 1 if u.options.UseAddPath { - budget -= 4 + budget -= packet.PathIdentifierLen } if budget < 0 {