This is in preparation for supporting EXT-187: flow entry notification
extension (ONF flow monitor).

Signed-off-by: Simon Horman <ho...@verge.net.au>

---
v2
* First post
---
 lib/ofp-msgs.c | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/lib/ofp-msgs.c b/lib/ofp-msgs.c
index 27ac1b2..602f8b4 100644
--- a/lib/ofp-msgs.c
+++ b/lib/ofp-msgs.c
@@ -161,7 +161,16 @@ ofphdrs_decode(struct ofphdrs *hdrs,
 
         ovh = (const struct ofp_vendor_header *) oh;
         hdrs->vendor = ntohl(ovh->vendor);
-        if (hdrs->vendor == NX_VENDOR_ID) {
+        if (hdrs->version >= OFP13_VERSION && hdrs->vendor == ONF_VENDOR_ID) {
+            /* Get ONF message subtype (ONF_*). */
+            const struct onf13_experimenter_header *onfeh;
+
+            if (length < sizeof *onfeh) {
+                return OFPERR_OFPBRC_BAD_LEN;
+            }
+            onfeh = (const struct onf13_experimenter_header *) oh;
+            hdrs->subtype = ntohl(onfeh->subtype);
+        } else if (hdrs->vendor == NX_VENDOR_ID) {
             /* Get Nicira message subtype (NXT_*). */
             const struct nicira_header *nh;
 
@@ -232,7 +241,17 @@ ofphdrs_decode(struct ofphdrs *hdrs,
 
             ovsm = (const struct ofp11_vendor_stats_msg *) oh;
             hdrs->vendor = ntohl(ovsm->vendor);
-            if (hdrs->vendor == NX_VENDOR_ID) {
+            if (hdrs->version >= OFP13_VERSION
+                && hdrs->vendor == ONF_VENDOR_ID) {
+                /* Get ONF statistic type (ONFST_*). */
+                const struct onf13_experimenter_multipart_msg *onfemm;
+
+                if (length < sizeof *onfemm) {
+                    return OFPERR_OFPBRC_BAD_LEN;
+                }
+                onfemm = (const struct onf13_experimenter_multipart_msg *) oh;
+                hdrs->subtype = ntohl(onfemm->mp_type);
+            } else if (hdrs->vendor == NX_VENDOR_ID) {
                 /* Get Nicira statistic type (NXST_*). */
                 const struct nicira11_stats_msg *nsm;
 
-- 
2.0.0.rc2

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to