summaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/fsm.go5
-rw-r--r--server/peer.go9
-rw-r--r--server/server.go2
3 files changed, 10 insertions, 6 deletions
diff --git a/server/fsm.go b/server/fsm.go
index 2de4787e..66762ca3 100644
--- a/server/fsm.go
+++ b/server/fsm.go
@@ -40,6 +40,7 @@ type fsmMsg struct {
MsgType fsmMsgType
MsgSrc string
MsgData interface{}
+ PathList []*table.Path
}
const (
@@ -503,6 +504,10 @@ func (h *FSMHandler) recvMessageWithError() error {
"error": err,
}).Warn("malformed BGP update message")
fmsg.MsgData = err
+ } else {
+ // FIXME: we should use the original message for bmp/mrt
+ table.UpdatePathAttrs4ByteAs(body)
+ fmsg.PathList = table.ProcessMessage(m, h.fsm.peerInfo)
}
fallthrough
case bgp.BGP_MSG_KEEPALIVE:
diff --git a/server/peer.go b/server/peer.go
index 82c61ae9..3009c73e 100644
--- a/server/peer.go
+++ b/server/peer.go
@@ -133,7 +133,8 @@ func open2Cap(open *bgp.BGPOpen, n *config.Neighbor) (map[bgp.BGPCapabilityCode]
return capMap, rfMap
}
-func (peer *Peer) handleBGPmessage(m *bgp.BGPMessage) ([]*table.Path, bool, []*bgp.BGPMessage) {
+func (peer *Peer) handleBGPmessage(e *fsmMsg) ([]*table.Path, bool, []*bgp.BGPMessage) {
+ m := e.MsgData.(*bgp.BGPMessage)
bgpMsgList := []*bgp.BGPMessage{}
pathList := []*table.Path{}
log.WithFields(log.Fields{
@@ -193,10 +194,8 @@ func (peer *Peer) handleBGPmessage(m *bgp.BGPMessage) ([]*table.Path, bool, []*b
case bgp.BGP_MSG_UPDATE:
update = true
peer.conf.Timers.TimersState.UpdateRecvTime = time.Now().Unix()
- body := m.Body.(*bgp.BGPUpdate)
- table.UpdatePathAttrs4ByteAs(body)
- pathList = table.ProcessMessage(m, peer.fsm.peerInfo)
- if len(pathList) > 0 {
+ if len(e.PathList) > 0 {
+ pathList = e.PathList
peer.staleAccepted = true
peer.ApplyPolicy(table.POLICY_DIRECTION_IN, pathList)
peer.adjRib.UpdateIn(pathList)
diff --git a/server/server.go b/server/server.go
index 80c6059a..9c160e8b 100644
--- a/server/server.go
+++ b/server/server.go
@@ -779,7 +779,7 @@ func (server *BgpServer) handleFSMMessage(peer *Peer, e *fsmMsg, incoming chan *
case *bgp.MessageError:
msgs = append(msgs, newSenderMsg(peer, []*bgp.BGPMessage{bgp.NewBGPNotificationMessage(m.TypeCode, m.SubTypeCode, m.Data)}))
case *bgp.BGPMessage:
- pathList, update, msgList := peer.handleBGPmessage(m)
+ pathList, update, msgList := peer.handleBGPmessage(e)
if len(msgList) > 0 {
msgs = append(msgs, newSenderMsg(peer, msgList))
break