This code has, until now, parsed and accepted invalid bitmaps. It seems
better to simply ignore them, leaving the original set of allowed versions
from the version field in the ofp_header.
Signed-off-by: Ben Pfaff <blp@nicira.com>
static bool
ofputil_decode_hello_bitmap(const struct ofp_hello_elem_header *oheh,
static bool
ofputil_decode_hello_bitmap(const struct ofp_hello_elem_header *oheh,
- uint32_t *allowed_versions)
+ uint32_t *allowed_versionsp)
{
uint16_t bitmap_len = ntohs(oheh->length) - sizeof *oheh;
const ovs_be32 *bitmap = (const ovs_be32 *) (oheh + 1);
{
uint16_t bitmap_len = ntohs(oheh->length) - sizeof *oheh;
const ovs_be32 *bitmap = (const ovs_be32 *) (oheh + 1);
+ uint32_t allowed_versions;
if (!bitmap_len || bitmap_len % sizeof *bitmap) {
return false;
if (!bitmap_len || bitmap_len % sizeof *bitmap) {
return false;
* should have no effect on session negotiation until Open vSwtich supports
* wire-protocol versions greater than 31.
*/
* should have no effect on session negotiation until Open vSwtich supports
* wire-protocol versions greater than 31.
*/
- *allowed_versions = ntohl(bitmap[0]);
+ allowed_versions = ntohl(bitmap[0]);
- if (*allowed_versions & 1) {
+ if (allowed_versions & 1) {
/* There's no OpenFlow version 0. */
VLOG_WARN_RL(&bad_ofmsg_rl, "peer claims to support invalid OpenFlow "
"version 0x00");
/* There's no OpenFlow version 0. */
VLOG_WARN_RL(&bad_ofmsg_rl, "peer claims to support invalid OpenFlow "
"version 0x00");
- *allowed_versions &= ~1u;
+ allowed_versions &= ~1u;
- if (!*allowed_versions) {
+ if (!allowed_versions) {
VLOG_WARN_RL(&bad_ofmsg_rl, "peer does not support any OpenFlow "
"version (between 0x01 and 0x1f)");
return false;
}
VLOG_WARN_RL(&bad_ofmsg_rl, "peer does not support any OpenFlow "
"version (between 0x01 and 0x1f)");
return false;
}
+ *allowed_versionsp = allowed_versions;