Signed-off-by: Simon Horman <[email protected]>
---
v4
* Rebase
---
lib/ofp-util.c | 14 ++++++++++++--
lib/ofp-util.h | 2 ++
ofproto/connmgr.c | 9 ++++++++-
3 files changed, 22 insertions(+), 3 deletions(-)
diff --git a/lib/ofp-util.c b/lib/ofp-util.c
index 9307cf2..c99a133 100644
--- a/lib/ofp-util.c
+++ b/lib/ofp-util.c
@@ -625,9 +625,10 @@ ofputil_protocol_to_ofp_version(enum ofputil_protocol
protocol)
return OFP10_VERSION;
case OFPUTIL_P_OF12:
return OFP12_VERSION;
+ case OFPUTIL_P_NONE:
+ default:
+ NOT_REACHED();
}
-
- NOT_REACHED();
}
/* Returns true if 'protocol' is a single OFPUTIL_P_* value, false
@@ -663,6 +664,7 @@ ofputil_protocol_set_tid(enum ofputil_protocol protocol,
bool enable)
case OFPUTIL_P_OF12:
return OFPUTIL_P_OF12;
+ case OFPUTIL_P_NONE:
default:
NOT_REACHED();
}
@@ -697,6 +699,7 @@ ofputil_protocol_set_base(enum ofputil_protocol cur,
case OFPUTIL_P_OF12:
return ofputil_protocol_set_tid(OFPUTIL_P_OF12, tid);
+ case OFPUTIL_P_NONE:
default:
NOT_REACHED();
}
@@ -727,6 +730,9 @@ ofputil_protocol_to_string(enum ofputil_protocol protocol)
case OFPUTIL_P_OF12:
return "OpenFlow12";
+
+ case OFPUTIL_P_NONE:
+ NOT_REACHED();
}
/* Check abbreviations. */
@@ -1217,6 +1223,7 @@ ofputil_encode_set_protocol(enum ofputil_protocol current,
case OFPUTIL_P_OF10_TID:
case OFPUTIL_P_NXM_TID:
+ case OFPUTIL_P_NONE:
NOT_REACHED();
}
}
@@ -1558,6 +1565,7 @@ ofputil_encode_flow_mod(const struct ofputil_flow_mod *fm,
break;
}
+ case OFPUTIL_P_NONE:
default:
NOT_REACHED();
}
@@ -1762,6 +1770,7 @@ ofputil_encode_flow_stats_request(const struct
ofputil_flow_stats_request *fsr,
break;
}
+ case OFPUTIL_P_NONE:
default:
NOT_REACHED();
}
@@ -2256,6 +2265,7 @@ ofputil_encode_flow_removed(const struct
ofputil_flow_removed *fr,
break;
}
+ case OFPUTIL_P_NONE:
default:
NOT_REACHED();
}
diff --git a/lib/ofp-util.h b/lib/ofp-util.h
index 93ccf50..7ed475f 100644
--- a/lib/ofp-util.h
+++ b/lib/ofp-util.h
@@ -58,6 +58,8 @@ int ofputil_netmask_to_wcbits(ovs_be32 netmask);
* to implement set union and intersection.
*/
enum ofputil_protocol {
+ OFPUTIL_P_NONE = 0,
+
/* OpenFlow 1.0-based protocols. */
OFPUTIL_P_OF10 = 1 << 0, /* OpenFlow 1.0 flow format. */
OFPUTIL_P_OF10_TID = 1 << 1, /* OF1.0 + flow_mod_table_id extension. */
diff --git a/ofproto/connmgr.c b/ofproto/connmgr.c
index ba93a1d..ce4b9cc 100644
--- a/ofproto/connmgr.c
+++ b/ofproto/connmgr.c
@@ -1034,7 +1034,7 @@ ofconn_flush(struct ofconn *ofconn)
int i;
ofconn->role = NX_ROLE_OTHER;
- ofconn->protocol = OFPUTIL_P_OF10;
+ ofconn->protocol = OFPUTIL_P_NONE;
ofconn->packet_in_format = NXPIF_OPENFLOW10;
/* Disassociate 'ofconn' from all of the ofopgroups that it initiated that
@@ -1181,6 +1181,13 @@ ofconn_run(struct ofconn *ofconn,
of_msg = (ofconn->blocked
? ofconn->blocked
: rconn_recv(ofconn->rconn));
+ if (ofconn_get_protocol(ofconn) == OFPUTIL_P_NONE) {
+ int version = rconn_get_version(ofconn->rconn);
+ if (version > 0) {
+ ofconn_set_protocol(ofconn,
+ ofputil_protocol_from_ofp_version(version));
+ }
+ }
if (!of_msg) {
break;
}
--
1.7.10.4
_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev