return vconn->allowed_versions;
}
+/* Sets the allowed_versions of 'vconn', overriding
+ * the allowed_versions passed to vconn_open(). */
+void
+vconn_set_allowed_versions(struct vconn *vconn, uint32_t allowed_versions)
+{
+ vconn->allowed_versions = allowed_versions;
+}
+
/* Returns the IP address of the peer, or 0 if the peer is not connected over
* an IP-based protocol or if its IP address is not yet known. */
ovs_be32
struct ofpbuf *b;
int retval;
- b = ofpraw_alloc(OFPRAW_OFPT_HELLO,
- leftmost_1bit_idx(vconn->allowed_versions), 0);
+ b = ofputil_encode_hello(vconn->allowed_versions);
retval = do_send(vconn, b);
if (!retval) {
vconn->state = VCS_RECV_HELLO;
retval = do_recv(vconn, &b);
if (!retval) {
- const struct ofp_header *oh = b->data;
enum ofptype type;
enum ofperr error;
char *peer_s, *local_s;
uint32_t common_versions;
- if (b->size > sizeof *oh) {
+ if (!ofputil_decode_hello(b->data, &vconn->peer_versions)) {
struct ds msg = DS_EMPTY_INITIALIZER;
- ds_put_format(&msg, "%s: extra-long hello:\n", vconn->name);
+ ds_put_format(&msg, "%s: unknown data in hello:\n",
+ vconn->name);
ds_put_hex_dump(&msg, b->data, b->size, 0, true);
VLOG_WARN_RL(&bad_ofmsg_rl, "%s", ds_cstr(&msg));
ds_destroy(&msg);