[ovs-dev] [PATCH] datapath: Calculate proper checksum for set_tp_src/dst action

Justin Pettit jpettit at nicira.com
Tue Nov 17 02:50:17 UTC 2009


When the set_tp_src or set_tp_dst action is used, the calculation for
where the checksum is located was wrong.  This caused the checksum to
not be updated and packet corruption in the bad offset.
---
 datapath/actions.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/datapath/actions.c b/datapath/actions.c
index 8a3e8ab..a21bce8 100644
--- a/datapath/actions.c
+++ b/datapath/actions.c
@@ -259,8 +259,8 @@ set_tp_port(struct sk_buff *skb, struct odp_flow_key *key,
 		u16 *f = a->type == ODPAT_SET_TP_SRC ? &th->source : &th->dest;
 		u16 old = *f;
 		u16 new = a->tp_port;
-		update_csum((u16*)((u8*)skb->data + check_ofs),
-			    skb, old, new, 1);
+		update_csum((u16*)(skb_transport_header(skb) + check_ofs), 
+				skb, old, new, 1);
 		*f = new;
 	}
 	return skb;
-- 
1.5.5





More information about the dev mailing list