Thread (7 messages) 7 messages, 2 authors, 2014-08-06
STALE4311d
Revisions (4)
  1. v2 [diff vs current]
  2. v3 [diff vs current]
  3. v4 current
  4. v5 [diff vs current]

[PATCH net-next 3/4 RFC] pktgen: Fixing UPD checksum calculation

From: Zoltan Kiss <hidden>
Date: 2014-08-04 13:37:44
Also in: lkml
Subsystem: networking [general], the rest · Maintainers: "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds

It passes port number instead of IP address for checksuming. The udp4_hwcsum()
call is also bad, but my next patch will get rid of it anyway. The IPv6 code
does it correctly already. It also changes replaces 8 with sizeof(struct udphdr) 

Signed-off-by: Zoltan Kiss <redacted>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Thomas Graf <tgraf@suug.ch>
Cc: Joe Perches <joe@perches.com>
Cc: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: xen-devel@lists.xenproject.org
---
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index ba61e2b..d8905cd 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -3061,8 +3061,9 @@ static struct sk_buff *fill_packet_ipv4(struct net_device *odev,
 		__wsum csum = udp_csum(skb);
 
 		/* add protocol-dependent pseudo-header */
-		udph->check = csum_tcpudp_magic(udph->source, udph->dest,
-						datalen + 8, IPPROTO_UDP, csum);
+		udph->check = csum_tcpudp_magic(iph->saddr, iph->daddr,
+						datalen + sizeof(struct udphdr),
+						IPPROTO_UDP, csum);
 
 		if (udph->check == 0)
 			udph->check = CSUM_MANGLED_0;
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help