summaryrefslogtreecommitdiffhomepage
path: root/server/peer.go
diff options
context:
space:
mode:
authorISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>2015-03-20 22:10:09 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2015-03-20 22:10:09 +0900
commit9355715ea394cb232d933ca20e8365b126ae6302 (patch)
tree9b22046329a177a457b7d66dbe71a7e19fcd3649 /server/peer.go
parenta307c5bc7a4cea293400e4475ea504b4e2b450f4 (diff)
peer: update pathattr for non-route-server client
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'server/peer.go')
-rw-r--r--server/peer.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/server/peer.go b/server/peer.go
index 77e6a01b..68e67254 100644
--- a/server/peer.go
+++ b/server/peer.go
@@ -24,6 +24,7 @@ import (
"github.com/osrg/gobgp/table"
"gopkg.in/tomb.v2"
"net"
+ "strings"
"time"
)
@@ -314,6 +315,8 @@ func (peer *Peer) handleREST(restReq *api.RestRequest) {
}
func (peer *Peer) sendUpdateMsgFromPaths(pList []table.Path) {
+ pList = table.CloneAndUpdatePathAttrs(pList, &peer.globalConfig, &peer.peerConfig)
+
peer.adjRib.UpdateOut(pList)
sendpathList := []table.Path{}
for _, p := range pList {
@@ -475,6 +478,15 @@ func (peer *Peer) Stop() error {
}
func (peer *Peer) PassConn(conn *net.TCPConn) {
+ localAddr := func(addrPort string) string {
+ if strings.Index(addrPort, "[") == -1 {
+ return strings.Split(addrPort, ":")[0]
+ }
+ idx := strings.LastIndex(addrPort, ":")
+ return addrPort[1 : idx-1]
+ }(conn.LocalAddr().String())
+
+ peer.peerConfig.LocalAddress = net.ParseIP(localAddr)
peer.acceptedConnCh <- conn
}