--- v2.6.5/linux/net/ipv4/netfilter/ip_nat_ftp.c 2004-02-19 00:13:38.000000000 +0200 +++ linux/net/ipv4/netfilter/ip_nat_ftp.c 2004-04-17 11:44:14.471074688 +0300 @@ -250,17 +250,23 @@ unsigned int datalen; int dir; struct ip_ct_ftp_expect *ct_ftp_info; + int i, do_manip = 0; if (!exp) DEBUGP("ip_nat_ftp: no exp!!"); ct_ftp_info = &exp->help.exp_ftp_info; - /* Only mangle things once: original direction in POST_ROUTING - and reply direction on PRE_ROUTING. */ + /* Only mangle things once: for the first manip in this direction. */ dir = CTINFO2DIR(ctinfo); - if (!((hooknum == NF_IP_POST_ROUTING && dir == IP_CT_DIR_ORIGINAL) - || (hooknum == NF_IP_PRE_ROUTING && dir == IP_CT_DIR_REPLY))) { + for (i = 0; i < info->num_manips; i++) { + if (info->manips[i].direction == dir) { + if (info->manips[i].hooknum == hooknum) + do_manip = 1; + break; + } + } + if (!do_manip) { DEBUGP("nat_ftp: Not touching dir %s at hook %s\n", dir == IP_CT_DIR_ORIGINAL ? "ORIG" : "REPLY", hooknum == NF_IP_POST_ROUTING ? "POSTROUTING"