[ovs-dev] [PATCH 33/38] Allow decoding of Open Flow 1.1 & 1.2 Flow Removed Messages
Simon Horman
horms at verge.net.au
Thu Aug 9 08:49:54 UTC 2012
Signed-off-by: Simon Horman <horms at verge.net.au>
---
v11
* Initial post
---
lib/ofp-util.c | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/lib/ofp-util.c b/lib/ofp-util.c
index 8b66598..19bb36c 100644
--- a/lib/ofp-util.c
+++ b/lib/ofp-util.c
@@ -1928,7 +1928,29 @@ ofputil_decode_flow_removed(struct ofputil_flow_removed *fr,
ofpbuf_use_const(&b, oh, ntohs(oh->length));
raw = ofpraw_pull_assert(&b);
- if (raw == OFPRAW_OFPT10_FLOW_REMOVED) {
+ if (raw == OFPRAW_OFPT11_FLOW_REMOVED) {
+ const struct ofp12_flow_removed *ofr;
+ enum ofperr error;
+
+ ofr = ofpbuf_pull(&b, sizeof *ofr);
+
+ error = ofputil_pull_ofp11_match(&b, ntohs(ofr->priority),
+ &fr->rule, NULL);
+ if (error) {
+ return error;
+ }
+
+ fr->cookie = ofr->cookie;
+ fr->reason = ofr->reason;
+ /* XXX: ofr->table_id is ignored */
+ fr->duration_sec = ntohl(ofr->duration_sec);
+ fr->duration_nsec = ntohl(ofr->duration_nsec);
+ fr->idle_timeout = ntohs(ofr->idle_timeout);
+ /* XXX: ofr->hard_timeout is ignored,
+ * This field was introduced in OpenFlow 1.2 */
+ fr->packet_count = ntohll(ofr->packet_count);
+ fr->byte_count = ntohll(ofr->byte_count);
+ } else if (raw == OFPRAW_OFPT10_FLOW_REMOVED) {
const struct ofp_flow_removed *ofr;
ofr = ofpbuf_pull(&b, sizeof *ofr);
--
1.7.10.2.484.gcd07cc5
More information about the dev
mailing list