Skip to content

Commit

Permalink
test-classifier: Use in_port.ofp_port, instead of in_port.
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Daniele Di Proietto <[email protected]>
Co-authored-by: Daniele Di Proietto <[email protected]>
Signed-off-by: Ben Pfaff <[email protected]>
  • Loading branch information
2 people authored and blp committed Dec 23, 2015
1 parent 06f41fc commit efe2037
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions tests/test-classifier.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,23 +49,23 @@
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.
*
Expand Down

0 comments on commit efe2037

Please sign in to comment.