summaryrefslogtreecommitdiffhomepage
path: root/server/fsm.go
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2015-02-16 10:52:55 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2015-02-16 10:52:55 +0900
commitd7253516a40801c7dcca553ffe244ccb0994116e (patch)
treec2649a7f27cb023fb6e7f11b10844399ff9a6da6 /server/fsm.go
parent560fa6cbd5c6ddb8fcd5c262b720459c064a9b23 (diff)
server: check the bgp message length before sending
if the length is over 4096, the message will be dropped. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'server/fsm.go')
-rw-r--r--server/fsm.go13
1 files changed, 11 insertions, 2 deletions
diff --git a/server/fsm.go b/server/fsm.go
index 4649ef85..f66e8f57 100644
--- a/server/fsm.go
+++ b/server/fsm.go
@@ -567,8 +567,17 @@ func (h *FSMHandler) sendMessageloop() error {
// sending notification, we'll die.
select {
case m := <-h.outgoing:
- b, _ := m.Serialize()
- _, err := conn.Write(b)
+ b, err := m.Serialize()
+ if err != nil {
+ log.WithFields(log.Fields{
+ "Topic": "Peer",
+ "Key": fsm.peerConfig.NeighborAddress,
+ "Data": err,
+ }).Warn("failed to serialize")
+ fsm.bgpMessageStateUpdate(0, false)
+ continue
+ }
+ _, err = conn.Write(b)
if err != nil {
h.errorCh <- true
return nil