diff options
Diffstat (limited to 'server')
-rw-r--r-- | server/server.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/server/server.go b/server/server.go index ed09f528..64db3420 100644 --- a/server/server.go +++ b/server/server.go @@ -867,6 +867,7 @@ func (server *BgpServer) handleModPathRequest(grpcReq *GrpcRequest, peerInfo *ta var nexthop string var rf bgp.RouteFamily var path *api.Path + seen := make(map[bgp.BGPAttrType]bool) arg, ok := grpcReq.Data.(*api.ModPathArguments) if !ok { @@ -897,6 +898,12 @@ func (server *BgpServer) handleModPathRequest(grpcReq *GrpcRequest, peerInfo *ta goto ERR } + if _, ok := seen[p.GetType()]; !ok { + seen[p.GetType()] = true + } else { + result.ResponseErr = fmt.Errorf("the path attribute apears twice. Type : " + strconv.Itoa(int(p.GetType()))) + goto ERR + } switch p.GetType() { case bgp.BGP_ATTR_TYPE_NEXT_HOP: nexthop = p.(*bgp.PathAttributeNextHop).Value.String() |