diff options
Diffstat (limited to 'server')
-rw-r--r-- | server/rpki.go | 6 | ||||
-rw-r--r-- | server/server.go | 8 | ||||
-rw-r--r-- | server/zclient.go | 2 | ||||
-rw-r--r-- | server/zclient_test.go | 8 |
4 files changed, 12 insertions, 12 deletions
diff --git a/server/rpki.go b/server/rpki.go index e6097d00..ed4af2ea 100644 --- a/server/rpki.go +++ b/server/rpki.go @@ -453,7 +453,7 @@ func (c *roaManager) validate(pathList []*table.Path, isMonitor bool) []*api.ROA } if tree, ok := c.roas[path.GetRouteFamily()]; ok { r, roaList := validatePath(c.AS, tree, path.GetNlri().String(), path.GetAsPath()) - if isMonitor && path.Validation != config.RpkiValidationResultType(r) { + if isMonitor && path.Validation() != config.RpkiValidationResultType(r) { apiRoaList := func() []*api.ROA { apiRoaList := make([]*api.ROA, 0) for _, r := range roaList { @@ -464,13 +464,13 @@ func (c *roaManager) validate(pathList []*table.Path, isMonitor bool) []*api.ROA rr := &api.ROAResult{ OriginAs: path.GetSourceAs(), Prefix: path.GetNlri().String(), - OldResult: api.ROAResult_ValidationResult(path.Validation.ToInt()), + OldResult: api.ROAResult_ValidationResult(path.Validation().ToInt()), NewResult: api.ROAResult_ValidationResult(r.ToInt()), Roas: apiRoaList, } results = append(results, rr) } - path.Validation = config.RpkiValidationResultType(r) + path.SetValidation(config.RpkiValidationResultType(r)) } } return results diff --git a/server/server.go b/server/server.go index 817c7d05..4a198e49 100644 --- a/server/server.go +++ b/server/server.go @@ -556,7 +556,7 @@ func filterpath(peer *Peer, path *table.Path) *table.Path { if !peer.isRouteServerClient() && isASLoop(peer, path) { return nil } - return path.Clone(net.ParseIP(remoteAddr), path.IsWithdraw) + return path.Clone(peer.fsm.peerInfo.Address, path.IsWithdraw) } func (server *BgpServer) dropPeerAllRoutes(peer *Peer) []*SenderMsg { @@ -643,7 +643,7 @@ func (server *BgpServer) broadcastValidationResults(results []*api.ROAResult) { func (server *BgpServer) broadcastBests(bests []*table.Path) { for _, path := range bests { - if !path.IsFromZebra { + if !path.IsFromZebra() { z := newBroadcastZapiBestMsg(server.zclient, path) if z != nil { server.broadcastMsgs = append(server.broadcastMsgs, z) @@ -1268,7 +1268,7 @@ func (server *BgpServer) handleModPathRequest(grpcReq *GrpcRequest) []*table.Pat path := func() *table.Path { for _, rf := range server.globalRib.GetRFlist() { for _, path := range server.globalRib.GetPathList(table.GLOBAL_RIB_NAME, rf) { - if len(path.Uuid) > 0 && bytes.Equal(path.Uuid, arg.Uuid) { + if len(path.UUID()) > 0 && bytes.Equal(path.UUID(), arg.Uuid) { return path } } @@ -1289,7 +1289,7 @@ func (server *BgpServer) handleModPathRequest(grpcReq *GrpcRequest) []*table.Pat if err == nil { u := uuid.NewV4() uuidBytes = u.Bytes() - paths[0].Uuid = uuidBytes + paths[0].SetUUID(uuidBytes) } } } diff --git a/server/zclient.go b/server/zclient.go index 994f1c78..3c3d3180 100644 --- a/server/zclient.go +++ b/server/zclient.go @@ -128,7 +128,7 @@ func createPathFromIPRouteMessage(m *zebra.Message, peerInfo *table.PeerInfo) *t pattr = append(pattr, med) p := table.NewPath(peerInfo, nlri, isWithdraw, pattr, time.Now(), false) - p.IsFromZebra = true + p.SetIsFromZebra(true) return p } diff --git a/server/zclient_test.go b/server/zclient_test.go index dcb3cb5c..2fbd7554 100644 --- a/server/zclient_test.go +++ b/server/zclient_test.go @@ -59,7 +59,7 @@ func Test_createPathFromIPRouteMessage(t *testing.T) { assert.NotEqual(nil, p) assert.Equal("0.0.0.0", p.GetNexthop().String()) assert.Equal("192.168.100.0/24", p.GetNlri().String()) - assert.True(p.IsFromZebra) + assert.True(p.IsFromZebra()) assert.False(p.IsWithdraw) // withdraw @@ -71,7 +71,7 @@ func Test_createPathFromIPRouteMessage(t *testing.T) { assert.Equal("192.168.100.0/24", p.GetNlri().String()) med, _ := p.GetMed() assert.Equal(uint32(100), med) - assert.True(p.IsFromZebra) + assert.True(p.IsFromZebra()) assert.True(p.IsWithdraw) // IPv6 @@ -88,7 +88,7 @@ func Test_createPathFromIPRouteMessage(t *testing.T) { assert.Equal("2001:db8:0:f101::/64", p.GetNlri().String()) med, _ = p.GetMed() assert.Equal(uint32(100), med) - assert.True(p.IsFromZebra) + assert.True(p.IsFromZebra()) assert.False(p.IsWithdraw) // withdraw @@ -98,7 +98,7 @@ func Test_createPathFromIPRouteMessage(t *testing.T) { assert.NotEqual(nil, p) assert.Equal("::", p.GetNexthop().String()) assert.Equal("2001:db8:0:f101::/64", p.GetNlri().String()) - assert.True(p.IsFromZebra) + assert.True(p.IsFromZebra()) assert.True(p.IsWithdraw) } |