All of lore.kernel.org
 help / color / mirror / Atom feed
* Source IP or Dest IP rewriting failed with correct TCP and IP checksum
@ 2009-07-27  7:17 Zhiyun Qian
  2009-08-02  4:00 ` Zhiyun Qian
  0 siblings, 1 reply; 2+ messages in thread
From: Zhiyun Qian @ 2009-07-27  7:17 UTC (permalink / raw)
  To: netfilter, netfilter-devel

Hi all,

Sorry about sending the question to both lists cause I am not sure which 
one is the best list.

I am using the latest libnetfilter_queue and other dependencies 
(downloaded a couple of days ago).

I've spent some time trying to rewrite the packets (specifically, the 
source IP address or the destination IP address) and reinject it back to 
the network. I think I got the code right. However, after I did the 
modification on the packets, although with the correct checksum at both 
IP and TCP layer (I have tried several fixed packet headers where the 
checksum is known beforehand and make sure checksum is computed 
correctly), the packet was not successfully reinjected (not captured by 
tcpdump).

The weird thing is that they fail deterministically but randomly (to me) 
for different IP addresses. For example, if I rewrite the destination IP 
to 1.1.1.1, it succeeded, but if I rewrite the destination IP to 
1.1.1.2, it then failed. And for source IPs, it always fails. I've 
tested the other fields like TTL or source port and destination port, it 
always succeeded.

One possibility that can partially explain this is that my machine is 
not allowing spoofed IP address. But then I use hping to spoof other IPs 
and the packets are indeed captured by tcpdump (I also checked my 
iptables configuration). I then think if hping is using a different 
mechanism to send out packets than libnetfilter_queue. But I couldn't 
find the answer until I dive into the corresponding kernel module (I 
think hping is just using raw socket). I am wondering if there's a way 
to get the result of the injected packet (whether or not it is delivered 
out). I don't know what the return value of nfq_set_verdict() means, it 
is always some value larger than 0 (e.g. 32, 72 ...).

Can anybody shed some lights on this? Thanks a lot! I can post my code 
here if needed.

Regards.
-Zhiyun

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Source IP or Dest IP rewriting failed with correct TCP and IP checksum
  2009-07-27  7:17 Source IP or Dest IP rewriting failed with correct TCP and IP checksum Zhiyun Qian
@ 2009-08-02  4:00 ` Zhiyun Qian
  0 siblings, 0 replies; 2+ messages in thread
From: Zhiyun Qian @ 2009-08-02  4:00 UTC (permalink / raw)
  To: netfilter

Hi all,

Sorry about sending the question to both lists cause I am not sure which 
one is the best list.

I am using the latest libnetfilter_queue and other dependencies 
(downloaded a couple of days ago).

I've spent some time trying to rewrite the packets (specifically, the 
source IP address or the destination IP address) and reinject it back to 
the network. I think I got the code right. However, after I did the 
modification on the packets, although with the correct checksum at both 
IP and TCP layer (I have tried several fixed packet headers where the 
checksum is known beforehand and make sure checksum is computed 
correctly), the packet was not successfully reinjected (not captured by 
tcpdump).

The weird thing is that they fail deterministically but randomly (to me) 
for different IP addresses. For example, if I rewrite the destination IP 
to 1.1.1.1, it succeeded, but if I rewrite the destination IP to 
1.1.1.2, it then failed. And for source IPs, it always fails. I've 
tested the other fields like TTL or source port and destination port, it 
always succeeded.

One possibility that can partially explain this is that my machine is 
not allowing spoofed IP address. But then I use hping to spoof other IPs 
and the packets are indeed captured by tcpdump (I also checked my 
iptables configuration). I then think if hping is using a different 
mechanism to send out packets than libnetfilter_queue. But I couldn't 
find the answer until I dive into the corresponding kernel module (I 
think hping is just using raw socket). I am wondering if there's a way 
to get the result of the injected packet (whether or not it is delivered 
out). I don't know what the return value of nfq_set_verdict() means, it 
is always some value larger than 0 (e.g. 32, 72 ...).

Can anybody shed some lights on this? Thanks a lot! I can post my code 
here if needed.

Regards.
-Zhiyun
--
To unsubscribe from this list: send the line "unsubscribe netfilter" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-08-02  4:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-27  7:17 Source IP or Dest IP rewriting failed with correct TCP and IP checksum Zhiyun Qian
2009-08-02  4:00 ` Zhiyun Qian

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.