Skip to content

Commit

Permalink
Fix Serialize() method to advertise BGP Router ID
Browse files Browse the repository at this point in the history
Co-authored-by: watal <watal.i27e@gmail.com>
  • Loading branch information
Enigamict and watal committed May 20, 2023
1 parent 573ae91 commit 1a6dc92
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions pkg/packet/bgp/bgp.go
Original file line number Diff line number Diff line change
Expand Up @@ -6917,8 +6917,14 @@ func (l *LsTLVBgpRouterID) DecodeFromBytes(data []byte) error {
}

func (l *LsTLVBgpRouterID) Serialize() ([]byte, error) {
var buf [4]byte
copy(buf[:], l.RouterID)
tmpaddr := l.RouterID
if tmpaddr.To4() != nil {
var buf [4]byte
copy(buf[:], l.RouterID.To4())
return l.LsTLV.Serialize(buf[:])
}
var buf [16]byte
copy(buf[:], l.RouterID.To16())
return l.LsTLV.Serialize(buf[:])
}

Expand Down

0 comments on commit 1a6dc92

Please sign in to comment.