summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2016-04-20 17:49:29 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2016-04-21 13:32:34 +0900
commitfb83e41aebfa0b51c5e454d1f77870513d47e82d (patch)
tree092ad74dbfcca8f36c6e2dc7b1509c6eefd06102
parent35efcd570d65a55cf059653ba153fdb360b71672 (diff)
rpki: use the own AS number if asPath is empty
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r--server/rpki.go27
1 files changed, 15 insertions, 12 deletions
diff --git a/server/rpki.go b/server/rpki.go
index 5b4903e1..cb785901 100644
--- a/server/rpki.go
+++ b/server/rpki.go
@@ -532,20 +532,23 @@ func (c *roaManager) handleGRPC(grpcReq *GrpcRequest) {
func validatePath(ownAs uint32, tree *radix.Tree, cidr string, asPath *bgp.PathAttributeAsPath) config.RpkiValidationResultType {
var as uint32
- if asPath == nil || len(asPath.Value) == 0 {
- return config.RPKI_VALIDATION_RESULT_TYPE_NOT_FOUND
- }
- asParam := asPath.Value[len(asPath.Value)-1].(*bgp.As4PathParam)
- switch asParam.Type {
- case bgp.BGP_ASPATH_ATTR_TYPE_SEQ:
- if len(asParam.AS) == 0 {
+
+ if len(asPath.Value) == 0 {
+ as = ownAs
+ } else {
+ asParam := asPath.Value[len(asPath.Value)-1].(*bgp.As4PathParam)
+ switch asParam.Type {
+ case bgp.BGP_ASPATH_ATTR_TYPE_SEQ:
+ if len(asParam.AS) == 0 {
+ as = ownAs
+ } else {
+ as = asParam.AS[len(asParam.AS)-1]
+ }
+ case bgp.BGP_ASPATH_ATTR_TYPE_CONFED_SET, bgp.BGP_ASPATH_ATTR_TYPE_CONFED_SEQ:
+ as = ownAs
+ default:
return config.RPKI_VALIDATION_RESULT_TYPE_NOT_FOUND
}
- as = asParam.AS[len(asParam.AS)-1]
- case bgp.BGP_ASPATH_ATTR_TYPE_CONFED_SET, bgp.BGP_ASPATH_ATTR_TYPE_CONFED_SEQ:
- as = ownAs
- default:
- return config.RPKI_VALIDATION_RESULT_TYPE_NOT_FOUND
}
_, n, _ := net.ParseCIDR(cidr)
ones, _ := n.Mask.Size()