summaryrefslogtreecommitdiffhomepage
path: root/table
diff options
context:
space:
mode:
Diffstat (limited to 'table')
-rw-r--r--table/path.go2
-rw-r--r--table/policy.go14
2 files changed, 9 insertions, 7 deletions
diff --git a/table/path.go b/table/path.go
index 05144812..94bc5fd0 100644
--- a/table/path.go
+++ b/table/path.go
@@ -208,7 +208,7 @@ func (path *Path) ToApiStruct(id string) *api.Path {
Pattrs: pattrs,
Age: int64(time.Now().Sub(path.timestamp).Seconds()),
IsWithdraw: path.IsWithdraw,
- Validation: int32(path.Validation),
+ Validation: int32(path.Validation.ToInt()),
Filtered: path.Filtered(id) > POLICY_DIRECTION_NONE,
Family: family,
}
diff --git a/table/policy.go b/table/policy.go
index c9e65300..e556ec1d 100644
--- a/table/policy.go
+++ b/table/policy.go
@@ -172,9 +172,10 @@ const (
)
func NewMatchOption(c interface{}) (MatchOption, error) {
- switch c.(type) {
+ switch t := c.(type) {
case config.MatchSetOptionsType:
- switch c.(config.MatchSetOptionsType) {
+ t = t.DefaultAsNeeded()
+ switch t {
case config.MATCH_SET_OPTIONS_TYPE_ANY:
return MATCH_OPTION_ANY, nil
case config.MATCH_SET_OPTIONS_TYPE_ALL:
@@ -183,7 +184,8 @@ func NewMatchOption(c interface{}) (MatchOption, error) {
return MATCH_OPTION_INVERT, nil
}
case config.MatchSetOptionsRestrictedType:
- switch c.(config.MatchSetOptionsRestrictedType) {
+ t = t.DefaultAsNeeded()
+ switch t {
case config.MATCH_SET_OPTIONS_RESTRICTED_TYPE_ANY:
return MATCH_OPTION_ANY, nil
case config.MATCH_SET_OPTIONS_RESTRICTED_TYPE_INVERT:
@@ -1696,7 +1698,7 @@ func (a *CommunityAction) ToApiStruct() *api.CommunityAction {
cs = append(cs, exp.String())
}
return &api.CommunityAction{
- Type: api.CommunityActionType(a.action),
+ Type: api.CommunityActionType(a.action.ToInt()),
Communities: cs,
}
}
@@ -1814,7 +1816,7 @@ func (a *ExtCommunityAction) ToApiStruct() *api.CommunityAction {
cs = append(cs, f(idx, exp.String()))
}
return &api.CommunityAction{
- Type: api.CommunityActionType(a.action),
+ Type: api.CommunityActionType(a.action.ToInt()),
Communities: cs,
}
}
@@ -2108,7 +2110,7 @@ func (s *Statement) ToApiStruct() *api.Statement {
case *ExtCommunityCondition:
cs.ExtCommunitySet = c.(*ExtCommunityCondition).ToApiStruct()
case *RpkiValidationCondition:
- cs.RpkiResult = int32(c.(*RpkiValidationCondition).result)
+ cs.RpkiResult = int32(c.(*RpkiValidationCondition).result.ToInt())
}
}
as := &api.Actions{}