[ovs-dev] [PATCH 08/19] Local: Fix ofputil_pull_ofp11_match()

Simon Horman horms at verge.net.au
Wed Jun 13 16:51:56 PDT 2012


This is just a hack to change the way that ofputil_pull_ofp11_match() works
to what I believe to be a more correct version before adding feature
changes to the same function.

This change should either be dropped or rolled into Ben Pfaff's patch
that adds ofputil_pull_ofp11_match().
---
 lib/ofp-util.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/lib/ofp-util.c b/lib/ofp-util.c
index 84bee2d..ea27f10 100644
--- a/lib/ofp-util.c
+++ b/lib/ofp-util.c
@@ -267,14 +267,13 @@ enum ofperr
 ofputil_pull_ofp11_match(struct ofpbuf *buf, unsigned int priority,
                          struct cls_rule *rule)
 {
-    struct ofp11_match_header *omh;
+    struct ofp11_match_header *omh = ofpbuf_pull(buf, sizeof *omh);
     struct ofp11_match *om;
 
-    if (buf->size < sizeof(struct ofp11_match_header)) {
+    if (buf->size < sizeof *omh) {
         return OFPERR_OFPBMC_BAD_LEN;
     }
 
-    omh = buf->data;
     switch (ntohs(omh->type)) {
     case OFPMT_STANDARD:
         if (omh->length != htons(sizeof *om) || buf->size < sizeof *om) {
-- 
1.7.10.2.484.gcd07cc5




More information about the dev mailing list