diff options
Diffstat (limited to 'packet/bgp.go')
-rw-r--r-- | packet/bgp.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/packet/bgp.go b/packet/bgp.go index 5131a284..a5fd715c 100644 --- a/packet/bgp.go +++ b/packet/bgp.go @@ -1134,6 +1134,7 @@ func (p *PathAttribute) getType() BGPAttrType { } func (p *PathAttribute) DecodeFromBytes(data []byte) error { + odata := data eCode := uint8(BGP_ERROR_UPDATE_MESSAGE_ERROR) eSubCode := uint8(BGP_ERROR_SUB_ATTRIBUTE_LENGTH_ERROR) if len(data) < 2 { @@ -1160,6 +1161,10 @@ func (p *PathAttribute) DecodeFromBytes(data []byte) error { } p.Value = data[:p.Length] + ok, eMsg := ValidateFlags(p.Type, p.Flags) + if !ok { + return NewMessageError(eCode, BGP_ERROR_SUB_ATTRIBUTE_FLAGS_ERROR, odata[:p.Len()], eMsg) + } return nil } |