Help about ip_filter, check sum always wrong
Help about ip_filter, check sum always wrong
- Subject: Help about ip_filter, check sum always wrong
- From: Jan Deng <email@hidden>
- Date: Sun, 2 Aug 2009 18:22:37 +0800
Hi all,
I have a emergency problem.
I have a local proxy and a NKE. The NKE will redirect TCP traffice to local proxy using IP filter. And then local proxy will relay the traffic. After local proxy receive data from server, it will write data back to browser.
The NKE use ipf_output_func to redirect the traffic. And after I modified the ip and port, I also modify the checksum.
After local proxy receive data from server, it sent data back to browser, and the packat will be hooked by ipf_output_func, and in the callback, the srouce ip and port will be modified back to server's ip and port. And then I modified the checksum too.( Strangely, this checksum is not changed according to TCP dump)
This solution works fine on most platform. But recently, I tried PPC G4 with 10.5.7. The connection always be reset by client( such as browser ).
From TCP dump, I can see the TCP checksum of packet from local proxy to client( browser ) is aways wrong with number 0xb5d0.
But I have modified the checksum. why it does not work?
Here is how I modified the check sum:
ip_hdr_gen *p_ip_header = (ip_hdr_gen *) mbuf_data( *data );
struct tcphdr *p_tcp_header = (struct tcphdr *)( (void *)p_ip_header + payloadOffset );
p_ip_header->ip.ip_sum = 0;
p_ip_header->ip.ip_sum = calcCsum();
p_tcp_header->th_sum = 0;
p_tcp_header->th_sum = calcTCPCsum();
Should I do any other thing? I find that the checksum is different from the value I set to TCP dump.
Can anyone help me?
Thanks very much!
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden