c - TCP Checksum Calculation Changing - tcp offloading is disabled -


i manipulating tcp packets using netfilter, have recalculate tcp , ip checksums working expected.

wireshark reports checksums correct on way out of server (which matches client thinks should well), when reach client checksum replaced 0xaa6a.

in post routing hook, calculating tcp checksum follows... after manipulating addresses/ports.

 tcp_header->check = 0;  tcp_header->check = tcp_v4_check(tcp_len,    ip_header->saddr,    ip_header->daddr,    csum_partial((char *)tcp_header, tcp_len, 0)); 

the ip checksum fine using

 ip_send_check(ip_header); 

the server not have tcp offloading enabled rx or tx , not support it, unsupported error when attempting enable or disable.

offload parameters 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 

another related point not sure on... manipulate packets/ports in pre-routing hook on server, , accepted transport layer , getting application no matter seem tcp checksum, under assumption dropped if tcp checksum wasn't updated after change of ip address/ , port.

is there obvious reason behaviour or misunderstanding part of network stack?

update:

setting ip_summed checksum_none stopping checksum being recalculated once leaves code. i'm not sure why being re-calculated incorrect fixed value? if don't set it, set checksum_partial.

if value same on other side, see 2 main possibilities: 1) overwrite checksum later after code 2) tcp_len wrong should check if netif_f_v4_csum set in sockbuff dev->features because kernel different in case


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -