[ovs-dev] [PATCH 21/24] ofp-util: Allow decoding of Open Flow 1.1 and 1.2 Packet Out Messages

Simon Horman horms at verge.net.au
Mon Jul 23 06:16:50 UTC 2012


Signed-off-by: Simon Horman <horms at verge.net.au>

---

v7
* Manual rebase

v6
* No change

v5
* No change

v4
* No change

v3
* Manual rebase
* Correct title: This patch relates to Packet Out not Packet In
* Use OFPT_PACKET_OUT instead of OFPT11_PACKET_OUT, it seems
  easier to use a single code and differentiate using the version
  in the ofp_header
* Return error value returned by ofputil_port_from_ofp11()
  rather than OFPERR_OFPBMC_BAD_VALUE.

v2
* No change

Conflicts:
	lib/ofp-util.c
---
 lib/ofp-util.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/lib/ofp-util.c b/lib/ofp-util.c
index a2ac943..f015929 100644
--- a/lib/ofp-util.c
+++ b/lib/ofp-util.c
@@ -2179,7 +2179,24 @@ ofputil_decode_packet_out(struct ofputil_packet_out *po,
     ofpbuf_use_const(&b, oh, ntohs(oh->length));
     raw = ofpraw_pull_assert(&b);
 
-    if (raw == OFPRAW_OFPT10_PACKET_OUT) {
+    if (raw == OFPRAW_OFPT11_PACKET_OUT) {
+        enum ofperr error;
+        const struct ofp11_packet_out *opo = ofpbuf_pull(&b, sizeof *opo);
+
+        po->buffer_id = ntohl(opo->buffer_id);
+        error = ofputil_port_from_ofp11(opo->in_port, &po->in_port);
+        if (error) {
+            return error;
+        }
+
+        error = ofpacts_pull_openflow11_actions(&b, ntohs(opo->actions_len),
+                                                ofpacts);
+        if (error) {
+            return error;
+        }
+
+        bad_in_port_err = OFPERR_NXBRC_BAD_IN_PORT;
+    } else if (raw == OFPRAW_OFPT10_PACKET_OUT) {
         enum ofperr error;
         const struct ofp_packet_out *opo = ofpbuf_pull(&b, sizeof *opo);
 
-- 
1.7.10.2.484.gcd07cc5




More information about the dev mailing list