summaryrefslogtreecommitdiffhomepage
path: root/config/util.go
diff options
context:
space:
mode:
Diffstat (limited to 'config/util.go')
-rw-r--r--config/util.go13
1 files changed, 10 insertions, 3 deletions
diff --git a/config/util.go b/config/util.go
index 8ecf56d5..ab7ebfe3 100644
--- a/config/util.go
+++ b/config/util.go
@@ -69,11 +69,18 @@ func (c AfiSafis) ToRfList() ([]bgp.RouteFamily, error) {
return rfs, nil
}
-func CreateRfMap(p *Neighbor) map[bgp.RouteFamily]bool {
+func CreateRfMap(p *Neighbor) map[bgp.RouteFamily]bgp.BGPAddPathMode {
rfs, _ := AfiSafis(p.AfiSafis).ToRfList()
- rfMap := make(map[bgp.RouteFamily]bool)
+ mode := bgp.BGP_ADD_PATH_NONE
+ if p.AddPaths.Config.Receive {
+ mode |= bgp.BGP_ADD_PATH_RECEIVE
+ }
+ if p.AddPaths.Config.SendMax > 0 {
+ mode |= bgp.BGP_ADD_PATH_SEND
+ }
+ rfMap := make(map[bgp.RouteFamily]bgp.BGPAddPathMode)
for _, rf := range rfs {
- rfMap[rf] = true
+ rfMap[rf] = mode
}
return rfMap
}