summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--config/bgp_configs.go2
-rw-r--r--server/peer.go3
2 files changed, 4 insertions, 1 deletions
diff --git a/config/bgp_configs.go b/config/bgp_configs.go
index 14d07fe9..be489e52 100644
--- a/config/bgp_configs.go
+++ b/config/bgp_configs.go
@@ -378,7 +378,7 @@ type BgpNeighborCommonStateType struct {
// peer-state
State uint32
// peer-uptime
- Uptime uint64
+ Uptime time.Time
// BGP statistics
// Open message input count
diff --git a/server/peer.go b/server/peer.go
index 23df06d9..5c26fc18 100644
--- a/server/peer.go
+++ b/server/peer.go
@@ -23,6 +23,7 @@ import (
"github.com/osrg/gobgp/table"
"gopkg.in/tomb.v2"
"net"
+ "time"
)
type Peer struct {
@@ -68,6 +69,7 @@ func (peer *Peer) handleBGPmessage(m *bgp.BGPMessage) {
pathList := peer.adjRib.GetOutPathList(table.RF_IPv4_UC)
peer.sendMessages(peer.path2update(pathList))
case bgp.BGP_MSG_UPDATE:
+ peer.peerConfig.BgpNeighborCommonState.UpdateRecvTime = time.Now()
msg := table.NewProcessMessage(m, peer.fsm.peerInfo)
pathList := msg.ToPathList()
if len(pathList) == 0 {
@@ -142,6 +144,7 @@ func (peer *Peer) loop() error {
if nextState == bgp.BGP_FSM_ESTABLISHED {
pathList := peer.adjRib.GetOutPathList(table.RF_IPv4_UC)
peer.sendMessages(peer.path2update(pathList))
+ peer.peerConfig.BgpNeighborCommonState.Uptime = time.Now()
peer.peerConfig.BgpNeighborCommonState.EstablishedCount++
}
if oldState == bgp.BGP_FSM_ESTABLISHED {