On 03/19/2018 02:14 PM, Sven Eckelmann wrote:
On Montag, 19. März 2018 14:02:43 CET Matthias Schiffer wrote:
Using skb_postpull_rcsum here is incorrect: As the name indicates, it is supposed to be used after pulling, and will thus subtract the checksum of the header *before* skb->data, while we are interested in the sizeof(*unicast_packet) bytes *after* skb->data.
Can you please explain this a little bit further. You give skb_postpull_rcsum the start and length via parameter and it is writing the resulting csum in the skb. It is not checking or accessing the position of skb->data [1]
/** * skb_postpull_rcsum - update checksum for received skb after pull * @skb: buffer to update * @start: start of data before pull * @len: length of data pulled * * After doing a pull on a received packet, you need to call this to * update the CHECKSUM_COMPLETE checksum, or set ip_summed to * CHECKSUM_NONE so that it can be recomputed from scratch. */
See also __skb_postpull_rcsum [2]:
skb->csum = csum_block_sub(skb->csum, csum_partial(start, len, 0), off);
What about the examples I gave in my patch - for example the easy-to-read set_eth_addr [3]?
Kind regards, Sven
[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/incl... [2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/incl... [3] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/net/...
Ah, you are right, I got confused. In that case, the patchs looks correct to me.
Matthias