[ovs-dev] [PATCH] ofproto-dpif: Correct endian problem in recv_upcalls()

Simon Horman horms at verge.net.au
Tue Oct 1 06:15:22 UTC 2013


Use nl_attr_get_u32() instead of nl_attr_get_be32() to parse nla
so that the decoded value which is passed to mhash_add()
is host byte order as mhash_add() expects.

This resolves a minor regression introduced by
10e576406c7444ef ("ofproto-dpif: Move special upcall handling into
ofproto-dpif-upcall.").

I do not expect this change has any runtime implications.

Detected using sparse.

Cc: Ethan Jackson <ethan at nicira.com>
Cc: Ben Pfaff <blp at nicira.com>
Signed-off-by: Simon Horman <horms at verge.net.au>
---
 ofproto/ofproto-dpif-upcall.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ofproto/ofproto-dpif-upcall.c b/ofproto/ofproto-dpif-upcall.c
index 4c92db3..571d312 100644
--- a/ofproto/ofproto-dpif-upcall.c
+++ b/ofproto/ofproto-dpif-upcall.c
@@ -515,7 +515,7 @@ recv_upcalls(struct udpif *udpif)
                 || type == OVS_KEY_ATTR_TCP
                 || type == OVS_KEY_ATTR_UDP) {
                 if (nl_attr_get_size(nla) == 4) {
-                    hash = mhash_add(hash, nl_attr_get_be32(nla));
+                    hash = mhash_add(hash, nl_attr_get_u32(nla));
                     n_bytes += 4;
                 } else {
                     VLOG_WARN_RL(&rl,
-- 
1.8.4




More information about the dev mailing list