2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 06:15:47 +00:00

connmgr: Only send role status messages to OpenFlow 1.4+ controllers.

Only OpenFlow 1.4 and later support role status messages, but this code
tried to send them to all controllers, which caused an assertion failure.

Also, add tests to check that role status messages work, and that they
don't cause trouble with OF1.2.

Reported-by: Anup Khadka <khadka.py@gmail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
This commit is contained in:
Ben Pfaff
2014-07-22 15:54:55 -07:00
parent ab66e29f7b
commit 6751a4b43e
4 changed files with 136 additions and 38 deletions

View File

@@ -4973,22 +4973,31 @@ ofputil_encode_role_reply(const struct ofp_header *request,
return buf;
}
/* Encodes "role status" message 'status' for sending in the given
* 'protocol'. Returns the role status message, if 'protocol' supports them,
* otherwise a null pointer. */
struct ofpbuf *
ofputil_encode_role_status(const struct ofputil_role_status *status,
enum ofputil_protocol protocol)
{
struct ofpbuf *buf;
enum ofp_version version;
struct ofp14_role_status *rstatus;
version = ofputil_protocol_to_ofp_version(protocol);
buf = ofpraw_alloc_xid(OFPRAW_OFPT14_ROLE_STATUS, version, htonl(0), 0);
rstatus = ofpbuf_put_zeros(buf, sizeof *rstatus);
rstatus->role = htonl(status->role);
rstatus->reason = status->reason;
rstatus->generation_id = htonll(status->generation_id);
if (version >= OFP14_VERSION) {
struct ofp14_role_status *rstatus;
struct ofpbuf *buf;
return buf;
buf = ofpraw_alloc_xid(OFPRAW_OFPT14_ROLE_STATUS, version, htonl(0),
0);
rstatus = ofpbuf_put_zeros(buf, sizeof *rstatus);
rstatus->role = htonl(status->role);
rstatus->reason = status->reason;
rstatus->generation_id = htonll(status->generation_id);
return buf;
} else {
return NULL;
}
}
enum ofperr