Skip to contentSkip to conversation

Sequence number translation explanations.

DISCUSSION Emmanuel Guiton 2 participants 3 messages Mar 27, 2004 – Mar 29, 2004 netfilter

lore
Share & tools
lore
#0 lore raw

Hi!

I need to translate sequence numbers between the two networks that are separated by the firewall. In fact, I just need to translate on of them (so tcph->ack_seq in one direction, and tcph->seq in the opposite direction). I found the ip_nat_seq stucture and the ip_nat_seq_adjust function but I do not understand them. Particularly this "correction_pos", what is it?

Could someone provide me with some explanations?

Emmanuel

#1 lore raw
Quoted 10 lines · Emmanuel Guiton

Hi!

I need to translate sequence numbers between the two networks that are separated by the firewall. In fact, I just need to translate on of them (so tcph->ack_seq in one direction, and tcph->seq in the opposite direction).
I found the ip_nat_seq stucture and the ip_nat_seq_adjust function but I do not understand them. Particularly this "correction_pos", what is it?

Could someone provide me with some explanations?

It is for inserting/removing bytes from a TCP stream, as needed with NAT of protocols like FTP (IP address printed in ASCII has different length, compare strlen('1.1.1.1') to strlen('255.255.255.255').

correction_pos is the position (sequence number) where the addition/subtraction occurred, and offset is the number of bytes added (positive) or removed (negative).

Quoted 1 line

Emmanuel

Signature · 5 lines
- Harald Welte <[email protected]>             http://www.netfilter.org/
============================================================================
  "Fragmentation is like classful addressing -- an interesting early
   architectural error that shows how much experimentation was going
   on while IP was being designed."                    -- Paul Vixie
#2 lore raw
Quoted 12 lines · Harald Welte
Quoted 8 lines · Emmanuel Guiton

Hi!

I need to translate sequence numbers between the two networks that are separated by the firewall. In fact, I just need to translate on of them (so tcph->ack_seq in one direction, and tcph->seq in the opposite direction). I found the ip_nat_seq stucture and the ip_nat_seq_adjust function but I do not understand them. Particularly this "correction_pos", what is it?

Could someone provide me with some explanations?

Quoted 9 lines

It is for inserting/removing bytes from a TCP stream, as needed with NAT of protocols like FTP (IP address printed in ASCII has different length, compare strlen('1.1.1.1') to strlen('255.255.255.255').

correction_pos is the position (sequence number) where the addition/subtraction occurred, and offset is the number of bytes added (positive) or removed (negative).

Ok, then it does not fit my problem. I will operate the change like for the TCP port number. Thanks!

Emmanuel