summaryrefslogtreecommitdiffhomepage
path: root/packet
diff options
context:
space:
mode:
authorISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>2015-11-24 12:07:21 +0900
committerISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>2015-11-24 15:30:03 +0900
commitd62984352e4acc8c6091213f37a18d41dfe1c49d (patch)
tree85358e044ad9d7d4053bd5f4916fde24f8d2d0d9 /packet
parent0b7433a6fbf4d55417e896ca02dd7da5f51014a1 (diff)
packet: fix extended community parsing
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'packet')
-rw-r--r--packet/bgp.go18
1 files changed, 10 insertions, 8 deletions
diff --git a/packet/bgp.go b/packet/bgp.go
index 86d63987..bac3edb0 100644
--- a/packet/bgp.go
+++ b/packet/bgp.go
@@ -5161,11 +5161,14 @@ func parseFlowSpecExtended(data []byte) (ExtendedCommunityInterface, error) {
dscp := data[7]
return NewTrafficRemarkExtended(dscp), nil
}
- return nil, fmt.Errorf("unknown flowspec subtype: %d", subType)
+ return &UnknownExtended{
+ Type: ExtendedCommunityAttrType(data[0]),
+ Value: data[1:8],
+ }, nil
}
type UnknownExtended struct {
- Type BGPAttrType
+ Type ExtendedCommunityAttrType
Value []byte
}
@@ -5245,13 +5248,12 @@ func ParseExtended(data []byte) (ExtendedCommunityInterface, error) {
case EC_TYPE_EVPN:
return parseEvpnExtended(data)
case EC_TYPE_GENERIC_TRANSITIVE_EXPERIMENTAL, EC_TYPE_GENERIC_TRANSITIVE_EXPERIMENTAL2, EC_TYPE_GENERIC_TRANSITIVE_EXPERIMENTAL3:
- p, err := parseFlowSpecExtended(data)
- return p, err
+ return parseFlowSpecExtended(data)
default:
- e := &UnknownExtended{}
- e.Type = BGPAttrType(data[0])
- e.Value = data[1:8]
- return e, nil
+ return &UnknownExtended{
+ Type: ExtendedCommunityAttrType(data[0]),
+ Value: data[1:8],
+ }, nil
}
}