diff options
author | Hiroshi Yokoi <yokoi.hiroshi@po.ntts.co.jp> | 2015-08-26 18:11:38 +0900 |
---|---|---|
committer | Hiroshi Yokoi <yokoi.hiroshi@po.ntts.co.jp> | 2015-09-01 19:42:02 +0900 |
commit | cc51c48a4934bde8f5a5555632633c3c8486b797 (patch) | |
tree | 14998dac3531e6a609bb414d2816f7f7d2ba1d5f /server/server.go | |
parent | f8d437ec0ea65656ca4c6d81ec48fe0f7099c60e (diff) |
zebra: distribute routes from zebra
Signed-off-by: Hiroshi Yokoi <yokoi.hiroshi@po.ntts.co.jp>
Diffstat (limited to 'server/server.go')
-rw-r--r-- | server/server.go | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/server/server.go b/server/server.go index 92e3d178..971cc517 100644 --- a/server/server.go +++ b/server/server.go @@ -231,7 +231,10 @@ func (server *BgpServer) Serve() { case rmsg := <-server.roaClient.recieveROA(): server.roaClient.handleRTRMsg(rmsg) case zmsg := <-zapiMsgCh: - handleZapiMsg(zmsg) + m := handleZapiMsg(zmsg, server) + if len(m) > 0 { + senderMsgs = append(senderMsgs, m...) + } case conn := <-acceptCh: remoteAddr, _, _ := net.SplitHostPort(conn.RemoteAddr().String()) peer, found := server.neighborMap[remoteAddr] @@ -548,9 +551,16 @@ func applyPolicies(peer *Peer, loc *LocalRib, d Direction, pathList []*table.Pat func (server *BgpServer) broadcastBests(bests []*table.Path) { for _, path := range bests { - z := newBroadcastZapiBestMsg(server.zclient, path) - if z != nil { - server.broadcastMsgs = append(server.broadcastMsgs, z) + if !path.IsFromZebra { + z := newBroadcastZapiBestMsg(server.zclient, path) + if z != nil { + server.broadcastMsgs = append(server.broadcastMsgs, z) + log.WithFields(log.Fields{ + "Topic": "Server", + "Client": z.client, + "Message": z.msg, + }).Debug("Default policy applied and rejected.") + } } result := &GrpcResponse{ @@ -654,6 +664,7 @@ func (server *BgpServer) propagateUpdate(peer *Peer, pathList []*table.Path) []* } targetPeer.adjRib.UpdateOut(f) msgList := table.CreateUpdateMsgFromPaths(f) + msgs = append(msgs, newSenderMsg(targetPeer, msgList)) } } @@ -2322,6 +2333,9 @@ func (server *BgpServer) NewZclient(url string) error { return err } cli.SendHello() + cli.SendRouterIDAdd() + cli.SendInterfaceAdd() + cli.SendRedistribute() server.zclient = cli return nil } |