[ovs-dev] [bundle 5/7] nx-match: New helpers.

Ethan Jackson ethan at nicira.com
Fri Jul 22 22:44:18 UTC 2011


Here is an incremental based on comments on a future patch.

---
 lib/nx-match.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/lib/nx-match.c b/lib/nx-match.c
index b382b26..6c48d02 100644
--- a/lib/nx-match.c
+++ b/lib/nx-match.c
@@ -1224,12 +1224,17 @@ nxm_dst_check(ovs_be32 dst_header, ovs_be16 ofs_nbits, size_t min_n_bits,
     n_bits = nxm_decode_n_bits(ofs_nbits);
     dst = nxm_field_lookup(ntohl(dst_header));
 
-    if (!field_ok(dst, flow, ofs + n_bits) || !dst->writable
-        || n_bits < min_n_bits) {
-        return BAD_ARGUMENT;
+    if (!field_ok(dst, flow, ofs + n_bits)) {
+        VLOG_WARN_RL(&rl, "invalid destination field");
+    } else if (!dst->writable) {
+        VLOG_WARN_RL(&rl, "destination field is not writable");
+    } else if (n_bits < min_n_bits) {
+        VLOG_WARN_RL(&rl, "insufficient bits in destination");
+    } else {
+        return 0;
     }
 
-    return 0;
+    return BAD_ARGUMENT;
 }
 
 int
-- 
1.7.6




More information about the dev mailing list