From 2b4cca6fc24ece6c727f877a9f17dd5f32da7f84 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Thu, 7 Nov 2013 09:39:03 -0800 Subject: vconn: Reply with OFPBRC_BAD_VERSION for bad version. Testers keep wanting to know why this doesn't work. I think it's a silly test, but it's easy enough to make them happy. Signed-off-by: Ben Pfaff --- lib/vconn.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'lib/vconn.c') diff --git a/lib/vconn.c b/lib/vconn.c index 5708987d5..2a83eda47 100644 --- a/lib/vconn.c +++ b/lib/vconn.c @@ -631,11 +631,25 @@ vconn_recv(struct vconn *vconn, struct ofpbuf **msgp) type != OFPTYPE_ERROR && type != OFPTYPE_ECHO_REQUEST && type != OFPTYPE_ECHO_REPLY)) { + struct ofpbuf *reply; + VLOG_ERR_RL(&bad_ofmsg_rl, "%s: received OpenFlow version " "0x%02"PRIx8" != expected %02x", vconn->name, oh->version, vconn->version); + + /* Send a "bad version" reply, if we can. */ + reply = ofperr_encode_reply(OFPERR_OFPBRC_BAD_VERSION, oh); + retval = vconn_send(vconn, reply); + if (retval) { + VLOG_INFO_RL(&bad_ofmsg_rl, + "%s: failed to queue error reply (%s)", + vconn->name, ovs_strerror(retval)); + ofpbuf_delete(reply); + } + + /* Suppress the received message, as if it had not arrived. */ + retval = EAGAIN; ofpbuf_delete(msg); - retval = EPROTO; } } } -- cgit v1.2.1