Note that there are some explanatory texts on larger screens.

plurals
  1. POTCP Checksum Calculation Changing - tcp offloading is disabled
    primarykey
    data
    text
    <p>I am manipulating TCP packets using netfilter, so I have to recalculate the TCP and IP checksums which is working as expected. </p> <p>Wireshark reports the checksums are correct on the way out of the server (which matches what the client thinks they should be as well), but when they reach the client the checksum is always replaced with 0xAA6A.</p> <p>In the post routing hook, I am calculating the TCP checksum as follows... after manipulating the addresses/ports.</p> <pre><code> tcp_header-&gt;check = 0; tcp_header-&gt;check = tcp_v4_check(tcp_len, ip_header-&gt;saddr, ip_header-&gt;daddr, csum_partial((char *)tcp_header, tcp_len, 0)); </code></pre> <p>The IP checksum is fine using </p> <pre><code> ip_send_check(ip_header); </code></pre> <p>The server does not have TCP offloading enabled for RX or TX and also does not even support it, I get an unsupported error when attempting to enable or disable. </p> <pre><code>Offload parameters for eth0: rx-checksumming: off tx-checksumming: off scatter-gather: off tcp-segmentation-offload: off udp-fragmentation-offload: off generic-segmentation-offload: off generic-receive-offload: on large-receive-offload: off rx-vlan-offload: off tx-vlan-offload: off ntuple-filters: off receive-hashing: off </code></pre> <p>Another related point that I am not to sure on... I also manipulate packets/ports in a pre-routing hook on the server, and they are accepted by the transport layer and are definitely getting to my application no matter what I seem to do to the TCP checksum, I was under the assumption that they would be dropped if the TCP checksum wasn't updated after a change of IP Address/ and Port.</p> <p>Is there any obvious reason for this behaviour or am I misunderstanding part of the network stack?</p> <p><strong>Update:</strong></p> <p>Setting ip_summed to CHECKSUM_NONE is stopping the checksum being recalculated once it leaves my code. What I'm not sure about is why it is being re-calculated to an incorrect fixed value? If I don't set it, it is set to CHECKSUM_PARTIAL.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload