diff options
Diffstat (limited to 'server')
-rw-r--r-- | server/fsm.go | 6 | ||||
-rw-r--r-- | server/rpki.go | 9 |
2 files changed, 8 insertions, 7 deletions
diff --git a/server/fsm.go b/server/fsm.go index 2c2128cb..c121c85f 100644 --- a/server/fsm.go +++ b/server/fsm.go @@ -677,10 +677,10 @@ func getPathAttrFromBGPUpdate(m *bgp.BGPUpdate, typ bgp.BGPAttrType) bgp.PathAtt return nil } -func hasOwnASLoop(ownAS uint32, limit int, aspath *bgp.PathAttributeAsPath) bool { +func hasOwnASLoop(ownAS uint32, limit int, asPath *bgp.PathAttributeAsPath) bool { cnt := 0 - for _, i := range aspath.Value { - for _, as := range i.(*bgp.As4PathParam).AS { + for _, param := range asPath.Value { + for _, as := range param.GetAS() { if as == ownAS { cnt++ if cnt > limit { diff --git a/server/rpki.go b/server/rpki.go index 8f286930..75f25409 100644 --- a/server/rpki.go +++ b/server/rpki.go @@ -511,13 +511,14 @@ func ValidatePath(ownAs uint32, tree *radix.Tree, cidr string, asPath *bgp.PathA if asPath == nil || len(asPath.Value) == 0 { as = ownAs } else { - asParam := asPath.Value[len(asPath.Value)-1].(*bgp.As4PathParam) - switch asParam.Type { + param := asPath.Value[len(asPath.Value)-1] + switch param.GetType() { case bgp.BGP_ASPATH_ATTR_TYPE_SEQ: - if len(asParam.AS) == 0 { + asList := param.GetAS() + if len(asList) == 0 { as = ownAs } else { - as = asParam.AS[len(asParam.AS)-1] + as = asList[len(asList)-1] } case bgp.BGP_ASPATH_ATTR_TYPE_CONFED_SET, bgp.BGP_ASPATH_ATTR_TYPE_CONFED_SEQ: as = ownAs |