diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2017-07-26 07:56:35 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2017-07-26 08:09:02 +0900 |
commit | 22772c0e62ab215a9872761ca01d103e297f98bd (patch) | |
tree | 5367116d55e327ae4bda16e0b5cd47c05a22aa4a /packet/bgp/bgp.go | |
parent | c99e499bce7a33feee36240b4d72acde8b0cb3d5 (diff) |
add LocalPathIdentifier
add-path support needs two identifiers, remote (rx) and local
(tx). The remote identifiers are assigined by remote peers, the local
ones are assigned by gobgpd itself.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'packet/bgp/bgp.go')
-rw-r--r-- | packet/bgp/bgp.go | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/packet/bgp/bgp.go b/packet/bgp/bgp.go index a07cd5e5..f7d39a30 100644 --- a/packet/bgp/bgp.go +++ b/packet/bgp/bgp.go @@ -994,10 +994,13 @@ type AddrPrefixInterface interface { Flat() map[string]string PathIdentifier() uint32 SetPathIdentifier(uint32) + PathLocalIdentifier() uint32 + SetPathLocalIdentifier(uint32) } type PrefixDefault struct { - id uint32 + id uint32 + localId uint32 } func (p *PrefixDefault) PathIdentifier() uint32 { @@ -1008,6 +1011,14 @@ func (p *PrefixDefault) SetPathIdentifier(id uint32) { p.id = id } +func (p *PrefixDefault) PathLocalIdentifier() uint32 { + return p.localId +} + +func (p *PrefixDefault) SetPathLocalIdentifier(id uint32) { + p.localId = id +} + func (p *PrefixDefault) decodePathIdentifier(data []byte) ([]byte, error) { if len(data) < 4 { code := uint8(BGP_ERROR_UPDATE_MESSAGE_ERROR) @@ -1020,7 +1031,7 @@ func (p *PrefixDefault) decodePathIdentifier(data []byte) ([]byte, error) { func (p *PrefixDefault) serializeIdentifier() ([]byte, error) { buf := make([]byte, 4) - binary.BigEndian.PutUint32(buf, p.PathIdentifier()) + binary.BigEndian.PutUint32(buf, p.PathLocalIdentifier()) return buf, nil } |