summaryrefslogtreecommitdiffhomepage
path: root/server/peer.go
diff options
context:
space:
mode:
authorNaoto Hanaue <hanaue.naoto@po.ntts.co.jp>2015-05-25 11:50:42 +0900
committerNaoto Hanaue <hanaue.naoto@po.ntts.co.jp>2015-05-26 17:28:44 +0900
commitfd4f6a91efb81646281ae8175433872627ec8611 (patch)
treef657b1c3bec445ed48dd82a009f61a34533209db /server/peer.go
parentfa5d2fe25ee3670a5ba2e66431dfd617f48737af (diff)
cli: add the add/del commands to routepolicy
% gobgp -u 10.0.255.1 policy routepolicy PolicyName policy0: StatementName st0: Conditions: PrefixSet: ps0 192.168.0.0/16 16..24 NeighborSet: ns2 10.0.0.4 AsPathLength: MatchOption: ALL Actions: REJECT % gobgp -u 10.0.255.1 policy routepolicy add policy1 st0 conditions --prefix ps2 --neighbor ns0 --aspath-len eq,5 --option all % gobgp -u 10.0.255.1 policy routepolicy add policy1 st0 actions --route-action accept % gobgp -u 10.0.255.1 policy routepolicy del policy0 % gobgp -u 10.0.255.1 policy routepolicy PolicyName policy1: StatementName st0: Conditions: PrefixSet: ps2 192.168.20.0/24 NeighborSet: ns0 10.0.0.2 10.0.0.3 AsPathLength: eq 5 MatchOption: ALL Actions: ACCEPT
Diffstat (limited to 'server/peer.go')
-rw-r--r--server/peer.go12
1 files changed, 10 insertions, 2 deletions
diff --git a/server/peer.go b/server/peer.go
index f83bbc3e..02585e11 100644
--- a/server/peer.go
+++ b/server/peer.go
@@ -624,10 +624,18 @@ func (peer *Peer) handleGrpc(grpcReq *GrpcRequest) {
resOutPolicies = append(resOutPolicies, &api.PolicyDefinition{PolicyDefinitionName: conOutPolicyName})
}
}
+ defaultInPolicy := "REJECT"
+ defaultOutPolicy := "REJECT"
+ if peer.defaultImportPolicy == 0 {
+ defaultInPolicy = "ACCEPT"
+ }
+ if peer.defaultExportPolicy == 0 {
+ defaultOutPolicy = "ACCEPT"
+ }
result.Data = &api.ApplyPolicy{
- DefaultImportPolicy: int64(peer.defaultImportPolicy),
+ DefaultImportPolicy: defaultInPolicy,
ImportPolicies: resInPolicies,
- DefaultExportPolicy: int64(peer.defaultExportPolicy),
+ DefaultExportPolicy: defaultOutPolicy,
ExportPolicies: resOutPolicies,
}
grpcReq.ResponseCh <- result