summaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
authorNaoto Hanaue <hanaue.naoto@po.ntts.co.jp>2015-12-09 19:22:56 +0900
committerNaoto Hanaue <hanaue.naoto@po.ntts.co.jp>2015-12-10 18:50:16 +0900
commit45ae72282ee5ed3f1d7d6641a5e4f1e8e7444ed2 (patch)
treecff25752d6dbb3ffe14e26acde524be6f4a1d469 /server
parent71588f6a1aacb996a8a6b4295a7f9a33717c6455 (diff)
server: fix bug when you add a neighbor config in grpc
Gobpg does not set AfiSafi if NeighborConfig is configured via gRPC, this issue causes error when Gobgp receives route from the Peer. log of following when peer was down ``` DEBU[0009] received Key=192.168.100.2 Topic=Peer data=&{Header:{Marker:[] Len:19 Type:4} Body:0xe17ff0} WARN[0010] malformed BGP update message Key=192.168.100.2 Topic=Peer error=Address-family rf 65537 not avalible for session WARN[0010] sent notification Data=&{Header:{Marker:[] Len:21 Type:3} Body:0xc8200117a0} Key=192.168.100.2 State=BGP_FSM_ESTABLISHED Topic=Peer INFO[0010] Peer Down Key=192.168.100.2 Reason=Peer closed the session State=BGP_FSM_ESTABLISHED Topic=Peer DEBU[0010] state changed Key=192.168.100.2 Topic=Peer new=BGP_FSM_IDLE old=BGP_FSM_ESTABLISHED ```
Diffstat (limited to 'server')
-rw-r--r--server/server.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/server/server.go b/server/server.go
index 8896ade2..c15403ee 100644
--- a/server/server.go
+++ b/server/server.go
@@ -1898,6 +1898,20 @@ func (server *BgpServer) handleGrpcModNeighbor(grpcReq *GrpcRequest) (sMsgs []*S
}
}
}
+ if a.Afisafis != nil {
+ for _, afisafi := range a.Afisafis.Afisafi {
+ cAfiSafi := config.AfiSafi{AfiSafiName: afisafi.Name}
+ pconf.AfiSafis.AfiSafiList = append(pconf.AfiSafis.AfiSafiList, cAfiSafi)
+ }
+ } else {
+ if net.ParseIP(a.Conf.NeighborAddress).To4() != nil {
+ pconf.AfiSafis.AfiSafiList = []config.AfiSafi{
+ config.AfiSafi{AfiSafiName: "ipv4-unicast"}}
+ } else {
+ pconf.AfiSafis.AfiSafiList = []config.AfiSafi{
+ config.AfiSafi{AfiSafiName: "ipv6-unicast"}}
+ }
+ }
return pconf
}
configneigh := apitoConfig(arg.Peer)