From: Davide Guerri <tato.net@tin.it>
To: Yasuyuki Kozakai <yasuyuki.kozakai@toshiba.co.jp>
Cc: netfilter-devel@lists.netfilter.org
Subject: Re: nf_conntrack
Date: Mon, 1 Mar 2004 12:08:28 +0100 [thread overview]
Message-ID: <200403011208.28184.tato.net@tin.it> (raw)
In-Reply-To: <200403010608.PAA13782@toshiba.co.jp>
Hi Yasuyuki,
On Monday 01 March 2004 07:08, you wrote:
> Hi, Davide,
>
> Sorry for late replying.
Don't worry, thank you very much for your reply ;)
> > > Sorry, I'm confusing. Which path should packets go through ? we need to
> > > design so that users can filter/log packets before and/or after
> > > translating. At least, translated packets should go through
> > > NF_IP{6}_FORWARD, I think.
> >
> > I agree with you, users should be able to filter/log NAT(P)T-PT'ed
> > packets. However there are some (bad) problems.
> > At present time your conntrack code doesn't handle IPv6 fragments, but I
> > guess that when it will do, IPv6 datagrams will be defragmented as in
> > current conntrack. So I assume that NA(P)T-PT code will see only entire
> > l3 packets.
>
> Yes. That is missing piece. Of cause, I'll implement that. But I haven't
> decide how to handle fragmented IPv6 packets yet.
>
> ip6_conntrack, which is written by me and tracks only IPv6 packets, clone
> fragmented packets and reassemble them (note: not linearize). After
> tracking, reassembled packet is discard and pass original fragmented
> packets to next network process. Of cause, original fragmented skbs points
> to same conntrack.
>
> I adopted this way to prevent from disturbing other IPv6 codes(ex. Path MTU
> Discovery.)
>
> But I don't know this is best. Maybe NA(P)T-PT helper module wants
> reassembled packet to rewrite data in payload (ex FTP).
Yes, that is a good way, but there is another issue. Since conntrack will be
used to implement a statefull IPv6 filtering, we need to be sure that what is
received by destination host is what the firewall have seen.
I know that partially overlapped IPv6 fragments should never appear (since
only the source host can perform fragmentation), but in general we don't know
if the destination host will accept or discard them.
If the firewall lets them pass, we couldn't be sure of the order in which they
will be received by the destination ( think, for instance, to the well-known
IPv4 overlapped fragments attack).
Personally I think that a firewall must discard overlapped (IPv4/IPv6)
fragments, but this is only my personal point of view.
> > One problem is that I should know if original datagrams had a fragment
> > header or not. NA(P)T-PT should produce IPv4 packets with DF flag set for
> > IPv6 non-fragment datagrams and IPv4 packets with DF not set for IPv6
> > datagrams with a fragment header. So, although on one hand I need
> > conntrack, on the other hand I should see original datagrams.
> > A similar problem turns out on IPv4-to-IPv6 translation. When I receive
> > IPv4 datagrams with DF not set, I should fragment them so that their IPv6
> > translation fits in 1280 octects. If DF flag is set, in order to allow
> > pathMTU discovery, I should preserve their size and I should translate
> > them into IPv6 datagram without a fragmentation header (except for IPv4
> > fragments with DF set...).
> > I'm trying to say (with my terrible English) that a NA(P)T-PT
> > implementation should have more control over IPv6/IPv4 packets: since
> > conntrack defragments/fragments them it's impossible to be RFC 2766
> > compliant.
>
> IPv4 header has DF bit field and it's not changed. so there is no problem
> even if reassembled by conntrack in the case of IPv4-to-IPv6.
Actually ip_conntrack ignore DF flag in fragmented IPv4 fragments.
This leads to a problem described in this bug report:
https://bugzilla.netfilter.org/cgi-bin/bugzilla/show_bug.cgi?id=48
In this report I've proposed a solution; however I must admit that the
implementation I've proposed it is not good. (However I don't know if that
idea can be useful for you).
I think we must avoid that problem in IPv6 connection tracking since in this
case the consequences are more serious.
> There is problem in the case of IPv6-to-IPv4. I was going to implement so
> that nf_conntrack removes Fragment Header in the case that payload length
> of reassembled packet is > 65535 - 8 .
>
> ok, I need to be more care about handling fragmented packet.
If there were no problems it wouldn't be amusing! ;))
> But in any case, original(not reassembled) IPv6 packets are needed to be
> passed next network.
> And I think it's natural that behavior for IPv4 and IPv6 is synchronized.
> This mean that IPv4 packets isn't reassembled.
>
> In this case, benefits are
> - all modules can process fragmented packets with any style.
> - all modules can prevent from disturbing other network code.
>
> drawbacks are
> - User Interface will be changed. current ip_conntrack reassemble at
> PRE_ROUTING, and refragment at POST_ROUTING. so users assume that
> packets are reassembled when filtering.
>
> - if multiple module want reassembled packets, reassembling is occurred
> many times.
>
> The 1st drawback can be solved at ip{6}_tables in kernel.
> But I don't any idea about 2nd issue in now.
I agree with you, IPv6 and IPv4 conntrack behaviours should be synchronized.
This is an hard issue: any solutions will require many changes in present
netfilter modules...
> > For these reasons I'm tempted to use the approach proposed by Henrik
> > (virtual network device).
>
> I have timely news. Recently, I heard that kernel implementation of NAT-PT
> is already created. Maybe this implementation doesn't use netfilter.
> virtual device ???
>
> I'll attach the message at usagi-users ML.
Thank you very much. I've also noticed another NA(P)T-PT implementation in the
Linux kernel (http://naptpt.sourceforge.net/). However this implementation
doesn't handle fragment (both for IPv4 and IPv6), and use a poor connection
tracking for TCP based on activity instead of the state: it removes a TCP
connection from tracked connections if there is no activity for a certain
period of time (this is good for UDP and ICMP but not for TCP).
Moreover this implementation bypasses all netfilter code (it intercepts
packets in PRE_ROUTING and uses ip_output() to send translated packets).
I'm really in trouble: I have got the code for the tranlation, I have got a
precise idea of how to translate packets (even in case of fragmentation) but
I can't decide where to translate... ;))
Best regards,
Davide Guerri.
--
T@1t
next prev parent reply other threads:[~2004-03-01 11:08 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <200402200942.13265.tato.net@tin.it>
[not found] ` <200402201258.VAA29529@toshiba.co.jp>
2004-02-22 10:10 ` nf_conntrack Davide Guerri
2004-02-23 5:27 ` nf_conntrack Yasuyuki Kozakai
2004-02-23 7:48 ` nf_conntrack Henrik Nordstrom
2004-02-26 12:20 ` nf_conntrack Davide
2004-03-01 6:08 ` nf_conntrack Yasuyuki Kozakai
2004-03-01 11:08 ` Davide Guerri [this message]
2004-02-22 10:25 ` nf_conntrack Davide
2005-01-10 20:31 nf_conntrack [was Re: [PATCH 1/4] RFC: fast string matching infrastrure for netfilter] Patrick McHardy
2005-01-10 21:28 ` Harald Welte
2005-01-14 2:45 ` Patrick McHardy
2005-01-14 4:31 ` nf_conntrack Yasuyuki KOZAKAI
-- strict thread matches above, loose matches on Subject: below --
2003-12-24 1:43 nf_conntrack Yasuyuki Kozakai
2004-02-24 9:21 ` nf_conntrack Harald Welte
2004-02-25 12:47 ` nf_conntrack Yasuyuki Kozakai
2004-02-25 15:05 ` nf_conntrack Harald Welte
2004-03-02 2:26 ` nf_conntrack Yasuyuki Kozakai
2004-03-01 11:47 ` nf_conntrack Jozsef Kadlecsik
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=200403011208.28184.tato.net@tin.it \
--to=tato.net@tin.it \
--cc=netfilter-devel@lists.netfilter.org \
--cc=yasuyuki.kozakai@toshiba.co.jp \
/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.