All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zheng Da <zhengda1936@gmail.com>
To: netfilter-devel@lists.netfilter.org
Subject: Re: The module I write seems to have conflict with iptables
Date: Mon, 30 Jul 2007 21:25:28 +0200	[thread overview]
Message-ID: <46AE3B28.3090505@gmail.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0707291042080.9488@fbirervta.pbzchgretzou.qr>

[-- Attachment #1: Type: text/plain, Size: 2245 bytes --]

Jan Engelhardt wrote:
> On Jul 29 2007 21:36, Zheng Da wrote:
>   
>>>   
>>>       
>>>> I write a module based on netfilter. It is proposed to be used
>>>> in the filter router, is hooked on FORWARD point, and has the
>>>> lowest priority, NF_IP_PRI_LAST. It does the following things:
>>>> When it finds TCP connection from the client to the server, it
>>>> will pretend as the server to build the connection with the
>>>> client. It blocks the SYN and ACK packets from the client, and
>>>> sends a UDP packet to the server, which can force the server
>>>> build the TCP connection with the client.
>>>>     
>>>>         
>>> It is almost impossible to help without seeing code.
>>>
>>>   
>>>       
>> Sorry, I'm just thinking whether the way of my module working may
>> make connection track not work correctly. OK. This is my code. A
>> little big.
>>     
>
> Quite a lot of code, I'd say, so I could not look through all of it.
> I suspect that NF_IP_PRI_LAST and NF_IP_PRI_FIRST may have problematic 
> effects. You could try NF_IP_PRI_FILTER+1 (instead of LAST), and
> NF_IP_PRI_FILTER-1 (instead of FIRST).
>
>
>
> 	Jan
>   
I finally find the problem. The problem is not caused by my module, but 
my configuration of iptables.
The original configuration is:
iptables -F
iptables -X
iptables -P FORWARD DROP
iptables -A FORWARD -i eth1 -j ACCEPT                         
<------------------change this line
iptables -A FORWARD -i eth0 -m state --state ESTABLISHED -j ACCEPT
iptables -A FORWARD -i eth0 -p tcp --dport 22 -m state --state 
ESTABLISHED,NEW -j ACCEPT
If I change the line for the device of eth1 to
iptables -A FORWARD -i eth1 -j ACCEPT -m state --state 
ESTABLISHED,RELATED,NEW
It works.
The problem is what is the difference between
iptables -A FORWARD -i eth1 -j ACCEPT
and
iptables -A FORWARD -i eth1 -j ACCEPT -m state --state 
ESTABLISHED,RELATED,NEW.
I check ip_conntrack in Router, the connections between Client and 
Server are assured in both configurations.
I use Wireshark to capture the packets when in the original 
configuration. I put the result in the attachment.
externel: the packets between Client and Router
internal: the packets between Router and Server
Does anyone have any idea?

Best,
Zheng Da

[-- Attachment #2: external --]
[-- Type: application/octet-stream, Size: 32792 bytes --]

[-- Attachment #3: internal --]
[-- Type: application/octet-stream, Size: 30993 bytes --]

  parent reply	other threads:[~2007-07-30 19:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-29 17:06 The module I write seems to have conflict with iptables Zheng Da
2007-07-28 17:35 ` Jan Engelhardt
     [not found]   ` <46ACEC5A.6040103@gmail.com>
     [not found]     ` <Pine.LNX.4.64.0707291042080.9488@fbirervta.pbzchgretzou.qr>
2007-07-30 19:25       ` Zheng Da [this message]
     [not found]       ` <46ADDA66.3030207@gmail.com>
     [not found]         ` <Pine.LNX.4.64.0707291508260.9488@fbirervta.pbzchgretzou.qr>
2007-07-30 19:49           ` Zheng Da

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=46AE3B28.3090505@gmail.com \
    --to=zhengda1936@gmail.com \
    --cc=netfilter-devel@lists.netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.