[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <a8b99311d732d2627d57beb3970fab9cdcd0e4d2.camel@sipsolutions.net>
Date: Tue, 21 Apr 2020 17:20:18 +0200
From: Johannes Berg <johannes@...solutions.net>
To: netdev@...r.kernel.org
Cc: linux-wireless@...r.kernel.org
Subject: how to use skb_postpush_rcsum()?
Hi,
This is probably a stupid question but I'm hitting my head against the
wall ...
I have an skb. I have this:
if (skb->ip_summed == CHECKSUM_COMPLETE) {
printk(KERN_DEBUG "csum before\n");
printk(KERN_DEBUG " hw = 0x%.4x\n", skb->csum);
printk(KERN_DEBUG " sw = 0x%.4x\n", csum_fold(skb_checksum(skb, 0, skb->len, 0)));
}
ehdr = skb_push(skb, ETH_HLEN);
memcpy(ehdr, &tmp, ETH_HLEN);
skb_postpush_rcsum(skb, &tmp, ETH_HLEN);
if (skb->ip_summed == CHECKSUM_COMPLETE) {
printk(KERN_DEBUG "csum after\n");
printk(KERN_DEBUG " hw = 0x%.4x\n", csum_fold(skb->csum));
printk(KERN_DEBUG " sw = 0x%.4x\n", csum_fold(skb_checksum(skb, 0, skb->len, 0)));
}
Why does this print, for example:
csum before
hw = 0xce81
sw = 0xce81
csum after
hw = 0x5f36
sw = 0xfc39
I'm clearly doing something wrong, but most of the examples seem to do
things this way, so what I'm I doing wrong?
johannes
Powered by blists - more mailing lists