test-classifier: Use `in_port.ofp_port`, instead of `in_port`.
authorWilliam Tu <u9012063@gmail.com>
Fri, 11 Dec 2015 01:58:13 +0000 (17:58 -0800)
committerBen Pfaff <blp@ovn.org>
Wed, 23 Dec 2015 07:05:44 +0000 (23:05 -0800)
The test uses 16-bit ofp_port_t, however the struct flow member
`in_port` is 32-bit, causing a memcpy to read uninitialized data.
We should restrict the test to the `ofp_port` member of the `in_port`
union

Signed-off-by: William Tu <u9012063@gmail.com>
Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
Co-authored-by: Daniele Di Proietto <diproiettod@vmware.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
tests/test-classifier.c

index bd5a267..675d47d 100644 (file)
 static bool versioned = false;
 
 /* Fields in a rule. */
-#define CLS_FIELDS                        \
-    /*        struct flow    all-caps */  \
-    /*        member name    name     */  \
-    /*        -----------    -------- */  \
-    CLS_FIELD(tunnel.tun_id, TUN_ID)      \
-    CLS_FIELD(metadata,      METADATA)    \
-    CLS_FIELD(nw_src,        NW_SRC)      \
-    CLS_FIELD(nw_dst,        NW_DST)      \
-    CLS_FIELD(in_port,       IN_PORT)     \
-    CLS_FIELD(vlan_tci,      VLAN_TCI)    \
-    CLS_FIELD(dl_type,       DL_TYPE)     \
-    CLS_FIELD(tp_src,        TP_SRC)      \
-    CLS_FIELD(tp_dst,        TP_DST)      \
-    CLS_FIELD(dl_src,        DL_SRC)      \
-    CLS_FIELD(dl_dst,        DL_DST)      \
-    CLS_FIELD(nw_proto,      NW_PROTO)    \
-    CLS_FIELD(nw_tos,        NW_DSCP)
+#define CLS_FIELDS                            \
+    /*        struct flow        all-caps */  \
+    /*        member name        name     */  \
+    /*        -----------        -------- */  \
+    CLS_FIELD(tunnel.tun_id,     TUN_ID)      \
+    CLS_FIELD(metadata,          METADATA)    \
+    CLS_FIELD(nw_src,            NW_SRC)      \
+    CLS_FIELD(nw_dst,            NW_DST)      \
+    CLS_FIELD(in_port.ofp_port,  IN_PORT)     \
+    CLS_FIELD(vlan_tci,          VLAN_TCI)    \
+    CLS_FIELD(dl_type,           DL_TYPE)     \
+    CLS_FIELD(tp_src,            TP_SRC)      \
+    CLS_FIELD(tp_dst,            TP_DST)      \
+    CLS_FIELD(dl_src,            DL_SRC)      \
+    CLS_FIELD(dl_dst,            DL_DST)      \
+    CLS_FIELD(nw_proto,          NW_PROTO)    \
+    CLS_FIELD(nw_tos,            NW_DSCP)
 
 /* Field indexes.
  *