diff options
author | FUJITA Tomonori <fujita.tomonori@gmail.com> | 2019-09-08 22:43:08 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@gmail.com> | 2019-09-08 22:43:08 +0900 |
commit | 25438b289c9c37a6f6a067b087836b979025e611 (patch) | |
tree | 100b23a5f12b34f25b40e58b22f79588c97e2e0e /internal | |
parent | 07e70de118842609a8e1e4740fdb82179f4bdaca (diff) |
execute rpki validation for policy only when it's necessary
currently, validate is executed even if the result is not necessary.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
Diffstat (limited to 'internal')
-rw-r--r-- | internal/pkg/table/policy.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/internal/pkg/table/policy.go b/internal/pkg/table/policy.go index bffc01c0..24eda345 100644 --- a/internal/pkg/table/policy.go +++ b/internal/pkg/table/policy.go @@ -35,9 +35,9 @@ import ( ) type PolicyOptions struct { - Info *PeerInfo - ValidationResult *Validation - OldNextHop net.IP + Info *PeerInfo + OldNextHop net.IP + Validate func(*Path) *Validation } type DefinedType int @@ -1905,8 +1905,8 @@ func (c *RpkiValidationCondition) Type() ConditionType { } func (c *RpkiValidationCondition) Evaluate(path *Path, options *PolicyOptions) bool { - if options != nil && options.ValidationResult != nil { - return c.result == options.ValidationResult.Status + if options != nil && options.Validate != nil { + return c.result == options.Validate(path).Status } return false } |