diff mbox

[ovs-dev,branch-2.7,12/14] datapath: Avoid struct copy on conntrack labels.

Message ID 20170419001002.4353-13-joe@ovn.org
State Accepted
Headers show

Commit Message

Joe Stringer April 19, 2017, 12:10 a.m. UTC
From: Jarno Rajahalme <jarno@ovn.org>

Older kernels have variable sized labels, and the struct itself
contains only the length, so we must memcpy the bits explicitly.

The modified system test fails on older kernels without this change.

[Committer Notes]
Dropped system-traffic changes as they modify a test not on branch-2.7.

VMware-BZ: #1841876
Fixes: 09aa98ad496d ("datapath: Inherit master's labels.")
Signed-off-by: Jarno Rajahalme <jarno@ovn.org>
Acked-by: Andy Zhou <azhou@ovn.org>
---
 datapath/conntrack.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/datapath/conntrack.c b/datapath/conntrack.c
index 87306a2c5e07..392be25cdb6d 100644
--- a/datapath/conntrack.c
+++ b/datapath/conntrack.c
@@ -290,9 +290,12 @@  static int ovs_ct_init_labels(struct nf_conn *ct, struct sw_flow_key *key,
 	if (!cl)
 		return -ENOSPC;
 
-	/* Inherit the master's labels, if any. */
+	/* Inherit the master's labels, if any.  Must use memcpy for backport
+	 * as struct assignment only copies the length field in older
+	 * kernels.
+	 */
 	if (master_cl)
-		*cl = *master_cl;
+		memcpy(cl->bits, master_cl->bits, OVS_CT_LABELS_LEN);
 
 	if (have_mask) {
 		u32 *dst = (u32 *)cl->bits;