[ovs-dev] [PATCH] dpif-netdev: Correct type of struct dp_netdev_flow's 'tcp_flags' member.

Ben Pfaff blp at nicira.com
Tue Mar 27 17:20:59 UTC 2012


TCP flags fit in 8 bits so this type seems more appropriate.

Fixes the following "sparse" warnings introduced by commit 734ec5ec1349
(packet: Add additional TCP flags extraction on IPv6.):

dpif-netdev.c:630: warning: incorrect type in assignment (different base types)
dpif-netdev.c:630:    expected unsigned char [unsigned] [usertype] tcp_flags
dpif-netdev.c:630:    got restricted __be16 [usertype] tcp_flags
dpif-netdev.c:979: warning: invalid assignment: |=
dpif-netdev.c:979:    left side has type restricted __be16
dpif-netdev.c:979:    right side has type unsigned char

CC: Jesse Gross <jesse at nicira.com>
Signed-off-by: Ben Pfaff <blp at nicira.com>
---
 lib/dpif-netdev.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 8381a89..1686087 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -113,7 +113,7 @@ struct dp_netdev_flow {
     long long int used;         /* Last used time, in monotonic msecs. */
     long long int packet_count; /* Number of packets matched. */
     long long int byte_count;   /* Number of bytes matched. */
-    ovs_be16 tcp_flags;         /* Bitwise-OR of seen tcp_flags values. */
+    uint8_t tcp_flags;          /* Bitwise-OR of seen tcp_flags values. */
 
     /* Actions. */
     struct nlattr *actions;
-- 
1.7.2.5




More information about the dev mailing list