- if (!ofperr_is_encodable(error, ofp_version)) {
- static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5);
-
- if (!ofperr_is_valid(error)) {
- /* 'error' seems likely to be a system errno value. */
- VLOG_WARN_RL(&rl, "invalid OpenFlow error code %d (%s)",
- error, strerror(error));
- } else {
- const char *s = ofperr_get_name(error);
- if (ofperr_is_category(error)) {
- VLOG_WARN_RL(&rl, "cannot encode error category (%s)", s);
- } else {
- VLOG_WARN_RL(&rl, "cannot encode %s for %s", s, domain->name);
- }
- }
-
- return NULL;
+ /* Make sure 'error' is valid in 'domain', or use a fallback error. */
+ if (!ofperr_is_valid(error)) {
+ /* 'error' seems likely to be a system errno value. */
+ VLOG_ERR_RL(&rl, "invalid OpenFlow error code %d (%s)",
+ error, ovs_strerror(error));
+ error = OFPERR_NXBRC_UNENCODABLE_ERROR;
+ } else if (domain->errors[error - OFPERR_OFS].code < 0) {
+ VLOG_ERR_RL(&rl, "cannot encode %s for %s",
+ ofperr_get_name(error), domain->name);
+ error = OFPERR_NXBRC_UNENCODABLE_ERROR;