On Sun, Nov 18, 2018 at 8:02 PM Herbert Xu <herb...@gondor.apana.org.au> wrote: > > On Fri, Nov 16, 2018 at 01:32:50PM -0800, Cong Wang wrote: > > > > This is true only when there is a skb_checksum_init*() or > > skb_checksum_validate*() prior to it, it seems not true for > > nf_ip_checksum() where skb->csum is correctly set to pesudo header > > checksum but there is no validation of the original skb->csum. > > So this check should be still inverted there?? > > > > Or am I still missing anything here? > > What do you mean? My copy of nf_ip_checksum seems to be doing the > right thing as far as verifying CHECKSUM_COMPLETED goes.
Hmm, it calls csum_tcpudp_magic() directly instead of __skb_checksum_validate_complete(), but it also sets ip_summed to CHECKSUM_UNNECESSARY: 20 if ((protocol == 0 && !csum_fold(skb->csum)) || 21 !csum_tcpudp_magic(iph->saddr, iph->daddr, 22 skb->len - dataoff, protocol, 23 skb->csum)) { 24 skb->ip_summed = CHECKSUM_UNNECESSARY; 25 break; 26 } which means the rx checksum fault won't be triggered.