code: func validatePathAttributeFlags(t BGPAttrType, flags BGPAttrFlag) string {
  
  	/*
  	 * RFC 4271 P.17 For well-known attributes, the Transitive bit MUST be set to 1.
  	 */
  	if flags&BGP_ATTR_FLAG_OPTIONAL == 0 && flags&BGP_ATTR_FLAG_TRANSITIVE == 0 {
  		eMsg := fmt.Sprintf("well-known attribute %s must have transitive flag 1", t)
  		return eMsg
  	}
  	/*
  	 * RFC 4271 P.17 For well-known attributes and for optional non-transitive attributes,
  	 * the Partial bit MUST be set to 0.
  	 */
  	if flags&BGP_ATTR_FLAG_OPTIONAL == 0 && flags&BGP_ATTR_FLAG_PARTIAL != 0 {
  		eMsg := fmt.Sprintf("well-known attribute %s must have partial bit 0", t)
  		return eMsg
  	}
  	if flags&BGP_ATTR_FLAG_OPTIONAL != 0 && flags&BGP_ATTR_FLAG_TRANSITIVE == 0 && flags&BGP_ATTR_FLAG_PARTIAL != 0 {
  		eMsg := fmt.Sprintf("optional non-transitive attribute %s must have partial bit 0", t)
  		return eMsg
  	}
  
  	// check flags are correct
  	if f, ok := PathAttrFlags[t]; ok {
  		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 eMsg
  		}
  	}
  	return ""
  }
docs: // validator for PathAttribute