diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2015-08-27 00:08:51 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-08-27 00:51:19 +0900 |
commit | 36f6d32ff224d887c8d06ba0386a00eb9a542b6e (patch) | |
tree | d8777d0e412cf6fb5f7ee5eb827517b7cfd8926c | |
parent | 319841ac5ec46c9e26517c83b56800155fb1498b (diff) |
packet: fix returning wrong OpaqueExtended subtype
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
-rw-r--r-- | packet/bgp.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/packet/bgp.go b/packet/bgp.go index d1c77303..ebf9d068 100644 --- a/packet/bgp.go +++ b/packet/bgp.go @@ -4073,15 +4073,16 @@ func (e *EncapExtended) String() string { type OpaqueExtended struct { IsTransitive bool Value OpaqueExtendedValueInterface + SubType ExtendedCommunityAttrSubType } func (e *OpaqueExtended) DecodeFromBytes(data []byte) error { if len(data) != 7 { return fmt.Errorf("Invalid OpaqueExtended bytes len: %d", len(data)) } - subType := ExtendedCommunityAttrSubType(data[0]) + e.SubType = ExtendedCommunityAttrSubType(data[0]) - switch subType { + switch e.SubType { case EC_SUBTYPE_COLOR: v := binary.BigEndian.Uint32(data[3:7]) e.Value = &ColorExtended{ @@ -4137,7 +4138,7 @@ func (e *OpaqueExtended) GetTypes() (ExtendedCommunityAttrType, ExtendedCommunit if !e.IsTransitive { t = EC_TYPE_NON_TRANSITIVE_OPAQUE } - return t, ExtendedCommunityAttrSubType(0xFF) + return t, e.SubType } func NewOpaqueExtended(isTransitive bool) *OpaqueExtended { |