On Thu, Oct 20, 2016 at 6:04 AM, David Lebrun <david.leb...@uclouvain.be> wrote: > On 10/17/2016 07:01 PM, Tom Herbert wrote: >>> > + >>> > + if (skb->ip_summed == CHECKSUM_COMPLETE) >>> > + skb->ip_summed = CHECKSUM_NONE; >>> > + >> Because the packet is being changed? Would it make sense to update the >> checksum complete value based on the changes being made. Consider the >> case that the next hop is local to the host (someone may try to >> implement network virtualization this way). >> > > Rethinking about that: even if the next hop is local, I am not sure to > see the benefits of updating the checksum instead of setting > CHECKSUM_NONE. For example, if the next and final hop is local and the > packet carries a TCP payload, tcp_checksum_complete() would force the > recomputation of the checksum anyway (unless ip_summed == > CHECKSUM_UNNECESSARY). > Or unless skb->csum_valid is set (tcp_checksum_complete calls skb_csum_unnecessary where the check is done). If the checksum complete value is correct then skb->csum_valid would be set from skb_checksum_init which is called early in tcp_v4_rcv and tcp_v6_rcv. This way if the penultimate and final hops are local and CHECKSUM_COMPLETE is set computing the packet checksum is avoided for a TCP packet.
Tom > So I fail to see a path where updating the checksum would be beneficial. > > Am I missing something ? > > David >