From ea87564b5b5d332ab48b6619c4a365559111e2c9 Mon Sep 17 00:00:00 2001 From: Carl Baldwin Date: Fri, 11 Oct 2019 14:25:08 -0600 Subject: Remove policy from FSM The `policy` member of fsm is apparently never used. Clean it up to avoid confusion. Policy is still set on the server and peers. --- pkg/server/fsm.go | 4 +--- pkg/server/fsm_test.go | 3 +-- pkg/server/peer.go | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) (limited to 'pkg/server') diff --git a/pkg/server/fsm.go b/pkg/server/fsm.go index b06ddd5d..39618aa5 100644 --- a/pkg/server/fsm.go +++ b/pkg/server/fsm.go @@ -189,7 +189,6 @@ type fsm struct { capMap map[bgp.BGPCapabilityCode][]bgp.ParameterCapabilityInterface recvOpen *bgp.BGPMessage peerInfo *table.PeerInfo - policy *table.RoutingPolicy gracefulRestartTimer *time.Timer twoByteAsTrans bool marshallingOptions *bgp.MarshallingOption @@ -261,7 +260,7 @@ func (fsm *fsm) bmpStatsUpdate(statType uint16, increment int) { } } -func newFSM(gConf *config.Global, pConf *config.Neighbor, policy *table.RoutingPolicy) *fsm { +func newFSM(gConf *config.Global, pConf *config.Neighbor) *fsm { adminState := adminStateUp if pConf.Config.AdminDown { adminState = adminStateDown @@ -281,7 +280,6 @@ func newFSM(gConf *config.Global, pConf *config.Neighbor, policy *table.RoutingP rfMap: make(map[bgp.RouteFamily]bgp.BGPAddPathMode), capMap: make(map[bgp.BGPCapabilityCode][]bgp.ParameterCapabilityInterface), peerInfo: table.NewPeerInfo(gConf, pConf), - policy: policy, gracefulRestartTimer: time.NewTimer(time.Hour), notification: make(chan *bgp.BGPMessage, 1), } diff --git a/pkg/server/fsm_test.go b/pkg/server/fsm_test.go index ac5ffd7b..9351c71d 100644 --- a/pkg/server/fsm_test.go +++ b/pkg/server/fsm_test.go @@ -26,7 +26,6 @@ import ( "github.com/eapache/channels" "github.com/osrg/gobgp/internal/pkg/config" - "github.com/osrg/gobgp/internal/pkg/table" "github.com/osrg/gobgp/pkg/packet/bgp" log "github.com/sirupsen/logrus" @@ -311,7 +310,7 @@ func TestCheckOwnASLoop(t *testing.T) { func makePeerAndHandler() (*peer, *fsmHandler) { p := &peer{ - fsm: newFSM(&config.Global{}, &config.Neighbor{}, table.NewRoutingPolicy()), + fsm: newFSM(&config.Global{}, &config.Neighbor{}), } h := &fsmHandler{ diff --git a/pkg/server/peer.go b/pkg/server/peer.go index a7843f49..c213a9ea 100644 --- a/pkg/server/peer.go +++ b/pkg/server/peer.go @@ -106,7 +106,7 @@ func newPeer(g *config.Global, conf *config.Neighbor, loc *table.TableManager, p peer := &peer{ localRib: loc, policy: policy, - fsm: newFSM(g, conf, policy), + fsm: newFSM(g, conf), prefixLimitWarned: make(map[bgp.RouteFamily]bool), } if peer.isRouteServerClient() { -- cgit v1.2.3