Search Linux Wireless

how to use skb_postpush_rcsum()?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux