summaryrefslogtreecommitdiffhomepage
path: root/server/peer.go
diff options
context:
space:
mode:
authorISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>2015-05-01 10:06:42 +0000
committerISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>2015-05-01 10:16:09 +0000
commit232b30117c8eafc5cae7aec81ce9fafe742bdd4b (patch)
tree235342a7345b6034f02a1864485a4c96e25d3ea2 /server/peer.go
parentcea5941db2dd9268ad35b5f494480350d747d404 (diff)
table: add support for route target constraint nlri
add rtc route $ gobgp global rib add 65000 77 -a rtc check it $ gobgp global rib -a rtc Network Next Hop AS_PATH Age Attrs *> 65001:65000:75 0.0.0.0 [65001] 00:15:35 [{Origin: IGP}] Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'server/peer.go')
-rw-r--r--server/peer.go27
1 files changed, 27 insertions, 0 deletions
diff --git a/server/peer.go b/server/peer.go
index 64235613..7af2653e 100644
--- a/server/peer.go
+++ b/server/peer.go
@@ -422,6 +422,33 @@ func (peer *Peer) handleGrpc(grpcReq *GrpcRequest) {
}
}(path.Attrs)
+ case bgp.RF_RTC_UC:
+ var ec bgp.ExtendedCommunityInterface
+ target := path.Nlri.RtNlri.Target
+ ec_type := target.Type
+ ec_subtype := target.Subtype
+ switch ec_type {
+ case api.EXTENDED_COMMUNITIE_TYPE_TWO_OCTET_AS_SPECIFIC:
+ if target.Asn == 0 && target.LocalAdmin == 0 {
+ break
+ }
+ ec = &bgp.TwoOctetAsSpecificExtended{
+ SubType: bgp.ExtendedCommunityAttrSubType(ec_subtype),
+ AS: uint16(target.Asn),
+ LocalAdmin: target.LocalAdmin,
+ IsTransitive: true,
+ }
+ default:
+ result.ResponseErr = fmt.Errorf("Invalid endpoint ip address: %s", path.Nlri.Prefix)
+ grpcReq.ResponseCh <- result
+ close(grpcReq.ResponseCh)
+ return
+ }
+
+ nlri = bgp.NewRouteTargetMembershipNLRI(peer.globalConfig.As, ec)
+
+ pattr = append(pattr, bgp.NewPathAttributeMpReachNLRI("0.0.0.0", []bgp.AddrPrefixInterface{nlri}))
+
default:
result.ResponseErr = fmt.Errorf("Unsupported address family: %s", rf)
grpcReq.ResponseCh <- result