diff options
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 } |