Skip to contentSkip to conversation

Port Expectation

DISCUSSION Ricky Foo 2 participants 2 messages Jun 25, 2003 netfilter

lore
Share & tools
lore

Ricky Foo

author
#0 lore raw

Greetings,

For this piece of code in ip_nat_ftp.c, why are we change the port to use? If your protocol uses the same protocol port number for both the src & dest port (in my case always 138 in both direction), I suppose there is no need to change the expected port to some other values?

++++++++++++++++++++++++++++++++++++++++++++++++++

/* Try to get same port: if not, try to change it. */ for (port = ct_ftp_info->port; port != 0; port++)

 {
	newtuple.dst.u.tcp.port = htons(port);
	if (ip_conntrack_change_expect(expect, &newtuple) == 0)
		break;

}

Ricky

_________________________________________________________________
Send a fun phone greeting to your friend! http://www.msn.com.sg/mobile/fungreetings/

#1 lore raw
Quoted 7 lines · Ricky Foo

For this piece of code in ip_nat_ftp.c, why are we change the port to use? If your protocol uses the same protocol port number for both the src & dest port (in my case always 138 in both direction), I suppose there is no need to change the expected port to some other values?

++++++++++++++++++++++++++++++++++++++++++++++++++

Quoted 7 lines

/* Try to get same port: if not, try to change it. */ for (port = ct_ftp_info->port; port != 0; port++)

  {
	newtuple.dst.u.tcp.port = htons(port);
	if (ip_conntrack_change_expect(expect, &newtuple) == 0)
		break;

}

It's required to avoid clashing with a connection already mapped to the port in question.

Best regards,
Jozsef
-
E-mail : [email protected], [email protected] PGP key : http://www.kfki.hu/~kadlec/pgp_public_key.txt
Address : KFKI Research Institute for Particle and Nuclear Physics

          H-1525 Budapest 114, POB. 49, Hungary