summaryrefslogtreecommitdiffhomepage
path: root/config/util.go
diff options
context:
space:
mode:
Diffstat (limited to 'config/util.go')
-rw-r--r--config/util.go19
1 files changed, 9 insertions, 10 deletions
diff --git a/config/util.go b/config/util.go
index de7ba3d4..f63e6d69 100644
--- a/config/util.go
+++ b/config/util.go
@@ -66,17 +66,16 @@ func (c AfiSafis) ToRfList() ([]bgp.RouteFamily, error) {
}
func CreateRfMap(p *Neighbor) map[bgp.RouteFamily]bgp.BGPAddPathMode {
- rfs, _ := AfiSafis(p.AfiSafis).ToRfList()
- 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] = mode
+ for _, af := range p.AfiSafis {
+ mode := bgp.BGP_ADD_PATH_NONE
+ if af.AddPaths.State.Receive {
+ mode |= bgp.BGP_ADD_PATH_RECEIVE
+ }
+ if af.AddPaths.State.SendMax > 0 {
+ mode |= bgp.BGP_ADD_PATH_SEND
+ }
+ rfMap[af.State.Family] = mode
}
return rfMap
}