summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2015-01-07 19:31:10 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2015-01-07 19:31:10 +0900
commitbeb39354e51eb74ab0a13d93dfde9e66e85d5bb6 (patch)
tree00f01d5bb411f3c5839716b4b2e3c4f8fca7f349
parent564a4a0bd260421443ca2c08ecff26648a4124ea (diff)
server: dump bgp message with peer addresss
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r--bgpd.go2
-rw-r--r--server/fsm.go3
-rw-r--r--server/peer.go2
3 files changed, 5 insertions, 2 deletions
diff --git a/bgpd.go b/bgpd.go
index 8e9effd3..7c24eadb 100644
--- a/bgpd.go
+++ b/bgpd.go
@@ -37,7 +37,7 @@ func main() {
var opts struct {
ConfigFile string `short:"f" long:"config-file" description:"specifying a config file"`
LogLevel string `short:"l" long:"log-level" description:"specifying log level"`
- LogJson bool `shot:"j" long:"log-json" description:"use json format for logging"`
+ LogJson bool `short:"j" long:"log-json" description:"use json format for logging"`
}
_, err := flags.Parse(&opts)
if err != nil {
diff --git a/server/fsm.go b/server/fsm.go
index 21c05399..8d43c6c8 100644
--- a/server/fsm.go
+++ b/server/fsm.go
@@ -16,6 +16,7 @@
package server
import (
+ "encoding/json"
log "github.com/Sirupsen/logrus"
"github.com/osrg/gobgp/config"
"github.com/osrg/gobgp/packet"
@@ -319,6 +320,8 @@ func (h *FSMHandler) sendMessageloop() error {
h.errorCh <- true
return nil
}
+ j, _ := json.Marshal(m)
+ log.Debugf("sent %v: %s", fsm.peerConfig.NeighborAddress, string(j))
fsm.bgpMessageStateUpdate(m.Header.Type, false)
case <-fsm.keepaliveTicker.C:
m := bgp.NewBGPKeepAliveMessage()
diff --git a/server/peer.go b/server/peer.go
index 0bc993e9..08a52530 100644
--- a/server/peer.go
+++ b/server/peer.go
@@ -97,7 +97,7 @@ func NewPeer(g config.GlobalType, peer config.NeighborType, serverMsgCh chan *se
func (peer *Peer) handleBGPmessage(m *bgp.BGPMessage) {
j, _ := json.Marshal(m)
- log.Debug(string(j))
+ log.Debugf("received %v: %s", peer.peerConfig.NeighborAddress, j)
switch m.Header.Type {
case bgp.BGP_MSG_OPEN: