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.
I am capturing the packets using netfilter, so I have access to the whole
SKB, I am using Linux 2.6.35-22
Looking into the source code of the TCP/IP, I found this function
void tcp_v4_send_check(struct sock *sk, struct sk_buff *skb);
The comment above it says this routing computes the IPv4 TCP checksum
Trying to use this function, I called it passing to it skb->sk and skb
With no success so far.
So my question is, how do I correctly calculate the TCP checksum? I know
there'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.
Thanks in advance,
Adel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20120710/dc27d975/attachment.html
On Tue, Jul 10, 2012 at 11:42 AM, Adel Kodmani [off-list ref] wrote:
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.
I am capturing the packets using netfilter, so I have access to the whole
SKB, I am using Linux 2.6.35-22
Looking into the source code of the TCP/IP, I found this function
void tcp_v4_send_check(struct sock *sk, struct sk_buff *skb);
The comment above it says this routing computes the IPv4 TCP checksum
Trying to use this function, I called it passing to it skb->sk and skb
With no success so far.
So my question is, how do I correctly calculate the TCP checksum? I know
there'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.
Thanks in advance,
Adel
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies at kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
I think this may be helpful to you
On Mon, Jul 16, 2012 at 1:30 PM, ???? [off-list ref] wrote:
On Tue, Jul 10, 2012 at 11:42 AM, Adel Kodmani [off-list ref] wrote:
quoted
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.
I am capturing the packets using netfilter, so I have access to the whole
SKB, I am using Linux 2.6.35-22
Looking into the source code of the TCP/IP, I found this function
void tcp_v4_send_check(struct sock *sk, struct sk_buff *skb);
The comment above it says this routing computes the IPv4 TCP checksum
Trying to use this function, I called it passing to it skb->sk and skb
With no success so far.
So my question is, how do I correctly calculate the TCP checksum? I know
there'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.
Thanks in advance,
Adel
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies at kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
I think this may be helpful to you
On Mon, Jul 16, 2012 at 1:30 PM, ???? [off-list ref] wrote:
quoted
On Tue, Jul 10, 2012 at 11:42 AM, Adel Kodmani [off-list ref] wrote:
quoted
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.
I am capturing the packets using netfilter, so I have access to the whole
SKB, I am using Linux 2.6.35-22
Looking into the source code of the TCP/IP, I found this function
void tcp_v4_send_check(struct sock *sk, struct sk_buff *skb);
The comment above it says this routing computes the IPv4 TCP checksum
Trying to use this function, I called it passing to it skb->sk and skb
With no success so far.
So my question is, how do I correctly calculate the TCP checksum? I know
there'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.
Thanks in advance,
Adel
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies at kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies