<div dir="ltr"><br><br><div class="gmail_quote">On Mon, Jul 16, 2012 at 1:30 PM, पारस <span dir="ltr">&lt;<a href="mailto:beparas@gmail.com" target="_blank">beparas@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br><br><div class="gmail_quote"><div><div class="h5">On Tue, Jul 10, 2012 at 11:42 AM, Adel Kodmani <span dir="ltr">&lt;<a href="mailto:mpcadel@gmail.com" target="_blank">mpcadel@gmail.com</a>&gt;</span> wrote:<br></div>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">

<div dir="ltr">I am writing a kernel module that actually modifies the TCP header(both at sending and receiving) and I need to re-calculate the header because of that.<br>I am capturing the packets using netfilter, so I have access to the whole SKB, I am using Linux 2.6.35-22<div>



<br></div><div>Looking into the source code of the TCP/IP, I found this function</div><div>void tcp_v4_send_check(struct sock *sk, struct sk_buff *skb);</div><div>The comment above it says this routing computes the IPv4 TCP checksum <br>



<br>Trying to use this function, I called it passing to it skb-&gt;sk and skb</div><div>With no success so far.<br><br>So my question is, how do I correctly calculate the TCP checksum? I know there&#39;s a psudoheader that must be created, and added to the calculation but there must be a function in the kernel I can call that already does that.<br>



<br><br>Thanks in advance,</div><div>Adel</div></div>
<br></div></div><div class="im">_______________________________________________<br>
Kernelnewbies mailing list<br>
<a href="mailto:Kernelnewbies@kernelnewbies.org" target="_blank">Kernelnewbies@kernelnewbies.org</a><br>
<a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
<br></div></blockquote></div>I think this may be helpful to you<br><a href="http://www.thegeekstuff.com/2012/05/ip-header-checksum/" target="_blank">http://www.thegeekstuff.com/2012/05/ip-header-checksum/</a><br><br><br>

</blockquote></div><br><br>Nope, what I need to calculate is the TCP checksum, not the IP checksum<br></div>