diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2015-06-20 13:23:10 +0900 |
---|---|---|
committer | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2015-06-20 15:32:56 +0900 |
commit | 1380d3697201754fd496444fc66391b5622fe62b (patch) | |
tree | 1d816a2d451952a6ac662dc42ac9c812e3354f9b /packet/validate.go | |
parent | 124733d4d3024f37a2dffce93fcc60400f62d421 (diff) |
packet: flag down BGP_ATTR_FLAG_PARTIAL when validating flags
BGP_ATTR_FLAG_PARTIAL flag can be set even for the valid path attributes.
Nessesary validation related to BGP_ATTR_FLAG_PARTIAL is all done before
here.
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'packet/validate.go')
-rw-r--r-- | packet/validate.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/packet/validate.go b/packet/validate.go index b79012fc..3da96387 100644 --- a/packet/validate.go +++ b/packet/validate.go @@ -156,8 +156,8 @@ func ValidateFlags(t BGPAttrType, flags BGPAttrFlag) (bool, string) { // check flags are correct if f, ok := pathAttrFlags[t]; ok { - if f != BGPAttrFlag(uint8(flags) & ^uint8(BGP_ATTR_FLAG_EXTENDED_LENGTH)) { - eMsg := fmt.Sprintf("flags are invalid. attribute type: %d, expect: %s, actual: %s", t, f, flags) + if f != flags & ^BGP_ATTR_FLAG_EXTENDED_LENGTH & ^BGP_ATTR_FLAG_PARTIAL { + eMsg := fmt.Sprintf("flags are invalid. attribute type: %s, expect: %s, actual: %s", t, f, flags) return false, eMsg } } |