summaryrefslogtreecommitdiffhomepage
path: root/server/peer.go
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2015-11-09 05:07:37 -0800
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2015-11-09 05:07:37 -0800
commitd621be037478fe1f92eafb03356339459bd84bd6 (patch)
treea5afcff26a47016c6959780bff50d0a967914143 /server/peer.go
parent344e575502102352ee448463763badc16e1ffdfd (diff)
server: call ValidateUpdateMsg() in fsm instead of peer
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'server/peer.go')
-rw-r--r--server/peer.go48
1 files changed, 14 insertions, 34 deletions
diff --git a/server/peer.go b/server/peer.go
index 17e40dee..6f9627a7 100644
--- a/server/peer.go
+++ b/server/peer.go
@@ -32,21 +32,20 @@ const (
)
type Peer struct {
- gConf config.Global
- conf config.Neighbor
- fsm *FSM
- rfMap map[bgp.RouteFamily]bool
- capMap map[bgp.BGPCapabilityCode][]bgp.ParameterCapabilityInterface
- adjRib *table.AdjRib
- peerInfo *table.PeerInfo
- outgoing chan *bgp.BGPMessage
- inPolicies []*table.Policy
- defaultInPolicy table.RouteType
- accepted uint32
- staleAccepted bool
- isConfederationMember bool
- recvOpen *bgp.BGPMessage
- localRib *table.TableManager
+ gConf config.Global
+ conf config.Neighbor
+ fsm *FSM
+ rfMap map[bgp.RouteFamily]bool
+ capMap map[bgp.BGPCapabilityCode][]bgp.ParameterCapabilityInterface
+ adjRib *table.AdjRib
+ peerInfo *table.PeerInfo
+ outgoing chan *bgp.BGPMessage
+ inPolicies []*table.Policy
+ defaultInPolicy table.RouteType
+ accepted uint32
+ staleAccepted bool
+ recvOpen *bgp.BGPMessage
+ localRib *table.TableManager
}
func NewPeer(g config.Global, conf config.Neighbor, loc *table.TableManager) *Peer {
@@ -72,14 +71,9 @@ func NewPeer(g config.Global, conf config.Neighbor, loc *table.TableManager) *Pe
}
peer.adjRib = table.NewAdjRib(peer.configuredRFlist())
peer.fsm = NewFSM(&g, &conf)
- peer.isConfederationMember = config.IsConfederationMember(&g, &conf)
return peer
}
-func (peer *Peer) isEBGPPeer() bool {
- return peer.conf.NeighborConfig.PeerAs != peer.gConf.GlobalConfig.As
-}
-
func (peer *Peer) isIBGPPeer() bool {
return peer.conf.NeighborConfig.PeerAs == peer.gConf.GlobalConfig.As
}
@@ -212,20 +206,6 @@ func (peer *Peer) handleBGPmessage(m *bgp.BGPMessage) ([]*table.Path, bool, []*b
update = true
peer.conf.Timers.TimersState.UpdateRecvTime = time.Now().Unix()
body := m.Body.(*bgp.BGPUpdate)
- confedCheckRequired := !peer.isConfederationMember && peer.isEBGPPeer()
- _, err := bgp.ValidateUpdateMsg(body, peer.rfMap, confedCheckRequired)
- if err != nil {
- log.WithFields(log.Fields{
- "Topic": "Peer",
- "Key": peer.conf.NeighborConfig.NeighborAddress,
- "error": err,
- }).Warn("malformed BGP update message")
- m := err.(*bgp.MessageError)
- if m.TypeCode != 0 {
- bgpMsgList = append(bgpMsgList, bgp.NewBGPNotificationMessage(m.TypeCode, m.SubTypeCode, m.Data))
- }
- break
- }
table.UpdatePathAttrs4ByteAs(body)
pathList = table.ProcessMessage(m, peer.peerInfo)
if len(pathList) > 0 {