diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2015-06-19 02:36:04 +0900 |
---|---|---|
committer | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2015-06-20 13:28:45 +0900 |
commit | 51f1c2b644e8fac485db45b571520b31a6cb0da0 (patch) | |
tree | e16b53e86495d54ebfebcd40ca01012458b5a119 /packet/validate.go | |
parent | caeea100653522090d36ece22e80a945d59742fd (diff) |
packet: store path attr flag as type BGPAttrFlag
also add more meaningful debug message to ValidateFlags()
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'packet/validate.go')
-rw-r--r-- | packet/validate.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/packet/validate.go b/packet/validate.go index b05574b2..b79012fc 100644 --- a/packet/validate.go +++ b/packet/validate.go @@ -132,7 +132,7 @@ func ValidateAttribute(a PathAttributeInterface, rfs map[RouteFamily]bool) (bool } // validator for PathAttribute -func ValidateFlags(t BGPAttrType, flags uint8) (bool, string) { +func ValidateFlags(t BGPAttrType, flags BGPAttrFlag) (bool, string) { /* * RFC 4271 P.17 For well-known attributes, the Transitive bit MUST be set to 1. @@ -156,8 +156,8 @@ func ValidateFlags(t BGPAttrType, flags uint8) (bool, string) { // check flags are correct if f, ok := pathAttrFlags[t]; ok { - if f != (flags & ^uint8(BGP_ATTR_FLAG_EXTENDED_LENGTH)) { - eMsg := "flags are invalid. attribtue type : " + strconv.Itoa(int(t)) + 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) return false, eMsg } } |