TCP Sequence number renumbering

Eddie Kohler kohler at icir.org
Tue Apr 9 00:16:14 EDT 2002


Hey Juan Luis,

So you might want to take a look again at TCPRewriter and FTPPortMapper,
which I've changed a bit. There were some problems that your message
inspired me to discover.

> What TCPRewriter does, only focusing in the sequence number renumbering is
> save the last known sequence number of each mapping in the table, and when
> FtpPortMapper translates the packet and the packet data growed or shrinked,
> it uses TCPRewriter to do sequence number renumbering. For this,
> TCPRewriter calculates the delta between the new sequence number and the
> last known one (of the entries in the mapping table), updates it in the
> mapping table and calculates the new sequence number for the new packet. If
> TCPRewriter didn't do this, all the next sequence numbers would be all
> wrong from the moment the first FTP packet is translated.

Pretty much right. The seqeunce number stored in the mapping is used to
determine which sequence numbers should be modified by TCPRewriter; it is
not quite used as you describe.

> 1. I see that TCPRewriter inherits from IPRewriter, so TCPRewriter can do
> everything that IPRewriter does, plus some other things like TCP secuence
> number renumbering. I see that the mazu-nat configuration uses both
> elements, IPRewriter rewrites all packets but not FTP packets, for those
> ones TCPRewriter is used. Does IPRewriter and TCPRewriter share the same
> mapping table, or each one have one of their own, and the one of
> TCPRewriter only have mappings that corresponds to FTP flows?

Each Rewriter element has its own mapping table. So that's your second
choice.

> 2. As you sugested, I would have to do an TCPAddressTranslator element,
> equivalent to TCPRewriter. I have not very clear what things from
> TCPRewriter I need only to do secuence number renumbering (I don't
> understand what are things like '_tcp_gc_interval' and what are they use,
> and if I need them for the sequence renumbering,) as I do not have time in
> this moment to implement the whole TCPRewriter functionality with
> AddressTarnslator.

You don't need _tcp_gc_interval at first. That controls how frequently 
mappings for idle TCP connections are garbage collected. You should just
need the mapping table.

Eddie



More information about the click mailing list