summaryrefslogtreecommitdiffhomepage
path: root/packet/bgp.go
diff options
context:
space:
mode:
Diffstat (limited to 'packet/bgp.go')
-rw-r--r--packet/bgp.go20
1 files changed, 18 insertions, 2 deletions
diff --git a/packet/bgp.go b/packet/bgp.go
index 533b0288..6f541037 100644
--- a/packet/bgp.go
+++ b/packet/bgp.go
@@ -1997,7 +1997,15 @@ func (a *AsPathParam) Len() int {
}
func (a *AsPathParam) ASLen() int {
- return len(a.AS)
+ switch a.Type {
+ case BGP_ASPATH_ATTR_TYPE_SEQ:
+ return len(a.AS)
+ case BGP_ASPATH_ATTR_TYPE_SET:
+ return 1
+ case BGP_ASPATH_ATTR_TYPE_CONFED_SET,BGP_ASPATH_ATTR_TYPE_CONFED_SEQ:
+ return 0
+ }
+ return 0
}
func NewAsPathParam(segType uint8, as []uint16) *AsPathParam {
@@ -2048,7 +2056,15 @@ func (a *As4PathParam) Len() int {
}
func (a *As4PathParam) ASLen() int {
- return len(a.AS)
+ switch a.Type {
+ case BGP_ASPATH_ATTR_TYPE_SEQ:
+ return len(a.AS)
+ case BGP_ASPATH_ATTR_TYPE_SET:
+ return 1
+ case BGP_ASPATH_ATTR_TYPE_CONFED_SET,BGP_ASPATH_ATTR_TYPE_CONFED_SEQ:
+ return 0
+ }
+ return 0
}
func NewAs4PathParam(segType uint8, as []uint32) *As4PathParam {