summaryrefslogtreecommitdiffhomepage
path: root/pkg/packet/bgp/bgp.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/packet/bgp/bgp.go')
-rw-r--r--pkg/packet/bgp/bgp.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/pkg/packet/bgp/bgp.go b/pkg/packet/bgp/bgp.go
index ac7b77d2..c46bc878 100644
--- a/pkg/packet/bgp/bgp.go
+++ b/pkg/packet/bgp/bgp.go
@@ -28,6 +28,7 @@ import (
"sort"
"strconv"
"strings"
+ "sync"
)
type MarshallingOption struct {
@@ -1229,23 +1230,36 @@ func LabelString(nlri AddrPrefixInterface) string {
}
type PrefixDefault struct {
+ mu sync.Mutex
id uint32
localId uint32
}
func (p *PrefixDefault) PathIdentifier() uint32 {
+ p.mu.Lock()
+ defer p.mu.Unlock()
+
return p.id
}
func (p *PrefixDefault) SetPathIdentifier(id uint32) {
+ p.mu.Lock()
+ defer p.mu.Unlock()
+
p.id = id
}
func (p *PrefixDefault) PathLocalIdentifier() uint32 {
+ p.mu.Lock()
+ defer p.mu.Unlock()
+
return p.localId
}
func (p *PrefixDefault) SetPathLocalIdentifier(id uint32) {
+ p.mu.Lock()
+ defer p.mu.Unlock()
+
p.localId = id
}