summaryrefslogtreecommitdiffhomepage
path: root/config/util.go
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2015-11-08 06:31:49 -0800
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2015-11-08 06:31:49 -0800
commit344e575502102352ee448463763badc16e1ffdfd (patch)
tree1cc17bab815a383d2c4e28d1a835892034cb819d /config/util.go
parent2f6db55c6743cdd568f1555b91017a6f2c09695d (diff)
server: add rfmap to fsm too
rfmap is necessary to validate BGP messages. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'config/util.go')
-rw-r--r--config/util.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/config/util.go b/config/util.go
index 26ab7004..85a36e38 100644
--- a/config/util.go
+++ b/config/util.go
@@ -15,6 +15,10 @@
package config
+import (
+ "github.com/osrg/gobgp/packet"
+)
+
func IsConfederationMember(g *Global, p *Neighbor) bool {
if p.NeighborConfig.PeerAs != g.GlobalConfig.As {
for _, member := range g.Confederation.ConfederationConfig.MemberAs {
@@ -25,3 +29,12 @@ func IsConfederationMember(g *Global, p *Neighbor) bool {
}
return false
}
+
+func CreateRfMap(p *Neighbor) map[bgp.RouteFamily]bool {
+ rfMap := make(map[bgp.RouteFamily]bool)
+ for _, rf := range p.AfiSafis.AfiSafiList {
+ k, _ := bgp.GetRouteFamily(rf.AfiSafiName)
+ rfMap[k] = true
+ }
+ return rfMap
+}